DAG vs chain-based consensus
| Property | Chain-based | DAG-based (Tessellation) |
|---|---|---|
| Block parents | Single predecessor | Multiple parent references (NonEmptyList[BlockReference]) |
| Throughput | Bounded by single producer | Parallel block creation across facilitators |
| Finality | Per-block | Per-snapshot (batched) |
| History | Linear chain | Partial order collapsed into ordered snapshots |
| Tip management | N/A | Active tips promoted / deprecated per snapshot (SnapshotTips) |
Block type captures this structure directly:
height is derived from parent.maximum.height.next, so heights form a monotonically increasing partial order rather than a flat sequence.
The five-phase consensus round
Every consensus round — whether at L1 (blocks) or L0 (snapshots) — progresses through exactly five phases tracked inConsensusState:
CollectingFacilities
Each eligible peer broadcasts a facility declaration advertising its willingness to participate. The round cannot advance until all expected peers have declared or the stall timeout expires.
CollectingProposals
Active facilitators exchange snapshot proposals — their candidate artifacts (blocks for L1, snapshots for L0). A proposal contains the artifact and a hash that peers will vote on.
CollectingSignatures
Facilitators collect majority signatures over the agreed artifact hash. A quorum is required before proceeding.
CollectingBinarySignatures
A second round of signatures over the binary (serialized) representation of the artifact is collected. This guards against serialization ambiguity.
The FSM: ConsensusState, ConsensusRoundRunner, ConsensusManager
The engine is structured around three collaborating components defined innode-shared/infrastructure/consensus/:
ConsensusState
ConsensusState
An immutable value type parameterised over
[Key, Status, Outcome, Kind] that captures the full state of one in-flight round:LockStatus controls whether new facilitators may join mid-round. It is set to Closed during stall detection and reset to Reopened once the stall is resolved.ConsensusRoundRunner
ConsensusRoundRunner
Runs a single round and its associated stall-detection monitor fiber. The runner:
- Calls
creator.tryFacilitateConsensusto initialise state for the new key. - Spawns a
roundMonitorfiber that polls every 100 ms for stalls. - Drives state transitions by enqueuing
ConsensusCommandvalues on an internal queue. - After the round completes, calls
afterConsensusFinishto schedule the next trigger (TimeTriggerorEventTrigger).
ConsensusManager
ConsensusManager
A thin façade that other parts of the system call to interact with consensus without touching internal queues directly:All methods are non-blocking — they enqueue a
ConsensusCommand and return immediately.L1 block consensus (5 s trigger)
The Layer 1 block consensus is triggered every five seconds when transactions are available in the mempool.Own-round trigger fires
The
StateChannel schedules a TimeTrigger at a fixed interval (timeTriggerInterval). If pending transactions exist, an EventTrigger can also start a round immediately.Proposal exchange
The initiating facilitator picks its transactions, creates a candidate
Block, and sends a proposal to the other facilitators. Proposals are validated and merged.Signature collection
Facilitators sign the agreed block hash. A multi-signed
Signed[Block] is produced once the majority threshold is met.Gossip and L0 forwarding
The finalised block is gossiped across the cluster and forwarded to Layer 0 via
L0BlockOutputClient.sendL1Output().L0 snapshot consensus
The Global L0 consensus aggregates events from all metagraphs into aGlobalIncrementalSnapshot.
- Events enqueued — L1 blocks and state-channel snapshots arrive at the
L0Cell, which processes them with a hylomorphism (unfold → fold). - Facilitators selected — The
FacilitatorSelectorchooses a deterministic set of peers based on the current cluster membership and trust scores (EigenTrust + DATT + Self-Avoiding Walk). - Proposals created — Each facilitator builds a candidate
GlobalIncrementalSnapshotcontaining the events it collected. - Signatures collected — The five-phase FSM collects majority and binary signatures.
- Rewards distributed — After
Finished, the reward engine runs classic or delegated reward distribution depending on the currentEpochProgress.
Consensus round sequence diagram
Stall detection
A round is considered stalled when a phase has not advanced withindeclarationTimeout. The roundMonitor fiber (started per round, not per phase) handles this:
The monitor polls every 100 ms by default, backing off exponentially up to 1 000 ms when nothing changes.
