-
Notifications
You must be signed in to change notification settings - Fork 360
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
stakerRewards bug | Payouts #5859
Comments
I used to get the |
Known issue. I am working on a fix to get the staking pages sorted and fixed. |
Thanks for the answer. fyi maybe related: being connected with a kusama node on v1.10.0, performing this ( |
Yea you definitely brought up a great point with the claimedRewards. I have been trying to clean it up in the derives for the past 3 hours as this is the last blocker until I can start pushing all these fixes downstream to the UI, but the change from I'll find some solution though 🤞 |
Fixed via #5862 |
|
Thanks for the quick resolution, I indeed implemented it using For reference: https://github.com/w3f/polkadot-k8s-payouts/blob/v1.2.9/src/claimer.ts#L138-L171 Unfortunately, there seems to be a bug still: even if unclaimed rewards are spotted, one cannot claim anything before era For now, this is my temporary fix. However, it will prevent people from claiming rewards before era 6514. UPDATE: Polkadot seems to have the same issue, one cannot claim before era Maybe related: paritytech/polkadot-sdk#1189 |
@Ank4n Have you anything similar to this? Pjs api is just returning |
Older rewards should work as usual. After the upgrade, all claimed rewards for eras are noted in the new storage For era 6512 your validator claimed reward here: https://kusama.subscan.io/extrinsic/22806784-2. I didn't check all the links you posted but I think it might already be claimed which is why you are seeing the error (correctly). You should see an entry in |
Thanks for checking. But then I guess the problem is that nor |
Weirdly enough I do remember seeing something similar during testing where the era during the staking transition was missing within legacyClaimedRewards, and or claimedRewards. At the time I thought nothing of it since I assumed it was just unclaimed, but now it seems a bit weird. I don't have the ability to verify what I saw right now since I am OOO for the next week. But definitely something to follow up on. |
Probably bug with the derived api? If you query the storage directly you can see that it is claimed. console.log((await api.query.staking.claimedRewards(6512, 'GaK38GT7LmgCpRSTRdDC2LeiMaV9TJmx8NmQcb9L3cJ3fyX')).length)
// returns 1 |
console.log((await api.query.staking.claimedRewards(6511, 'GaK38GT7LmgCpRSTRdDC2LeiMaV9TJmx8NmQcb9L3cJ3fyX')).length)
// returns 0 And it returns 0 for all the era previous to |
Before https://kusama.polkassembly.io/referenda/373, claimed rewards were saved in the storage item The reason behind doing this lazy upgrade was that migrating (all ledgers * 84 eras) would be extremely huge. In 84 eras though, all non paged storage item would be stale and there will exist only one source of truth. Admittedly this is causing lot of confusion. More info here. I wrote a small script that reads both old and new storage and figures out if era is claimed or not. let stash = 'GaK38GT7LmgCpRSTRdDC2LeiMaV9TJmx8NmQcb9L3cJ3fyX';
// we need controller to read ledger.
let controller = (await api.query.staking.bonded(stash)).unwrap();
let era = 6512;
// calculate pages
let pageCount = 0;
// check if non paged exposure, then page is always 1
if ((await api.query.staking.erasStakers(era, stash)).total > 0) {
pageCount = 1;
} else {
let overview = (await api.query.staking.erasStakersOverview(era, stash));
if (overview !== null && overview.isSome) {
// if paged exposure, we get count from `ErasStakersOverview`.
pageCount = overview.unwrap().pageCount;
}
else {
console.log('no exposure found');
return;
}
}
// get paged claimed rewards.
let pagedClaimedRewards = (await api.query.staking.claimedRewards(era, stash)).length == pageCount;
// get legacy claimed rewards.
let legacyClaimedRewards = (await api.query.staking.ledger(controller)).unwrap().legacyClaimedRewards.filter((e) => e == era).length == 1;
console.log(`page claimed: ${pagedClaimedRewards || legacyClaimedRewards}`); |
I think what would help is a runtime api to check if era reward is claimable given a validator stash and era. I will make one but might take sometime for it to be live on production networks. |
@ironoa This would help in future but I think it will take sometime to get it merged and live in Kusama and Polkadot. paritytech/polkadot-sdk#4301 Also happy to incorporate any other runtime suggestions that would help. |
To recap:
So I guess the only thing missing is to fix the |
Yea I will double check this when I am back to see if there is any under lying issues with how the derive parses the |
So #5870 fixes the main issues with the eras being incorrect. The regression is fixed which means the That being said I did notice an issue and I will reference polkadot as the chain since that is what I was testing with. If i query But when I query Here is a code example: const x = await api.query.staking.claimedRewards(1419, '12YP2b7L7gcHabZqE7vJMyF9eSZA9W68gnvb8BzTYx4MUxRo')
const y = await api.query.staking.erasStakersOverview(1419, '12YP2b7L7gcHabZqE7vJMyF9eSZA9W68gnvb8BzTYx4MUxRo')
const z = await api.query.staking.ledger('12YP2b7L7gcHabZqE7vJMyF9eSZA9W68gnvb8BzTYx4MUxRo');
console.log('claimedRewards: ', x.toJSON());
console.log('Overview: ', y.isSome);
console.log('LegacyClaimedRewards: ', z.isSome && z.unwrap().legacyClaimedRewards.toJSON()) This will output:
That being said once the above PR goes in I think it's safe to say we can close this issue. |
This should now be fixed and resolved! |
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. |
stakerRewards call may be broken, not filtering out the already claimed rewards
Likely related, the ui seems to be showing something wrong (I've just manually claimed for era 6528, 6527, 6526, but yet they are shown there)
As a double check, If I try to claim again I get indeed the the already claimed error
@polkadot/api version: v10.13.1
The text was updated successfully, but these errors were encountered: