Skip to main content

Head logic machines

This page is generated from the Haskell machine signatures. The overview diagrams show state ownership; arrows in the individual machine diagrams show permitted phase transitions.

A validation workflow returns a typed result to its caller for the current input; these results are not persisted state.

Node state updates​

The node owns the Head state, deposit registry, and observed chain time and synchronisation status. Deposits remain recoverable after their Head closes. Tick inputs trigger time-dependent work in the rules.

Updates: Hydra.HeadLogic.State.Node.step.

MachineTopology
Hydra.HeadLogic.State.Head.machineHydra.HeadLogic.State.Head.LifecycleTopology
Hydra.HeadLogic.State.Deposits.machineCrem.Topology.TrivialTopology (in the machine signature)

The node applies each state-change event to the relevant components and updates chain time and synchronisation directly in NodeState. Increment settlement reads the deposited UTxO before the registry marks it consumed and passes that value to the Head.

Off-chain state updates​

An open Head owns snapshots, local transactions and decommit reservations, and commit selection. Ordinary transaction commands go directly to the transaction machine.

Updates: Hydra.HeadLogic.State.Coordinated.advance.

MachineTopology
Hydra.HeadLogic.State.Coordinated.Snapshots.machineHydra.HeadLogic.State.Coordinated.Snapshots.Topology.SnapshotTopology
Hydra.HeadLogic.State.Coordinated.Transactions.machineHydra.HeadLogic.State.Coordinated.Transactions.DecommitTopology
Hydra.HeadLogic.State.Coordinated.Commits.machineCrem.Topology.TrivialTopology (in the machine signature)

Snapshot acceptance, confirmation and adoption update the snapshot first, reconcile local transactions and decommit reservations, then update commit selection. Settlement uses the same order. Retained events restore snapshot state without repeating live admission checks.

Head lifecycle​

This is the lifecycle of the Head protocol.

↻ marks a transition that keeps the same state.

All inputs into the head logic​

Client commands, network messages, and chain events.

ReqTx: Receive a transaction​

Check duplicates, outputs and deposits before selecting a snapshot or deciding whether to retry.

ReqDec: Receive a decommit request​

Check competing incremental work and transaction validity before recording a pending decommit.

ReqSn: Receive a snapshot request​

The ValidateRequest stage runs validationWorkflow to check the request, resolve incremental work, apply transactions and check commitment capacity. The remaining stages sign and acknowledge the snapshot, prune local transactions and retain the snapshot.

AckSn: Receive a snapshot acknowledgement​

Collect a signature for the owned candidate; a complete certificate permits confirmation and continuation.

Decommit rules​

Check availability, ledger applicability, nonempty outputs and capacity.

Client decommit​

Validate a client decommit before broadcasting it.

Client fanout​

Validate a selection, retain its matching intent and post the planned transaction.

Side-load a snapshot​

Check compatibility, verify a signed snapshot, adopt and clear local work.

Observe close or contest​

Attempt adoption, record the observed chain fact even when verification fails, then consider contesting with a newer certificate.

Observe incremental settlement​

Record the chain observation, reconcile a matching candidate and consider requesting the next snapshot.

Snapshot progressing logic​

Handles requesting, accepting, collecting and confirming snapshots.

Transactions on the local ledger​

Handles transactions and updates the ledger; also manages decommits.

Commits​

Handles selection of commits for inclusion.

Deposits​

Handles recording a deposit, and their activation or expiry.