Skip to content

Fix automatic payout#1967

Open
HenriqueNogara wants to merge 13 commits into
developfrom
fix-automatic-payout
Open

Fix automatic payout#1967
HenriqueNogara wants to merge 13 commits into
developfrom
fix-automatic-payout

Conversation

@HenriqueNogara

@HenriqueNogara HenriqueNogara commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

changelog

other

  • Fix automatic payout: removes the scheduler; Payouts are made on_initialize;

depends on: PolymeshAssociation/polkadot-sdk#10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_system implementation to iterate through all EraInfo pages and pay out each page.
  • Update Cargo.lock to a newer polkadot-sdk commit (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.

Comment thread pallets/validators/src/permissioned.rs Outdated
Comment thread pallets/validators/src/permissioned.rs Outdated
Comment thread pallets/validators/src/permissioned.rs Outdated
@HenriqueNogara HenriqueNogara requested a review from Neopallium July 3, 2026 11:44
Comment thread pallets/runtime/common/src/runtime.rs Outdated
Comment thread pallets/runtime/mainnet/src/runtime.rs Outdated
Comment thread pallets/validators/src/permissioned.rs Outdated
Comment thread pallets/validators/src/permissioned.rs Outdated
Comment thread pallets/validators/src/lib.rs Outdated
Comment thread pallets/validators/src/lib.rs Outdated
Comment thread pallets/validators/src/permissioned.rs Outdated
Comment thread pallets/validators/src/permissioned.rs Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 5 comments.

Comment thread pallets/validators/src/lib.rs Outdated
Comment thread pallets/validators/src/permissioned.rs Outdated
Comment thread pallets/validators/src/permissioned.rs
Comment thread pallets/validators/src/permissioned.rs Outdated
Comment thread pallets/validators/src/permissioned.rs
Comment thread pallets/validators/src/permissioned.rs Outdated
Comment thread pallets/validators/src/permissioned.rs Outdated
@HenriqueNogara HenriqueNogara requested a review from Neopallium July 8, 2026 12:20

@Neopallium Neopallium left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread Cargo.toml
[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" }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These can be changed back, since the PR was merged.

Comment on lines +447 to +448
// 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);

@Neopallium Neopallium Jul 9, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add an event to record that the payouts finished for the era.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants