| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Hydra.Tx.Snapshot
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 :: [tx]
- utxo :: UTxOType tx
- utxoToCommit :: Maybe (UTxOType tx)
- depositTxId :: Maybe (TxIdType tx)
- utxoToDecommit :: Maybe (UTxOType tx)
- accumulator :: HydraAccumulator
- commitOutputsHash :: forall tx. IsTx tx => Snapshot tx -> ByteString
- snapshotCBORTag :: Text
- snapshotCBORTagV1 :: Text
- snapshotUTxO :: IsTx tx => Snapshot tx -> UTxOType tx
- data ConfirmedSnapshot tx
- = InitialSnapshot { }
- | ConfirmedSnapshot {
- snapshot :: Snapshot tx
- signatures :: MultiSignature (Snapshot tx)
- getSnapshot :: forall tx. IsTx tx => ConfirmedSnapshot tx -> Snapshot tx
SnapshotNumber and SnapshotVersion
newtype SnapshotNumber Source #
Constructors
| UnsafeSnapshotNumber Natural |
Instances
fromChainSnapshotNumber :: SnapshotNumber -> SnapshotNumber Source #
newtype SnapshotVersion Source #
Constructors
| UnsafeSnapshotVersion Natural |
Instances
fromChainSnapshotVersion :: SnapshotVersion -> SnapshotVersion Source #
Snapshot
Constructors
| Snapshot | |
Fields
| |
Instances
| IsTx tx => FromJSON (Snapshot tx) Source # | |
Defined in Hydra.Tx.Snapshot Methods 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 Methods 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 # | |
| IsTx tx => FromCBOR (Snapshot tx) Source # | |
| IsTx tx => ToCBOR (Snapshot tx) Source # | |
Defined in Hydra.Tx.Snapshot Methods 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 28 version = uint number = uint accumulatorHash = bytes .size 32 ; blake2b-256 hash of the compressed G1 accumulator commitment decommitOutputsHash = bytes .size 32 ; sha2-256 of the ordered decommit outputs (Uω) commitOutputsHash = bytes .size 32 ; sha2-256 of the ordered commit outputs (Uα) ; and of the deposit transaction id The BLS accumulator commitment (bound via accumulatorHash) commits to the full
UTxO set.
|
Defined in Hydra.Tx.Snapshot Methods 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-2.3.0-AmphLXDqLbeiaw5uNmLIz" '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 [tx]))) :*: ((S1 ('MetaSel ('Just "utxo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (UTxOType tx)) :*: S1 ('MetaSel ('Just "utxoToCommit") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (UTxOType tx)))) :*: (S1 ('MetaSel ('Just "depositTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (TxIdType tx))) :*: (S1 ('MetaSel ('Just "utxoToDecommit") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (UTxOType tx))) :*: S1 ('MetaSel ('Just "accumulator") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 HydraAccumulator)))))) | |
commitOutputsHash :: forall tx. IsTx tx => Snapshot tx -> ByteString Source #
Digest of a snapshot's pending commit (Uα) as bound into its signature: the ordered commit outputs together with the id of the deposit transaction they come from.
Both halves are required. The outputs alone do not identify a deposit, since a
deposit datum is unauthenticated data anyone can copy into a look-alike
deposit holding less value; binding the deposit's transaction id makes the
signature usable for that one deposit only. The increment validator recomputes
this from the deposit input it claims, see checkIncrement.
Close, contest and decrement transactions cannot recompute it (they spend no
deposit) and carry it in their redeemer instead, where it only feeds signature
verification.
snapshotCBORTag :: Text Source #
Tag of the current on-disk/wire layout, which carries $sel:depositTxId:Snapshot.
The fields are a bare concatenation with no length prefix, so a layout change
is only decodable when the tag distinguishes it: snapshotCBORTagV1 names the
one written before $sel:depositTxId:Snapshot existed and is still accepted, letting a node
replay an event log from an earlier version.
snapshotCBORTagV1 :: Text Source #
Tag of the layout without $sel:depositTxId:Snapshot. Decoded, never written.
snapshotUTxO :: IsTx tx => Snapshot tx -> UTxOType tx Source #
All UTxOs represented by this snapshot: settled plus any pending commit/decommit.
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.
Constructors
| InitialSnapshot | |
| ConfirmedSnapshot | |
Fields
| |
Instances
getSnapshot :: forall tx. IsTx tx => 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 explicitly define a getter which
will force us into thinking about changing the signature properly if this
happens.