-
Notifications
You must be signed in to change notification settings - Fork 798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[pallet-staking] Auto payout validator reward #5894
Comments
Hey @Ank4n , |
This issue has been mentioned on Polkadot Forum. There might be relevant details there: https://forum.polkadot.network/t/ux-ui-automatic-payout-for-all-validator/11106/3 |
@PieWol, what's the status on this? If you're busy, I’m happy to take it over and aim to wrap it up in two weeks. Let me know! |
Please go for it @vovacha |
@Ank4n Could you answer some of the questions? Its my first PR so I may have follow-up questions later as well. Some context:
1. Task design. I see at least several options,not sure which one was suggested or assumed:
2. Cleanup. The requirement to drop tasks older than X=3 eras raises some questions: My findings:
What's the motivation behind implementing additional task cleanup layer within staking pallet? 3. Execution (assumption). I assume both payout extrinsics will be deprecated and OCW is not considered as execution method. So pallet Scheduler is the way to go. 4. Migration approach (TBD). Feel free to put some comments here as well. |
Thanks for looking into this.
This ^. But there can be more than 499 tasks per era as some validators can have multiple pages. Also, there can be more than one task that can be executed in the same block (based on how much block weight is free).
Thanks for crunching the numbers. In practice, this should rarely be an issue. However, it’s likely still needed as a defensive measure, though you can consider it optional for now. If we’re unable to execute all tasks within an era (due to missed blocks, full blocks, etc.), we’ll need to determine what to prioritize in the next era: the newest tasks or the oldest ones. If this pattern persists over multiple eras, we’ll eventually need to drop older tasks and focus solely on the new ones.
We can retain the payout extrinsics. If someone needs to payout urgently and cannot wait for tasks to be automatically executed, or in cases where old unprocessed tasks are deprecated, this extrinsic provides a way to process them manually. Curious why you mentioned
I don’t think any migration is necessary. Is there something specific you had in mind? |
@Ank4n Thanks for the clarification. Let me explain my initial thoughts. Why I assumed OCW is not considered:
I suggest approach with pallet Scheduler:
WDYT? |
Darwinia utilized the on_idle to distribute the reward. |
I haven’t looked deeply into the scheduler, but the proposed approach seems quite similar to the one proposed with Could you perhaps look into this further and elaborate on why the scheduler would be a better choice than tasks in this context? Another question to consider is how we recover from failure scenarios. Eg: what happens if a scheduled call or task cannot be executed at the specified block number? |
@Ank4n You mentioned From initial investigation, it seems all approaches would need similar storage for tracking pending payouts. The main differences appear to be in implementation:
All approaches would be constrained by block space availability with similar behavior:
If we choose OCW approach, we'd need to decide on fee payment. |
That is not correct. The stuff is build exactly for these kind of use cases which are being talked about here. You don't need to pay fees for it. The scheduler at some point will/should also be rewritten to use |
I apologize for the confusion. Looking at Will start working on implementation soon. |
Context
Validator payouts are lazy, and paged. Meaning for each era, and page of nominators (see MaxExposurePageSize), the reward needs to be claimed by calling Staking::payout_stakers.
Validators generally run a bot to claim these. They have HistoryDepth eras (84 eras in dotsama) after which these claims are dropped/become unavailable.
To Do
Utilize tasks to payout rewards.
Probably the best place to schedule this is when a new era is triggered and we set the exposure for the validators.
Other requirements
The tasks should also keep track of pages. This can be as easy as, not remove validator from task until all pages of validator has been paid out.
We also need to have a way to make sure we don't just keep backfilling tasks while not having enough time to process them. I would suggest something like dropping tasks more than X=3 eras (where X is configurable) old.
Related
#4630 is very similar to this issue.
The text was updated successfully, but these errors were encountered: