Bug: unstake page is broken

The cause is that
Math.floor(lastFullDay - lastClaimDay) / SECONDS_IN_DAY is larger then centralState.currentDayIdx that produces a negative array index in calcRewards(...) , please fix it.

My guess is that this problem occurs only if user’s last claim day is in 2021. :thinking:

1 Like

This should already be fixed. Thanks for catching :slight_smile:

1 Like

It doesn’t seem been fixed, the only change of the code is adding a try catch block around the statements which causes the error, it only hides the error.

And because of that, there should be a Rewards to collect row sits between Claim and Rewards collected, but it is now disappeared, and I can’t see the rewards collected.

I’m wondering if I can claim the rewards now, is the onchain calculation logic the same as the frontend?

You are right I added a try/catch as a quick fix to allow people to claim their rewards before rewriting the logic that compute the approximate rewards to collect. It does’t not impact the on-chain logic at all.

1 Like

I’ve dug a little deeper to the rewards code, and found a strange thing, here is what I did.

  • In centralState.rewards, which is a array of size 1095 (3year); I dumped the array with some calculation, and got the below result:
centralState.rewards.map(x => x.toNumber() / Math.pow(2, 32) * 100)
[0 … 99]
0: 0
1: 0
2: 3.769428632222116
3: 1.4528991654515266
4: 1.4932391932234168
5: 1.5585746616125107
6: 0.15685504768043756
7: 0.1715319463983178
8: 0.2343075117096305
9: 0.2792567014694214
10: 0.06976623553782701
11: 0.24397652596235275
12: 0.22892882116138935
13: 0.07816771976649761
14: 0.15567941591143608
15: 0.12503506150096655
16: 0.08003599941730499
17: 0.0986551633104682
18: 0.04629269242286682
19: 0.13523614034056664
20: 0.0503825256600976
21: 0.03872534725815058
22: 0.06118242163211107
23: 0.28291193302720785
24: 0.13440996408462524
25: 0
26: 0
  • The Historical Data chart on the bottom of staking web page has the same daily return percentage number as the centralState.rewards array, and the start date of that chart is 2022-01-02


I’ve claimed once at 2021-12-27, and with some calculation, the claimed reward I got is exactly matched with the sum of the array above! (from index 2 to index 6), which means the centralState.rewards's start date should be 2021-12-21. AND it is different than the chart you provide.

So, what exactly is the story behind this, can someone explain a little bit more?


1 Like

@bigsan It’s related to the Solana outage we had over the last few days (see this post [Announcement] Staking and Solana outage) where several days have been merged together

I see.

There is a Crank transaction happend about 1 hour ago,

sig: 4aka6RKdR2Hjb3B1V76xvhNpGZkRyPAi3MHkPKi4tqn4ETEvFyR73DbfdxrFTwVR9tvJ7XqauFQK7U69DPSk8NYi

but the front end still doesn’t show the rewards, I saw a lot of txs on chain who claimed reward but no FIDA transfer happened.

Hope that can be fixed sooooooon…

You should be able to claim now

What I’m caring about is NOT claiming reward, but to know the amount of reward before claiming.

Is there any issue that it can not be fixed?

You can deduce this amount by looking at the central state circular buffer and the last claimed time of your stake account. If your stake account is in advance compared to the central state (due to Solana outage, see my post above) then you have already claimed all the rewards of the past days and your stake account last claim day will be adjusted with the central state the next time you claim

Did not have time to update the UI if this what you are asking for.

I sent a claim reward request, it succeeded, but I got 0 reward, how’s that possible?

My last claimed day is 2021-12-27.

Because I sent a Claim rewards yesterday, now I can see the Rewards to collect row on the UI.

BUT the amount contains only yesterday’s return. All daily returns between yesterday and last claim day are lost! Not as you said in the announcement added to the next day.

This should be considered a bug, and the reward are actually lost, please take my use case as an example.

Mind giving your address so I can have a look?

I’ve sent you a private message, thank you.

@bonfida I also have a similar issue. I last unstaked on 19 Jan 2022 and have no rewards to claim. I even tried to send the unstaking instruction but no token was accrued

The unstake tx does not make you claim any rewards so I assume you mean claim.

See the post here [Announcement] Staking and Solana outage about the crank days missed. Some of days were merged together because of this, so by bumping the central state to catch up, some people will claim 0 because they already claim their rewards during the days that were merged. The total amount of rewards does not change, it’s just the days over which they are distributed that change.

thanks yes I meant claim. I saw the announcement and assume the fix is already live? if yes I don’t understand how from Jan 19 to yesterday (8 days, so since before the Solana outage) there were no rewards to claim as I didn’t claim anything in between which could have been merged

Hi everyone,

I’m new to this forum and I registered cause I have the same problem.

I created new staking account and Rewards to collect are not displayed.


Could you please explain/fix this issue? Or is it something I’m doing wrong?



Looking at the deposit time and the time of your post it’s possible that you had nothing to collect when you took the screenshot

Did you ever hear anything back on this?