Epoch Processing

Consensus

Per-subnet periodic processing that runs Yuma Consensus, distributes emissions, and updates metagraph state.

Click items to navigate to their reference pages.

The Big Picture

Epoch processing is the bridge between block-by-block emission accumulation and stake landing on hotkeys. When a slot is due, the subnet runs Yuma Consensus on its weight matrix and pays out the four pending buckets: miners by incentive, validators by dividend split into alpha-weighted and root-weighted legs, the owner cut, and the root share. Every payout is a stake increase on the subnet; nothing is paid to free balance. The path emits AutoStakeAdded, EpochDeferred and EpochSkipped, plus SubnetLeaseDividendsDistributed on leased subnets; the dividend and take credits themselves are silent.

Why This Matters

Understanding epochs is key to knowing when you get paid. Emission accumulates every block but only becomes stake at the epoch. The recorded dividend maps are net of the validator take, so an indexer that subtracts take again undercounts nominators.

Example Scenario

A subnet with Tempo=360 (~72 min at 12s blocks) accumulates emissions for 360 blocks. If the subnet earns 0.02 TAO/block, the epoch distributes 7.2 TAO worth of alpha. A miner with 10% incentive receives 0.36 TAO worth of alpha as stake at the epoch, not per block.

Common Questions

What is Tempo?
The number of blocks per epoch for a given subnet. Shorter Tempo means more frequent consensus and distribution. The subnet owner can configure it.
What happens if no validators set weights?
The epoch still runs. If Yuma produces zero total incentive, distribute_emission adds the whole miner bucket to the validator bucket, so validators receive both halves that epoch. Nothing stays pending on that account.
Why did my subnet run its epoch a block late, or not at all?
Late: more than MaxEpochsPerBlock subnets were due in the same block and yours was deferred (EpochDeferred). Not at all: the input state was inconsistent and the slot was consumed without running (EpochSkipped); the pending buckets carry into the next successful epoch.

Use Cases

  • Predicting when emissions will be distributed
  • Understanding per-epoch earnings
  • Debugging stale metagraph data
  • Monitoring subnet epoch health

Each subnet has a Tempo parameter defining how many blocks constitute an epoch. When a slot is due, the runtime runs Yuma Consensus on the weight matrix, distributes the pending emission to validators, miners, the owner and root stakers, updates bonds, and refreshes metagraph metadata.

Epoch processing bridges per-block Alpha injection and UID-level reward distribution. Each block, run_coinbase injects TAO into subnet Alpha pools and accumulates alpha into four pending buckets: PendingServerEmission (miners), PendingValidatorEmission, PendingRootAlphaDivs and PendingOwnerCut. From v488 the burn and recycle slots of SubnetEmissionWeights are burned and recycled in the same block and never accumulate; from v490 the gamma shares of SubnetGammaEmission accumulate in a fifth bucket, PendingGammaEmission (coinbase/run_coinbase.rs L300-L368 at d967d1358, runtime v490). At the epoch, drain_pending zeroes the first four and distribute_emission pays them out: the owner cut is staked to the owner hotkey; incentive is staked to each miner (or its AutoStakeDestination), except owner-hotkey incentive which is withheld and recycled or burned; dividends are split per hotkey between the root-weighted and alpha-weighted legs, then between the validator take, staked to the owner coldkey, and the nominator amount written to AlphaDividendsPerSubnet and RootAlphaDividendsPerSubnet. From v490 mint_gamma_emission runs for the subnet right after distribute_emission: it allots PendingGammaEmission to the gamma shares in proportion to their size (UnconvertedGammaEmission) and converts each share in its own storage layer, selling the alpha on the subnet pool, buying and burning the target subnet alpha with all of the TAO, and crediting gamma to the deposit of the subnet owner at the subnet owner hotkey on the target (GammaEmissionMinted). A share that cannot convert keeps its alpha for a later epoch (run_coinbase.rs L549, subnets/gamma.rs L258-L341).

Scheduling has been stateful since v423. A slot is due when PendingEpochAt is reached, or current_block − LastEpochBlock ≥ Tempo, or BlocksSinceLastStep exceeds Tempo. At most MaxEpochsPerBlock subnets run per block; the rest are deferred one block (EpochDeferred). A subnet whose input state is inconsistent consumes the slot without running (EpochSkipped) and its pending buckets carry over to the next successful epoch.

Triggers

  • PendingEpochAt(netuid) is non-zero and current_block ≥ PendingEpochAt
  • current_block − LastEpochBlock(netuid) ≥ Tempo(netuid)
  • BlocksSinceLastStep(netuid) > Tempo(netuid) (safety net)

Inputs (10)

ItemTypeRole
Tempo SubtensorModulestorageBlocks per epoch for this subnet
LastEpochBlock SubtensorModulestorageAnchor for the next automatic slot (LastEpochBlock + Tempo)
PendingEpochAt SubtensorModulestorageOut-of-cycle slot from an owner trigger or a capacity deferral
MaxEpochsPerBlock SubtensorModulestorageCap on epochs run per block; excess subnets are deferred
PendingServerEmission SubtensorModulestorageAccumulated miner alpha, drained at the epoch
PendingValidatorEmission SubtensorModulestorageAccumulated validator alpha, drained at the epoch
PendingRootAlphaDivs SubtensorModulestorageAccumulated root-share alpha, drained at the epoch
PendingOwnerCut SubtensorModulestorageAccumulated owner cut, drained at the epoch
PendingGammaEmission SubtensorModulestorageAccumulated gamma-share alpha, allotted to the shares at the epoch (from v490)
SubnetGammaEmission SubtensorModulestorageGamma shares the pending amount is allotted by (from v490)

