Skip to content

Fix Perbill/eras unit bugs in chain-state value formatters#7086

Open
ss-deshmukh wants to merge 1 commit into
w3f:masterfrom
ss-deshmukh:fix/chain-state-perbill-formatter
Open

Fix Perbill/eras unit bugs in chain-state value formatters#7086
ss-deshmukh wants to merge 1 commit into
w3f:masterfrom
ss-deshmukh:fix/chain-state-perbill-formatter

Conversation

@ss-deshmukh

@ss-deshmukh ss-deshmukh commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

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.

  • 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. I verified the values against the live Polkadot/Kusama Asset Hub chain state values on PJS.

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.
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.

1 participant