reth_rpc_eth_api::helpers::pending_block

Trait LoadPendingBlock

Source
pub trait LoadPendingBlock: EthApiTypes + RpcNodeCore<Provider: BlockReaderIdExt + EvmEnvProvider + ChainSpecProvider<ChainSpec: EthChainSpec + EthereumHardforks> + StateProviderFactory, Pool: TransactionPool, Evm: ConfigureEvm<Header = Header>> {
    // Required method
    fn pending_block(&self) -> &Mutex<Option<PendingBlock>>;

    // Provided methods
    fn pending_block_env_and_cfg(&self) -> Result<PendingBlockEnv, Self::Error> { ... }
    fn local_pending_block(
        &self,
    ) -> impl Future<Output = Result<Option<(SealedBlockWithSenders, Vec<Receipt>)>, Self::Error>> + Send
       where Self: SpawnBlocking { ... }
    fn assemble_receipt(
        &self,
        tx: &TransactionSignedEcRecovered,
        result: ExecutionResult,
        cumulative_gas_used: u64,
    ) -> Receipt { ... }
    fn receipts_root(
        &self,
        _block_env: &BlockEnv,
        execution_outcome: &ExecutionOutcome,
        block_number: BlockNumber,
    ) -> B256 { ... }
    fn build_block(
        &self,
        env: PendingBlockEnv,
    ) -> Result<(SealedBlockWithSenders, Vec<Receipt>), Self::Error>
       where EthApiError: From<ProviderError> { ... }
}
Expand description

Loads a pending block from database.

Behaviour shared by several eth_ RPC methods, not exclusive to eth_ blocks RPC methods.

Required Methods§

Source

fn pending_block(&self) -> &Mutex<Option<PendingBlock>>

Returns a handle to the pending block.

Data access in default (L1) trait method implementations.

Provided Methods§

Source

fn pending_block_env_and_cfg(&self) -> Result<PendingBlockEnv, Self::Error>

Configures the [CfgEnvWithHandlerCfg] and [BlockEnv] for the pending block

If no pending block is available, this will derive it from the latest block

Source

fn local_pending_block( &self, ) -> impl Future<Output = Result<Option<(SealedBlockWithSenders, Vec<Receipt>)>, Self::Error>> + Send
where Self: SpawnBlocking,

Returns the locally built pending block

Source

fn assemble_receipt( &self, tx: &TransactionSignedEcRecovered, result: ExecutionResult, cumulative_gas_used: u64, ) -> Receipt

Assembles a [Receipt] for a transaction, based on its [ExecutionResult].

Source

fn receipts_root( &self, _block_env: &BlockEnv, execution_outcome: &ExecutionOutcome, block_number: BlockNumber, ) -> B256

Calculates receipts root in block building.

Panics if block is not in the ExecutionOutcome’s block range.

Source

fn build_block( &self, env: PendingBlockEnv, ) -> Result<(SealedBlockWithSenders, Vec<Receipt>), Self::Error>

Builds a pending block using the configured provider and pool.

If the origin is the actual pending block, the block is built with withdrawals.

After Cancun, if the origin is the actual pending block, the block includes the EIP-4788 pre block contract call using the parent beacon block root received from the CL.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§