Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- data HeadState tx
- = Idle (IdleState tx)
- | Initial (InitialState tx)
- | Open (OpenState tx)
- | Closed (ClosedState tx)
- setChainState :: ChainStateType tx -> HeadState tx -> HeadState tx
- getHeadParameters :: HeadState tx -> Maybe HeadParameters
- newtype IdleState tx = IdleState {
- chainState :: ChainStateType tx
- data InitialState tx = InitialState {}
- type PendingCommits = Set Party
- type Committed tx = Map Party (UTxOType tx)
- data OpenState tx = OpenState {}
- data CoordinatedHeadState tx = CoordinatedHeadState {
- localUTxO :: UTxOType tx
- localTxs :: [tx]
- allTxs :: Map (TxIdType tx) tx
- confirmedSnapshot :: ConfirmedSnapshot tx
- seenSnapshot :: SeenSnapshot tx
- data SeenSnapshot tx
- = NoSeenSnapshot
- | LastSeenSnapshot { }
- | RequestedSnapshot { }
- | SeenSnapshot { }
- seenSnapshotNumber :: SeenSnapshot tx -> SnapshotNumber
- data ClosedState tx = ClosedState {}
Documentation
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 (InitialState, 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 actualy not be needed in the HeadState anymore as we
do not persist the HeadState
and not access it in the HeadLogic either.
Idle (IdleState tx) | |
Initial (InitialState tx) | |
Open (OpenState tx) | |
Closed (ClosedState tx) |
Instances
setChainState :: ChainStateType tx -> HeadState tx -> HeadState tx Source #
Update the chain state in any HeadState
.
getHeadParameters :: HeadState tx -> Maybe HeadParameters Source #
Get the head parameters in any HeadState
.
Idle
An Idle
head only having a chain state with things seen on chain so far.
Instances
Initial
data InitialState tx Source #
An Initial
head which already has an identity and is collecting commits.
InitialState | |
|
Instances
type PendingCommits = Set Party Source #
Open
An Open
head with a CoordinatedHeadState
tracking off-chain
transactions.
OpenState | |
|
Instances
data CoordinatedHeadState tx Source #
Off-chain state of the Coordinated Head protocol.
CoordinatedHeadState | |
|
Instances
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.
NoSeenSnapshot | Never saw a ReqSn. |
LastSeenSnapshot | No snapshot in flight with last seen snapshot number as given. |
RequestedSnapshot | ReqSn was sent out and it should be considered already in flight. |
SeenSnapshot | ReqSn for given snapshot was received. |
Instances
seenSnapshotNumber :: SeenSnapshot tx -> SnapshotNumber Source #
Get the last seen snapshot number given a SeenSnapshot
.
Closed
data ClosedState tx Source #
An Closed
head with an current candidate ConfirmedSnapshot
, which may
be contested before the $sel:contestationDeadline:ClosedState
.
ClosedState | |
|