AlphaShareEpoch

Storage Map v459 → current

The pool epoch a share row was last written in.

Explore chain
Queried by: developersanalytics

The Big Picture

The row-side half of the epoch scheme. AlphaSharePoolEpoch is the pool-side half. A row is live when the pool epoch is 0 or equals the row stamp.

Why This Matters

Without this stamp a stale row could be valued against a pool it no longer belongs to.

Example Scenario

AlphaSharePoolEpoch(H, 7) = 2 and AlphaShareEpoch(H, C, 7) = 1: the row for C is retired and worth nothing, whatever AlphaV2 says.

Use Cases

  • Filter retired rows out of a position reconstruction
  • Audit which rows survived a pool closure

From Chain Metadata

NMAP ( hot, cold, netuid ) --> epoch | Pool epoch in which an `AlphaV2` (or legacy `Alpha`) share row was last written. Absent means epoch 0.

Purpose & Usage

Purpose

Marks an AlphaV2 (or legacy Alpha) row with the AlphaSharePoolEpoch in force when it was written, so a later pool generation can retire it.

Common Query Patterns

  • Query (hotkey, coldkey, netuid) alongside AlphaV2 when valuing a row from raw storage
  • Absent means epoch 0

Notes

  • First appears at runtime v459.
  • Written only when the pool epoch is nonzero; a never-closed pool has no stamped rows (staking/stake_utils.rs set_share at v467).
  • Removed when the share row is removed, including on full unstake (staking/remove_stake.rs at v467).

Query Keys

#NameTypeDescription
1
hot
AccountId hot (AccountId, hashed key component) (hex -> SS58)
2
cold
AccountId cold (AccountId, hashed key component) (hex -> SS58)
3
netuid
NetUid netuid (NetUid, hashed key component)

Stored Value

epoch (u64)

RAO -> TAO (/ 10^9)

Default Value

0 0x0000000000000000

Absent keys read as this value — querying a key that has never been written returns this default, not an error or empty result.

Code Examples

import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443

const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);

// Query AlphaShareEpoch storage
const hot = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
const cold = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
const netuid = 1;

const result = await api.query.SubtensorModule.AlphaShareEpoch.getValue(hot, cold, netuid);
console.log("AlphaShareEpoch:", result);

Runtime Info

View Source
Pallet
SubtensorModule
Storage Kind
Map
First Version
v459
Current Version
v472