Fix Perbill/eras unit bugs in chain-state value formatters#7086
Open
ss-deshmukh wants to merge 1 commit into
Open
Fix Perbill/eras unit bugs in chain-state value formatters#7086ss-deshmukh wants to merge 1 commit into
ss-deshmukh wants to merge 1 commit into
Conversation
The chain-state-values page rendered several values with the wrong scaling: - Validator/pool commission values are Perbill (1e9 = 100%) but were run through the `percentage` formatter (÷10000, valid only for Permill), inflating them 1000×. Added a `percentage_perbill` formatter (÷1e7) and switched the four commission calls to it: * Staking.MinCommission (Kusama) 15000% → 15% * NominationPools.GlobalMaxCommission 10000% → 10% - Staking.BondingDuration is denominated in eras, not blocks, but used `blocks_to_days`, rendering 0.0019 days. Added an `eras_to_days` helper and `eras_to_days_kusama` formatter → 7 days (matches the formula the page's own prose documents). The genuinely-Permill uses (Bounties.CuratorDepositMultiplier, Treasury.Burn) are unchanged. Values verified against live Polkadot/Kusama Asset Hub RPC.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The chain-state-values page rendered a few values with the wrong scaling:
TLDR: Max & Min staking commission and a few other sections show incorrect values on the wiki Check chain state page for reference. These were queried right but parsed incorrectly.
percentageformatter (÷10000, valid only for Permill), inflating them 1000×. Added apercentage_perbillformatter (÷1e7) and switched the four commission calls to it:blocks_to_days, rendering 0.0019 days. Added aneras_to_dayshelper anderas_to_days_kusamaformatter -> 7 days (matches the formula the page's own prose documents).The genuinely-Permill uses (Bounties.CuratorDepositMultiplier, Treasury.Burn) are unchanged. I verified the values against the live Polkadot/Kusama Asset Hub chain state values on PJS.