hydra-node
Safe HaskellSafe-Inferred
LanguageGHC2021

Hydra.HeadLogic

Description

Implements the Head Protocol's state machine as pure functions in an event sourced manner.

More specifically, the update will handle Inputs (or rather "commands" in event sourcing speak) and convert that into a list of side-Effects and StateChanged events, which in turn are applied via aggregateNodeState into a single NodeState.

As the specification is using a more imperative way of specifying the protocol behavior, one would find the decision logic in update while state updates can be found in the corresponding applyEvent branch.

Synopsis

Documentation

data OnChainFanoutDatum Source #

Which on-chain head datum the next fanout step will be posted against: still Closed (no partial fanout has landed yet) or already FanoutProgress. A FinalPartialFanoutTx (which burns the head tokens) is only valid once the datum is DatumFanoutProgress.

update Source #

Arguments

:: IsChainState tx 
=> Environment 
-> Ledger tx 
-> UTCTime

Current system time.

-> NodeState tx

Current NodeState to validate the command against.

-> Input tx

Input to be processed.

-> Outcome tx 

Handles inputs and converts them into StateChanged events along with Effects, in case it is processed successfully. Later, the Node will apply the events via aggregateNodeState, resulting in a new NodeState.

aggregateNodeState :: IsChainState tx => NodeState tx -> StateChanged tx -> NodeState tx Source #

Reflect StateChanged events onto the NodeState aggregateNodeState. Events carrying a HeadId that does not match the current state are silently ignored, preventing cross-head state contamination during event replay. Events without a HeadId are always applied.

maxTxsPerSnapshot :: Int Source #

Maximum number of transaction ids per snapshot. This effectively limits our "block size" and ensures it does not grow arbitrarily with the backlog of pending transactions (localTxs). Only applied when requesting snapshots as a leader; followers accept larger requests, so this can change without a coordinated upgrade.

1000 was chosen from a sweep against 100/250 on sustained-load benchmarks (see hydra-clusterbenchBASELINES.md): per-round costs that scale with the backlog dominate at small caps (4.6-5.7x lower throughput at 100 with a deep backlog), while peak node memory was flat across the sweep.

aggregateState :: IsChainState tx => NodeState tx -> Outcome tx -> NodeState tx Source #

isLeader :: HeadParameters -> Party -> SnapshotNumber -> Bool Source #

onIdleClientInit :: Environment -> Outcome tx Source #

Client request to init the head. This leads to an init transaction on chain, containing the head parameters.

Transition: IdleStateIdleState

onIdleChainInitTx Source #

Arguments

:: Environment 
-> ChainStateType tx

New chain state.

-> HeadId 
-> HeadSeed 
-> HeadParameters 
-> [OnChainId] 
-> Outcome tx 

Observe an init transaction and initialize parameters in an OpenState.

Transition: IdleStateOpenState

onOpenClientNewTx Source #

Arguments

:: tx

The transaction to be submitted to the head.

-> Outcome tx 

Client request to ingest a new transaction into the head.

Transition: OpenStateOpenState

onOpenNetworkReqTx Source #

Arguments

:: IsTx tx 
=> Environment 
-> Ledger tx 
-> ChainSlot 
-> OpenState tx 
-> TTL 
-> PendingDeposits tx 
-> tx

The transaction to be submitted to the head.

-> Outcome tx 

Process a transaction request (ReqTx) from a party.

We apply this transaction to the seen utxo (ledger state). If not applicable, we wait and retry later. If it applies, this yields an updated seen ledger state. Then, we check whether we are the leader for the next snapshot and emit a snapshot request ReqSn including this transaction if needed.

Transition: OpenStateOpenState

selectNextIncrementalAction Source #

Arguments

:: IsTx tx 
=> PendingDeposits tx 
-> Maybe (TxIdType tx) 
-> Maybe tx

Pending decommit tx

-> Maybe (UTxOType tx)

utxoToCommit of the last relevant confirmed snapshot

-> (Maybe tx, Maybe (TxIdType tx)) 

The incremental action to put in the next ReqSn: a commit or a decommit, never both. A snapshot carrying both cannot be closed, since close and fanout express a single incremental action (setIncrementalActionMaybe).

A commit wins: its deposit expires on-chain, while a decommit only waits. This cannot starve the decommit, because selectNextDeposit refuses to start a *new* commit while a decommit is pending — only one already in flight can win, and that one stops being selected once it settles and leaves $sel:pendingDeposits:NodeInSync.

onOpenNetworkReqSn Source #

Arguments

:: IsTx tx 
=> Environment 
-> Ledger tx 
-> PendingDeposits tx 
-> ChainSlot 
-> OpenState tx 
-> Party

Party which sent the ReqSn.

-> SnapshotVersion

Requested snapshot version.

-> SnapshotNumber

Requested snapshot number.

-> [TxIdType tx]

List of transactions to snapshot.

-> Maybe tx

Optional decommit transaction of removing funds from the head.

-> Maybe (TxIdType tx)

Optional commit of additional funds into the head.

-> Outcome tx 

Process a snapshot request (ReqSn) from party.

This checks that s is the next snapshot number and that the party is responsible for leading that snapshot. Then, we potentially wait until the previous snapshot is confirmed (no snapshot is in flight), before we apply (or wait until applicable) the requested transactions to the last confirmed snapshot. Only then, we start tracking this new "seen" snapshot, compute a signature of it and send the corresponding AckSn to all parties. Finally, the pending transaction set gets pruned to only contain still applicable transactions.

Transition: OpenStateOpenState

onOpenNetworkAckSn Source #

Arguments

:: IsTx tx 
=> Environment 
-> PendingDeposits tx 
-> OpenState tx 
-> Party

Party which sent the AckSn.

-> Signature (Snapshot tx)

Signature from other party.

-> SnapshotNumber

Snapshot number of this AckSn.

-> Outcome tx 

Process a snapshot acknowledgement (AckSn) from a party.

We do require that the is from the last seen or next expected snapshot, and potentially wait wait for the corresponding ReqSn before proceeding. If the party hasn't sent us a signature yet, we store it. Once a signature from each party has been collected, we aggregate a multi-signature and verify it is correct. If everything is fine, the snapshot can be considered as the latest confirmed one. Similar to processing a ReqTx, we check whether we are leading the next snapshot and craft a corresponding ReqSn if needed.

Transition: OpenStateOpenState

onClientRecover :: IsTx tx => ChainSlot -> PendingDeposits tx -> TxIdType tx -> Outcome tx Source #

Client request to recover deposited UTxO.

Transition: OpenStateOpenState Client request to recover a deposit by posting a recover transaction on-chain. Works in any head state (Open, Closed, or Idle after fanout). Deposits from a previous head are never cleared from $sel:pendingDeposits:NodeInSync on fanout, so recovery remains available after a head closes. A new head only sees its own deposits via depositsForHead, so old deposits are never accidentally ingested into L2. On-chain, the deposit validator only enforces that the deadline has passed and that the recovered outputs match the originals — it does not require the head to still be active.

onOpenClientDecommit Source #

Arguments

:: IsTx tx 
=> HeadId 
-> Ledger tx 
-> ChainSlot 
-> CoordinatedHeadState tx 
-> tx

Decommit transaction.

-> Outcome tx 

Client request to decommit UTxO from the head.

Only possible if there is no decommit _in flight_ and if the tx applies cleanly to the local ledger state.

Transition: OpenStateOpenState

requireDecommitOutputs :: IsTx tx => HeadId -> UTxOType tx -> tx -> Outcome tx -> Outcome tx Source #

Reject a decommit that materializes no output. checkDecrement requires at least one, so such a decommit can never settle on-chain, and recording it would block every later snapshot (which cannot carry a different one).

Belongs after the applicability check at every call site: a transaction that does not apply is reported with the ledger's own, more precise reason.

onOpenNetworkReqDec :: IsTx tx => Environment -> Ledger tx -> TTL -> ChainSlot -> PendingDeposits tx -> OpenState tx -> tx -> Outcome tx Source #

Process the request ReqDec to decommit something from the Open head.

Transition: OpenStateOpenState

When node receives ReqDec network message it should: - Check there is no decommit in flight: - Alter it's state to record what is to be decommitted - Issue a server output DecommitRequested with the relevant utxo - Issue a ReqSn since all parties need to agree in order for decommit to be taken out of a Head. - Check if we are the leader

existingDeposit :: IsTx tx => PendingDeposits tx -> Maybe (TxIdType tx) -> Maybe (TxIdType tx, Deposit tx) Source #

The pending deposit that a local $sel:currentDepositTxId:CoordinatedHeadState still refers to, if any: the deposit must be registered in $sel:pendingDeposits:NodeInSync and not Expired.

Being registered and unexpired is what makes a recorded deposit id something the head may still act on, and nothing else should be treated as a commit in flight. Neither of the two ways a deposit stops being pending clears $sel:currentDepositTxId:CoordinatedHeadState: DepositExpired deliberately keeps the deposit in the map so it can still be recovered, and DepositRecovered only deletes the map entry. So a caller that reads $sel:currentDepositTxId:CoordinatedHeadState on its own can end up waiting on a deposit that is unclaimable, or already gone, and that wait never resolves.

onChainTick :: IsTx tx => Environment -> PendingDeposits tx -> UTCTime -> Outcome tx Source #

Process the chain (and time) advancing in any head state.

Transition: AnyStateAnyState

This is primarily used to track deposits status changes.

onOpenChainTick :: IsTx tx => Environment -> UTCTime -> PendingDeposits tx -> OpenState tx -> Outcome tx Source #

Process the chain (and time) advancing in an open head.

Transition: OpenStateOpenState

This is primarily used to track deposits and either drop them or request snapshots for inclusion.

maybeRequestSnapshotAfterVersionBump :: IsTx tx => HeadParameters -> Party -> SnapshotNumber -> Seq tx -> SnapshotVersion -> SnapshotVersion -> SeenSnapshot tx -> Maybe (TxIdType tx) -> Outcome tx Source #

If this node is the snapshot leader and there are pending local transactions, request the next snapshot with the bumped version after a commit or decommit finalises on-chain.

Guards: * Only fires when 'version /= newVersion' to avoid duplicate SnapshotRequestDecided events when multiple parties post the same on-chain tx and each posting produces a separate finalisation observation. * Skips when AckSns are already being collected (SeenSnapshot): the in-flight snapshot will complete and maybeRequestNextSnapshot will chain the next one with the bumped version. Firing here would use stale $sel:localTxs:CoordinatedHeadState and cause BadInputsUTxO on other parties. * Allows RequestedSnapshot: the in-flight ReqSn carries the old version and will be parked by waitOnSnapshotVersion until TTL drops it, so we re-request immediately with the new version to make progress without waiting for the stale request's retries to exhaust.

