-
Notifications
You must be signed in to change notification settings - Fork 152
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
fix: claimed in staking info endpoint #1445
base: master
Are you sure you want to change the base?
Conversation
The change is reasonable. Sidecar user does not care of internal renaming changes since the retrieved info has the same meaning. Is this PR ready for review or are we waiting for the Todos list to be checked? |
Yes, ideally the todos needs to be completed before a review. However, if any review will speed things up then please feel free to add them. |
Update
The response will also needs to be changed from a Related Resource |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just had a question about unwraps
docs/src/openapi-v1.yaml
Outdated
for _validators._ This array is populated with values from `stakingLedger.legacyClaimedRewards` | ||
or `stakingLedger.claimedRewards`, as well as the `query.staking.claimedRewards` call, depending | ||
on whether the queried block is before or after the migration. For more details on the implementation | ||
and the migration, refer to the related PR and linked issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where/how can the user find the relevant linked info?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added specific links of the PR and linked issue. Let me know if this covers your question. I also updated the schema description since I no longer return lastReward
. Changes included in this commit.
Do we have specific data for this statement? How long does it take to return the staking info in the any worst case scenario (for example, 84 eras in different pages and/or with different logic)? |
You are right, I didn't have any formal data when I wrote that. It was based on my observations from the tests I did and also on my knowledge of the calculations of each implementation.
|
@IkerAlus After our last convo on whether the status
Here is the next round of conclusions about
Currently, I am also considering that in both scenarios, it is useful to add the |
- removed `partially claimed` value - added `undefined` value - updated tests
- bringing back `partially claimed` for validator
- Added validator and nominator status types to allow specific status values for each - Updated existing test
Description
Closes #1433
This PR restores the field
claimed
(understaking
) in thestaking-info
endpoint's response which was "broken". The root cause of this is explained here.Suggested Fix
The suggested solution includes :
IStakingLedger
interface to have more control on the response fields understaking
.stakingLedger.legacyClaimedRewards
ORstakingLedger.claimedRewards
(depending on what call is available every time)staking.claimedRewards
(if available)For the Reviewer
Please refer to this hackMD doc for more information and a step-by-step on how to check, test and review this PR.
Todos
partially claimed
eras &erasStakersOverview
= nulldepth
.lastReward
instead ofclaimedRewards
understakingLedger
.era < 518
andchain = isKusama
-> the era is considered asclaimed
"automatically".status = undefined
-> which is when we do not have enough info to determine the status of the era.nominator
logic mentioned in this commentIMPLEMENTATION_DETAILS
guideNice to have
staking.erasStakersOverview
=null
&erasStakers
= 0 which can be implemented by mocking this requesthttp://127.0.0.1:8080/accounts/CmjHFdR59QAZMuyjDF5Sn4mwTgGbKMH2cErUFuf6UT51UwS/staking-info?at=22869643
Changelog
This PR introduces breaking changes to the
staking-info
endpoint response by :lastReward
for early eras and addingclaimedRewards
updated accordingly.claimedRewards
field name after the breaking change of renaming it tolegacyClaimedRewards
claimedRewards
field (understaking
) : before we had an array of eras that were claimed, now we have an object with the list of eras and their corresponding statusclaimedRewards
These changes should be explicitly mentioned in the corresponding Changelog and Release Notes of the release in which this PR is included.