Limits storage for historical set ID to session correlations.
Current Value
0The Big Picture
To validate equivocation proofs, the chain needs to correlate set IDs with sessions. This constant limits how many historical entries are kept. Older entries are pruned, meaning equivocations from the distant past can't be proven. Should align with staking unbonding periods.
Why This Matters
If this is too small, old equivocations can't be reported because the proof can't be validated. If it's too large, storage bloats. The value should cover at least the bonding period to catch cheaters before they unbond.
Example
MaxSetIdSessionEntries is 168 (one week of sessions). Equivocations from more than a week ago can't be proven because the SetIdSession mapping was pruned.
Common Questions
- What if this is set to 0?
- Equivocation handling is effectively disabled. No proofs can be validated because there's no session correlation data to verify key ownership.
- How does this relate to bonding?
- Should be at least as long as the unbonding period. Otherwise, validators could equivocate, wait for the entries to prune, then unbond without penalty.
From Chain Metadata
The maximum number of entries to keep in the set id to session index mapping. Since the `SetIdSession` map is only used for validating equivocations this value should relate to the bonding duration of whatever staking system is being used (if any). If equivocation handling is not enabled then this value can be zero.
Use Cases
- Understand how long equivocation proofs remain valid
- Plan storage usage for GRANDPA state
Code Examples
import { ApiPromise, WsProvider } from "@polkadot/api";
import { stringCamelCase } from "@polkadot/util";
const provider = new WsProvider("wss://entrypoint-finney.opentensor.ai:443");
const api = await ApiPromise.create({ provider });
// Query MaxSetIdSessionEntries constant
const value = api.consts[stringCamelCase("Grandpa")][stringCamelCase("MaxSetIdSessionEntries")];
console.log("MaxSetIdSessionEntries:", value.toHuman());
// Convert RAO to TAO if this is a balance value
const taoValue = value.toBigInt() / BigInt(1e9);
console.log("TAO:", taoValue.toString());Type Information
- Type
- u64
- Byte Size
- 8 bytes
- Encoding
- fixed
- Raw Hex
- 0x0000000000000000
Runtime Info
- Pallet
- Grandpa
- First Version
- v101
- Latest Version
- v101
- Current Runtime
- v393