hydra-node-0.20.0: The Hydra node
Safe HaskellSafe-Inferred
LanguageGHC2021

Hydra.HeadLogic.Outcome

Synopsis

Documentation

data Effect tx Source #

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 ServerOutput.

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
(ArbitraryIsTx tx, IsChainState tx) => Arbitrary (Effect tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Outcome

Methods

arbitrary :: Gen (Effect tx)

shrink :: Effect tx -> [Effect tx]

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

Defined in Hydra.HeadLogic.Outcome

Methods

parseJSON :: Value -> Parser (Effect tx)

parseJSONList :: Value -> Parser [Effect tx]

omittedField :: Maybe (Effect tx)

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-0.20.0-5pXAEiXeWsXH8K4KfwlMxW" 'False) (C1 ('MetaCons "ClientEffect" 'PrefixI 'True) (S1 ('MetaSel ('Just "serverOutput") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ServerOutput 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

HeadInitialized 

Fields

CommittedUTxO 

Fields

HeadAborted 

Fields

HeadOpened 

Fields

TransactionReceived 

Fields

  • tx :: tx
     
TransactionAppliedToLocalUTxO 

Fields

CommitRecorded 

Fields

CommitRecovered 

Fields

DecommitRecorded 

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

CommitFinalized 

Fields

DecommitFinalized 

Fields

PartySignedSnapshot 

Fields

SnapshotConfirmed 

Fields

HeadClosed 

Fields

HeadContested 

Fields

HeadIsReadyToFanout 
HeadFannedOut 

Fields

ChainRolledBack 

Fields

TickObserved 

Fields

Instances

Instances details
(ArbitraryIsTx tx, IsChainState tx) => Arbitrary (StateChanged tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Outcome

Methods

arbitrary :: Gen (StateChanged tx)

shrink :: StateChanged tx -> [StateChanged tx]

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

Defined in Hydra.HeadLogic.Outcome

Methods

parseJSON :: Value -> Parser (StateChanged tx)

parseJSONList :: Value -> Parser [StateChanged tx]

omittedField :: Maybe (StateChanged 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 #

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

Defined in Hydra.HeadLogic.Outcome

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

Defined in Hydra.HeadLogic.Outcome

(ArbitraryIsTx tx, IsChainState tx) => ToADTArbitrary (StateChanged tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Outcome

Methods

toADTArbitrarySingleton :: Proxy (StateChanged tx) -> Gen (ADTArbitrarySingleton (StateChanged tx))

toADTArbitrary :: Proxy (StateChanged tx) -> Gen (ADTArbitrary (StateChanged tx))

type Rep (StateChanged tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Outcome

type Rep (StateChanged tx) = D1 ('MetaData "StateChanged" "Hydra.HeadLogic.Outcome" "hydra-node-0.20.0-5pXAEiXeWsXH8K4KfwlMxW" 'False) ((((C1 ('MetaCons "HeadInitialized" 'PrefixI 'True) ((S1 ('MetaSel ('Just "parameters") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HeadParameters) :*: S1 ('MetaSel ('Just "chainState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ChainStateType tx))) :*: (S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HeadId) :*: S1 ('MetaSel ('Just "headSeed") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HeadSeed))) :+: C1 ('MetaCons "CommittedUTxO" 'PrefixI 'True) (S1 ('MetaSel ('Just "party") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Party) :*: (S1 ('MetaSel ('Just "committedUTxO") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (UTxOType tx)) :*: S1 ('MetaSel ('Just "chainState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ChainStateType tx))))) :+: (C1 ('MetaCons "HeadAborted" 'PrefixI 'True) (S1 ('MetaSel ('Just "chainState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ChainStateType tx))) :+: (C1 ('MetaCons "HeadOpened" 'PrefixI 'True) (S1 ('MetaSel ('Just "chainState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ChainStateType tx)) :*: S1 ('MetaSel ('Just "initialUTxO") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (UTxOType tx))) :+: C1 ('MetaCons "TransactionReceived" 'PrefixI 'True) (S1 ('MetaSel ('Just "tx") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 tx))))) :+: ((C1 ('MetaCons "TransactionAppliedToLocalUTxO" 'PrefixI 'True) (S1 ('MetaSel ('Just "tx") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 tx) :*: S1 ('MetaSel ('Just "newLocalUTxO") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (UTxOType tx))) :+: C1 ('MetaCons "CommitRecorded" 'PrefixI 'True) (S1 ('MetaSel ('Just "pendingDeposits") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map (TxIdType tx) (UTxOType tx))) :*: S1 ('MetaSel ('Just "newLocalUTxO") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (UTxOType tx)))) :+: (C1 ('MetaCons "CommitRecovered" 'PrefixI 'True) (S1 ('MetaSel ('Just "recoveredUTxO") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (UTxOType tx)) :*: (S1 ('MetaSel ('Just "newLocalUTxO") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (UTxOType tx)) :*: S1 ('MetaSel ('Just "recoveredTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TxIdType tx)))) :+: (C1 ('MetaCons "DecommitRecorded" 'PrefixI 'True) (S1 ('MetaSel ('Just "decommitTx") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 tx) :*: S1 ('MetaSel ('Just "newLocalUTxO") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (UTxOType tx))) :+: C1 ('MetaCons "SnapshotRequestDecided" 'PrefixI 'True) (S1 ('MetaSel ('Just "snapshotNumber") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SnapshotNumber)))))) :+: (((C1 ('MetaCons "SnapshotRequested" 'PrefixI 'True) ((S1 ('MetaSel ('Just "snapshot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Snapshot tx)) :*: S1 ('MetaSel ('Just "requestedTxIds") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [TxIdType tx])) :*: (S1 ('MetaSel ('Just "newLocalUTxO") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (UTxOType tx)) :*: S1 ('MetaSel ('Just "newLocalTxs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [tx]))) :+: C1 ('MetaCons "CommitFinalized" 'PrefixI 'True) (S1 ('MetaSel ('Just "newVersion") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SnapshotVersion) :*: S1 ('MetaSel ('Just "depositTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TxIdType tx)))) :+: (C1 ('MetaCons "DecommitFinalized" 'PrefixI 'True) (S1 ('MetaSel ('Just "newVersion") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SnapshotVersion)) :+: (C1 ('MetaCons "PartySignedSnapshot" 'PrefixI 'True) (S1 ('MetaSel ('Just "snapshot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Snapshot tx)) :*: (S1 ('MetaSel ('Just "party") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Party) :*: S1 ('MetaSel ('Just "signature") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Signature (Snapshot tx))))) :+: C1 ('MetaCons "SnapshotConfirmed" 'PrefixI 'True) (S1 ('MetaSel ('Just "snapshot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Snapshot tx)) :*: S1 ('MetaSel ('Just "signatures") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (MultiSignature (Snapshot tx))))))) :+: ((C1 ('MetaCons "HeadClosed" 'PrefixI 'True) (S1 ('MetaSel ('Just "chainState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ChainStateType tx)) :*: S1 ('MetaSel ('Just "contestationDeadline") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UTCTime)) :+: (C1 ('MetaCons "HeadContested" 'PrefixI 'True) (S1 ('MetaSel ('Just "chainState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ChainStateType tx)) :*: S1 ('MetaSel ('Just "contestationDeadline") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UTCTime)) :+: C1 ('MetaCons "HeadIsReadyToFanout" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "HeadFannedOut" 'PrefixI 'True) (S1 ('MetaSel ('Just "chainState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ChainStateType tx))) :+: (C1 ('MetaCons "ChainRolledBack" 'PrefixI 'True) (S1 ('MetaSel ('Just "chainState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ChainStateType tx))) :+: C1 ('MetaCons "TickObserved" 'PrefixI 'True) (S1 ('MetaSel ('Just "chainSlot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ChainSlot)))))))

genStateChanged :: (ArbitraryIsTx tx, IsChainState tx) => Environment -> Gen (StateChanged tx) Source #

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
(ArbitraryIsTx tx, IsChainState tx) => Arbitrary (Outcome tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Outcome

Methods

arbitrary :: Gen (Outcome tx)

shrink :: Outcome tx -> [Outcome tx]

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

Defined in Hydra.HeadLogic.Outcome

Methods

parseJSON :: Value -> Parser (Outcome tx)

parseJSONList :: Value -> Parser [Outcome tx]

omittedField :: Maybe (Outcome tx)

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-0.20.0-5pXAEiXeWsXH8K4KfwlMxW" 'False) (C1 ('MetaCons "Continue" 'PrefixI 'True) (S1 ('MetaSel ('Just "stateChanges") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [StateChanged tx]) :*: S1 ('MetaSel ('Just "effects") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Effect tx])) :+: (C1 ('MetaCons "Wait" 'PrefixI 'True) (S1 ('MetaSel ('Just "reason") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (WaitReason tx)) :*: S1 ('MetaSel ('Just "stateChanges") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [StateChanged tx])) :+: C1 ('MetaCons "Error" 'PrefixI 'True) (S1 ('MetaSel ('Just "error") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (LogicError tx)))))

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

data WaitReason tx Source #

Instances

Instances details
ArbitraryIsTx tx => Arbitrary (WaitReason tx) Source # 
Instance details

Defined in Hydra.HeadLogic.Outcome

Methods

arbitrary :: Gen (WaitReason tx)

shrink :: WaitReason tx -> [WaitReason tx]

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

Defined in Hydra.HeadLogic.Outcome

Methods

parseJSON :: Value -> Parser (WaitReason tx)

parseJSONList :: Value -> Parser [WaitReason tx]

omittedField :: Maybe (WaitReason tx)

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-0.20.0-5pXAEiXeWsXH8K4KfwlMxW" 'False) (((C1 ('MetaCons "WaitOnNotApplicableTx" 'PrefixI 'True) (S1 ('MetaSel ('Just "validationError") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ValidationError)) :+: C1 ('MetaCons "WaitOnSnapshotNumber" 'PrefixI 'True) (S1 ('MetaSel ('Just "waitingForNumber") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SnapshotNumber))) :+: (C1 ('MetaCons "WaitOnSnapshotVersion" 'PrefixI 'True) (S1 ('MetaSel ('Just "waitingForVersion") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SnapshotVersion)) :+: C1 ('MetaCons "WaitOnSeenSnapshot" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "WaitOnTxs" 'PrefixI 'True) (S1 ('MetaSel ('Just "waitingForTxIds") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [TxIdType tx])) :+: C1 ('MetaCons "WaitOnContestationDeadline" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "WaitOnNotApplicableDecommitTx" 'PrefixI 'True) (S1 ('MetaSel ('Just "notApplicableReason") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (DecommitInvalidReason tx))) :+: (C1 ('MetaCons "WaitOnUnresolvedCommit" 'PrefixI 'True) (S1 ('MetaSel ('Just "commitUTxO") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (UTxOType tx))) :+: C1 ('MetaCons "WaitOnUnresolvedDecommit" 'PrefixI 'True) (S1 ('MetaSel ('Just "decommitTx") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 tx))))))