The optional StateChanged argument is forwarded into ReqSn: commit finalisation passes Nothing (deposit already included), while decommit finalisation passes the next queued deposit if one is pending.

onOpenChainIncrementTx Source #

Arguments

:: IsTx tx 
=> Environment 
-> OpenState tx 
-> ChainStateType tx 
-> SnapshotVersion

New open state version

-> TxIdType tx

Deposit TxId

-> Outcome tx 

Observe a increment transaction. If the outputs match the ones of the pending commit UTxO, then we consider the deposit/increment finalized, and remove the increment UTxO from $sel:pendingDeposits:NodeInSync from the local state.

Finally, if the client observing happens to be the leader, then a new ReqSn is broadcasted.

Transition: OpenStateOpenState

onOpenChainDecrementTx Source #

Arguments

:: IsTx tx 
=> Environment 
-> PendingDeposits tx 
-> OpenState tx 
-> ChainStateType tx 
-> SnapshotVersion

New open state version

-> UTxOType tx

Outputs removed by the decrement

-> Outcome tx 

Observe a decrement transaction. If the outputs match the ones of the pending decommit tx, then we consider the decommit finalized, and remove the decommit tx in flight.

Finally, if the client observing happens to be the leader, then a new ReqSn is broadcasted.

Transition: OpenStateOpenState

setExistingDeposit :: IsTx tx => PendingDeposits tx -> Maybe (TxIdType tx) -> Maybe (TxIdType tx) Source #

Validate whether a current deposit in the local state actually exists in the map of pending deposits.

This is typically used to confirm that a local deposit that is to be requested in ReqSn is indeed still pending and has not been processed or removed.

Expired deposits are dropped rather than carried: requesting one makes every receiving party hard-error with RequestedDepositExpired, so a deposit that somehow became unclaimable would stall snapshots for the whole head instead of just being abandoned by its depositor.

maybeRepostIncrementTx :: IsTx tx => HeadSeed -> HeadId -> HeadParameters -> PendingDeposits tx -> ConfirmedSnapshot tx -> Outcome tx Source #

On rollback, re-post the IncrementTx if there is a pending deposit whose confirmed snapshot contains a matching utxoToCommit. The rollback may have erased the original on-chain IncrementTx observation.

maybeRepostDecrementTx :: HeadSeed -> HeadId -> HeadParameters -> Maybe tx -> ConfirmedSnapshot tx -> Outcome tx Source #

On rollback, re-post the DecrementTx if there is a pending decommit whose confirmed snapshot contains a matching utxoToDecommit. The rollback may have erased the original on-chain DecrementTx observation.

onOpenClientClose :: OpenState tx -> Outcome tx Source #

Client request to close the head. This leads to a close transaction on chain using the latest confirmed snaphshot of the OpenState.

Transition: OpenStateOpenState

onOpenChainCloseTx Source #

Arguments

:: IsTx tx 
=> OpenState tx 
-> ChainStateType tx

New chain state.

-> SnapshotNumber

Closed snapshot number.

-> UTCTime

Contestation deadline.

-> Outcome tx 

Observe a close transaction. If the closed snapshot number is smaller than our last confirmed, we post a contest transaction. Also, we do schedule a notification for clients to fanout at the deadline.

Transition: OpenStateClosedState

onOpenClientSideLoadSnapshot :: IsTx tx => OpenState tx -> ConfirmedSnapshot tx -> Outcome tx Source #

Client request to side load confirmed snapshot.

Note this is not covered by the spec as it is not reachable from an organic use of the protocol.

It must not have any effects outside of a neutral modification of the state to: * something it was before (in the case of the initial snapshot). * something it would be using side communication (in the case of a confirmed snapshot).

Besides the above, it is expected to work very much like the confirmed snapshot.

Transition: OpenStateOpenState

onClosedChainContestTx Source #

Arguments

:: IsTx tx 
=> ClosedState tx 
-> ChainStateType tx

New chain state.

-> SnapshotNumber 
-> UTCTime

Contestation deadline.

-> Outcome tx 

Observe a contest transaction. If the contested snapshot number is smaller than our last confirmed snapshot, we post a contest transaction.

Transition: ClosedStateClosedState

onClosedClientFanout :: IsTx tx => ClosedState tx -> Outcome tx Source #

Client request to fanout the whole closed head automatically. Emits a FanoutTx; the chain layer either lands a single full fanout (→ IdleState) or falls back to dynamically-chunked partial fanouts. The first observed partial fanout transitions the head to PartialFanout in AutoDrain mode, which keeps draining the rest automatically until the final (burning) step.

This node becomes the fanout driver: it transitions into PartialFanout in AutoDrain mode so that, as the chain layer chunks the fanout, this node auto-continues to completion. Other parties that merely observe the resulting partial fanout do not auto-drive (see onClosedChainPartialFanoutTx).

Transition: ClosedStatePartialFanoutState (then → IdleState once the final fanout is observed).

computeFullFanoutUTxO :: IsTx tx => ClosedState tx -> UTxOType tx Source #

Compute the full UTxO set to be fanned out, combining snapshot utxo with utxoToCommit/utxoToDecommit based on version.

mkFullFanoutTx :: IsTx tx => ConfirmedSnapshot tx -> SnapshotVersion -> HeadSeed -> UTCTime -> PostChainTx tx Source #

Build the full automatic FanoutTx from a confirmed snapshot at the given on-chain version. Shared by onClosedClientFanout and the rollback re-post in FanoutProgress (repostFanoutStep).

effectiveCommitDecommit Source #

Arguments

:: SnapshotVersion

On-chain version

-> SnapshotVersion

Snapshot version

-> Maybe (UTxOType tx)

Pending commit

-> Maybe (UTxOType tx)

Pending decommit

-> (Maybe (UTxOType tx), Maybe (UTxOType tx)) 

Given the on-chain version and a snapshot's own version, decide which of a pending commit / decommit is still to be distributed on fanout. When the increment has landed on chain (versions match) the commit was already applied (drop it) while a pending decommit still applies; otherwise the commit still applies and the decommit was already paid out. Centralises the version check shared by mkFullFanoutTx and fanoutUTxOFromSnapshot.

onClosedClientPartialFanout :: IsTx tx => ClosedState tx -> UTxOType tx -> Outcome tx Source #

Client request to fan out a user-selected subset of a freshly closed head. Validates the selection is a non-empty sub-multiset (by content) of the fan-out-able UTxO, transitions the head into PartialFanout (in DistributingSelection mode) and emits the first PartialFanoutTx.

Transition: ClosedStatePartialFanoutState

nullOutputs :: IsTx tx => UTxOType tx -> Bool Source #

Whether a UTxO has no outputs.

isSubMultisetOf :: IsTx tx => UTxOType tx -> UTxOType tx -> Bool Source #

Whether the outputs of sub are a sub-multiset (by content) of sup. This mirrors how partial fanout tracks distributed UTxO by content rather than by TxIn, so a user-provided selection is validated against what is actually still in the head.

sameOutputs :: IsTx tx => UTxOType tx -> UTxOType tx -> Bool Source #

Whether two UTxO sets have the same outputs (by content, as a multiset). The a == b short-circuit avoids the O(n²) multiset comparison in the common case where both arguments are the same tracked set (e.g. the auto-drain sameOutputs remaining remaining check on every observed chunk), which is exactly the large-UTxO heads partial fanout targets.

emitPartialFanoutStep Source #

Arguments

:: IsTx tx 
=> UTxOType tx

Chunk source for the next step (the user selection remainder, or the whole remaining set when auto-draining)

-> UTxOType tx

The head's full remaining set

-> OnChainFanoutDatum

The on-chain datum the step is posted against. DatumClosed only for the very first step from a Closed head, where FinalPartialFanoutTx is not yet possible.

-> ConfirmedSnapshot tx 
-> SnapshotVersion 
-> HeadSeed 
-> UTCTime 
-> Outcome tx 

Emit the next partial fanout on-chain effect.

  • When the chunk source target covers the entire remaining set and the head is already in FanoutProgress on chain, emit the final FinalPartialFanoutTx that distributes the rest and burns the head tokens.
  • Otherwise emit a non-final PartialFanoutTx drawing from target. The chain layer sizes the actual on-chain chunk dynamically.

onPartialFanoutClientPartialFanout :: IsTx tx => PartialFanoutState tx -> UTxOType tx -> Outcome tx Source #

Client request to continue a selective partial fanout. Validates the selection against the current StateChanged, records it as the active selection and emits the next step.

Transition: PartialFanoutStatePartialFanoutState

onChainFanoutDatum :: IsTx tx => UTxOType tx -> OnChainFanoutDatum Source #

The on-chain datum implied by how much has been distributed so far: still Closed while nothing has landed, FanoutProgress once some has.

onClosedChainFanoutTx Source #

Arguments

:: ClosedState tx 
-> ChainStateType tx

New chain state

-> UTxOType tx 
-> Outcome tx 

Observe a (full or final) fanout transaction, finalizing the head.

Transition: ClosedStateIdleState

onClosedChainPartialFanoutTx Source #

Arguments

:: IsTx tx 
=> ClosedState tx 
-> ChainStateType tx

New chain state

-> UTxOType tx

UTxO distributed in this partial fanout (keyed by new TxIn; values preserve duplicates)

-> Outcome tx 

Observe a partial fanout while this node is still Closed — i.e. a partial fanout this node did NOT initiate (another party did). The fanout driver moved to PartialFanout when it issued its Fanout/PartialFanout command, so this handler is only reached by passive observers.

The observer transitions into PartialFanout in AwaitingSelection mode and does not auto-drive the rest: only the driver advances the fanout. This is what makes selective partial fanout work in a multi-party head — observers must not steamroll the remaining UTxO the driver deliberately left.

Transition: ClosedStatePartialFanoutState

removeDistributedOutputs :: IsTx tx => [TxOutType tx] -> UTxOType tx -> UTxOType tx Source #

onPartialFanoutChainPartialFanoutTx Source #

Arguments

:: IsTx tx 
=> PartialFanoutState tx 
-> ChainStateType tx

New chain state

-> UTxOType tx

UTxO distributed in this partial fanout

-> Outcome tx 

Observe a partial fanout while in PartialFanout. Updates the remaining and distributed sets and, depending on the current FanoutMode, either continues draining automatically (or within the active selection) or waits for the next PartialFanout command.

Transition: PartialFanoutStatePartialFanoutState

onPartialFanoutChainFanoutTx Source #

Arguments

:: IsTx tx 
=> PartialFanoutState tx 
-> ChainStateType tx

New chain state

-> UTxOType tx 
-> Outcome tx 

Observe the final fanout while in PartialFanout, finalizing the head with the accumulated distributed outputs plus this final batch.

Transition: PartialFanoutStateIdleState

fanoutUTxOFromSnapshot :: IsTx tx => ConfirmedSnapshot tx -> SnapshotVersion -> UTxOType tx Source #

The fan-out-able UTxO of a confirmed snapshot at the given on-chain version: the snapshot UTxO plus a pending commit (if the increment landed on chain) or a pending decommit (if the decrement has not landed yet).

closedToFanoutProgress :: ClosedState tx -> ChainStateType tx -> UTxOType tx -> UTxOType tx -> FanoutMode tx -> HeadState tx Source #

Build the PartialFanout (FanoutProgress) head state from a closed head, carrying over the snapshot/parameters and using the given chain state, remaining and distributed UTxO and fanout StateChanged. Shared by the three Closed → FanoutProgress transitions in aggregateNodeState.

fanoutProgressToClosed :: PartialFanoutState tx -> ClosedState tx Source #

Rebuild the ClosedState from a PartialFanoutState when reverting an optimistic ClosedPartialFanout transition (see HeadFanoutReverted). $sel:readyToFanoutSent:ClosedState is restored to True because a fanout is only reachable after the head was announced ReadyToFanout.

isFanoutPostChainTx :: PostChainTx tx -> Bool Source #

Whether a PostChainTx is one of the fanout-posting transactions (used to scope the optimistic-fanout revert to genuine fanout post failures).

repostFanoutStep :: IsTx tx => PartialFanoutState tx -> Outcome tx Source #

Re-post the next fanout step after a chain rollback while in FanoutProgress, so the fanout resumes instead of stalling with the rolled-back transaction gone and nothing re-posted. This mirrors the IncrementDecrement re-post on rollback (maybeRepostIncrementTx maybeRepostDecrementTx): it uses the current best-effort bookkeeping and, like those re-posts, assumes the rolled-back transactions re-appear — it does not attempt to reconstruct fanout progress across a divergent rollback (the same limitation the general rollback handling has).

distributedOutputs being empty means no partial fanout has landed on chain yet (the head datum is still Closed); otherwise the datum is FanoutProgress and a FinalPartialFanoutTx is possible.

handleOutOfSync Source #

Arguments

:: IsChainState tx 
=> Environment 
-> UTCTime

Current system time

-> ChainPointType tx

Latest Chain point observed

-> UTCTime

Latest Chain point time representation observed

-> SyncedStatus 
-> Outcome tx 

Detect our view of the chain going out of sync and issue a NodeUnsynced event when this is the case.

nextActiveDepositId :: IsTx tx => PendingDeposits tx -> Maybe (TxIdType tx) Source #

Find the oldest non-empty active deposit, if any. Deposits are selected in FIFO order by their StateChanged timestamp. This mirrors the selection logic in withNextActive used by onOpenChainTick.

selectNextDeposit Source #

Arguments

:: IsTx tx 
=> PendingDeposits tx 
-> Maybe (TxIdType tx) 
-> Maybe tx

Pending decommit tx

-> Maybe (UTxOType tx)

utxoToCommit of the last relevant confirmed snapshot

-> Maybe (TxIdType tx) 

Select the deposit to include in the next snapshot.

Prefers a deposit already tracked in $sel:currentDepositTxId:CoordinatedHeadState (if still pending). Falls back to the oldest active deposit from $sel:pendingDeposits:NodeInSync, but only when neither a decommit is pending nor the last confirmed snapshot already included a deposit (to avoid double-posting IncrementTx before CommitFinalized removes the deposit).

updateCatchingUpHead Source #

Arguments

:: IsChainState tx 
=> Environment 
-> Ledger tx 
-> UTCTime

Current system time.

-> ChainPointTime

Last known chain point time

-> PendingDeposits tx 
-> HeadState tx

Current HeadState to validate the command against.

-> Input tx

Input to be processed.

-> SyncedStatus 
-> Outcome tx 

updateInSyncHead Source #

Arguments

:: IsChainState tx 
=> Environment 
-> Ledger tx 
-> UTCTime

Current system time.

-> ChainPointTime

Last known chain point time

-> PendingDeposits tx 
-> HeadState tx

Current HeadState to validate the command against.

-> Input tx

Input to be processed.

-> SyncedStatus 
-> Outcome tx 

handleChainInput Source #

Arguments

:: IsChainState tx 
=> Environment 
-> Ledger tx 
-> UTCTime

Current system time.

-> ChainPointTime

Last known chain point time

-> PendingDeposits tx 
-> HeadState tx

Current HeadState to validate the command against.

-> Input tx

Input to be processed.

-> SyncedStatus 
-> Outcome tx 

handleClientInput Source #

Arguments

:: IsChainState tx 
=> Environment 
-> Ledger tx 
-> ChainPointTime

Last known chain point time

-> PendingDeposits tx 
-> HeadState tx

Current NodeState to validate the command against.

-> Input tx

Input to be processed.

-> Outcome tx 

handleNetworkInput Source #

Arguments

:: IsChainState tx 
=> Environment 
-> Ledger tx 
-> ChainPointTime

Last known chain point time

-> PendingDeposits tx 
-> HeadState tx

Current NodeState to validate the command against.

-> Input tx

Input to be processed.

-> Outcome tx 

headIdOf :: HeadState tx -> Maybe HeadId Source #

Extract the HeadId from the current HeadState, if any.

eventHeadId :: StateChanged tx -> Maybe HeadId Source #

Extract the HeadId from a StateChanged event, if the event carries one. Events that do not carry a HeadId always pass through aggregateNodeState unchanged.

applyEvent :: IsChainState tx => HeadState tx -> StateChanged tx -> HeadState tx Source #

data Input tx Source #

Inputs that are processed by the head logic (the "core"). Corresponding to each of the "shell" layers, we distinguish between inputs from the client, the network and the chain.

Constructors

ClientInput

Input received from clients via the Hydra.API.

Fields

NetworkInput

Input received from peers via a Hydra.Network.

  • $sel:ttl:ClientInput is a simple counter that's decreased every time the event is reenqueued due to a wait. It's default value is defaultTTL
ChainInput

Input received from the chain via a Hydra.Chain.

Fields

Instances

Instances details
IsChainState tx => FromJSON (Input tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Input

Methods

parseJSON :: Value -> Parser (Input tx)

parseJSONList :: Value -> Parser [Input tx]

omittedField :: Maybe (Input tx)

IsChainState tx => ToJSON (Input tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Input

Methods

toJSON :: Input tx -> Value

toEncoding :: Input tx -> Encoding

toJSONList :: [Input tx] -> Value

toEncodingList :: [Input tx] -> Encoding

omitField :: Input tx -> Bool

Generic (Input tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Input

Associated Types

type Rep (Input tx) :: Type -> Type Source #

Methods

from :: Input tx -> Rep (Input tx) x Source #

to :: Rep (Input tx) x -> Input tx Source #

IsChainState tx => Show (Input tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Input

Methods

showsPrec :: Int -> Input tx -> ShowS Source #

show :: Input tx -> String Source #

showList :: [Input tx] -> ShowS Source #

IsChainState tx => Eq (Input tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Input

Methods

(==) :: Input tx -> Input tx -> Bool Source #

(/=) :: Input tx -> Input tx -> Bool Source #

type Rep (Input tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Input

type Rep (Input tx) = D1 ('MetaData "Input" "Hydra.HeadLogic.Input" "hydra-node-2.3.0-1cgalYNmLJQC1YXlYVq7mp" 'False) (C1 ('MetaCons "ClientInput" 'PrefixI 'True) (S1 ('MetaSel ('Just "clientInput") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (ClientInput tx))) :+: (C1 ('MetaCons "NetworkInput" 'PrefixI 'True) (S1 ('MetaSel ('Just "ttl") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 TTL) :*: S1 ('MetaSel ('Just "networkEvent") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (NetworkEvent (Message tx)))) :+: C1 ('MetaCons "ChainInput" 'PrefixI 'True) (S1 ('MetaSel ('Just "chainEvent") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (ChainEvent tx)))))

data SideLoadRequirementFailure tx Source #

Constructors

SideLoadInitialSnapshotMismatch 
SideLoadSnNumberInvalid 

Fields

SideLoadSvNumberInvalid 

Fields

SideLoadUTxOToCommitInvalid 

Fields

SideLoadDepositTxIdInvalid

The side-loaded snapshot commits the same UTxO as the confirmed one, but from a different deposit. Since the deposit is what identifies a pending commit, this is a distinct disagreement from SideLoadUTxOToCommitInvalid, whose payload would show two identical UTxO sets here.

Fields

SideLoadUTxOToDecommitInvalid 

Fields

SideLoadInvalidMultisignature 

Fields

Instances

Instances details
(FromJSON (UTxOType tx), FromJSON (TxIdType tx)) => FromJSON (SideLoadRequirementFailure tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

(ToJSON (UTxOType tx), ToJSON (TxIdType tx)) => ToJSON (SideLoadRequirementFailure tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

Generic (SideLoadRequirementFailure tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

Associated Types

type Rep (SideLoadRequirementFailure tx) :: Type -> Type Source #

(Show (UTxOType tx), Show (TxIdType tx)) => Show (SideLoadRequirementFailure tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

IsTx tx => FromCBOR (SideLoadRequirementFailure tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

IsTx tx => ToCBOR (SideLoadRequirementFailure tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

Methods

toCBOR :: SideLoadRequirementFailure tx -> Encoding

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy (SideLoadRequirementFailure tx) -> Size

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [SideLoadRequirementFailure tx] -> Size

(Eq (UTxOType tx), Eq (TxIdType tx)) => Eq (SideLoadRequirementFailure tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

type Rep (SideLoadRequirementFailure tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

type Rep (SideLoadRequirementFailure tx) = D1 ('MetaData "SideLoadRequirementFailure" "Hydra.HeadLogic.Error" "hydra-node-2.3.0-1cgalYNmLJQC1YXlYVq7mp" 'False) ((C1 ('MetaCons "SideLoadInitialSnapshotMismatch" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "SideLoadSnNumberInvalid" 'PrefixI 'True) (S1 ('MetaSel ('Just "requestedSn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotNumber) :*: S1 ('MetaSel ('Just "lastSeenSn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotNumber)) :+: C1 ('MetaCons "SideLoadSvNumberInvalid" 'PrefixI 'True) (S1 ('MetaSel ('Just "requestedSv") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotVersion) :*: S1 ('MetaSel ('Just "lastSeenSv") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotVersion)))) :+: ((C1 ('MetaCons "SideLoadUTxOToCommitInvalid" 'PrefixI 'True) (S1 ('MetaSel ('Just "requestedSc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe (UTxOType tx))) :*: S1 ('MetaSel ('Just "lastSeenSc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe (UTxOType tx)))) :+: C1 ('MetaCons "SideLoadDepositTxIdInvalid" 'PrefixI 'True) (S1 ('MetaSel ('Just "requestedDeposit") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe (TxIdType tx))) :*: S1 ('MetaSel ('Just "lastSeenDeposit") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe (TxIdType tx))))) :+: (C1 ('MetaCons "SideLoadUTxOToDecommitInvalid" 'PrefixI 'True) (S1 ('MetaSel ('Just "requestedSd") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe (UTxOType tx))) :*: S1 ('MetaSel ('Just "lastSeenSd") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe (UTxOType tx)))) :+: C1 ('MetaCons "SideLoadInvalidMultisignature" 'PrefixI 'True) (S1 ('MetaSel ('Just "multisig") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "vkeys") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [VerificationKey HydraKey])))))

data LogicError tx Source #

Instances

Instances details
(ToJSON (HeadState tx), ToJSON (Input tx), ToJSON (RequirementFailure tx), ToJSON (SideLoadRequirementFailure tx)) => ToJSON (LogicError tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

Methods

toJSON :: LogicError tx -> Value

toEncoding :: LogicError tx -> Encoding

toJSONList :: [LogicError tx] -> Value

toEncodingList :: [LogicError tx] -> Encoding

omitField :: LogicError tx -> Bool

Generic (LogicError tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

Associated Types

type Rep (LogicError tx) :: Type -> Type Source #

Methods

from :: LogicError tx -> Rep (LogicError tx) x Source #

to :: Rep (LogicError tx) x -> LogicError tx Source #

(Show (HeadState tx), Show (Input tx), Show (RequirementFailure tx), Show (SideLoadRequirementFailure tx)) => Show (LogicError tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

(Eq (HeadState tx), Eq (Input tx), Eq (RequirementFailure tx), Eq (SideLoadRequirementFailure tx)) => Eq (LogicError tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

Methods

(==) :: LogicError tx -> LogicError tx -> Bool Source #

(/=) :: LogicError tx -> LogicError tx -> Bool Source #

type Rep (LogicError tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

type Rep (LogicError tx) = D1 ('MetaData "LogicError" "Hydra.HeadLogic.Error" "hydra-node-2.3.0-1cgalYNmLJQC1YXlYVq7mp" 'False) ((C1 ('MetaCons "UnhandledInput" 'PrefixI 'True) (S1 ('MetaSel ('Just "input") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Input tx)) :*: S1 ('MetaSel ('Just "currentHeadState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (HeadState tx))) :+: C1 ('MetaCons "RequireFailed" 'PrefixI 'True) (S1 ('MetaSel ('Just "requirementFailure") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (RequirementFailure tx)))) :+: (C1 ('MetaCons "AssertionFailed" 'PrefixI 'True) (S1 ('MetaSel ('Just "message") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)) :+: (C1 ('MetaCons "NotOurHead" 'PrefixI 'True) (S1 ('MetaSel ('Just "ourHeadId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadId) :*: S1 ('MetaSel ('Just "otherHeadId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadId)) :+: C1 ('MetaCons "SideLoadSnapshotFailed" 'PrefixI 'True) (S1 ('MetaSel ('Just "sideLoadRequirementFailure") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (SideLoadRequirementFailure tx))))))

data RequirementFailure tx Source #

Constructors

ReqSnNumberInvalid 

Fields

ReqSvNumberInvalid 

Fields

ReqSnNotLeader 

Fields

ReqSnDecommitNotSettled 
ReqSnCommitNotSettled 
ReqSnBothCommitAndDecommit

A snapshot may settle a commit or a decommit, never both: close and fanout carry a single incremental action, so a snapshot with both would leave the head unclosable.

Fields

ReqSnDecommitNoOutputs

A decommit that materializes no output cannot be settled: the decrement validator requires at least one decommit output.

Fields

InvalidMultisignature 

Fields

SnapshotAlreadySigned 

Fields

AckSnNumberInvalid 

Fields

SnapshotDoesNotApply 

Fields

NoMatchingDeposit 
RequestedDepositExpired 

Fields

RequestedDepositNotFoundLocally 

Fields

ReqSnUTxOSetTooLarge 

Fields

Instances

Instances details
ToJSON (TxIdType tx) => ToJSON (RequirementFailure tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

Generic (RequirementFailure tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

Associated Types

type Rep (RequirementFailure tx) :: Type -> Type Source #

Show (TxIdType tx) => Show (RequirementFailure tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

IsTx tx => FromCBOR (RequirementFailure tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

Methods

fromCBOR :: Decoder s (RequirementFailure tx)

label :: Proxy (RequirementFailure tx) -> Text

IsTx tx => ToCBOR (RequirementFailure tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

Methods

toCBOR :: RequirementFailure tx -> Encoding

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy (RequirementFailure tx) -> Size

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [RequirementFailure tx] -> Size

Eq (TxIdType tx) => Eq (RequirementFailure tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

type Rep (RequirementFailure tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Error

type Rep (RequirementFailure tx) = D1 ('MetaData "RequirementFailure" "Hydra.HeadLogic.Error" "hydra-node-2.3.0-1cgalYNmLJQC1YXlYVq7mp" 'False) (((C1 ('MetaCons "ReqSnNumberInvalid" 'PrefixI 'True) (S1 ('MetaSel ('Just "requestedSn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotNumber) :*: S1 ('MetaSel ('Just "lastSeenSn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotNumber)) :+: (C1 ('MetaCons "ReqSvNumberInvalid" 'PrefixI 'True) (S1 ('MetaSel ('Just "requestedSv") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotVersion) :*: S1 ('MetaSel ('Just "lastSeenSv") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotVersion)) :+: C1 ('MetaCons "ReqSnNotLeader" 'PrefixI 'True) (S1 ('MetaSel ('Just "requestedSn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotNumber) :*: S1 ('MetaSel ('Just "leader") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Party)))) :+: ((C1 ('MetaCons "ReqSnDecommitNotSettled" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ReqSnCommitNotSettled" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ReqSnBothCommitAndDecommit" 'PrefixI 'True) (S1 ('MetaSel ('Just "depositTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (TxIdType tx)) :*: S1 ('MetaSel ('Just "decommitTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (TxIdType tx))) :+: C1 ('MetaCons "ReqSnDecommitNoOutputs" 'PrefixI 'True) (S1 ('MetaSel ('Just "decommitTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (TxIdType tx)))))) :+: (((C1 ('MetaCons "InvalidMultisignature" 'PrefixI 'True) (S1 ('MetaSel ('Just "multisig") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "vkeys") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [VerificationKey HydraKey])) :+: C1 ('MetaCons "SnapshotAlreadySigned" 'PrefixI 'True) (S1 ('MetaSel ('Just "knownSignatures") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [Party]) :*: S1 ('MetaSel ('Just "receivedSignature") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Party))) :+: (C1 ('MetaCons "AckSnNumberInvalid" 'PrefixI 'True) (S1 ('MetaSel ('Just "requestedSn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotNumber) :*: S1 ('MetaSel ('Just "lastSeenSn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotNumber)) :+: C1 ('MetaCons "SnapshotDoesNotApply" 'PrefixI 'True) (S1 ('MetaSel ('Just "requestedSn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotNumber) :*: (S1 ('MetaSel ('Just "txid") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (TxIdType tx)) :*: S1 ('MetaSel ('Just "error") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ValidationError))))) :+: ((C1 ('MetaCons "NoMatchingDeposit" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "RequestedDepositExpired" 'PrefixI 'True) (S1 ('MetaSel ('Just "depositTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (TxIdType tx)))) :+: (C1 ('MetaCons "RequestedDepositNotFoundLocally" 'PrefixI 'True) (S1 ('MetaSel ('Just "depositTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (TxIdType tx))) :+: C1 ('MetaCons "ReqSnUTxOSetTooLarge" 'PrefixI 'True) (S1 ('MetaSel ('Just "utxoCount") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "maxAllowed") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int))))))

data CoordinatedHeadState tx Source #

Off-chain state of the Coordinated Head protocol.

Constructors

CoordinatedHeadState 

Fields

  • localUTxO :: UTxOType tx

    The latest UTxO resulting from applying $sel:localTxs:CoordinatedHeadState to CoordinatedHeadState. Spec: L̂

  • localTxs :: Seq tx

    Sequence of transactions applied locally and pending inclusion in a snapshot. Ordering is important as transactions are added in order of application. Spec: T̂

  • allTxs :: !(Map (TxIdType tx) tx)

    Map containing all the transactions ever seen by this node and not yet included in a snapshot. Spec: Tall

  • confirmedSnapshot :: ConfirmedSnapshot tx

    The latest confirmed snapshot. Spec: S̅

  • seenSnapshot :: SeenSnapshot tx

    Last seen snapshot and signatures accumulator. Spec: Û, ŝ and Σ̂

  • currentDepositTxId :: Maybe (TxIdType tx)

    Current/next deposit to incrementally commit. Spec: Uα TODO: update in spec: Uα -> tx^#α

  • decommitTx :: Maybe tx

    Pending decommit transaction. Spec: txω

  • version :: SnapshotVersion

    Last open state version as observed on chain. Spec: ̂v

Instances

Instances details
IsTx tx => FromJSON (CoordinatedHeadState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

parseJSON :: Value -> Parser (CoordinatedHeadState tx)

parseJSONList :: Value -> Parser [CoordinatedHeadState tx]

omittedField :: Maybe (CoordinatedHeadState tx)

IsTx tx => ToJSON (CoordinatedHeadState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Generic (CoordinatedHeadState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Associated Types

type Rep (CoordinatedHeadState tx) :: Type -> Type Source #

IsTx tx => Show (CoordinatedHeadState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

IsTx tx => FromCBOR (CoordinatedHeadState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

fromCBOR :: Decoder s (CoordinatedHeadState tx)

label :: Proxy (CoordinatedHeadState tx) -> Text

IsTx tx => ToCBOR (CoordinatedHeadState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

toCBOR :: CoordinatedHeadState tx -> Encoding

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy (CoordinatedHeadState tx) -> Size

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [CoordinatedHeadState tx] -> Size

IsTx tx => Eq (CoordinatedHeadState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

type Rep (CoordinatedHeadState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

type Rep (CoordinatedHeadState tx) = D1 ('MetaData "CoordinatedHeadState" "Hydra.HeadLogic.State" "hydra-node-2.3.0-1cgalYNmLJQC1YXlYVq7mp" 'False) (C1 ('MetaCons "CoordinatedHeadState" 'PrefixI 'True) (((S1 ('MetaSel ('Just "localUTxO") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (UTxOType tx)) :*: S1 ('MetaSel ('Just "localTxs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Seq tx))) :*: (S1 ('MetaSel ('Just "allTxs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Map (TxIdType tx) tx)) :*: S1 ('MetaSel ('Just "confirmedSnapshot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (ConfirmedSnapshot tx)))) :*: ((S1 ('MetaSel ('Just "seenSnapshot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (SeenSnapshot tx)) :*: S1 ('MetaSel ('Just "currentDepositTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe (TxIdType tx)))) :*: (S1 ('MetaSel ('Just "decommitTx") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe tx)) :*: S1 ('MetaSel ('Just "version") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotVersion)))))

data HeadState tx Source #

The main state of the Hydra protocol state machine. It holds both, the overall protocol state, but also the off-chain CoordinatedHeadState.

Each of the sub-types (OpenState, etc.) contain a black-box IdleState corresponding to the ChainEvent that has been observed leading to the state.

Note that rollbacks are currently not fully handled in the head logic and only this internal chain state gets replaced with the "rolled back to" version.

TODO: chainState would actually not be needed in the HeadState anymore as we do not persist the HeadState and not access it in the HeadLogic either.

Constructors

Idle (IdleState tx) 
Open (OpenState tx) 
Closed (ClosedState tx) 
FanoutProgress (PartialFanoutState tx)

A closed head whose UTxO is being fanned out across multiple transactions (on-chain in the FanoutProgress state). Reached from Closed once the first partial fanout is observed.

Instances

Instances details
(IsTx tx, FromJSON (ChainStateType tx)) => FromJSON (HeadState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

parseJSON :: Value -> Parser (HeadState tx)

parseJSONList :: Value -> Parser [HeadState tx]

omittedField :: Maybe (HeadState tx)

(IsTx tx, ToJSON (ChainStateType tx)) => ToJSON (HeadState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

toJSON :: HeadState tx -> Value

toEncoding :: HeadState tx -> Encoding

toJSONList :: [HeadState tx] -> Value

toEncodingList :: [HeadState tx] -> Encoding

omitField :: HeadState tx -> Bool

Generic (HeadState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Associated Types

type Rep (HeadState tx) :: Type -> Type Source #

Methods

from :: HeadState tx -> Rep (HeadState tx) x Source #

to :: Rep (HeadState tx) x -> HeadState tx Source #

(IsTx tx, Show (ChainStateType tx)) => Show (HeadState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

IsChainState tx => FromCBOR (HeadState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

fromCBOR :: Decoder s (HeadState tx)

label :: Proxy (HeadState tx) -> Text

IsChainState tx => ToCBOR (HeadState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

toCBOR :: HeadState tx -> Encoding

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy (HeadState tx) -> Size

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [HeadState tx] -> Size

(IsTx tx, Eq (ChainStateType tx)) => Eq (HeadState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

(==) :: HeadState tx -> HeadState tx -> Bool Source #

(/=) :: HeadState tx -> HeadState tx -> Bool Source #

type Rep (HeadState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

data OpenState tx Source #

An Open head with a CoordinatedHeadState tracking off-chain transactions.

Constructors

OpenState 

Fields

Instances

Instances details
(IsTx tx, FromJSON (ChainStateType tx)) => FromJSON (OpenState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

parseJSON :: Value -> Parser (OpenState tx)

parseJSONList :: Value -> Parser [OpenState tx]

omittedField :: Maybe (OpenState tx)

(IsTx tx, ToJSON (ChainStateType tx)) => ToJSON (OpenState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

toJSON :: OpenState tx -> Value

toEncoding :: OpenState tx -> Encoding

toJSONList :: [OpenState tx] -> Value

toEncodingList :: [OpenState tx] -> Encoding

omitField :: OpenState tx -> Bool

Generic (OpenState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Associated Types

type Rep (OpenState tx) :: Type -> Type Source #

Methods

from :: OpenState tx -> Rep (OpenState tx) x Source #

to :: Rep (OpenState tx) x -> OpenState tx Source #

(IsTx tx, Show (ChainStateType tx)) => Show (OpenState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

IsChainState tx => FromCBOR (OpenState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

fromCBOR :: Decoder s (OpenState tx)

label :: Proxy (OpenState tx) -> Text

IsChainState tx => ToCBOR (OpenState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

toCBOR :: OpenState tx -> Encoding

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy (OpenState tx) -> Size

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [OpenState tx] -> Size

(IsTx tx, Eq (ChainStateType tx)) => Eq (OpenState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

(==) :: OpenState tx -> OpenState tx -> Bool Source #

(/=) :: OpenState tx -> OpenState tx -> Bool Source #

type Rep (OpenState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

type Rep (OpenState tx) = D1 ('MetaData "OpenState" "Hydra.HeadLogic.State" "hydra-node-2.3.0-1cgalYNmLJQC1YXlYVq7mp" 'False) (C1 ('MetaCons "OpenState" 'PrefixI 'True) ((S1 ('MetaSel ('Just "parameters") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadParameters) :*: S1 ('MetaSel ('Just "coordinatedHeadState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (CoordinatedHeadState tx))) :*: (S1 ('MetaSel ('Just "chainState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (ChainStateType tx)) :*: (S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadId) :*: S1 ('MetaSel ('Just "headSeed") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadSeed)))))

data SeenSnapshot tx Source #

Data structure to help in tracking whether we have seen or requested a ReqSn already and if seen, the signatures we collected already.

Constructors

NoSeenSnapshot

Never saw a ReqSn.

LastSeenSnapshot

No snapshot in flight with last seen snapshot number as given.

Fields

RequestedSnapshot

ReqSn was sent out and it should be considered already in flight.

Fields

SeenSnapshot

ReqSn for given snapshot was received.

Fields

  • snapshot :: Snapshot tx
     
  • signatories :: Map Party (Signature (Snapshot tx))

    Collected signatures so far.

  • signableBytes :: ~ByteString

    Pre-computed result of 'getSignableRepresentation snapshot', cached to avoid recomputing the expensive UTxO hash on every AckSn verification. Explicitly lazy under StrictData: state hydration folds every historical NodeState to WHNF, and a strict field here would force one full accumulator commitment per replayed SnapshotRequested event. At runtime it is forced once, on the first AckSn.

Instances

Instances details
IsTx tx => FromJSON (SeenSnapshot tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

parseJSON :: Value -> Parser (SeenSnapshot tx)

parseJSONList :: Value -> Parser [SeenSnapshot tx]

omittedField :: Maybe (SeenSnapshot tx)

IsTx tx => ToJSON (SeenSnapshot tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

toJSON :: SeenSnapshot tx -> Value

toEncoding :: SeenSnapshot tx -> Encoding

toJSONList :: [SeenSnapshot tx] -> Value

toEncodingList :: [SeenSnapshot tx] -> Encoding

omitField :: SeenSnapshot tx -> Bool

Generic (SeenSnapshot tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Associated Types

type Rep (SeenSnapshot tx) :: Type -> Type Source #

IsTx tx => Show (SeenSnapshot tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

IsTx tx => FromCBOR (SeenSnapshot tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

fromCBOR :: Decoder s (SeenSnapshot tx)

label :: Proxy (SeenSnapshot tx) -> Text

IsTx tx => ToCBOR (SeenSnapshot tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

toCBOR :: SeenSnapshot tx -> Encoding

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy (SeenSnapshot tx) -> Size

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [SeenSnapshot tx] -> Size

IsTx tx => Eq (SeenSnapshot tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

type Rep (SeenSnapshot tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

type Rep (SeenSnapshot tx) = D1 ('MetaData "SeenSnapshot" "Hydra.HeadLogic.State" "hydra-node-2.3.0-1cgalYNmLJQC1YXlYVq7mp" 'False) ((C1 ('MetaCons "NoSeenSnapshot" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LastSeenSnapshot" 'PrefixI 'True) (S1 ('MetaSel ('Just "lastSeen") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotNumber))) :+: (C1 ('MetaCons "RequestedSnapshot" 'PrefixI 'True) (S1 ('MetaSel ('Just "lastSeen") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotNumber) :*: S1 ('MetaSel ('Just "requested") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotNumber)) :+: C1 ('MetaCons "SeenSnapshot" 'PrefixI 'True) (S1 ('MetaSel ('Just "snapshot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Snapshot tx)) :*: (S1 ('MetaSel ('Just "signatories") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Map Party (Signature (Snapshot tx)))) :*: S1 ('MetaSel ('Just "signableBytes") 'NoSourceUnpackedness 'SourceLazy 'DecidedLazy) (Rec0 ByteString)))))

data ClosedState tx Source #

An Closed head with an current candidate ConfirmedSnapshot, which may be contested before the ClosedState.

Constructors

ClosedState 

Fields

Instances

Instances details
(IsTx tx, FromJSON (ChainStateType tx)) => FromJSON (ClosedState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

parseJSON :: Value -> Parser (ClosedState tx)

parseJSONList :: Value -> Parser [ClosedState tx]

omittedField :: Maybe (ClosedState tx)

(IsTx tx, ToJSON (ChainStateType tx)) => ToJSON (ClosedState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

toJSON :: ClosedState tx -> Value

toEncoding :: ClosedState tx -> Encoding

toJSONList :: [ClosedState tx] -> Value

toEncodingList :: [ClosedState tx] -> Encoding

omitField :: ClosedState tx -> Bool

Generic (ClosedState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Associated Types

type Rep (ClosedState tx) :: Type -> Type Source #

Methods

from :: ClosedState tx -> Rep (ClosedState tx) x Source #

to :: Rep (ClosedState tx) x -> ClosedState tx Source #

(IsTx tx, Show (ChainStateType tx)) => Show (ClosedState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

IsChainState tx => FromCBOR (ClosedState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

fromCBOR :: Decoder s (ClosedState tx)

label :: Proxy (ClosedState tx) -> Text

IsChainState tx => ToCBOR (ClosedState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

toCBOR :: ClosedState tx -> Encoding

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy (ClosedState tx) -> Size

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [ClosedState tx] -> Size

(IsTx tx, Eq (ChainStateType tx)) => Eq (ClosedState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

type Rep (ClosedState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

type Rep (ClosedState tx) = D1 ('MetaData "ClosedState" "Hydra.HeadLogic.State" "hydra-node-2.3.0-1cgalYNmLJQC1YXlYVq7mp" 'False) (C1 ('MetaCons "ClosedState" 'PrefixI 'True) (((S1 ('MetaSel ('Just "parameters") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadParameters) :*: S1 ('MetaSel ('Just "confirmedSnapshot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (ConfirmedSnapshot tx))) :*: (S1 ('MetaSel ('Just "contestationDeadline") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 UTCTime) :*: S1 ('MetaSel ('Just "readyToFanoutSent") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool))) :*: ((S1 ('MetaSel ('Just "chainState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (ChainStateType tx)) :*: S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadId)) :*: (S1 ('MetaSel ('Just "headSeed") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadSeed) :*: S1 ('MetaSel ('Just "version") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotVersion)))))

data FanoutMode tx Source #

How the node decides which UTxOs to distribute in the next fanout step while the head is in FanoutProgress.

Constructors

AutoDrain

Entered only via the Fanout client command: drain the whole remaining set automatically, dynamically chunked, ending in the final fanout.

DistributingSelection (UTxOType tx)

Manual mode: keep distributing this (content-tracked) user selection, dynamically chunked, until it is exhausted.

AwaitingSelection

Manual mode: the previous selection has been fully distributed. Wait for the next PartialFanout command; do not auto-drain.

Instances

Instances details
IsTx tx => FromJSON (FanoutMode tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

parseJSON :: Value -> Parser (FanoutMode tx)

parseJSONList :: Value -> Parser [FanoutMode tx]

omittedField :: Maybe (FanoutMode tx)

IsTx tx => ToJSON (FanoutMode tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

toJSON :: FanoutMode tx -> Value

toEncoding :: FanoutMode tx -> Encoding

toJSONList :: [FanoutMode tx] -> Value

toEncodingList :: [FanoutMode tx] -> Encoding

omitField :: FanoutMode tx -> Bool

Generic (FanoutMode tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Associated Types

type Rep (FanoutMode tx) :: Type -> Type Source #

Methods

from :: FanoutMode tx -> Rep (FanoutMode tx) x Source #

to :: Rep (FanoutMode tx) x -> FanoutMode tx Source #

IsTx tx => Show (FanoutMode tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

IsTx tx => FromCBOR (FanoutMode tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

fromCBOR :: Decoder s (FanoutMode tx)

label :: Proxy (FanoutMode tx) -> Text

IsTx tx => ToCBOR (FanoutMode tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

toCBOR :: FanoutMode tx -> Encoding

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy (FanoutMode tx) -> Size

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [FanoutMode tx] -> Size

IsTx tx => Eq (FanoutMode tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

(==) :: FanoutMode tx -> FanoutMode tx -> Bool Source #

(/=) :: FanoutMode tx -> FanoutMode tx -> Bool Source #

type Rep (FanoutMode tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

type Rep (FanoutMode tx) = D1 ('MetaData "FanoutMode" "Hydra.HeadLogic.State" "hydra-node-2.3.0-1cgalYNmLJQC1YXlYVq7mp" 'False) (C1 ('MetaCons "AutoDrain" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "DistributingSelection" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (UTxOType tx))) :+: C1 ('MetaCons "AwaitingSelection" 'PrefixI 'False) (U1 :: Type -> Type)))

data PartialFanoutState tx Source #

A closed head whose UTxO is being distributed across multiple fanout transactions (on-chain FanoutProgress). Holds the partial-fanout bookkeeping that used to live in ClosedState.

Constructors

PartialFanoutState 

Fields

Instances

Instances details
(IsTx tx, FromJSON (ChainStateType tx)) => FromJSON (PartialFanoutState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

parseJSON :: Value -> Parser (PartialFanoutState tx)

parseJSONList :: Value -> Parser [PartialFanoutState tx]

omittedField :: Maybe (PartialFanoutState tx)

(IsTx tx, ToJSON (ChainStateType tx)) => ToJSON (PartialFanoutState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Generic (PartialFanoutState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Associated Types

type Rep (PartialFanoutState tx) :: Type -> Type Source #

(IsTx tx, Show (ChainStateType tx)) => Show (PartialFanoutState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

IsChainState tx => FromCBOR (PartialFanoutState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

fromCBOR :: Decoder s (PartialFanoutState tx)

label :: Proxy (PartialFanoutState tx) -> Text

IsChainState tx => ToCBOR (PartialFanoutState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

toCBOR :: PartialFanoutState tx -> Encoding

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy (PartialFanoutState tx) -> Size

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [PartialFanoutState tx] -> Size

(IsTx tx, Eq (ChainStateType tx)) => Eq (PartialFanoutState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

type Rep (PartialFanoutState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

type Rep (PartialFanoutState tx) = D1 ('MetaData "PartialFanoutState" "Hydra.HeadLogic.State" "hydra-node-2.3.0-1cgalYNmLJQC1YXlYVq7mp" 'False) (C1 ('MetaCons "PartialFanoutState" 'PrefixI 'True) (((S1 ('MetaSel ('Just "parameters") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadParameters) :*: S1 ('MetaSel ('Just "confirmedSnapshot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (ConfirmedSnapshot tx))) :*: (S1 ('MetaSel ('Just "contestationDeadline") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 UTCTime) :*: (S1 ('MetaSel ('Just "chainState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (ChainStateType tx)) :*: S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadId)))) :*: ((S1 ('MetaSel ('Just "headSeed") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadSeed) :*: S1 ('MetaSel ('Just "version") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotVersion)) :*: (S1 ('MetaSel ('Just "remainingOutputs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (UTxOType tx)) :*: (S1 ('MetaSel ('Just "distributedOutputs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (UTxOType tx)) :*: S1 ('MetaSel ('Just "mode") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (FanoutMode tx)))))))

newtype IdleState tx Source #

An Idle head only having a chain state with things seen on chain so far.

Constructors

IdleState 

Fields

Instances

Instances details
FromJSON (ChainStateType tx) => FromJSON (IdleState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

parseJSON :: Value -> Parser (IdleState tx)

parseJSONList :: Value -> Parser [IdleState tx]

omittedField :: Maybe (IdleState tx)

ToJSON (ChainStateType tx) => ToJSON (IdleState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

toJSON :: IdleState tx -> Value

toEncoding :: IdleState tx -> Encoding

toJSONList :: [IdleState tx] -> Value

toEncodingList :: [IdleState tx] -> Encoding

omitField :: IdleState tx -> Bool

Generic (IdleState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Associated Types

type Rep (IdleState tx) :: Type -> Type Source #

Methods

from :: IdleState tx -> Rep (IdleState tx) x Source #

to :: Rep (IdleState tx) x -> IdleState tx Source #

Show (ChainStateType tx) => Show (IdleState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

IsChainState tx => FromCBOR (IdleState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

fromCBOR :: Decoder s (IdleState tx)

label :: Proxy (IdleState tx) -> Text

IsChainState tx => ToCBOR (IdleState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

toCBOR :: IdleState tx -> Encoding

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy (IdleState tx) -> Size

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [IdleState tx] -> Size

Eq (ChainStateType tx) => Eq (IdleState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

Methods

(==) :: IdleState tx -> IdleState tx -> Bool Source #

(/=) :: IdleState tx -> IdleState tx -> Bool Source #

type Rep (IdleState tx) Source # 
Instance details

Defined in Hydra.HeadLogic.State

type Rep (IdleState tx) = D1 ('MetaData "IdleState" "Hydra.HeadLogic.State" "hydra-node-2.3.0-1cgalYNmLJQC1YXlYVq7mp" 'True) (C1 ('MetaCons "IdleState" 'PrefixI 'True) (S1 ('MetaSel ('Just "chainState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ChainStateType tx))))

getChainState :: HeadState tx -> ChainStateType tx Source #

Get the chain state in any HeadState.

isCollectingAcks :: SeenSnapshot tx -> Bool Source #

Whether AckSns are currently being collected for a snapshot. Unlike snapshotInFlight, returns False for RequestedSnapshot — a snapshot sent but not yet echoed is stale once the version bumps and should not block a fresh request with the new version.

mkSeenSnapshot :: IsTx tx => Snapshot tx -> Map Party (Signature (Snapshot tx)) -> SeenSnapshot tx Source #

Smart constructor for SeenSnapshot that computes and caches $sel:signableBytes:NoSeenSnapshot from $sel:snapshot:NoSeenSnapshot, enforcing the invariant that they stay in sync.

seenSnapshotNumber :: SeenSnapshot tx -> SnapshotNumber Source #

Get the last seen snapshot number given a SeenSnapshot.

setChainState :: ChainStateType tx -> HeadState tx -> HeadState tx Source #

Update the chain state in any HeadState.

snapshotInFlight :: SeenSnapshot tx -> Bool Source #

Whether a snapshot is currently in-flight (requested or being signed).

data Effect tx Source #

Analogous to inputs, the pure head logic "core" can have effects emitted to the "shell" layers and we distinguish the same: effects onto the client, the network and the chain.

Constructors

ClientEffect

Effect to be handled by the Hydra.API, results in sending this ClientMessage.

NetworkEffect

Effect to be handled by a Hydra.Network, results in a broadcast.

Fields

OnChainEffect

Effect to be handled by a Hydra.Chain, results in a postTx.

Fields

Instances

Instances details
IsChainState tx => ToJSON (Effect tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Outcome

Methods

toJSON :: Effect tx -> Value

toEncoding :: Effect tx -> Encoding

toJSONList :: [Effect tx] -> Value

toEncodingList :: [Effect tx] -> Encoding

omitField :: Effect tx -> Bool

Generic (Effect tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Outcome

Associated Types

type Rep (Effect tx) :: Type -> Type Source #

Methods

from :: Effect tx -> Rep (Effect tx) x Source #

to :: Rep (Effect tx) x -> Effect tx Source #

IsChainState tx => Show (Effect tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Outcome

IsChainState tx => Eq (Effect tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Outcome

Methods

(==) :: Effect tx -> Effect tx -> Bool Source #

(/=) :: Effect tx -> Effect tx -> Bool Source #

type Rep (Effect tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Outcome

type Rep (Effect tx) = D1 ('MetaData "Effect" "Hydra.HeadLogic.Outcome" "hydra-node-2.3.0-1cgalYNmLJQC1YXlYVq7mp" 'False) (C1 ('MetaCons "ClientEffect" 'PrefixI 'True) (S1 ('MetaSel ('Just "clientMessage") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (ClientMessage tx))) :+: (C1 ('MetaCons "NetworkEffect" 'PrefixI 'True) (S1 ('MetaSel ('Just "message") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Message tx))) :+: C1 ('MetaCons "OnChainEffect" 'PrefixI 'True) (S1 ('MetaSel ('Just "postChainTx") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (PostChainTx tx)))))

data Outcome tx Source #

Constructors

Continue

Continue with the given state updates and side effects.

Fields

Wait

Wait for some condition to be met with optional state updates.

Error

Processing resulted in an error.

Fields

Instances

Instances details
IsChainState tx => ToJSON (Outcome tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Outcome

Methods

toJSON :: Outcome tx -> Value

toEncoding :: Outcome tx -> Encoding

toJSONList :: [Outcome tx] -> Value

toEncodingList :: [Outcome tx] -> Encoding

omitField :: Outcome tx -> Bool

Semigroup (Outcome tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Outcome

Methods

(<>) :: Outcome tx -> Outcome tx -> Outcome tx Source #

sconcat :: NonEmpty (Outcome tx) -> Outcome tx Source #

stimes :: Integral b => b -> Outcome tx -> Outcome tx Source #

Generic (Outcome tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Outcome

Associated Types

type Rep (Outcome tx) :: Type -> Type Source #

Methods

from :: Outcome tx -> Rep (Outcome tx) x Source #

to :: Rep (Outcome tx) x -> Outcome tx Source #

IsChainState tx => Show (Outcome tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Outcome

IsChainState tx => Eq (Outcome tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Outcome

Methods

(==) :: Outcome tx -> Outcome tx -> Bool Source #

(/=) :: Outcome tx -> Outcome tx -> Bool Source #

type Rep (Outcome tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Outcome

type Rep (Outcome tx) = D1 ('MetaData "Outcome" "Hydra.HeadLogic.Outcome" "hydra-node-2.3.0-1cgalYNmLJQC1YXlYVq7mp" 'False) (C1 ('MetaCons "Continue" 'PrefixI 'True) (S1 ('MetaSel ('Just "stateChanges") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [StateChanged tx]) :*: S1 ('MetaSel ('Just "effects") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [Effect tx])) :+: (C1 ('MetaCons "Wait" 'PrefixI 'True) (S1 ('MetaSel ('Just "reason") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (WaitReason tx)) :*: S1 ('MetaSel ('Just "stateChanges") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [StateChanged tx])) :+: C1 ('MetaCons "Error" 'PrefixI 'True) (S1 ('MetaSel ('Just "error") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (LogicError tx)))))

data StateChanged tx Source #

Head state changed event. These events represent all the internal state changes, get persisted and processed in an event sourcing manner.

Constructors

NetworkConnected 
NetworkDisconnected 
PeerConnected 

Fields

PeerDisconnected 

Fields

NetworkVersionMismatch 
NetworkClusterIDMismatch 

Fields

HeadOpened 

Fields

TransactionReceived 

Fields

  • tx :: tx
     
TransactionAppliedToLocalUTxO 

Fields

SnapshotRequestDecided 

Fields

SnapshotRequested 

Fields

PartySignedSnapshot 

Fields

SnapshotConfirmed 

Fields

DepositRecorded 

Fields

DepositActivated 

Fields

DepositExpired 

Fields

DepositRecovered 

Fields

CommitApproved 

Fields

CommitFinalized 

Fields

DecommitRecorded 

Fields

DecommitApproved 

Fields

DecommitInvalid 
DecommitFinalized 

Fields

HeadClosed 

Fields

HeadContested 

Fields

HeadIsReadyToFanout 

Fields

HeadFanoutInitiated

This node initiated a full automatic fanout (Fanout command). It transitions ClosedPartialFanout in AutoDrain mode so that this node (the driver) auto-continues draining as chunks are observed. Other parties that merely observe the resulting partial fanout do NOT auto-drive (they go to AwaitingSelection). No chain state change (client command).

Fields

HeadPartialFanoutSelected

A user initiated or updated a selective partial fanout. From Closed this transitions into the PartialFanout state (using $sel:remainingOutputs:NetworkConnected as the initial remaining set); from PartialFanout it just updates the active selection. No chain state change (driven by a client command).

Fields

HeadFanoutReverted

Revert an optimistic ClosedPartialFanout transition back to Closed. Emitted when posting the initiating fanout transaction fails terminally before any partial fanout has landed on chain (i.e. while the off-chain state is PartialFanout but the on-chain datum is still Closed). Without this the head would wedge in PartialFanout with Fanout rejected. No chain state change.

Fields

HeadFannedOut 

Fields

HeadPartialFannedOut 

Fields

ChainRolledBack 

Fields

TickObserved 

Fields

IgnoredHeadInitializing 

Fields

TxInvalid 

Fields

LocalStateCleared 

Fields

Checkpoint 

Fields

NodeUnsynced 

Fields

NodeSynced 

Fields

Instances

Instances details
(IsChainState tx, IsTx tx, FromJSON (NodeState tx), FromJSON (ChainStateType tx)) => FromJSON (StateChanged tx) Source #

Decoded generically, except that a HeadPartialFannedOut persisted before the $sel:mode:NetworkConnected field existed (event logs from an earlier node) is decoded with $sel:mode:NetworkConnected defaulting to AwaitingSelection. That is the safe default: the node waits for the next PartialFanout rather than assuming an auto-drain, so a node mid-fanout can still restart. All other constructors decode as before.

Instance details

Defined in Hydra.HeadLogic.Outcome

Methods

parseJSON :: Value -> Parser (StateChanged tx)

parseJSONList :: Value -> Parser [StateChanged tx]

omittedField :: Maybe (StateChanged tx)

(IsChainState tx, IsTx tx, ToJSON (ChainStateType tx)) => ToJSON (StateChanged tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Outcome

Methods

toJSON :: StateChanged tx -> Value

toEncoding :: StateChanged tx -> Encoding

toJSONList :: [StateChanged tx] -> Value

toEncodingList :: [StateChanged tx] -> Encoding

omitField :: StateChanged tx -> Bool

Generic (StateChanged tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Outcome

Associated Types

type Rep (StateChanged tx) :: Type -> Type Source #

(IsChainState tx, IsTx tx, Show (NodeState tx), Show (ChainStateType tx)) => Show (StateChanged tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Outcome

IsChainState tx => FromCBOR (StateChanged tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Outcome

Methods

fromCBOR :: Decoder s (StateChanged tx)

label :: Proxy (StateChanged tx) -> Text

IsChainState tx => ToCBOR (StateChanged tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Outcome

Methods

toCBOR :: StateChanged tx -> Encoding

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy (StateChanged tx) -> Size

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [StateChanged tx] -> Size

(IsChainState tx, IsTx tx, Eq (NodeState tx), Eq (ChainStateType tx)) => Eq (StateChanged tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Outcome

type Rep (StateChanged tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Outcome

type Rep (StateChanged tx) = D1 ('MetaData "StateChanged" "Hydra.HeadLogic.Outcome" "hydra-node-2.3.0-1cgalYNmLJQC1YXlYVq7mp" 'False) (((((C1 ('MetaCons "NetworkConnected" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NetworkDisconnected" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "PeerConnected" 'PrefixI 'True) (S1 ('MetaSel ('Just "peer") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Host)) :+: C1 ('MetaCons "PeerDisconnected" 'PrefixI 'True) (S1 ('MetaSel ('Just "peer") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Host)))) :+: ((C1 ('MetaCons "NetworkVersionMismatch" 'PrefixI 'True) (S1 ('MetaSel ('Just "ourVersion") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ProtocolVersion) :*: S1 ('MetaSel ('Just "theirVersion") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe ProtocolVersion))) :+: C1 ('MetaCons "NetworkClusterIDMismatch" 'PrefixI 'True) (S1 ('MetaSel ('Just "clusterPeers") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "misconfiguredPeers") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text))) :+: (C1 ('MetaCons "HeadOpened" 'PrefixI 'True) ((S1 ('MetaSel ('Just "parameters") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadParameters) :*: S1 ('MetaSel ('Just "chainState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (ChainStateType tx))) :*: (S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadId) :*: (S1 ('MetaSel ('Just "headSeed") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadSeed) :*: S1 ('MetaSel ('Just "parties") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [Party])))) :+: (C1 ('MetaCons "TransactionReceived" 'PrefixI 'True) (S1 ('MetaSel ('Just "tx") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 tx)) :+: C1 ('MetaCons "TransactionAppliedToLocalUTxO" 'PrefixI 'True) (S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadId) :*: S1 ('MetaSel ('Just "tx") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 tx)))))) :+: (((C1 ('MetaCons "SnapshotRequestDecided" 'PrefixI 'True) (S1 ('MetaSel ('Just "snapshotNumber") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotNumber)) :+: C1 ('MetaCons "SnapshotRequested" 'PrefixI 'True) (S1 ('MetaSel ('Just "requestedSnapshot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Snapshot tx)) :*: (S1 ('MetaSel ('Just "newLocalTxs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Seq tx)) :*: S1 ('MetaSel ('Just "newCurrentDepositTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe (TxIdType tx)))))) :+: (C1 ('MetaCons "PartySignedSnapshot" 'PrefixI 'True) (S1 ('MetaSel ('Just "snapshotNumber") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotNumber) :*: (S1 ('MetaSel ('Just "party") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Party) :*: S1 ('MetaSel ('Just "signature") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Signature (Snapshot tx))))) :+: (C1 ('MetaCons "SnapshotConfirmed" 'PrefixI 'True) (S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadId) :*: (S1 ('MetaSel ('Just "snapshot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe (Snapshot tx))) :*: S1 ('MetaSel ('Just "signatures") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (MultiSignature (Snapshot tx))))) :+: C1 ('MetaCons "DepositRecorded" 'PrefixI 'True) ((S1 ('MetaSel ('Just "chainState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (ChainStateType tx)) :*: (S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadId) :*: S1 ('MetaSel ('Just "depositTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (TxIdType tx)))) :*: (S1 ('MetaSel ('Just "deposited") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (UTxOType tx)) :*: (S1 ('MetaSel ('Just "created") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 UTCTime) :*: S1 ('MetaSel ('Just "deadline") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 UTCTime))))))) :+: ((C1 ('MetaCons "DepositActivated" 'PrefixI 'True) (S1 ('MetaSel ('Just "depositTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (TxIdType tx)) :*: (S1 ('MetaSel ('Just "chainTime") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 UTCTime) :*: S1 ('MetaSel ('Just "deposit") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Deposit tx)))) :+: C1 ('MetaCons "DepositExpired" 'PrefixI 'True) (S1 ('MetaSel ('Just "depositTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (TxIdType tx)) :*: (S1 ('MetaSel ('Just "chainTime") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 UTCTime) :*: S1 ('MetaSel ('Just "deposit") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Deposit tx))))) :+: (C1 ('MetaCons "DepositRecovered" 'PrefixI 'True) ((S1 ('MetaSel ('Just "chainState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (ChainStateType tx)) :*: S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadId)) :*: (S1 ('MetaSel ('Just "depositTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (TxIdType tx)) :*: S1 ('MetaSel ('Just "recovered") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (UTxOType tx)))) :+: (C1 ('MetaCons "CommitApproved" 'PrefixI 'True) (S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadId) :*: S1 ('MetaSel ('Just "utxoToCommit") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (UTxOType tx))) :+: C1 ('MetaCons "CommitFinalized" 'PrefixI 'True) ((S1 ('MetaSel ('Just "chainState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (ChainStateType tx)) :*: S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadId)) :*: (S1 ('MetaSel ('Just "newVersion") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotVersion) :*: S1 ('MetaSel ('Just "depositTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (TxIdType tx))))))))) :+: ((((C1 ('MetaCons "DecommitRecorded" 'PrefixI 'True) (S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadId) :*: S1 ('MetaSel ('Just "decommitTx") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 tx)) :+: C1 ('MetaCons "DecommitApproved" 'PrefixI 'True) (S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadId) :*: (S1 ('MetaSel ('Just "decommitTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (TxIdType tx)) :*: S1 ('MetaSel ('Just "utxoToDecommit") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (UTxOType tx))))) :+: (C1 ('MetaCons "DecommitInvalid" 'PrefixI 'True) (S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadId) :*: (S1 ('MetaSel ('Just "decommitTx") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 tx) :*: S1 ('MetaSel ('Just "decommitInvalidReason") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (DecommitInvalidReason tx)))) :+: (C1 ('MetaCons "DecommitFinalized" 'PrefixI 'True) ((S1 ('MetaSel ('Just "chainState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (ChainStateType tx)) :*: S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadId)) :*: (S1 ('MetaSel ('Just "distributedUTxO") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (UTxOType tx)) :*: S1 ('MetaSel ('Just "newVersion") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotVersion))) :+: C1 ('MetaCons "HeadClosed" 'PrefixI 'True) ((S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadId) :*: S1 ('MetaSel ('Just "snapshotNumber") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotNumber)) :*: (S1 ('MetaSel ('Just "chainState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (ChainStateType tx)) :*: S1 ('MetaSel ('Just "contestationDeadline") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 UTCTime)))))) :+: ((C1 ('MetaCons "HeadContested" 'PrefixI 'True) ((S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadId) :*: S1 ('MetaSel ('Just "chainState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (ChainStateType tx))) :*: (S1 ('MetaSel ('Just "contestationDeadline") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 UTCTime) :*: S1 ('MetaSel ('Just "snapshotNumber") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotNumber))) :+: C1 ('MetaCons "HeadIsReadyToFanout" 'PrefixI 'True) (S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadId))) :+: (C1 ('MetaCons "HeadFanoutInitiated" 'PrefixI 'True) (S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadId) :*: S1 ('MetaSel ('Just "remainingOutputs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (UTxOType tx))) :+: (C1 ('MetaCons "HeadPartialFanoutSelected" 'PrefixI 'True) (S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadId) :*: (S1 ('MetaSel ('Just "remainingOutputs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (UTxOType tx)) :*: S1 ('MetaSel ('Just "selection") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (UTxOType tx)))) :+: C1 ('MetaCons "HeadFanoutReverted" 'PrefixI 'True) (S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadId)))))) :+: (((C1 ('MetaCons "HeadFannedOut" 'PrefixI 'True) (S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadId) :*: (S1 ('MetaSel ('Just "finalizedOutputs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (UTxOType tx)) :*: S1 ('MetaSel ('Just "chainState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (ChainStateType tx)))) :+: C1 ('MetaCons "HeadPartialFannedOut" 'PrefixI 'True) ((S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadId) :*: S1 ('MetaSel ('Just "distributedOutputs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (UTxOType tx))) :*: (S1 ('MetaSel ('Just "remainingOutputs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (UTxOType tx)) :*: (S1 ('MetaSel ('Just "chainState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (ChainStateType tx)) :*: S1 ('MetaSel ('Just "mode") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (FanoutMode tx)))))) :+: (C1 ('MetaCons "ChainRolledBack" 'PrefixI 'True) (S1 ('MetaSel ('Just "chainState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (ChainStateType tx))) :+: (C1 ('MetaCons "TickObserved" 'PrefixI 'True) (S1 ('MetaSel ('Just "chainPoint") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (ChainPointType tx)) :*: S1 ('MetaSel ('Just "chainTime") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 UTCTime)) :+: C1 ('MetaCons "IgnoredHeadInitializing" 'PrefixI 'True) ((S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadId) :*: S1 ('MetaSel ('Just "contestationPeriod") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ContestationPeriod)) :*: (S1 ('MetaSel ('Just "parties") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [Party]) :*: S1 ('MetaSel ('Just "participants") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [OnChainId])))))) :+: ((C1 ('MetaCons "TxInvalid" 'PrefixI 'True) ((S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadId) :*: S1 ('MetaSel ('Just "utxo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (UTxOType tx))) :*: (S1 ('MetaSel ('Just "transaction") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 tx) :*: S1 ('MetaSel ('Just "validationError") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ValidationError))) :+: C1 ('MetaCons "LocalStateCleared" 'PrefixI 'True) (S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 HeadId) :*: S1 ('MetaSel ('Just "snapshotNumber") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotNumber))) :+: (C1 ('MetaCons "Checkpoint" 'PrefixI 'True) (S1 ('MetaSel ('Just "state") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (NodeState tx))) :+: (C1 ('MetaCons "NodeUnsynced" 'PrefixI 'True) (S1 ('MetaSel ('Just "chainSlot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ChainSlot) :*: (S1 ('MetaSel ('Just "chainTime") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 UTCTime) :*: S1 ('MetaSel ('Just "drift") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 NominalDiffTime))) :+: C1 ('MetaCons "NodeSynced" 'PrefixI 'True) (S1 ('MetaSel ('Just "chainSlot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ChainSlot) :*: (S1 ('MetaSel ('Just "chainTime") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 UTCTime) :*: S1 ('MetaSel ('Just "drift") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 NominalDiffTime)))))))))

data WaitReason tx Source #

Instances

Instances details
IsTx tx => ToJSON (WaitReason tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Outcome

Methods

toJSON :: WaitReason tx -> Value

toEncoding :: WaitReason tx -> Encoding

toJSONList :: [WaitReason tx] -> Value

toEncodingList :: [WaitReason tx] -> Encoding

omitField :: WaitReason tx -> Bool

Generic (WaitReason tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Outcome

Associated Types

type Rep (WaitReason tx) :: Type -> Type Source #

Methods

from :: WaitReason tx -> Rep (WaitReason tx) x Source #

to :: Rep (WaitReason tx) x -> WaitReason tx Source #

IsTx tx => Show (WaitReason tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Outcome

IsTx tx => Eq (WaitReason tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Outcome

Methods

(==) :: WaitReason tx -> WaitReason tx -> Bool Source #

(/=) :: WaitReason tx -> WaitReason tx -> Bool Source #

type Rep (WaitReason tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Outcome

type Rep (WaitReason tx) = D1 ('MetaData "WaitReason" "Hydra.HeadLogic.Outcome" "hydra-node-2.3.0-1cgalYNmLJQC1YXlYVq7mp" 'False) (((C1 ('MetaCons "WaitOnNotApplicableTx" 'PrefixI 'True) (S1 ('MetaSel ('Just "validationError") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ValidationError)) :+: (C1 ('MetaCons "WaitOnSnapshotNumber" 'PrefixI 'True) (S1 ('MetaSel ('Just "waitingForNumber") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotNumber)) :+: C1 ('MetaCons "WaitOnSnapshotVersion" 'PrefixI 'True) (S1 ('MetaSel ('Just "waitingForVersion") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SnapshotVersion)))) :+: (C1 ('MetaCons "WaitOnSeenSnapshot" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "WaitOnTxs" 'PrefixI 'True) (S1 ('MetaSel ('Just "waitingForTxIds") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [TxIdType tx])) :+: C1 ('MetaCons "WaitOnContestationDeadline" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "WaitOnNotApplicableDecommitTx" 'PrefixI 'True) (S1 ('MetaSel ('Just "notApplicableReason") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (DecommitInvalidReason tx))) :+: (C1 ('MetaCons "WaitOnUnresolvedCommit" 'PrefixI 'True) (S1 ('MetaSel ('Just "commitUTxO") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (UTxOType tx))) :+: C1 ('MetaCons "WaitOnUnresolvedDecommit" 'PrefixI 'True) (S1 ('MetaSel ('Just "decommitTx") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 tx)))) :+: (C1 ('MetaCons "WaitOnDepositObserved" 'PrefixI 'True) (S1 ('MetaSel ('Just "depositTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (TxIdType tx))) :+: (C1 ('MetaCons "WaitOnDepositActivation" 'PrefixI 'True) (S1 ('MetaSel ('Just "depositTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (TxIdType tx))) :+: C1 ('MetaCons "WaitOnNodeInSync" 'PrefixI 'True) (S1 ('MetaSel ('Just "currentSlot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ChainSlot))))))

causes :: [Effect tx] -> Outcome tx Source #