ouroboros-consensus
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Consensus.Block.Forging

Synopsis

Documentation

data BlockForging (m ∷ Type → Type) blk Source #

Stateful wrapper around block production

NOTE: do not refer to the consensus or ledger config in the closure of this record because they might contain an EpochInfo Identity, which will be incorrect when used as part of the hard fork combinator.

Constructors

BlockForging 

Fields

Instances

Instances details
Functor m ⇒ Isomorphic (BlockForging m) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Embed.Unary

Methods

project ∷ NoHardForks blk ⇒ BlockForging m (HardForkBlock '[blk]) → BlockForging m blk Source #

inject ∷ NoHardForks blk ⇒ BlockForging m blk → BlockForging m (HardForkBlock '[blk]) Source #

newtype MkBlockForging (m ∷ Type → Type) blk Source #

MkBlockForging is a wrapper around a monadic action that allocates a BlockForging, potentially allocating other linked resources like KES HotKeys, that *MUST* be finalized when the BlockForging is no longer in use. Users of this code must call the finalize function on the returned BlockForging at least once after terminating otherwise allocated resources may leak.

Constructors

MkBlockForging 

Fields

Instances

Instances details
Functor m ⇒ Isomorphic (MkBlockForging m) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Embed.Unary

type family CannotForge blk Source #

Information about why we cannot forge a block, although we are a leader

This should happen only rarely. An example might be that our hot key does not (yet/anymore) match the delegation state.

Instances

Instances details
type CannotForge (HardForkBlock xs) Source # 
Instance details

Defined in Ouroboros.Consensus.HardFork.Combinator.Forging

type CannotForge (DualBlock m a) Source # 
Instance details

Defined in Ouroboros.Consensus.Ledger.Dual

type family ForgeStateInfo blk Source #

Returned when a call to updateForgeState succeeded and caused the forge state to change. This info is traced.

type family ForgeStateUpdateError blk Source #

Returned when a call updateForgeState failed, e.g., because the KES key is no longer valid. This info is traced.

data ForgeStateUpdateInfo blk Source #

The result of updateForgeState.

Note: the forge state itself is implicit and not reflected in the types.

Constructors

ForgeStateUpdated (ForgeStateInfo blk)

NB The update might have not changed the forge state.

ForgeStateUpdateFailed (ForgeStateUpdateError blk) 
ForgeStateUpdateSuppressed

A node was prevented from forging for an artificial reason, such as testing, benchmarking, etc. It's artificial in that this constructor should never occur in a production deployment.

data ShouldForge blk Source #

Constructors

ForgeStateUpdateError (ForgeStateUpdateError blk)

Before check whether we are a leader in this slot, we tried to update our forge state (updateForgeState), but it failed. We will not check whether we are leader and will thus not forge a block either.

E.g., we could not evolve our KES key.

CannotForge (CannotForge blk)

We are a leader in this slot, but we cannot forge for a certain reason.

E.g., our KES key is not yet valid in this slot or we are not the current delegate of the genesis key we have a delegation certificate from.

NotLeader

We are not a leader in this slot

ShouldForge (IsLeader (BlockProtocol blk))

We are a leader in this slot and we should forge a block.

UpdateInfo

data UpdateInfo updated failed Source #

The result of updating something, e.g., the forge state.

Constructors

Updated updated

NOTE: The update may have induced no change.

UpdateFailed failed 

Instances

Instances details
(Show updated, Show failed) ⇒ Show (UpdateInfo updated failed) Source # 
Instance details

Defined in Ouroboros.Consensus.Block.Forging

Methods

showsPrec ∷ Int → UpdateInfo updated failed → ShowS #

show ∷ UpdateInfo updated failed → String #

showList ∷ [UpdateInfo updated failed] → ShowS #

ForgeBlockArgs

data ForgeBlockArgs blk Source #

Arguments to forgeBlock aggregated into a single record.

Constructors

ForgeBlockArgs 

Fields

  • fbConfig ∷ !(TopLevelConfig blk)

    The node's top-level config.

  • fbCurrentBlockNo ∷ !BlockNo

    The block number of the block to be forged.

  • fbCurrentSlotNo ∷ !SlotNo

    The slot number of the block to be forged.

  • fbPerasCert ∷ !(Maybe (PerasCert blk))

    Optional Peras certificate to include in the forged block

    For blk that supports Peras Nothing means no certificate. For blk that doesn't support Peras it's always Nothing.

  • fbCurrentTickedLedgerState ∷ !(TickedLedgerState blk EmptyMK)

    The current ledger state ticked to fbCurrentSlotNo.

  • fbTxs ∷ ![Validated (GenTx blk)]

    The transactions to include in the forged block.

    The function is passed the prefix of the mempool that will fit within a valid block; this is a set of transactions that is guaranteed to be consistent with the ledger state fbCurrentTickedLedgerState and with each other (when applied in order). All of them should be included in the forged block, since the mempool ensures they can fit.

    NOTE: do not refer to the consensus or ledger config in the closure, because they might contain an EpochInfo Identity, which will be incorrect when used as part of the hard fork combinator. Use the given fbConfig instead, as it is guaranteed to be correct even when used as part of the hard fork combinator.

    PRECONDITION: checkCanForge returned Right ().

  • fbIsLeader ∷ !(IsLeader (BlockProtocol blk))

    Proof that the node is the slot leader.