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

Underlying storage for exposures has changed #5771

Closed
1 of 4 tasks
Ank4n opened this issue Dec 12, 2023 · 3 comments · Fixed by #5815
Closed
1 of 4 tasks

Underlying storage for exposures has changed #5771

Ank4n opened this issue Dec 12, 2023 · 3 comments · Fixed by #5815
Assignees

Comments

@Ank4n
Copy link

Ank4n commented Dec 12, 2023

  • I'm submitting a ...

    • Bug report
    • Feature request
    • Support request
    • Other
  • What is the current behavior and expected behavior?
    The api.derive.staking._era_exposures(era) under the hood calls ErasStakersClipped. This storage item would not be used anymore with the paged rewards changes (PR link, forum link) and would be replaced with a new storage ErasStakersPaged which is a nmap of (Era, Validator, Page).

  • What is the motivation for changing the behavior?
    When runtime upgrades to v1.4, this api would start breaking.

  • Suggest a motivation for the request or ideas how to implement the
    addition or change

    There can be two apis, one to query how many pages of exposure exists which can be looked up by reading the storage item ErasStakersOverview. The current _era_exposures should then take a page index to read the exposure.

@TarikGul TarikGul self-assigned this Mar 6, 2024
@TarikGul
Copy link
Member

TarikGul commented Mar 6, 2024

I'll be working on this soon and getting this supported/fixed. Going to ensure there is compatibility for previous runtime versions as well so this doesn't act as a breaking change for some folks.

@TarikGul
Copy link
Member

So i currently just made sure there is backwards and forward compatibility with erasStakersPaged for _eraExposure. I am going to create a tracking issue to remove erasStakersClipped once all relays have finally been updated to appropriate runtime.

Couple things:

one to query how many pages of exposure exists which can be looked up by reading the storage item ErasStakersOverview

This already exists, the user can just use api.query.staking.erasStakersOverview

The current _era_exposures should then take a page index to read the exposure.

With the current implementation this is not possible. Since _eraExposure is grabbing all the storageEntries using .entries the last storage entry arg is removed from the call. In this case that is pageIndex.


On another note, #5807 did augment the substrate types accordingly so the new storage calls are statically there for users.

@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 Mar 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
3 participants