Outputs (14)

ItemTypeRole
Emission SubtensorModulestoragePer-UID emission record of the epoch; from v482 not the miner payout on a non-default split (IncentiveAlphaEmittedToMiners is)
AlphaDividendsPerSubnet SubtensorModulestorageNominator dividend per hotkey, net of take, cleared and rewritten each epoch
RootAlphaDividendsPerSubnet SubtensorModulestorageRoot-weighted dividend per hotkey, net of take, cleared and rewritten each epoch
TotalHotkeyAlphaLastEpoch SubtensorModulestorageDenominator snapshot for nominator shares
MinerBurned SubtensorModulestorageFraction of incentive withheld from owner hotkeys this epoch
LastEpochBlock SubtensorModulestorageSet to the current block whenever a slot is consumed
SubnetEpochIndex SubtensorModulestorageIncremented once per consumed slot
LastMechansimStepBlock SubtensorModulestorageSet to the current block only when the distribution actually ran
LastUpdate SubtensorModulestoragePer-UID last update block numbers
EpochDeferred SubtensorModuleeventSlot pushed one block by MaxEpochsPerBlock
EpochSkipped SubtensorModuleeventSlot consumed without running because input state was inconsistent
AutoStakeAdded SubtensorModuleeventMiner incentive redirected to an AutoStakeDestination
UnconvertedGammaEmission SubtensorModulestorageAlpha allotted to a gamma share and not yet converted (from v490)
GammaEmissionMinted SubtensorModuleeventA gamma share converted into gamma on its target subnet (from v490)

Source Files

pallets/subtensor/src/coinbase/block_step.rs
block_step()
pallets/subtensor/src/coinbase/run_coinbase.rs
drain_pending()should_run_epoch_with_tempo()distribute_emission()calculate_dividend_distribution()distribute_dividends_and_incentives()get_parent_child_dividends_distribution()
pallets/subtensor/src/epoch/run_epoch.rs
epoch()
pallets/subtensor/src/subnets/gamma.rs
allot_gamma_emission()mint_gamma_emission()mint_gamma_emission_share()

Formulas

Epoch Trigger

Since v423 a slot is due from a stored anchor plus tempo, with an override block and a safety net. Before v423 it was (block_number + netuid + 1) % (tempo + 1) == 0.

if tempo == 0: never
due = (PendingEpochAt > 0 and block >= PendingEpochAt)
   or BlocksSinceLastStep > tempo
   or block - LastEpochBlock >= tempo
// per block: at most MaxEpochsPerBlock subnets run; the rest get
// PendingEpochAt = block + 1 and EpochDeferred
// a due slot with inconsistent input state is consumed (LastEpochBlock = block,
// SubnetEpochIndex += 1) but not run: EpochSkipped, pending buckets carry over

Dividend Split

How one hotkey dividend from Yuma becomes the amounts written to AlphaDividendsPerSubnet and RootAlphaDividendsPerSubnet.

// per hotkey, after parent/child redistribution
weighted_root = root_stake * TaoWeight
alpha_divs = dividend * alpha_stake / (alpha_stake + weighted_root)
root_divs  = dividend - alpha_divs   if hotkey has a root UID, else 0
// pools are then shared by proportion
alpha_amount = PendingValidatorEmission * alpha_divs / sum(alpha_divs)
root_amount  = PendingRootAlphaDivs   * root_divs  / sum(root_divs)
// each leg: take to owner coldkey, remainder recorded
take = hotkey_take * amount            // staked to (hotkey, Owner(hotkey)), no event
AlphaDividendsPerSubnet[netuid, hotkey]     = alpha_amount - take_alpha
RootAlphaDividendsPerSubnet[netuid, hotkey] = root_amount  - take_root   // queued to basket

Per-Block Alpha Injection

Each block, run_coinbase injects TAO into subnet Alpha pools. At epoch, accumulated Alpha is distributed across UIDs.

// Each block: TAO injected into subnet pool via run_coinbase
SubnetTAO[subnet] += emission_share
SubnetAlphaIn[subnet] += minted_alpha
// At epoch: distribute accumulated alpha → per-UID amounts

Related Workflows

set-weights
Read the deep dive: Epoch Processing

Version History

v101 Initial epoch processing
v150 Tempo made configurable per subnet
v200 Sparse epoch mode for subnets with >256 UIDs
v290 Epoch emissions routed through Alpha pools
v350 Owner cut deducted before miner/validator split
v421 Incentive assigned to owner hotkeys withheld; MinerBurned records the fraction
v423 Stateful scheduler: LastEpochBlock + Tempo, PendingEpochAt, MaxEpochsPerBlock, SubnetEpochIndex, EpochDeferred and EpochSkipped events replace the block-modulo trigger
v437 Miner collateral settled from incentive and validator take at each epoch
v441 Net root dividends queued into PendingBasketDeposits instead of RootClaimable
v488 Root dividend credits of a hotkey with deferred dividends are recorded against the earning root stake when queued (enqueue_root_dividend)
v490 Gamma emission shares allotted and converted after distribute_emission (mint_gamma_emission)