| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Ouroboros.Consensus.Ledger.Dual
Synopsis
- class (HasHeader m, GetHeader m, HasHeader (Header m), LedgerSupportsProtocol m, HasHardForkHistory m, LedgerSupportsMempool m, CommonProtocolParams m, HasTxId (GenTx m), Show (ApplyTxErr m), Typeable a, UpdateLedger a, LedgerSupportsMempool a, Show (ApplyTxErr a), NoThunks (LedgerConfig a), NoThunks (CodecConfig a), NoThunks (StorageConfig a), Show (BridgeLedger m a), Eq (BridgeLedger m a), Serialise (BridgeLedger m a), Serialise (BridgeBlock m a), Serialise (BridgeTx m a), Show (BridgeTx m a)) => Bridge m a where
- type BridgeLedger m a :: Type
- type BridgeBlock m a :: Type
- type BridgeTx m a :: Type
- updateBridgeWithBlock :: DualBlock m a -> BridgeLedger m a -> BridgeLedger m a
- updateBridgeWithTx :: GenTx (DualBlock m a) -> BridgeLedger m a -> BridgeLedger m a
- data DualBlock m a = DualBlock {
- dualBlockMain :: m
- dualBlockAux :: Maybe a
- dualBlockBridge :: BridgeBlock m a
- type DualHeader m a = Header (DualBlock m a)
- data DualLedgerConfig m a = DualLedgerConfig {}
- data DualLedgerError m a = DualLedgerError {}
- data DualGenTxErr m a = DualGenTxErr {}
- dualExtValidationErrorMain :: ExtValidationError (DualBlock m a) -> ExtValidationError m
- dualTopLevelConfigMain :: TopLevelConfig (DualBlock m a) -> TopLevelConfig m
- ctxtDualMain :: NestedCtxt_ (DualBlock m a) f x -> NestedCtxt_ m f x
- data family Header blk :: Type
- data family BlockConfig blk :: Type
- data family CodecConfig blk :: Type
- data family StorageConfig blk :: Type
- data family LedgerState blk :: Type
- data family GenTx blk :: Type
- data family TxId tx :: Type
- data family NestedCtxt_ blk :: (Type -> Type) -> Type -> Type
- data family Ticked st :: Type
- encodeDualBlock :: (Bridge m a, Serialise a) => (m -> Encoding) -> DualBlock m a -> Encoding
- decodeDualBlock :: (Bridge m a, Serialise a) => Decoder s (ByteString -> m) -> Decoder s (ByteString -> DualBlock m a)
- encodeDualHeader :: (Header m -> Encoding) -> Header (DualBlock m a) -> Encoding
- decodeDualHeader :: Decoder s (ByteString -> Header m) -> Decoder s (ByteString -> Header (DualBlock m a))
- encodeDualGenTx :: (Bridge m a, Serialise (GenTx a)) => (GenTx m -> Encoding) -> GenTx (DualBlock m a) -> Encoding
- decodeDualGenTx :: (Bridge m a, Serialise (GenTx a)) => Decoder s (GenTx m) -> Decoder s (GenTx (DualBlock m a))
- encodeDualGenTxId :: (GenTxId m -> Encoding) -> GenTxId (DualBlock m a) -> Encoding
- decodeDualGenTxId :: Decoder s (GenTxId m) -> Decoder s (GenTxId (DualBlock m a))
- encodeDualGenTxErr :: Serialise (ApplyTxErr a) => (ApplyTxErr m -> Encoding) -> ApplyTxErr (DualBlock m a) -> Encoding
- decodeDualGenTxErr :: Serialise (ApplyTxErr a) => Decoder s (ApplyTxErr m) -> Decoder s (ApplyTxErr (DualBlock m a))
- encodeDualLedgerState :: (Bridge m a, Serialise (LedgerState a)) => (LedgerState m -> Encoding) -> LedgerState (DualBlock m a) -> Encoding
- decodeDualLedgerState :: (Bridge m a, Serialise (LedgerState a)) => Decoder s (LedgerState m) -> Decoder s (LedgerState (DualBlock m a))
Documentation
class (HasHeader m, GetHeader m, HasHeader (Header m), LedgerSupportsProtocol m, HasHardForkHistory m, LedgerSupportsMempool m, CommonProtocolParams m, HasTxId (GenTx m), Show (ApplyTxErr m), Typeable a, UpdateLedger a, LedgerSupportsMempool a, Show (ApplyTxErr a), NoThunks (LedgerConfig a), NoThunks (CodecConfig a), NoThunks (StorageConfig a), Show (BridgeLedger m a), Eq (BridgeLedger m a), Serialise (BridgeLedger m a), Serialise (BridgeBlock m a), Serialise (BridgeTx m a), Show (BridgeTx m a)) => Bridge m a where Source #
Bridge the two ledgers
Associated Types
type BridgeLedger m a :: Type Source #
Additional information relating both ledgers
type BridgeBlock m a :: Type Source #
Information required to update the bridge when applying a block
type BridgeTx m a :: Type Source #
Information required to update the bridge when applying a transaction
Methods
updateBridgeWithBlock :: DualBlock m a -> BridgeLedger m a -> BridgeLedger m a Source #
updateBridgeWithTx :: GenTx (DualBlock m a) -> BridgeLedger m a -> BridgeLedger m a Source #
Pair types
Dual block
The dual block is used to instantiate the consensus with a dual ledger, consisting of two ledger states associated with two types of blocks. The (consensus) chain state will still be updated based on one block type only, which is therefore designed as the main block, while the other block is designated as the auxiliary block.
The auxiliary block is optional; this can be used if some " main " blocks should have no effect on the auxiliary ledger state at all. The motivating example is EBBs: if the main blocks are real Byron blocks, and the auxiliary blocks are Byron spec blocks, then regular Byron blocks correspond to Byron spec blocks, but EBBs don't correspond to a spec block at all and should leave the Byron spec ledger state unchanged.
NOTE: The dual ledger is used for testing purposes only; we do not do any
meaningful NoThunks checks here.
Constructors
| DualBlock | |
Fields
| |
Instances
type DualHeader m a = Header (DualBlock m a) Source #
data DualLedgerConfig m a Source #
Constructors
| DualLedgerConfig | |
Fields | |
Instances
| NoThunks (DualLedgerConfig m a) Source # | |
Defined in Ouroboros.Consensus.Ledger.Dual | |
data DualLedgerError m a Source #
Both ledger rules threw an error
We do not verify that the errors agree, merely that they both report some error.
If only one of the two semantics reports an error, we fail with an error
(see agreeOnError), rather than a regular chain failure; if this happens,
it indicates a bug, and the node should fail (rather than just, for example,
reject a block).
Constructors
| DualLedgerError | |
Fields | |
Instances
| (Eq (LedgerError m), Eq (LedgerError a)) => Eq (DualLedgerError m a) Source # | |
Defined in Ouroboros.Consensus.Ledger.Dual Methods (==) :: DualLedgerError m a -> DualLedgerError m a -> Bool # (/=) :: DualLedgerError m a -> DualLedgerError m a -> Bool # | |
| (Show (LedgerError m), Show (LedgerError a)) => Show (DualLedgerError m a) Source # | |
Defined in Ouroboros.Consensus.Ledger.Dual Methods showsPrec :: Int -> DualLedgerError m a -> ShowS # show :: DualLedgerError m a -> String # showList :: [DualLedgerError m a] -> ShowS # | |
| NoThunks (DualLedgerError m a) Source # | |
Defined in Ouroboros.Consensus.Ledger.Dual | |
data DualGenTxErr m a Source #
Constructors
| DualGenTxErr | |
Fields
| |
Instances
| (Typeable m, Typeable a) => ShowProxy (DualGenTxErr m a :: Type) Source # | |
Defined in Ouroboros.Consensus.Ledger.Dual | |
| Bridge m a => Show (DualGenTxErr m a) Source # | |
Defined in Ouroboros.Consensus.Ledger.Dual Methods showsPrec :: Int -> DualGenTxErr m a -> ShowS # show :: DualGenTxErr m a -> String # showList :: [DualGenTxErr m a] -> ShowS # | |
Lifted functions
dualTopLevelConfigMain :: TopLevelConfig (DualBlock m a) -> TopLevelConfig m Source #
This is only used for block production
ctxtDualMain :: NestedCtxt_ (DualBlock m a) f x -> NestedCtxt_ m f x Source #
Type class family instances
data family Header blk :: Type Source #
Instances
data family BlockConfig blk :: Type Source #
Static configuration required to work with this type of blocks
Instances
| Isomorphic BlockConfig Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.Unary Methods project :: NoHardForks blk => BlockConfig (HardForkBlock '[blk]) -> BlockConfig blk Source # inject :: NoHardForks blk => BlockConfig blk -> BlockConfig (HardForkBlock '[blk]) Source # | |
| NoThunks (BlockConfig (DualBlock m a)) Source # | |
| CanHardFork xs => NoThunks (BlockConfig (HardForkBlock xs)) Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.Basics Methods noThunks :: Context -> BlockConfig (HardForkBlock xs) -> IO (Maybe ThunkInfo) Source # wNoThunks :: Context -> BlockConfig (HardForkBlock xs) -> IO (Maybe ThunkInfo) Source # showTypeOf :: Proxy (BlockConfig (HardForkBlock xs)) -> String Source # | |
| newtype BlockConfig (HardForkBlock xs) Source # | |
| data BlockConfig (DualBlock m a) Source # | |
Defined in Ouroboros.Consensus.Ledger.Dual | |
data family CodecConfig blk :: Type Source #
Static configuration required for serialisation and deserialisation of types pertaining to this type of block.
Data family instead of type family to get better type inference.
Instances
data family StorageConfig blk :: Type Source #
Config needed for the
NodeInitStorage class. Defined here to
avoid circular dependencies.
Instances
data family LedgerState blk :: Type Source #
Ledger state associated with a block
Instances
data family GenTx blk :: Type 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
data family TxId tx :: Type Source #
A generalized transaction, GenTx, identifier.
Instances
data family NestedCtxt_ blk :: (Type -> Type) -> Type -> Type Source #
Context identifying what kind of block we have
In almost all places we will use NestedCtxt rather than NestedCtxt_.
Instances
data family Ticked st :: Type Source #
" Ticked " piece of state (LedgerState, LedgerView, ChainIndepState)
Ticking refers to the passage of time (the ticking of the clock). When a piece of state is marked as ticked, it means that time-related changes have been applied to the state (or forecast).
Some examples of time related changes:
- Scheduled delegations might have been applied in Byron
- New leader schedule computed for Shelley
- Transition from Byron to Shelley activated in the hard fork combinator.
- Nonces switched out at the start of a new epoch.
Instances
Serialisation
encodeDualBlock :: (Bridge m a, Serialise a) => (m -> Encoding) -> DualBlock m a -> Encoding Source #
decodeDualBlock :: (Bridge m a, Serialise a) => Decoder s (ByteString -> m) -> Decoder s (ByteString -> DualBlock m a) Source #
decodeDualHeader :: Decoder s (ByteString -> Header m) -> Decoder s (ByteString -> Header (DualBlock m a)) Source #
encodeDualGenTx :: (Bridge m a, Serialise (GenTx a)) => (GenTx m -> Encoding) -> GenTx (DualBlock m a) -> Encoding Source #
decodeDualGenTx :: (Bridge m a, Serialise (GenTx a)) => Decoder s (GenTx m) -> Decoder s (GenTx (DualBlock m a)) Source #
encodeDualGenTxErr :: Serialise (ApplyTxErr a) => (ApplyTxErr m -> Encoding) -> ApplyTxErr (DualBlock m a) -> Encoding Source #
decodeDualGenTxErr :: Serialise (ApplyTxErr a) => Decoder s (ApplyTxErr m) -> Decoder s (ApplyTxErr (DualBlock m a)) Source #
encodeDualLedgerState :: (Bridge m a, Serialise (LedgerState a)) => (LedgerState m -> Encoding) -> LedgerState (DualBlock m a) -> Encoding Source #
decodeDualLedgerState :: (Bridge m a, Serialise (LedgerState a)) => Decoder s (LedgerState m) -> Decoder s (LedgerState (DualBlock m a)) Source #