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

Use pending_rewards for claimed info in related endpoints #1452

Open
Imod7 opened this issue Jun 13, 2024 · 3 comments
Open

Use pending_rewards for claimed info in related endpoints #1452

Imod7 opened this issue Jun 13, 2024 · 3 comments

Comments

@Imod7
Copy link
Contributor

Imod7 commented Jun 13, 2024

Description
Track this issue paritytech/polkadot-sdk#4313 to see when pending_rewards are in production so it can be used for the claimed information in the related endpoints (staking-info, staking-payouts).

More info

Related to #1445

@IkerAlus
Copy link
Contributor

Will this "simply" add a new field pending to the endpoint response? If that is the case, is this pending rewards information not available (doing a bit of local computation) in current and previous versions of the staking pallet? This way we would have a stable output format.

@Imod7
Copy link
Contributor Author

Imod7 commented Jun 14, 2024

Will this "simply" add a new field pending to the endpoint response? If that is the case, is this pending rewards information not available (doing a bit of local computation) in current and previous versions of the staking pallet? This way we would have a stable output format.

No, my intention was not to modify the endpoints' responses as soon as pending_rewards goes live, only to check if it can be used to simplify the internal calculations in our endpoints. The reason I added this issue was more of a tracker issue to re iterate through the logic as soon as it is available. It could potentially make the code simpler and more efficient.

Based on this comment for example, the response under claimed will now be something like this:

"claimedRewards": [
      {
        "era": "1322",
        "status": "claimed"
      },
      {
        "era": "1323",
        "status": "unclaimed"
      },
      {
        "era": "1324",
        "status": "partially claimed"
      },

which is calculated by currently comparing the results from 3 calls and quite a few if else statements. So if pending_rewards can be used to reduce this, maybe it is worth re iterating. Wdyt?

Note: I updated the More Info section in the Description to give some more context.

@IkerAlus
Copy link
Contributor

IkerAlus commented Jun 14, 2024

So if pending_rewards can be used to reduce this, maybe it is worth re iterating. Wdyt?

Yes, that total makes sense. Bear in mind that this will simplify the logic from the relevant spec version onwards, but for previous ones, we will still need to maintain the more complex logic as introduced by #1445

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

No branches or pull requests

2 participants