SetIdSession

Storage Map v101 → current

Maps GRANDPA set ID to the session index when that set was last responsible.

Explore chain
Queried by: validatorsdevelopers

The Big Picture

Equivocation proofs must prove the offender owned their key during the relevant session. This storage links set IDs to sessions, allowing the chain to verify that the key ownership proof matches the correct time period.

Use Cases

  • Validate equivocation proofs by verifying key ownership during session
  • Correlate historical authority sets with session data

From Chain Metadata

A mapping from grandpa set ID to the index of the *most recent* session for which its members were responsible. This is only used for validating equivocation proofs. An equivocation proof must contains a key-ownership proof for a given session, therefore we need a way to tie together sessions and GRANDPA set ids, i.e. we need to validate that a validator was the owner of a given key on a given session, and what the active set ID was during that session. TWOX-NOTE: `SetId` is not under user control.

Purpose & Usage

Purpose

Links authority sets to sessions for equivocation proof validation.

Common Query Patterns

  • Query by set ID to get session index
  • Iterate to correlate sets with sessions

Query Keys

#NameTypeDescription
1
key1
u64 key1 (u64)

Stored Value

value (u32)

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 SetIdSession storage
const key1 = 0;

const result = await api.query
  [stringCamelCase("Grandpa")]
  [stringCamelCase("SetIdSession")](
  key1
);

console.log("SetIdSession:", result.toHuman());

Runtime Info

Pallet
Grandpa
Storage Kind
Map
First Version
v101
Current Version
v393