Fix automatic payout#1967
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to fix automatic staking reward payouts by updating the validators pallet’s system-triggered payout logic to handle paginated staking exposures (i.e., multiple “pages” of nominators), alongside a dependency lock update consistent with the staking API changes.
Changes:
- Update
payout_stakers_by_systemimplementation to iterate through allEraInfopages and pay out each page. - Update
Cargo.lockto a newerpolkadot-sdkcommit (and associated transitive dependency resolutions).
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
pallets/validators/src/permissioned.rs |
Switch system payout logic to loop through exposure pages and call do_payout_stakers_by_page for each page. |
Cargo.lock |
Bump polkadot-sdk git source revision and refresh resolved dependency versions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Neopallium
left a comment
There was a problem hiding this comment.
Few small changes. Otherwise all good.
| let next_era = current_payout_era.saturating_add(1); | ||
|
|
||
| // This write has already been accounted for | ||
| PendingPayouts::<T>::remove(current_payout_era); |
There was a problem hiding this comment.
Can't remove that inside the PendingPayouts::mutate callback, since it will store the empty vec after this closure returns.
mutate_exists allows mutating the value to None to remove it.
https://docs.rs/frame-support/48.0.0/frame_support/storage/trait.StorageMap.html#tymethod.mutate_exists
| [patch.crates-io] | ||
| # Patch this to avoid duplicate deps (subxt uses this dep). | ||
| sp-crypto-hashing = { git = "https://github.com/PolymeshAssociation/polkadot-sdk", branch = "polymesh-v8-stable2603-2" } | ||
| sp-crypto-hashing = { git = "https://github.com/PolymeshAssociation/polkadot-sdk", branch = "polymesh-v8-stable2603-2-remove-staking-scheduler" } |
There was a problem hiding this comment.
These can be changed back, since the PR was merged.
| // All validators have been paid. Checks if there are validators from the next era to payout | ||
| let next_era = current_payout_era.saturating_add(1); |
There was a problem hiding this comment.
We should add an event to record that the payouts finished for the era.
changelog
other
depends on: PolymeshAssociation/polkadot-sdk#10