Safe Haskell | None |
---|---|
Language | Haskell2010 |
Ouroboros.Consensus.Byron.Ledger.Mempool
Description
Byron mempool integration
Synopsis
- data family GenTx blk
- data family TxId blk
- data family Validated x
- byronIdDlg ∷ ACertificate ByteString → CertificateId
- byronIdProp ∷ AProposal ByteString → UpId
- byronIdTx ∷ ATxAux ByteString → TxId
- byronIdVote ∷ AVote ByteString → VoteId
- decodeByronApplyTxError ∷ Decoder s (ApplyTxErr ByronBlock)
- decodeByronGenTx ∷ Decoder s (GenTx ByronBlock)
- decodeByronGenTxId ∷ Decoder s (GenTxId ByronBlock)
- encodeByronApplyTxError ∷ ApplyTxErr ByronBlock → Encoding
- encodeByronGenTx ∷ GenTx ByronBlock → Encoding
- encodeByronGenTxId ∷ GenTxId ByronBlock → Encoding
- fromMempoolPayload ∷ AMempoolPayload ByteString → GenTx ByronBlock
- toMempoolPayload ∷ GenTx ByronBlock → AMempoolPayload ByteString
- countByronGenTxs ∷ ByronBlock → Word64
Mempool integration
data family GenTx blk Source #
Generalized transaction
The mempool (and, accordingly, blocks) consist of "generalized transactions"; this could be "proper" transactions (transferring funds) but also other kinds of things such as update proposals, delegations, etc.
Instances
A generalized transaction, GenTx
, identifier.
Instances
SerialiseNodeToClient ByronBlock (GenTxId ByronBlock) Source # | |
Defined in Ouroboros.Consensus.Byron.Node.Serialisation | |
SerialiseNodeToNode ByronBlock (GenTxId ByronBlock) Source # | |
Defined in Ouroboros.Consensus.Byron.Node.Serialisation | |
(Typeable m, Typeable a) ⇒ ShowProxy (TxId (GenTx (DualBlock m a)) ∷ Type) | |
ShowProxy (TxId (GenTx ByronBlock)) Source # | |
Defined in Ouroboros.Consensus.Byron.Ledger.Mempool | |
(Typeable era, Typeable proto) ⇒ ShowProxy (TxId (GenTx (ShelleyBlock proto era)) ∷ Type) Source # | |
Defined in Ouroboros.Consensus.Shelley.Ledger.Mempool | |
(Typeable era, Typeable proto, Crypto (ProtoCrypto proto)) ⇒ DecCBOR (TxId (GenTx (ShelleyBlock proto era))) Source # | |
(Typeable era, Typeable proto, Crypto (ProtoCrypto proto)) ⇒ EncCBOR (TxId (GenTx (ShelleyBlock proto era))) Source # | |
Defined in Ouroboros.Consensus.Shelley.Ledger.Mempool Methods encCBOR ∷ TxId (GenTx (ShelleyBlock proto era)) → Encoding Source # encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (TxId (GenTx (ShelleyBlock proto era))) → Size Source # encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [TxId (GenTx (ShelleyBlock proto era))] → Size Source # | |
Show (GenTxId ByronBlock) Source # | |
Defined in Ouroboros.Consensus.Byron.Ledger.Mempool | |
Show (GenTxId (ShelleyBlock proto era)) Source # | |
Defined in Ouroboros.Consensus.Shelley.Ledger.Mempool | |
Show (GenTxId m) ⇒ Show (TxId (GenTx (DualBlock m a))) | |
Eq (GenTxId m) ⇒ Eq (TxId (GenTx (DualBlock m a))) | |
Eq (TxId (GenTx ByronBlock)) Source # | |
Defined in Ouroboros.Consensus.Byron.Ledger.Mempool Methods (==) ∷ TxId (GenTx ByronBlock) → TxId (GenTx ByronBlock) → Bool # (/=) ∷ TxId (GenTx ByronBlock) → TxId (GenTx ByronBlock) → Bool # | |
Eq (TxId (GenTx (ShelleyBlock proto era))) Source # | |
Defined in Ouroboros.Consensus.Shelley.Ledger.Mempool Methods (==) ∷ TxId (GenTx (ShelleyBlock proto era)) → TxId (GenTx (ShelleyBlock proto era)) → Bool # (/=) ∷ TxId (GenTx (ShelleyBlock proto era)) → TxId (GenTx (ShelleyBlock proto era)) → Bool # | |
Ord (GenTxId m) ⇒ Ord (TxId (GenTx (DualBlock m a))) | |
Defined in Ouroboros.Consensus.Ledger.Dual Methods compare ∷ TxId (GenTx (DualBlock m a)) → TxId (GenTx (DualBlock m a)) → Ordering # (<) ∷ TxId (GenTx (DualBlock m a)) → TxId (GenTx (DualBlock m a)) → Bool # (<=) ∷ TxId (GenTx (DualBlock m a)) → TxId (GenTx (DualBlock m a)) → Bool # (>) ∷ TxId (GenTx (DualBlock m a)) → TxId (GenTx (DualBlock m a)) → Bool # (>=) ∷ TxId (GenTx (DualBlock m a)) → TxId (GenTx (DualBlock m a)) → Bool # max ∷ TxId (GenTx (DualBlock m a)) → TxId (GenTx (DualBlock m a)) → TxId (GenTx (DualBlock m a)) # min ∷ TxId (GenTx (DualBlock m a)) → TxId (GenTx (DualBlock m a)) → TxId (GenTx (DualBlock m a)) # | |
Ord (TxId (GenTx ByronBlock)) Source # | |
Defined in Ouroboros.Consensus.Byron.Ledger.Mempool Methods compare ∷ TxId (GenTx ByronBlock) → TxId (GenTx ByronBlock) → Ordering # (<) ∷ TxId (GenTx ByronBlock) → TxId (GenTx ByronBlock) → Bool # (<=) ∷ TxId (GenTx ByronBlock) → TxId (GenTx ByronBlock) → Bool # (>) ∷ TxId (GenTx ByronBlock) → TxId (GenTx ByronBlock) → Bool # (>=) ∷ TxId (GenTx ByronBlock) → TxId (GenTx ByronBlock) → Bool # max ∷ TxId (GenTx ByronBlock) → TxId (GenTx ByronBlock) → TxId (GenTx ByronBlock) # min ∷ TxId (GenTx ByronBlock) → TxId (GenTx ByronBlock) → TxId (GenTx ByronBlock) # | |
Ord (TxId (GenTx (ShelleyBlock proto era))) Source # | |
Defined in Ouroboros.Consensus.Shelley.Ledger.Mempool Methods compare ∷ TxId (GenTx (ShelleyBlock proto era)) → TxId (GenTx (ShelleyBlock proto era)) → Ordering # (<) ∷ TxId (GenTx (ShelleyBlock proto era)) → TxId (GenTx (ShelleyBlock proto era)) → Bool # (<=) ∷ TxId (GenTx (ShelleyBlock proto era)) → TxId (GenTx (ShelleyBlock proto era)) → Bool # (>) ∷ TxId (GenTx (ShelleyBlock proto era)) → TxId (GenTx (ShelleyBlock proto era)) → Bool # (>=) ∷ TxId (GenTx (ShelleyBlock proto era)) → TxId (GenTx (ShelleyBlock proto era)) → Bool # max ∷ TxId (GenTx (ShelleyBlock proto era)) → TxId (GenTx (ShelleyBlock proto era)) → TxId (GenTx (ShelleyBlock proto era)) # min ∷ TxId (GenTx (ShelleyBlock proto era)) → TxId (GenTx (ShelleyBlock proto era)) → TxId (GenTx (ShelleyBlock proto era)) # | |
NoThunks (TxId (GenTx (DualBlock m a))) | |
NoThunks (TxId (GenTx ByronBlock)) Source # | |
NoThunks (TxId (GenTx (ShelleyBlock proto era))) Source # | |
Defined in Ouroboros.Consensus.Shelley.Ledger.Mempool | |
Condense (GenTxId ByronBlock) Source # | |
Defined in Ouroboros.Consensus.Byron.Ledger.Mempool | |
Condense (GenTxId (ShelleyBlock proto era)) Source # | |
Defined in Ouroboros.Consensus.Shelley.Ledger.Mempool | |
ShelleyCompatible proto era ⇒ SerialiseNodeToClient (ShelleyBlock proto era) (GenTxId (ShelleyBlock proto era)) Source # | |
Defined in Ouroboros.Consensus.Shelley.Node.Serialisation Methods encodeNodeToClient ∷ CodecConfig (ShelleyBlock proto era) → BlockNodeToClientVersion (ShelleyBlock proto era) → GenTxId (ShelleyBlock proto era) → Encoding Source # decodeNodeToClient ∷ CodecConfig (ShelleyBlock proto era) → BlockNodeToClientVersion (ShelleyBlock proto era) → ∀ s. Decoder s (GenTxId (ShelleyBlock proto era)) Source # | |
ShelleyCompatible proto era ⇒ SerialiseNodeToNode (ShelleyBlock proto era) (GenTxId (ShelleyBlock proto era)) Source # | |
Defined in Ouroboros.Consensus.Shelley.Node.Serialisation Methods encodeNodeToNode ∷ CodecConfig (ShelleyBlock proto era) → BlockNodeToNodeVersion (ShelleyBlock proto era) → GenTxId (ShelleyBlock proto era) → Encoding Source # decodeNodeToNode ∷ CodecConfig (ShelleyBlock proto era) → BlockNodeToNodeVersion (ShelleyBlock proto era) → ∀ s. Decoder s (GenTxId (ShelleyBlock proto era)) Source # | |
type Rep (TxId (GenTx (HardForkBlock xs))) | |
Defined in Ouroboros.Consensus.HardFork.Combinator.Mempool type Rep (TxId (GenTx (HardForkBlock xs))) = D1 ('MetaData "TxId" "Ouroboros.Consensus.HardFork.Combinator.Mempool" "ouroboros-consensus-0.26.0.0-inplace" 'True) (C1 ('MetaCons "HardForkGenTxId" 'PrefixI 'True) (S1 ('MetaSel ('Just "getHardForkGenTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (OneEraGenTxId xs)))) | |
newtype TxId (GenTx (HardForkBlock xs)) | |
newtype TxId (GenTx (DualBlock m a)) | |
Defined in Ouroboros.Consensus.Ledger.Dual | |
data TxId (GenTx ByronBlock) Source # | |
Defined in Ouroboros.Consensus.Byron.Ledger.Mempool | |
newtype TxId (GenTx (ShelleyBlock proto era)) Source # | |
Defined in Ouroboros.Consensus.Shelley.Ledger.Mempool |
data family Validated x Source #
" Validated " transaction or block
The ledger defines how to validate transactions and blocks. It's possible the type before and after validation may be distinct (eg Alonzo transactions), which originally motivated this family.
We also gain the related benefit that certain interface functions, such as those that reapply blocks, can have a more precise type now. TODO
Similarly, the Node-to-Client mini protocols can explicitly indicate that the
client trusts the blocks from the local server, by having the server send
Validated
blocks to the client. TODO
Note that validation has different implications for a transaction than for a block. In particular, a validated transaction can be " reapplied " to different ledger states, whereas a validated block must only be " reapplied " to the exact same ledger state (eg as part of rebuilding from an on-disk ledger snapshot).
Since the ledger defines validation, see the ledger details for concrete
examples of what determines the validity (wrt to a LedgerState
) of a
transaction and/or block. Example properties include: a transaction's claimed
inputs exist and are still unspent, a block carries a sufficient
cryptographic signature, etc.
Instances
(Typeable era, Typeable proto) ⇒ ShowProxy (Validated (GenTx (ShelleyBlock proto era)) ∷ Type) Source # | |||||
Defined in Ouroboros.Consensus.Shelley.Ledger.Mempool | |||||
Generic (Validated (GenTx ByronBlock)) Source # | |||||
Defined in Ouroboros.Consensus.Byron.Ledger.Mempool Associated Types
Methods from ∷ Validated (GenTx ByronBlock) → Rep (Validated (GenTx ByronBlock)) x # to ∷ Rep (Validated (GenTx ByronBlock)) x → Validated (GenTx ByronBlock) # | |||||
Generic (Validated (GenTx (ShelleyBlock proto era))) Source # | |||||
Defined in Ouroboros.Consensus.Shelley.Ledger.Mempool Associated Types
Methods from ∷ Validated (GenTx (ShelleyBlock proto era)) → Rep (Validated (GenTx (ShelleyBlock proto era))) x # to ∷ Rep (Validated (GenTx (ShelleyBlock proto era))) x → Validated (GenTx (ShelleyBlock proto era)) # | |||||
Bridge m a ⇒ Show (Validated (GenTx (DualBlock m a))) | |||||
Show (Validated (GenTx ByronBlock)) Source # | |||||
Defined in Ouroboros.Consensus.Byron.Ledger.Mempool | |||||
ShelleyBasedEra era ⇒ Show (Validated (GenTx (ShelleyBlock proto era))) Source # | |||||
Defined in Ouroboros.Consensus.Shelley.Ledger.Mempool | |||||
Eq (Validated (GenTx ByronBlock)) Source # | |||||
Defined in Ouroboros.Consensus.Byron.Ledger.Mempool Methods (==) ∷ Validated (GenTx ByronBlock) → Validated (GenTx ByronBlock) → Bool # (/=) ∷ Validated (GenTx ByronBlock) → Validated (GenTx ByronBlock) → Bool # | |||||
ShelleyBasedEra era ⇒ Eq (Validated (GenTx (ShelleyBlock proto era))) Source # | |||||
Defined in Ouroboros.Consensus.Shelley.Ledger.Mempool Methods (==) ∷ Validated (GenTx (ShelleyBlock proto era)) → Validated (GenTx (ShelleyBlock proto era)) → Bool # (/=) ∷ Validated (GenTx (ShelleyBlock proto era)) → Validated (GenTx (ShelleyBlock proto era)) → Bool # | |||||
NoThunks (Validated (GenTx (DualBlock m a))) | |||||
NoThunks (Validated (GenTx ByronBlock)) Source # | |||||
ShelleyBasedEra era ⇒ NoThunks (Validated (GenTx (ShelleyBlock proto era))) Source # | |||||
Defined in Ouroboros.Consensus.Shelley.Ledger.Mempool | |||||
type Rep (Validated (GenTx (HardForkBlock xs))) | |||||
Defined in Ouroboros.Consensus.HardFork.Combinator.Mempool type Rep (Validated (GenTx (HardForkBlock xs))) = D1 ('MetaData "Validated" "Ouroboros.Consensus.HardFork.Combinator.Mempool" "ouroboros-consensus-0.26.0.0-inplace" 'True) (C1 ('MetaCons "HardForkValidatedGenTx" 'PrefixI 'True) (S1 ('MetaSel ('Just "getHardForkValidatedGenTx") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (OneEraValidatedGenTx xs)))) | |||||
type Rep (Validated (GenTx ByronBlock)) Source # | |||||
Defined in Ouroboros.Consensus.Byron.Ledger.Mempool type Rep (Validated (GenTx ByronBlock)) = D1 ('MetaData "Validated" "Ouroboros.Consensus.Byron.Ledger.Mempool" "ouroboros-consensus-cardano-0.25.0.1-inplace" 'True) (C1 ('MetaCons "ValidatedByronTx" 'PrefixI 'True) (S1 ('MetaSel ('Just "forgetValidatedByronTx") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (GenTx ByronBlock)))) | |||||
type Rep (Validated (GenTx (ShelleyBlock proto era))) Source # | |||||
Defined in Ouroboros.Consensus.Shelley.Ledger.Mempool type Rep (Validated (GenTx (ShelleyBlock proto era))) = D1 ('MetaData "Validated" "Ouroboros.Consensus.Shelley.Ledger.Mempool" "ouroboros-consensus-cardano-0.25.0.1-inplace" 'False) (C1 ('MetaCons "ShelleyValidatedTx" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TxId) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Validated (Tx era))))) | |||||
newtype Validated (GenTx (HardForkBlock xs)) | |||||
data Validated (GenTx (DualBlock m a)) | |||||
Defined in Ouroboros.Consensus.Ledger.Dual data Validated (GenTx (DualBlock m a)) = ValidatedDualGenTx {
| |||||
newtype Validated (GenTx ByronBlock) Source # | |||||
Defined in Ouroboros.Consensus.Byron.Ledger.Mempool | |||||
data Validated (GenTx (ShelleyBlock proto era)) Source # | |||||
Defined in Ouroboros.Consensus.Shelley.Ledger.Mempool |
Transaction IDs
Serialisation
decodeByronGenTx ∷ Decoder s (GenTx ByronBlock) Source #
The ByteString
annotation will be the canonical encoding.
While the new implementation does not care about canonical encodings, the
old one does. When a generalised transaction arrives that is not in its
canonical encoding (only the ATxAux
of the ByronTx
can be
produced by nodes that are not under our control), the old implementation
will reject it. Therefore, we need to reject them too. See #905.
We use the ledger to check for canonical encodings: the ledger will check
whether the signed hash of the transaction (in the case of a
ATxAux
, the transaction witness) matches the annotated
bytestring. Is therefore important that the annotated bytestring be the
canonical encoding, not the original, possibly non-canonical encoding.
Low-level API (primarily for testing)
Auxiliary functions
countByronGenTxs ∷ ByronBlock → Word64 Source #
Count all (generalized) transactions in the block
Orphan instances
HasTxs ByronBlock Source # | |||||
Methods extractTxs ∷ ByronBlock → [GenTx ByronBlock] Source # | |||||
LedgerSupportsMempool ByronBlock Source # | |||||
Methods txInvariant ∷ GenTx ByronBlock → Bool Source # applyTx ∷ LedgerConfig ByronBlock → WhetherToIntervene → SlotNo → GenTx ByronBlock → TickedLedgerState ByronBlock ValuesMK → Except (ApplyTxErr ByronBlock) (TickedLedgerState ByronBlock DiffMK, Validated (GenTx ByronBlock)) Source # reapplyTx ∷ ComputeDiffs → LedgerConfig ByronBlock → SlotNo → Validated (GenTx ByronBlock) → TickedLedgerState ByronBlock ValuesMK → Except (ApplyTxErr ByronBlock) (TickedLedgerState ByronBlock TrackingMK) Source # reapplyTxs ∷ ComputeDiffs → LedgerConfig ByronBlock → SlotNo → [(Validated (GenTx ByronBlock), extra)] → TickedLedgerState ByronBlock ValuesMK → ReapplyTxsResult extra ByronBlock Source # txForgetValidated ∷ Validated (GenTx ByronBlock) → GenTx ByronBlock Source # getTransactionKeySets ∷ GenTx ByronBlock → LedgerTables (LedgerState ByronBlock) KeysMK Source # prependMempoolDiffs ∷ TickedLedgerState ByronBlock DiffMK → TickedLedgerState ByronBlock DiffMK → TickedLedgerState ByronBlock DiffMK Source # applyMempoolDiffs ∷ LedgerTables (LedgerState ByronBlock) ValuesMK → LedgerTables (LedgerState ByronBlock) KeysMK → TickedLedgerState ByronBlock DiffMK → TickedLedgerState ByronBlock ValuesMK Source # | |||||
TxLimits ByronBlock Source # | |||||
Associated Types
Methods txMeasure ∷ LedgerConfig ByronBlock → TickedLedgerState ByronBlock ValuesMK → GenTx ByronBlock → Except (ApplyTxErr ByronBlock) (TxMeasure ByronBlock) Source # blockCapacityTxMeasure ∷ ∀ (mk ∷ MapKind). LedgerConfig ByronBlock → TickedLedgerState ByronBlock mk → TxMeasure ByronBlock Source # | |||||
ShowProxy ApplyMempoolPayloadErr Source # | |||||
ShowProxy (GenTx ByronBlock) Source # | |||||
ShowProxy (TxId (GenTx ByronBlock)) Source # | |||||
Generic (Validated (GenTx ByronBlock)) Source # | |||||
Associated Types
Methods from ∷ Validated (GenTx ByronBlock) → Rep (Validated (GenTx ByronBlock)) x # to ∷ Rep (Validated (GenTx ByronBlock)) x → Validated (GenTx ByronBlock) # | |||||
Generic (GenTx ByronBlock) Source # | |||||
Associated Types
Methods from ∷ GenTx ByronBlock → Rep (GenTx ByronBlock) x # to ∷ Rep (GenTx ByronBlock) x → GenTx ByronBlock # | |||||
Show (Validated (GenTx ByronBlock)) Source # | |||||
Show (GenTx ByronBlock) Source # | |||||
Show (GenTxId ByronBlock) Source # | |||||
Eq (Validated (GenTx ByronBlock)) Source # | |||||
Methods (==) ∷ Validated (GenTx ByronBlock) → Validated (GenTx ByronBlock) → Bool # (/=) ∷ Validated (GenTx ByronBlock) → Validated (GenTx ByronBlock) → Bool # | |||||
Eq (GenTx ByronBlock) Source # | |||||
Methods (==) ∷ GenTx ByronBlock → GenTx ByronBlock → Bool # (/=) ∷ GenTx ByronBlock → GenTx ByronBlock → Bool # | |||||
Eq (TxId (GenTx ByronBlock)) Source # | |||||
Methods (==) ∷ TxId (GenTx ByronBlock) → TxId (GenTx ByronBlock) → Bool # (/=) ∷ TxId (GenTx ByronBlock) → TxId (GenTx ByronBlock) → Bool # | |||||
Ord (TxId (GenTx ByronBlock)) Source # | |||||
Methods compare ∷ TxId (GenTx ByronBlock) → TxId (GenTx ByronBlock) → Ordering # (<) ∷ TxId (GenTx ByronBlock) → TxId (GenTx ByronBlock) → Bool # (<=) ∷ TxId (GenTx ByronBlock) → TxId (GenTx ByronBlock) → Bool # (>) ∷ TxId (GenTx ByronBlock) → TxId (GenTx ByronBlock) → Bool # (>=) ∷ TxId (GenTx ByronBlock) → TxId (GenTx ByronBlock) → Bool # max ∷ TxId (GenTx ByronBlock) → TxId (GenTx ByronBlock) → TxId (GenTx ByronBlock) # min ∷ TxId (GenTx ByronBlock) → TxId (GenTx ByronBlock) → TxId (GenTx ByronBlock) # | |||||
NoThunks (Validated (GenTx ByronBlock)) Source # | |||||
NoThunks (GenTx ByronBlock) Source # | |||||
NoThunks (TxId (GenTx ByronBlock)) Source # | |||||
ConvertRawTxId (GenTx ByronBlock) Source # | |||||
Methods toRawTxIdHash ∷ TxId (GenTx ByronBlock) → ShortByteString Source # | |||||
HasTxId (GenTx ByronBlock) Source # | |||||
Methods txId ∷ GenTx ByronBlock → TxId (GenTx ByronBlock) Source # | |||||
Condense (GenTx ByronBlock) Source # | |||||
Condense (GenTxId ByronBlock) Source # | |||||