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

CSUB-946 wrong pending rewards calculation #42

Merged
merged 1 commit into from
Jan 10, 2024

Conversation

frankli-dev
Copy link
Contributor

@frankli-dev frankli-dev commented Dec 19, 2023

Fixed

  • Increased MaxSupportedPayoutEras to 84.
  • Check all validators instead of the first one.

One important thing is to clear the browser local storage before restart the chain and run the dashboard.

nominate___Creditcoin

If it is not cleared, then the calculation will include the previous chain's values.

Copy link
Contributor

Test before merge -> Staking Dashboad Preview!

Copy link
Contributor

@atodorov atodorov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't seem to have any effect. Rewards difference is almost 50% between Polkadot JS Apps and staking dashboard.

era_613_polkadot_js_apps_reward_27_ctc

era_613_staking_dashboard_reward_13_ctc

@frankli-dev frankli-dev changed the title [CSUB-946] wrong pending rewards calculation CSUB-946 wrong pending rewards calculation Dec 20, 2023
Copy link
Contributor

@atodorov atodorov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the fisrt 30 eras both Polkadot JS Apps and Creditcoin3 Staking Dashboard seem to be in agreement about how much the payout is. The they start to diverge slightly:

01_dashboard_eras_53-86

01_polkadot_eras_53-86

After a full 84 eras they seem to get back in sync, see my other comment!

@@ -4,7 +4,7 @@

import type { PayoutsContextInterface } from './types';

export const MaxSupportedPayoutEras = 7;
export const MaxSupportedPayoutEras = 84;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After a full 84 eras Polkadot JS Apps and Staking Dashboard seem to be in agreement about the total payouts:

02_dashboard_eras_62-145

02_polkadot_eras_62-145

However reloading the page results in 2 possible cases:

  1. Takes over 5 seconds to load, usually results in this console error:

03_dashboard_console_error

  1. If I reload the page again sometimes it doesn't show the error and the reward number is displayed in the matter of 1-2 seconds after displaying the rest of the page.

@atodorov atodorov requested a review from pLabarta January 9, 2024 17:29
@frankli-dev frankli-dev self-assigned this Jan 10, 2024
@atodorov atodorov force-pushed the fix/increase-max-payout-era branch from 77764dd to fa1bda9 Compare January 10, 2024 14:25
Copy link
Contributor

@atodorov atodorov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the defaults of max 7 eras to claimed it looks good to me.

Pending rewards amount is in sync with Polkadot JS Apps.

Note: as soon as we have rewards from eras older than current_era - 7, they cannot be claimed via Staking Dashboard but can still be claimed via Polkadot JS Apps. This how Staking Dashboard is designed to work !

@atodorov atodorov merged commit 67ce153 into dev Jan 10, 2024
11 checks passed
@atodorov atodorov deleted the fix/increase-max-payout-era branch January 10, 2024 14:54
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

Successfully merging this pull request may close these issues.

4 participants