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.
| Machine | Topology |
|---|---|
Hydra.HeadLogic.State.Head.machine | Hydra.HeadLogic.State.Head.LifecycleTopology |
Hydra.HeadLogic.State.Deposits.machine | Crem.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.
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.
- Machine:
Hydra.HeadLogic.State.Head.machine. - Topology:
Hydra.HeadLogic.State.Head.LifecycleTopology.
↻ marks a transition that keeps the same state.
All inputs into the head logic
Client commands, network messages, and chain events.
- Machine:
Hydra.HeadLogic.Rules.Input.workflow. - Topology:
Hydra.HeadLogic.Rules.Input.InputTopology.
ReqTx: Receive a transaction
Check duplicates, outputs and deposits before selecting a snapshot or deciding whether to retry.
- Machine:
Hydra.HeadLogic.Rules.Network.ReqTx.workflow. - Topology:
Hydra.HeadLogic.Rules.Network.ReqTx.ReqTxTopology.
ReqDec: Receive a decommit request
Check competing incremental work and transaction validity before recording a pending decommit.
- Machine:
Hydra.HeadLogic.Rules.Network.ReqDec.workflow. - Topology:
Hydra.HeadLogic.Rules.Network.ReqDec.ReqDecTopology.
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.
- Machine:
Hydra.HeadLogic.Rules.Network.ReqSn.workflow. - Topology:
Hydra.HeadLogic.Rules.Network.ReqSn.ReqSnTopology. - Includes:
Hydra.HeadLogic.Rules.Network.ReqSn.validationWorkflow.
AckSn: Receive a snapshot acknowledgement
Collect a signature for the owned candidate; a complete certificate permits confirmation and continuation.
- Machine:
Hydra.HeadLogic.Rules.Network.AckSn.workflow. - Topology:
Hydra.HeadLogic.Rules.Network.AckSn.AckTopology.
Decommit rules
Check availability, ledger applicability, nonempty outputs and capacity.
- Machine:
Hydra.HeadLogic.Rules.Decommit.workflow. - Topology:
Hydra.HeadLogic.Rules.Decommit.AdmissionTopology.
Client decommit
Validate a client decommit before broadcasting it.
- Machine:
Hydra.HeadLogic.Rules.Client.Decommit.workflow. - Topology:
Hydra.HeadLogic.Rules.Client.Decommit.DecommitTopology.
Client fanout
Validate a selection, retain its matching intent and post the planned transaction.
- Machine:
Hydra.HeadLogic.Rules.Client.Fanout.workflow. - Topology:
Hydra.HeadLogic.Rules.Client.Fanout.FanoutTopology.
Side-load a snapshot
Check compatibility, verify a signed snapshot, adopt and clear local work.
- Machine:
Hydra.HeadLogic.Rules.Client.SideLoad.workflow. - Topology:
Hydra.HeadLogic.Rules.Client.SideLoad.SideLoadTopology.
Observe close or contest
Attempt adoption, record the observed chain fact even when verification fails, then consider contesting with a newer certificate.
- Machine:
Hydra.HeadLogic.Rules.Chain.Lifecycle.maybeContestWorkflow. - Topology:
Hydra.HeadLogic.Rules.Chain.Lifecycle.ObservationTopology.
Observe incremental settlement
Record the chain observation, reconcile a matching candidate and consider requesting the next snapshot.
- Machine:
Hydra.HeadLogic.Rules.Chain.Settlement.workflow. - Topology:
Hydra.HeadLogic.Rules.Chain.Settlement.SettlementTopology.
Snapshot progressing logic
Handles requesting, accepting, collecting and confirming snapshots.
- Machine:
Hydra.HeadLogic.State.Coordinated.Snapshots.machine. - Topology:
Hydra.HeadLogic.State.Coordinated.Snapshots.Topology.SnapshotTopology.
Transactions on the local ledger
Handles transactions and updates the ledger; also manages decommits.
- Machine:
Hydra.HeadLogic.State.Coordinated.Transactions.machine. - Topology:
Hydra.HeadLogic.State.Coordinated.Transactions.DecommitTopology.
Commits
Handles selection of commits for inclusion.
- Machine:
Hydra.HeadLogic.State.Coordinated.Commits.machine. - Topology:
Crem.Topology.TrivialTopology(in the machine signature).
Deposits
Handles recording a deposit, and their activation or expiry.
- Machine:
Hydra.HeadLogic.State.Deposits.machine. - Topology:
Crem.Topology.TrivialTopology(in the machine signature).

