ab_client_block_authoring/
lib.rs

1//! Block authoring implementation
2
3#![feature(async_fn_traits, unboxed_closures)]
4
5pub mod beacon_chain;
6pub mod slot_worker;
7
8use ab_core_primitives::block::header::{
9    BeaconChainHeader, BlockHeaderConsensusInfo, OwnedBlockHeaderSeal,
10};
11use ab_core_primitives::hashes::Blake3Hash;
12use ab_core_primitives::pot::PotCheckpoints;
13
14#[derive(Debug)]
15pub struct ClaimedSlot {
16    /// Consensus info for a block header
17    pub consensus_info: BlockHeaderConsensusInfo,
18    /// Proof of time checkpoints from after future proof of the parent beacon chain block to
19    /// current block's future proof (inclusive) contained in the `consensus_info` field
20    pub checkpoints: Vec<PotCheckpoints>,
21}
22
23/// Block builder interface
24pub trait BlockProducer: Send {
25    /// Produce (build and import) a new block for the claimed slot
26    fn produce_block<SealBlock>(
27        &mut self,
28        claimed_slot: ClaimedSlot,
29        best_beacon_chain_header: &BeaconChainHeader<'_>,
30        seal_block: SealBlock,
31    ) -> impl Future<Output = ()> + Send
32    where
33        SealBlock: AsyncFnOnce<(Blake3Hash,), Output = Option<OwnedBlockHeaderSeal>, CallOnceFuture: Send>
34            + Send;
35}