Safrole State Transition Function
Overview
The Safrole State Transition Function (STF) defines how the protocol state evolves with each block. It handles four main types of transitions: |
1. Timekeeping
Updates the timeslot index (τ) based on the block header timestamp:
2. Entropy Accumulation
Updates the entropy (η₀) by incorporating VRF outputs from block headers:
3. Ticket Processing
Handles ticket extrinsics in each block:
Validates ticket entries (entry index, VRF signature)
Verifies tickets are not duplicated
Ensures proper ordering by VRF output
Accumulates valid tickets into state:
4. Epoch Transitions
Manages state updates at epoch boundaries:
Rotates validator keys:
where \(\Phi(\iota)\) filters out offenders from the new validator set.
Updates entropy values:
Updates slot sealing keys based on conditions:
Computes new ring root from validator set:
API Reference
- class jam.consensus.safrole.safrole.Safrole[source]
Bases:
object- static compute_ring_root(keys: List[ByteArray32]) ByteArray32[source]
- static vrf_output(proof) ByteArray32[source]
- static ensure_valid_ticket_extrinsics(block: Block)[source]
Ensures the tickets submitted via the extrinsic are valid.
- static ensure_tickets_order(tickets: TicketsExtrinsic)[source]
Ensures the tickets submitted via the extrinsic must already have been placed in order of their implied identifier. https://graypaper.fluffylabs.dev/#/5b732de/0fc7000fc800
- static ensure_valid_vrf(ticket: TicketEnvelope)[source]
Signature must be valid Ring-VRF proof
- static ensure_valid_attempt(ticket: TicketEnvelope)[source]
Entry index should be a natural number less than N https://graypaper.fluffylabs.dev/#/5b732de/0f22000f2400
- static arrange_fallback(entropy: Bytes, validators: Kappa) GammaSFallback[source]
This function is to be called in case the ticketing system fails to accumulate valid tickeys. :param Etn`2 - Upcoming eta2 or current eta1: :param Kappa - List of current validators:
- Returns:
GammaSFallback - Set of Bandersnatch keys