Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data ByronBlock
- type family ChainDepState p
- data family GenTx blk
- data EraMismatch = EraMismatch {
- ledgerEraName :: !Text
- otherEraName :: !Text
- data PastHorizonException
- class ConsensusProtocol p => PraosProtocolSupportsNode p
- type family PraosProtocolSupportsNodeCrypto p
- data ShelleyGenesisStaking c = ShelleyGenesisStaking {}
- byronIdTx :: ATxAux ByteString -> TxId
- condense :: Condense a => a -> String
- getOpCertCounters :: PraosProtocolSupportsNode p => proxy p -> ChainDepState p -> Map (KeyHash 'BlockIssuer (PraosProtocolSupportsNodeCrypto p)) Word64
- interpreterToEpochInfo :: forall (xs :: [Type]). Interpreter xs -> EpochInfo (Except PastHorizonException)
- unsafeExtendSafeZone :: forall (xs :: [Type]). Interpreter xs -> Interpreter xs
- txId :: HasTxId tx => tx -> TxId tx
Documentation
data ByronBlock Source #
Byron block
We cache two bits of information:
- We cache the slot number as this is not readily available for EBBs.
Having it cached allows us to e.g. give a
HasHeader
instance. - We cache the hash as this is expensive to compute and we need it often.
Instances
type family ChainDepState p Source #
Protocol-specific state
NOTE: This chain is blockchain dependent, i.e., updated when new blocks come in (more precisely, new headers), and subject to rollback.
Instances
type ChainDepState (HardForkProtocol xs) | |
type ChainDepState (Bft c) | |
Defined in Ouroboros.Consensus.Protocol.BFT | |
type ChainDepState (PBft c) | |
Defined in Ouroboros.Consensus.Protocol.PBFT | |
type ChainDepState (Praos c) | |
Defined in Ouroboros.Consensus.Protocol.Praos | |
type ChainDepState (TPraos c) | |
Defined in Ouroboros.Consensus.Protocol.TPraos | |
type ChainDepState (ModChainSel p s) | |
Defined in Ouroboros.Consensus.Protocol.ModChainSel |
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
Inject GenTx | |
Defined in Ouroboros.Consensus.HardFork.Combinator.Embed.Nary inject :: forall x (xs :: [Type]). CanHardFork xs => Exactly xs Bound -> Index xs x -> GenTx x -> GenTx (HardForkBlock xs) Source # | |
Isomorphic GenTx | |
Defined in Ouroboros.Consensus.HardFork.Combinator.Embed.Unary project :: NoHardForks blk => GenTx (HardForkBlock '[blk]) -> GenTx blk Source # inject :: NoHardForks blk => GenTx blk -> GenTx (HardForkBlock '[blk]) Source # | |
(Typeable m, Typeable a) => ShowProxy (GenTx (DualBlock m a) :: Type) | |
(Typeable m, Typeable a) => ShowProxy (TxId (GenTx (DualBlock m a)) :: Type) | |
Bridge m a => Show (Validated (GenTx (DualBlock m a))) | |
Bridge m a => Show (GenTx (DualBlock m a)) | |
Show (GenTxId m) => Show (TxId (GenTx (DualBlock m a))) | |
Eq (GenTxId m) => Eq (TxId (GenTx (DualBlock m a))) | |
Ord (GenTxId m) => Ord (TxId (GenTx (DualBlock m a))) | |
Defined in Ouroboros.Consensus.Ledger.Dual compare :: TxId (GenTx (DualBlock m a)) -> TxId (GenTx (DualBlock m a)) -> Ordering Source # (<) :: TxId (GenTx (DualBlock m a)) -> TxId (GenTx (DualBlock m a)) -> Bool Source # (<=) :: TxId (GenTx (DualBlock m a)) -> TxId (GenTx (DualBlock m a)) -> Bool Source # (>) :: TxId (GenTx (DualBlock m a)) -> TxId (GenTx (DualBlock m a)) -> Bool Source # (>=) :: TxId (GenTx (DualBlock m a)) -> TxId (GenTx (DualBlock m a)) -> Bool Source # max :: TxId (GenTx (DualBlock m a)) -> TxId (GenTx (DualBlock m a)) -> TxId (GenTx (DualBlock m a)) Source # min :: TxId (GenTx (DualBlock m a)) -> TxId (GenTx (DualBlock m a)) -> TxId (GenTx (DualBlock m a)) Source # | |
NoThunks (Validated (GenTx (DualBlock m a))) | |
NoThunks (GenTx (DualBlock m a)) | |
NoThunks (TxId (GenTx (DualBlock m a))) | |
Bridge m a => HasTxId (GenTx (DualBlock m a)) | |
data GenTx ByronBlock | Generalized transactions in Byron This is effectively the same as |
Defined in Ouroboros.Consensus.Byron.Ledger.Mempool | |
type TranslationError era (GenTx :.: ShelleyBlock proto) | |
Defined in Ouroboros.Consensus.Shelley.ShelleyHFC | |
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.21.0.0-96a81cb4588538917e2e1bd1565d867fc48490e88747b2693485d823f16f2133" 'True) (C1 ('MetaCons "HardForkValidatedGenTx" 'PrefixI 'True) (S1 ('MetaSel ('Just "getHardForkValidatedGenTx") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (OneEraValidatedGenTx xs)))) | |
type Rep (Validated (GenTx ByronBlock)) | |
Defined in Ouroboros.Consensus.Byron.Ledger.Mempool type Rep (Validated (GenTx ByronBlock)) = D1 ('MetaData "Validated" "Ouroboros.Consensus.Byron.Ledger.Mempool" "ouroboros-consensus-cardano-0.20.0.0-2bd9b95213c4ce1ce608f7e1fa75ab5517c5c68b93059f91e3d89fedcdadeff3" 'True) (C1 ('MetaCons "ValidatedByronTx" 'PrefixI 'True) (S1 ('MetaSel ('Just "forgetValidatedByronTx") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (GenTx ByronBlock)))) | |
type Rep (Validated (GenTx (ShelleyBlock proto era))) | |
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.20.0.0-2bd9b95213c4ce1ce608f7e1fa75ab5517c5c68b93059f91e3d89fedcdadeff3" 'False) (C1 ('MetaCons "ShelleyValidatedTx" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (TxId (EraCrypto era))) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Validated (Tx era))))) | |
type Rep (GenTx (HardForkBlock xs)) | |
Defined in Ouroboros.Consensus.HardFork.Combinator.Mempool type Rep (GenTx (HardForkBlock xs)) = D1 ('MetaData "GenTx" "Ouroboros.Consensus.HardFork.Combinator.Mempool" "ouroboros-consensus-0.21.0.0-96a81cb4588538917e2e1bd1565d867fc48490e88747b2693485d823f16f2133" 'True) (C1 ('MetaCons "HardForkGenTx" 'PrefixI 'True) (S1 ('MetaSel ('Just "getHardForkGenTx") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (OneEraGenTx xs)))) | |
type Rep (GenTx ByronBlock) | |
Defined in Ouroboros.Consensus.Byron.Ledger.Mempool type Rep (GenTx ByronBlock) = D1 ('MetaData "GenTx" "Ouroboros.Consensus.Byron.Ledger.Mempool" "ouroboros-consensus-cardano-0.20.0.0-2bd9b95213c4ce1ce608f7e1fa75ab5517c5c68b93059f91e3d89fedcdadeff3" 'False) ((C1 ('MetaCons "ByronTx" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 TxId) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (ATxAux ByteString))) :+: C1 ('MetaCons "ByronDlg" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 CertificateId) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (ACertificate ByteString)))) :+: (C1 ('MetaCons "ByronUpdateProposal" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 UpId) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (AProposal ByteString))) :+: C1 ('MetaCons "ByronUpdateVote" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 VoteId) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (AVote ByteString))))) | |
type Rep (GenTx (ShelleyBlock proto era)) | |
Defined in Ouroboros.Consensus.Shelley.Ledger.Mempool type Rep (GenTx (ShelleyBlock proto era)) = D1 ('MetaData "GenTx" "Ouroboros.Consensus.Shelley.Ledger.Mempool" "ouroboros-consensus-cardano-0.20.0.0-2bd9b95213c4ce1ce608f7e1fa75ab5517c5c68b93059f91e3d89fedcdadeff3" 'False) (C1 ('MetaCons "ShelleyTx" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (TxId (EraCrypto era))) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Tx era)))) | |
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.21.0.0-96a81cb4588538917e2e1bd1565d867fc48490e88747b2693485d823f16f2133" 'True) (C1 ('MetaCons "HardForkGenTxId" 'PrefixI 'True) (S1 ('MetaSel ('Just "getHardForkGenTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (OneEraGenTxId xs)))) | |
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) | |
Defined in Ouroboros.Consensus.Byron.Ledger.Mempool | |
data Validated (GenTx (ShelleyBlock proto era)) | |
Defined in Ouroboros.Consensus.Shelley.Ledger.Mempool data Validated (GenTx (ShelleyBlock proto era)) = ShelleyValidatedTx !(TxId (EraCrypto era)) !(Validated (Tx era)) | |
newtype GenTx (HardForkBlock xs) | |
newtype TxId (GenTx (HardForkBlock xs)) | |
newtype TxId (GenTx (DualBlock m a)) | |
Defined in Ouroboros.Consensus.Ledger.Dual | |
data TxId (GenTx ByronBlock) | |
Defined in Ouroboros.Consensus.Byron.Ledger.Mempool | |
newtype TxId (GenTx (ShelleyBlock proto era)) | |
Defined in Ouroboros.Consensus.Shelley.Ledger.Mempool | |
data GenTx (DualBlock m a) | |
Defined in Ouroboros.Consensus.Ledger.Dual data GenTx (DualBlock m a) = DualGenTx {
| |
data GenTx (ShelleyBlock proto era) | |
Defined in Ouroboros.Consensus.Shelley.Ledger.Mempool |
data EraMismatch Source #
Extra info for errors caused by applying a block, header, transaction, or query from one era to a ledger from a different era.
EraMismatch | |
|
Instances
Generic EraMismatch | |||||
Defined in Ouroboros.Consensus.HardFork.Combinator.AcrossEras
from :: EraMismatch -> Rep EraMismatch x Source # to :: Rep EraMismatch x -> EraMismatch Source # | |||||
Show EraMismatch | |||||
Eq EraMismatch | |||||
Defined in Ouroboros.Consensus.HardFork.Combinator.AcrossEras (==) :: EraMismatch -> EraMismatch -> Bool Source # (/=) :: EraMismatch -> EraMismatch -> Bool Source # | |||||
type Rep EraMismatch | |||||
Defined in Ouroboros.Consensus.HardFork.Combinator.AcrossEras type Rep EraMismatch = D1 ('MetaData "EraMismatch" "Ouroboros.Consensus.HardFork.Combinator.AcrossEras" "ouroboros-consensus-0.21.0.0-96a81cb4588538917e2e1bd1565d867fc48490e88747b2693485d823f16f2133" 'False) (C1 ('MetaCons "EraMismatch" 'PrefixI 'True) (S1 ('MetaSel ('Just "ledgerEraName") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "otherEraName") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text))) |
data PastHorizonException Source #
We tried to convert something that is past the horizon
That is, we tried to convert something that is past the point in time beyond which we lack information due to uncertainty about the next hard fork.
Instances
class ConsensusProtocol p => PraosProtocolSupportsNode p Source #
The node has Praos-aware code that inspects nonces in order to support some Cardano API queries that are crucial to the user exprience
The interface being used for that has grown and needs review, but we're adding to it here under time pressure. See https://github.com/IntersectMBO/cardano-node/issues/3864
Instances
PraosCrypto c => PraosProtocolSupportsNode (Praos c) | |||||
Defined in Ouroboros.Consensus.Protocol.Praos
getPraosNonces :: proxy (Praos c) -> ChainDepState (Praos c) -> PraosNonces Source # getOpCertCounters :: proxy (Praos c) -> ChainDepState (Praos c) -> Map (KeyHash 'BlockIssuer (PraosProtocolSupportsNodeCrypto (Praos c))) Word64 Source # | |||||
PraosCrypto c => PraosProtocolSupportsNode (TPraos c) | |||||
Defined in Ouroboros.Consensus.Protocol.TPraos
getPraosNonces :: proxy (TPraos c) -> ChainDepState (TPraos c) -> PraosNonces Source # getOpCertCounters :: proxy (TPraos c) -> ChainDepState (TPraos c) -> Map (KeyHash 'BlockIssuer (PraosProtocolSupportsNodeCrypto (TPraos c))) Word64 Source # |
type family PraosProtocolSupportsNodeCrypto p Source #
Instances
type PraosProtocolSupportsNodeCrypto (Praos c) | |
Defined in Ouroboros.Consensus.Protocol.Praos | |
type PraosProtocolSupportsNodeCrypto (TPraos c) | |
Defined in Ouroboros.Consensus.Protocol.TPraos |
data ShelleyGenesisStaking c Source #
Genesis Shelley staking configuration.
This allows us to configure some initial stake pools and delegation to them, in order to test Praos in a static configuration, without requiring on-chain registration and delegation.
For simplicity, pools defined in the genesis staking do not pay deposits for their registration.
ShelleyGenesisStaking | |
|
Instances
Crypto c => FromJSON (ShelleyGenesisStaking c) | |||||
Defined in Cardano.Ledger.Shelley.Genesis parseJSON :: Value -> Parser (ShelleyGenesisStaking c) # parseJSONList :: Value -> Parser [ShelleyGenesisStaking c] # omittedField :: Maybe (ShelleyGenesisStaking c) # | |||||
Crypto c => ToJSON (ShelleyGenesisStaking c) | |||||
Defined in Cardano.Ledger.Shelley.Genesis toJSON :: ShelleyGenesisStaking c -> Value # toEncoding :: ShelleyGenesisStaking c -> Encoding # toJSONList :: [ShelleyGenesisStaking c] -> Value # toEncodingList :: [ShelleyGenesisStaking c] -> Encoding # omitField :: ShelleyGenesisStaking c -> Bool # | |||||
Monoid (ShelleyGenesisStaking c) | |||||
Defined in Cardano.Ledger.Shelley.Genesis mempty :: ShelleyGenesisStaking c Source # mappend :: ShelleyGenesisStaking c -> ShelleyGenesisStaking c -> ShelleyGenesisStaking c Source # mconcat :: [ShelleyGenesisStaking c] -> ShelleyGenesisStaking c Source # | |||||
Semigroup (ShelleyGenesisStaking c) | |||||
Defined in Cardano.Ledger.Shelley.Genesis (<>) :: ShelleyGenesisStaking c -> ShelleyGenesisStaking c -> ShelleyGenesisStaking c Source # sconcat :: NonEmpty (ShelleyGenesisStaking c) -> ShelleyGenesisStaking c Source # stimes :: Integral b => b -> ShelleyGenesisStaking c -> ShelleyGenesisStaking c Source # | |||||
Generic (ShelleyGenesisStaking c) | |||||
Defined in Cardano.Ledger.Shelley.Genesis
from :: ShelleyGenesisStaking c -> Rep (ShelleyGenesisStaking c) x Source # to :: Rep (ShelleyGenesisStaking c) x -> ShelleyGenesisStaking c Source # | |||||
Show (ShelleyGenesisStaking c) | |||||
Defined in Cardano.Ledger.Shelley.Genesis | |||||
Crypto c => DecCBOR (ShelleyGenesisStaking c) | |||||
Defined in Cardano.Ledger.Shelley.Genesis | |||||
Crypto c => EncCBOR (ShelleyGenesisStaking c) | |||||
Defined in Cardano.Ledger.Shelley.Genesis encCBOR :: ShelleyGenesisStaking c -> Encoding Source # encodedSizeExpr :: (forall t. EncCBOR t => Proxy t -> Size) -> Proxy (ShelleyGenesisStaking c) -> Size Source # encodedListSizeExpr :: (forall t. EncCBOR t => Proxy t -> Size) -> Proxy [ShelleyGenesisStaking c] -> Size Source # | |||||
Eq (ShelleyGenesisStaking c) | |||||
Defined in Cardano.Ledger.Shelley.Genesis (==) :: ShelleyGenesisStaking c -> ShelleyGenesisStaking c -> Bool Source # (/=) :: ShelleyGenesisStaking c -> ShelleyGenesisStaking c -> Bool Source # | |||||
NoThunks (ShelleyGenesisStaking c) | |||||
Defined in Cardano.Ledger.Shelley.Genesis noThunks :: Context -> ShelleyGenesisStaking c -> IO (Maybe ThunkInfo) # wNoThunks :: Context -> ShelleyGenesisStaking c -> IO (Maybe ThunkInfo) # showTypeOf :: Proxy (ShelleyGenesisStaking c) -> String # | |||||
type Rep (ShelleyGenesisStaking c) | |||||
Defined in Cardano.Ledger.Shelley.Genesis type Rep (ShelleyGenesisStaking c) = D1 ('MetaData "ShelleyGenesisStaking" "Cardano.Ledger.Shelley.Genesis" "cardano-ledger-shelley-1.14.1.0-6da62eb4db0139bb466588c0f3bf17f53ad859af8a090c113a1a960870dce943" 'False) (C1 ('MetaCons "ShelleyGenesisStaking" 'PrefixI 'True) (S1 ('MetaSel ('Just "sgsPools") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ListMap (KeyHash 'StakePool c) (PoolParams c))) :*: S1 ('MetaSel ('Just "sgsStake") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ListMap (KeyHash 'Staking c) (KeyHash 'StakePool c))))) |
getOpCertCounters :: PraosProtocolSupportsNode p => proxy p -> ChainDepState p -> Map (KeyHash 'BlockIssuer (PraosProtocolSupportsNodeCrypto p)) Word64 Source #
interpreterToEpochInfo :: forall (xs :: [Type]). Interpreter xs -> EpochInfo (Except PastHorizonException) Source #
Construct an EpochInfo
for a snapshot of the ledger state
unsafeExtendSafeZone :: forall (xs :: [Type]). Interpreter xs -> Interpreter xs Source #
UNSAFE: extend the safe zone of the current era of the given Interpreter
to be unbounded, ignoring any future hard forks.
This only has effect when the Interpreter
was obtained in an era that was
not the final one (in the final era, this is a no-op). The Interpreter
will be made to believe that the current era is the final era, making its
horizon unbounded, and thus never returning a PastHorizonException
.
Use of this function is strongly discouraged, as it will ignore any future
hard forks, and the results produced by the Interpreter
can thus be
incorrect.
txId :: HasTxId tx => tx -> TxId tx Source #
NOTE: a TxId
must be unique up to ledger rules, i.e., two GenTx
s with
the same TxId
must be the same transaction according to the ledger.
However, we do not assume that a TxId
uniquely determines a GenTx
:
two GenTx
s with the same TxId
can differ in, e.g., witnesses.
Should be cheap as this will be called often.