Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

nomination-pools: optimize re-bonding unclaimed rewards. #11671

Closed
kianenigma opened this issue Jun 15, 2022 · 2 comments
Closed

nomination-pools: optimize re-bonding unclaimed rewards. #11671

kianenigma opened this issue Jun 15, 2022 · 2 comments
Labels
I7-refactor Code needs refactoring. U4-some_day_maybe Issue might be worth doing eventually.

Comments

@kianenigma
Copy link
Contributor

There is an option in pools to directly bond your unclaimed rewards. This is currently coded, as of #11669, such that is basically like a transfer. The funds are literally transferred to your account, and taken out again.

We can and should optimize this such that the account of the pool member is not touched in this process. Although, since they pay the fee anyways, their account data is already in overlay. Some code cleanup can also be done via doing this.

reward_pool.update_records(bonded_pool.id, bonded_pool.points);
// TODO: optimize this to not touch the free balance of `who ` at all in benchmarks.
// Currently, bonding rewards is like a batch. In the same PR, also make this function
// take a boolean argument that make it either 100% pure (no storage update), or make it
// also emit event and do the transfer.
let claimed =
Self::do_reward_payout(&who, &mut member, &mut bonded_pool, &mut reward_pool)?;

@kianenigma kianenigma added I7-refactor Code needs refactoring. U3-nice_to_have Issue is worth doing eventually. Z6-mentor An easy task where a mentor is available. Please indicate in the issue who the mentor could be. labels Jun 15, 2022
@Szegoo
Copy link
Contributor

Szegoo commented Jul 2, 2022

I am going to give this a try.

@kianenigma kianenigma added U4-some_day_maybe Issue might be worth doing eventually. and removed U3-nice_to_have Issue is worth doing eventually. labels Aug 19, 2022
@kianenigma
Copy link
Contributor Author

We tried this with @Szegoo in the linked PR and it proved to complicate the code quite a lot. Not something that we want to do for now. If we want to re-visit, this is the best we've got so far: #11767 (comment)

@kianenigma kianenigma removed the Z6-mentor An easy task where a mentor is available. Please indicate in the issue who the mentor could be. label Aug 19, 2022
Repository owner moved this from 📕 Backlog to ✅ Done in (Nominated) Proof of Stake Oct 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
I7-refactor Code needs refactoring. U4-some_day_maybe Issue might be worth doing eventually.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants