| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Hydra.HeadLogic.Outcome
Synopsis
- data Effect tx
- = ClientEffect {
- clientMessage :: ClientMessage tx
- | NetworkEffect { }
- | OnChainEffect {
- postChainTx :: PostChainTx tx
- = ClientEffect {
- data StateChanged tx
- = NetworkConnected
- | NetworkDisconnected
- | PeerConnected { }
- | PeerDisconnected { }
- | NetworkVersionMismatch { }
- | HeadInitialized {
- parameters :: HeadParameters
- chainState :: ChainStateType tx
- headId :: HeadId
- headSeed :: HeadSeed
- parties :: [Party]
- | CommittedUTxO {
- headId :: HeadId
- party :: Party
- committedUTxO :: UTxOType tx
- chainState :: ChainStateType tx
- | HeadAborted {
- headId :: HeadId
- utxo :: UTxOType tx
- chainState :: ChainStateType tx
- | HeadOpened {
- headId :: HeadId
- chainState :: ChainStateType tx
- initialUTxO :: UTxOType tx
- | TransactionReceived {
- tx :: tx
- | TransactionAppliedToLocalUTxO {
- headId :: HeadId
- tx :: tx
- newLocalUTxO :: UTxOType tx
- | SnapshotRequestDecided {
- snapshotNumber :: SnapshotNumber
- | SnapshotRequested {
- snapshot :: Snapshot tx
- requestedTxIds :: [TxIdType tx]
- newLocalUTxO :: UTxOType tx
- newLocalTxs :: [tx]
- | PartySignedSnapshot { }
- | SnapshotConfirmed {
- headId :: HeadId
- snapshot :: Snapshot tx
- signatures :: MultiSignature (Snapshot tx)
- | CommitRecorded {
- chainState :: ChainStateType tx
- headId :: HeadId
- pendingDeposits :: Map (TxIdType tx) (UTxOType tx)
- newLocalUTxO :: UTxOType tx
- utxoToCommit :: UTxOType tx
- pendingDeposit :: TxIdType tx
- deadline :: UTCTime
- | CommitApproved {
- headId :: HeadId
- utxoToCommit :: UTxOType tx
- | CommitRecovered {
- chainState :: ChainStateType tx
- headId :: HeadId
- recoveredUTxO :: UTxOType tx
- newLocalUTxO :: UTxOType tx
- recoveredTxId :: TxIdType tx
- | CommitFinalized {
- chainState :: ChainStateType tx
- headId :: HeadId
- newVersion :: SnapshotVersion
- depositTxId :: TxIdType tx
- | DecommitRecorded {
- headId :: HeadId
- decommitTx :: tx
- newLocalUTxO :: UTxOType tx
- utxoToDecommit :: UTxOType tx
- | DecommitApproved {
- headId :: HeadId
- decommitTxId :: TxIdType tx
- utxoToDecommit :: UTxOType tx
- | DecommitInvalid {
- headId :: HeadId
- decommitTx :: tx
- decommitInvalidReason :: DecommitInvalidReason tx
- | DecommitFinalized {
- chainState :: ChainStateType tx
- headId :: HeadId
- distributedUTxO :: UTxOType tx
- newVersion :: SnapshotVersion
- | HeadClosed {
- headId :: HeadId
- snapshotNumber :: SnapshotNumber
- chainState :: ChainStateType tx
- contestationDeadline :: UTCTime
- | HeadContested {
- headId :: HeadId
- chainState :: ChainStateType tx
- contestationDeadline :: UTCTime
- snapshotNumber :: SnapshotNumber
- | HeadIsReadyToFanout {
- headId :: HeadId
- | HeadFannedOut {
- headId :: HeadId
- utxo :: UTxOType tx
- chainState :: ChainStateType tx
- | ChainRolledBack {
- chainState :: ChainStateType tx
- | TickObserved {
- chainSlot :: ChainSlot
- | IgnoredHeadInitializing {
- headId :: HeadId
- contestationPeriod :: ContestationPeriod
- parties :: [Party]
- participants :: [OnChainId]
- | TxInvalid {
- headId :: HeadId
- utxo :: UTxOType tx
- transaction :: tx
- validationError :: ValidationError
- | LocalStateCleared {
- headId :: HeadId
- snapshotNumber :: SnapshotNumber
- genStateChanged :: (ArbitraryIsTx tx, IsChainState tx) => Environment -> Gen (StateChanged tx)
- data Outcome tx
- = Continue {
- stateChanges :: [StateChanged tx]
- effects :: [Effect tx]
- | Wait {
- reason :: WaitReason tx
- stateChanges :: [StateChanged tx]
- | Error {
- error :: LogicError tx
- = Continue {
- noop :: Outcome tx
- wait :: WaitReason tx -> Outcome tx
- newState :: StateChanged tx -> Outcome tx
- cause :: Effect tx -> Outcome tx
- causes :: [Effect tx] -> Outcome tx
- changes :: [StateChanged tx] -> Outcome tx
- data WaitReason tx
- = WaitOnNotApplicableTx { }
- | WaitOnSnapshotNumber {
- waitingForNumber :: SnapshotNumber
- | WaitOnSnapshotVersion {
- waitingForVersion :: SnapshotVersion
- | WaitOnSeenSnapshot
- | WaitOnTxs {
- waitingForTxIds :: [TxIdType tx]
- | WaitOnContestationDeadline
- | WaitOnNotApplicableDecommitTx { }
- | WaitOnUnresolvedCommit {
- commitUTxO :: UTxOType tx
- | WaitOnUnresolvedDecommit {
- decommitTx :: tx
Documentation
Analogous to inputs, the pure head logic "core" can have effects emited 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 |
Fields
| |
| NetworkEffect | Effect to be handled by a Hydra.Network, results in a |
| OnChainEffect | Effect to be handled by a Hydra.Chain, results in a |
Fields
| |
Instances
| (ArbitraryIsTx tx, IsChainState tx) => Arbitrary (Effect tx) Source # | |
| IsChainState tx => ToJSON (Effect tx) Source # | |
Defined in Hydra.HeadLogic.Outcome Methods toEncoding :: Effect tx -> Encoding toJSONList :: [Effect tx] -> Value toEncodingList :: [Effect tx] -> Encoding | |
| Generic (Effect tx) Source # | |
| IsChainState tx => Show (Effect tx) Source # | |
| IsChainState tx => Eq (Effect tx) Source # | |
| type Rep (Effect tx) Source # | |
Defined in Hydra.HeadLogic.Outcome type Rep (Effect tx) = D1 ('MetaData "Effect" "Hydra.HeadLogic.Outcome" "hydra-node-0.21.0-4ibc00B6CCmF4EmjGjxvGm" 'False) (C1 ('MetaCons "ClientEffect" 'PrefixI 'True) (S1 ('MetaSel ('Just "clientMessage") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ClientMessage tx))) :+: (C1 ('MetaCons "NetworkEffect" 'PrefixI 'True) (S1 ('MetaSel ('Just "message") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Message tx))) :+: C1 ('MetaCons "OnChainEffect" 'PrefixI 'True) (S1 ('MetaSel ('Just "postChainTx") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PostChainTx 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 | |
| PeerDisconnected | |
| NetworkVersionMismatch | |
Fields | |
| HeadInitialized | |
Fields
| |
| CommittedUTxO | |
Fields
| |
| HeadAborted | |
Fields
| |
| HeadOpened | |
Fields
| |
| TransactionReceived | |
Fields
| |
| TransactionAppliedToLocalUTxO | |
Fields
| |
| SnapshotRequestDecided | |
Fields
| |
| SnapshotRequested | A snapshot was requested by some party. NOTE: We deliberately already include an updated local ledger state to not need a ledger to interpret this event. |
Fields
| |
| PartySignedSnapshot | |
| SnapshotConfirmed | |
Fields
| |
| CommitRecorded | |
Fields
| |
| CommitApproved | |
Fields
| |
| CommitRecovered | |
Fields
| |
| CommitFinalized | |
Fields
| |
| DecommitRecorded | |
Fields
| |
| DecommitApproved | |
Fields
| |
| DecommitInvalid | |
Fields
| |
| DecommitFinalized | |
Fields
| |
| HeadClosed | |
Fields
| |
| HeadContested | |
Fields
| |
| HeadIsReadyToFanout | |
Fields
| |
| HeadFannedOut | |
Fields
| |
| ChainRolledBack | |
Fields
| |
| TickObserved | |
Fields
| |
| IgnoredHeadInitializing | |
Fields
| |
| TxInvalid | |
Fields
| |
| LocalStateCleared | |
Fields
| |
Instances
genStateChanged :: (ArbitraryIsTx tx, IsChainState tx) => Environment -> Gen (StateChanged 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. |
Fields
| |
| Error | Processing resulted in an error. |
Fields
| |
Instances
wait :: WaitReason tx -> Outcome tx Source #
newState :: StateChanged tx -> Outcome tx Source #
changes :: [StateChanged tx] -> Outcome tx Source #
data WaitReason tx Source #
Constructors
| WaitOnNotApplicableTx | |
Fields | |
| WaitOnSnapshotNumber | |
Fields
| |
| WaitOnSnapshotVersion | |
Fields
| |
| WaitOnSeenSnapshot | |
| WaitOnTxs | |
Fields
| |
| WaitOnContestationDeadline | |
| WaitOnNotApplicableDecommitTx | |
Fields | |
| WaitOnUnresolvedCommit | |
Fields
| |
| WaitOnUnresolvedDecommit | |
Fields
| |