Skip to content
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

Support Paged Reward Payouts #10004

Closed
Ank4n opened this issue Nov 1, 2023 · 9 comments
Closed

Support Paged Reward Payouts #10004

Ank4n opened this issue Nov 1, 2023 · 9 comments

Comments

@Ank4n
Copy link
Contributor

Ank4n commented Nov 1, 2023

We will soon have paged rewards once paritytech/polkadot-sdk#1189 makes it to the runtime upgrade. Creating this ticket to add support for this to Polkadot-js app.
Similar to: polkadot-cloud/polkadot-staking-dashboard#1586

Changes are not reflected in rust docs yet but linking to the documentation and relevant structs in the code.

Changes:
3 new Storage items:

Following storage items are deprecated.
(Note: Once these changes are in a runtime, all the new era exposure will go to new storage items above while the following storage items will still keep historical era information (looking to make this info easy to get via a runtime api). In 84 eras after the release, all these storage items will be empty and can be removed from runtime code.)

Extrinsics to payout rewards:
payout_stakers: can be called multiple times for an era and validator stash, paying out one page of exposure at a time.
payout_stakers_by_page: can be used to payout rewards for a particular page of exposure.

Feel free to add any useful runtime api requests to issue#426 to help with this.

@Ank4n
Copy link
Contributor Author

Ank4n commented Dec 12, 2023

Any updates to this? The changes are live on westend.

@TarikGul
Copy link
Member

TarikGul commented Mar 8, 2024

polkadot-js/api#5813 fixes the erasStakersClipped issue

@TarikGul
Copy link
Member

TarikGul commented Mar 13, 2024

Completed in the API via: polkadot-js/api#5815 for ErasStakersPaged

@kukabi
Copy link
Contributor

kukabi commented Apr 20, 2024

Hi,

There seems to be something wrong with the new Staking.ErasStakersPaged storage item on Kusama.

When I query the keys of the storage item for the current era 6522 it gives 1000 keys. Two of those pages belong to GUw3gm93T85i9Syb4hA3NotNMFgCB56p7osxi3hnoqforMj, which seems to have over 700 active stakers. So that means the storage contains the exposure data for only 999 validators.

And when I checked it against the active validator list, the storage item doesn't give the exposure for validator GhGzv1S37MxmUFszHvx2M69ka3xTq4PBQZ4Ck8RzQ9TZ77u. And it seems the same problem exists for Staking.ErasStakersOverview.

It looks like there's no storage item where I can get the exposure for GhGzv1S37MxmUFszHvx2M69ka3xTq4PBQZ4Ck8RzQ9TZ77u. Could you please confirm?

Thanks in advance.

@Ank4n
Copy link
Contributor Author

Ank4n commented Apr 20, 2024

@kukabi
Gh...7u seems to have no exposure except its own. If you query ErasStakersOverview you will see it returns

{
  total: 6,999,998,586,259,297
  own: 6,999,998,586,259,297
  nominatorCount: 0
  pageCount: 0
}

This is why you do not see any entry for Gh..7u in ErasStakersPaged.

@Ank4n
Copy link
Contributor Author

Ank4n commented Apr 20, 2024

Not sure if you meant there is some issue with GU...Mj as well. I queried ErasStakersOverview and ErasStakersPaged for it and seems alright to me.

console.log((await api.query.staking.erasStakersOverview(6522, 'GUw3gm93T85i9Syb4hA3NotNMFgCB56p7osxi3hnoqforMj')))
console.log((await api.query.staking.erasStakersPaged.keys(6522, 'GUw3gm93T85i9Syb4hA3NotNMFgCB56p7osxi3hnoqforMj')).length)
console.log((await api.query.staking.erasStakersPaged(6522, 'GUw3gm93T85i9Syb4hA3NotNMFgCB56p7osxi3hnoqforMj', 0)).unwrap().others.length)
console.log((await api.query.staking.erasStakersPaged(6522, 'GUw3gm93T85i9Syb4hA3NotNMFgCB56p7osxi3hnoqforMj', 1)).unwrap().others.length)

Output:

{"total":"0x00000000000000000019adfbb107f3a0","own":10000063083922,"nominatorCount":716,"pageCount":2}
2
512
204

@kukabi
Copy link
Contributor

kukabi commented Apr 20, 2024

@Ank4n That probably was the issue, thanks. And no there's no issue with GU...Mj, just meant it had two pages of data.

@TarikGul
Copy link
Member

TarikGul commented May 9, 2024

Completed via #10554

@TarikGul TarikGul closed this as completed May 9, 2024
@polkadot-js-bot
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.

@polkadot-js polkadot-js locked as resolved and limited conversation to collaborators May 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

4 participants