Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- newtype SnapshotNumber = UnsafeSnapshotNumber Natural
- fromChainSnapshotNumber :: SnapshotNumber -> SnapshotNumber
- newtype SnapshotVersion = UnsafeSnapshotVersion Natural
- fromChainSnapshotVersion :: SnapshotVersion -> SnapshotVersion
- data Snapshot tx = Snapshot {
- headId :: HeadId
- version :: SnapshotVersion
- number :: SnapshotNumber
- confirmed :: [TxIdType tx]
- utxo :: UTxOType tx
- utxoToDecommit :: Maybe (UTxOType tx)
- data ConfirmedSnapshot tx
- = InitialSnapshot {
- headId :: HeadId
- initialUTxO :: UTxOType tx
- | ConfirmedSnapshot {
- snapshot :: Snapshot tx
- signatures :: MultiSignature (Snapshot tx)
- = InitialSnapshot {
- getSnapshot :: ConfirmedSnapshot tx -> Snapshot tx
- isInitialSnapshot :: ConfirmedSnapshot tx -> Bool
- genConfirmedSnapshot :: IsTx tx => HeadId -> SnapshotVersion -> SnapshotNumber -> UTxOType tx -> Maybe (UTxOType tx) -> [SigningKey HydraKey] -> Gen (ConfirmedSnapshot tx)
SnapshotNumber and SnapshotVersion
newtype SnapshotNumber Source #
Instances
fromChainSnapshotNumber :: SnapshotNumber -> SnapshotNumber Source #
newtype SnapshotVersion Source #
Instances
fromChainSnapshotVersion :: SnapshotVersion -> SnapshotVersion Source #
Snapshot
Snapshot | |
|
Instances
(Arbitrary (UTxOType tx), Arbitrary (TxIdType tx)) => Arbitrary (Snapshot tx) Source # | |
IsTx tx => FromJSON (Snapshot tx) Source # | |
Defined in Hydra.Tx.Snapshot parseJSON :: Value -> Parser (Snapshot tx) parseJSONList :: Value -> Parser [Snapshot tx] omittedField :: Maybe (Snapshot tx) | |
IsTx tx => ToJSON (Snapshot tx) Source # | |
Defined in Hydra.Tx.Snapshot toJSON :: Snapshot tx -> Value toEncoding :: Snapshot tx -> Encoding toJSONList :: [Snapshot tx] -> Value toEncodingList :: [Snapshot tx] -> Encoding | |
Generic (Snapshot tx) Source # | |
IsTx tx => Show (Snapshot tx) Source # | |
(Typeable tx, FromCBOR (UTxOType tx), FromCBOR (TxIdType tx)) => FromCBOR (Snapshot tx) Source # | |
(Typeable tx, ToCBOR (UTxOType tx), ToCBOR (TxIdType tx)) => ToCBOR (Snapshot tx) Source # | |
Defined in Hydra.Tx.Snapshot toCBOR :: Snapshot tx -> Encoding encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy (Snapshot tx) -> Size encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [Snapshot tx] -> Size | |
IsTx tx => SignableRepresentation (Snapshot tx) Source # | Binary representation of snapshot signatures. That is, concatenated CBOR for
headId = bytes .size 16 version = uint number = uint utxoHash = bytes utxoToDecommitHash = bytes where hashes are the result of applying |
Defined in Hydra.Tx.Snapshot getSignableRepresentation :: Snapshot tx -> ByteString | |
IsTx tx => Eq (Snapshot tx) Source # | |
type Rep (Snapshot tx) Source # | |
Defined in Hydra.Tx.Snapshot type Rep (Snapshot tx) = D1 ('MetaData "Snapshot" "Hydra.Tx.Snapshot" "hydra-tx-0.19.0-GruKCDFrYmltVsR6Cb5jZ" 'False) (C1 ('MetaCons "Snapshot" 'PrefixI 'True) ((S1 ('MetaSel ('Just "headId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HeadId) :*: (S1 ('MetaSel ('Just "version") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SnapshotVersion) :*: S1 ('MetaSel ('Just "number") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SnapshotNumber))) :*: (S1 ('MetaSel ('Just "confirmed") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [TxIdType tx]) :*: (S1 ('MetaSel ('Just "utxo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (UTxOType tx)) :*: S1 ('MetaSel ('Just "utxoToDecommit") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (UTxOType tx))))))) |
ConfirmedSnapshot
data ConfirmedSnapshot tx Source #
A snapshot that can be used to close a head with. Either the initial one, or when it was signed by all parties, i.e. it is confirmed.
InitialSnapshot | |
| |
ConfirmedSnapshot | |
|
Instances
getSnapshot :: ConfirmedSnapshot tx -> Snapshot tx Source #
Safely get a Snapshot
from a confirmed snapshot.
NOTE: While we could use $sel:snapshot:InitialSnapshot
directly, this is a record-field accessor
which may become partial (and lead to unnoticed runtime errors) if we ever
add a new branch to the sumtype. So, we explicitely define a getter which
will force us into thinking about changing the signature properly if this
happens.
isInitialSnapshot :: ConfirmedSnapshot tx -> Bool Source #
Tell whether a snapshot is the initial snapshot coming from the collect-com transaction.
:: IsTx tx | |
=> HeadId | |
-> SnapshotVersion | Exact snapshot version to generate. |
-> SnapshotNumber | The lower bound on snapshot number to generate.
If this is 0, then we can generate an |
-> UTxOType tx | |
-> Maybe (UTxOType tx) | |
-> [SigningKey HydraKey] | |
-> Gen (ConfirmedSnapshot tx) |