pub trait LoadPendingBlock: EthApiTypes + RpcNodeCorewhere
Self::NetworkTypes: Network<HeaderResponse = Header<<Self::Provider as HeaderProvider>::Header>>,
Self::Provider: BlockReaderIdExt + EvmEnvProvider<<Self::Provider as HeaderProvider>::Header> + ChainSpecProvider + StateProviderFactory,
<Self::Provider as ReceiptProvider>::Receipt: Receipt,
<Self::Provider as ChainSpecProvider>::ChainSpec: EthChainSpec + EthereumHardforks,
Self::Pool: TransactionPool,
<Self::Pool as TransactionPool>::Transaction: PoolTransaction<Consensus = <Self::Provider as TransactionsProvider>::Transaction>,
Self::Evm: ConfigureEvm<Header = <Self::Provider as HeaderProvider>::Header, Transaction = <Self::Provider as TransactionsProvider>::Transaction>,{
// Required methods
fn pending_block(
&self,
) -> &Mutex<Option<PendingBlock<<Self::Provider as BlockReader>::Block, <Self::Provider as ReceiptProvider>::Receipt>>>;
fn assemble_receipt(
&self,
tx: &<Self::Provider as TransactionsProvider>::Transaction,
result: ExecutionResult,
cumulative_gas_used: u64,
) -> <Self::Provider as ReceiptProvider>::Receipt;
fn assemble_block(
&self,
block_env: &BlockEnv,
parent_hash: FixedBytes<32>,
state_root: FixedBytes<32>,
transactions: Vec<<Self::Provider as TransactionsProvider>::Transaction>,
receipts: &[<Self::Provider as ReceiptProvider>::Receipt],
) -> <Self::Provider as BlockReader>::Block;
// Provided methods
fn pending_block_env_and_cfg(
&self,
) -> Result<PendingBlockEnv<<Self::Provider as BlockReader>::Block, <Self::Provider as ReceiptProvider>::Receipt>, Self::Error> { ... }
fn local_pending_block(
&self,
) -> impl Future<Output = Result<Option<(SealedBlockWithSenders<<Self::Provider as BlockReader>::Block>, Vec<<Self::Provider as ReceiptProvider>::Receipt>)>, Self::Error>> + Send
where Self: SpawnBlocking { ... }
fn assemble_block_and_receipts(
&self,
block_env: &BlockEnv,
parent_hash: FixedBytes<32>,
state_root: FixedBytes<32>,
transactions: Vec<<Self::Provider as TransactionsProvider>::Transaction>,
results: Vec<ExecutionResult>,
) -> (<Self::Provider as BlockReader>::Block, Vec<<Self::Provider as ReceiptProvider>::Receipt>) { ... }
fn build_block(
&self,
cfg: CfgEnvWithHandlerCfg,
block_env: BlockEnv,
parent_hash: FixedBytes<32>,
) -> Result<(SealedBlockWithSenders<<Self::Provider as BlockReader>::Block>, Vec<<Self::Provider as ReceiptProvider>::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§
Sourcefn pending_block(
&self,
) -> &Mutex<Option<PendingBlock<<Self::Provider as BlockReader>::Block, <Self::Provider as ReceiptProvider>::Receipt>>>
fn pending_block( &self, ) -> &Mutex<Option<PendingBlock<<Self::Provider as BlockReader>::Block, <Self::Provider as ReceiptProvider>::Receipt>>>
Returns a handle to the pending block.
Data access in default (L1) trait method implementations.
Sourcefn assemble_receipt(
&self,
tx: &<Self::Provider as TransactionsProvider>::Transaction,
result: ExecutionResult,
cumulative_gas_used: u64,
) -> <Self::Provider as ReceiptProvider>::Receipt
fn assemble_receipt( &self, tx: &<Self::Provider as TransactionsProvider>::Transaction, result: ExecutionResult, cumulative_gas_used: u64, ) -> <Self::Provider as ReceiptProvider>::Receipt
Assembles a receipt for a transaction, based on its ExecutionResult
.
Sourcefn assemble_block(
&self,
block_env: &BlockEnv,
parent_hash: FixedBytes<32>,
state_root: FixedBytes<32>,
transactions: Vec<<Self::Provider as TransactionsProvider>::Transaction>,
receipts: &[<Self::Provider as ReceiptProvider>::Receipt],
) -> <Self::Provider as BlockReader>::Block
fn assemble_block( &self, block_env: &BlockEnv, parent_hash: FixedBytes<32>, state_root: FixedBytes<32>, transactions: Vec<<Self::Provider as TransactionsProvider>::Transaction>, receipts: &[<Self::Provider as ReceiptProvider>::Receipt], ) -> <Self::Provider as BlockReader>::Block
Assembles a pending block.
Provided Methods§
Sourcefn pending_block_env_and_cfg(
&self,
) -> Result<PendingBlockEnv<<Self::Provider as BlockReader>::Block, <Self::Provider as ReceiptProvider>::Receipt>, Self::Error>
fn pending_block_env_and_cfg( &self, ) -> Result<PendingBlockEnv<<Self::Provider as BlockReader>::Block, <Self::Provider as ReceiptProvider>::Receipt>, 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
Sourcefn local_pending_block(
&self,
) -> impl Future<Output = Result<Option<(SealedBlockWithSenders<<Self::Provider as BlockReader>::Block>, Vec<<Self::Provider as ReceiptProvider>::Receipt>)>, Self::Error>> + Sendwhere
Self: SpawnBlocking,
fn local_pending_block(
&self,
) -> impl Future<Output = Result<Option<(SealedBlockWithSenders<<Self::Provider as BlockReader>::Block>, Vec<<Self::Provider as ReceiptProvider>::Receipt>)>, Self::Error>> + Sendwhere
Self: SpawnBlocking,
Returns the locally built pending block
Sourcefn assemble_block_and_receipts(
&self,
block_env: &BlockEnv,
parent_hash: FixedBytes<32>,
state_root: FixedBytes<32>,
transactions: Vec<<Self::Provider as TransactionsProvider>::Transaction>,
results: Vec<ExecutionResult>,
) -> (<Self::Provider as BlockReader>::Block, Vec<<Self::Provider as ReceiptProvider>::Receipt>)
fn assemble_block_and_receipts( &self, block_env: &BlockEnv, parent_hash: FixedBytes<32>, state_root: FixedBytes<32>, transactions: Vec<<Self::Provider as TransactionsProvider>::Transaction>, results: Vec<ExecutionResult>, ) -> (<Self::Provider as BlockReader>::Block, Vec<<Self::Provider as ReceiptProvider>::Receipt>)
Helper to invoke both Self::assemble_block
and Self::assemble_receipt
.
Sourcefn build_block(
&self,
cfg: CfgEnvWithHandlerCfg,
block_env: BlockEnv,
parent_hash: FixedBytes<32>,
) -> Result<(SealedBlockWithSenders<<Self::Provider as BlockReader>::Block>, Vec<<Self::Provider as ReceiptProvider>::Receipt>), Self::Error>
fn build_block( &self, cfg: CfgEnvWithHandlerCfg, block_env: BlockEnv, parent_hash: FixedBytes<32>, ) -> Result<(SealedBlockWithSenders<<Self::Provider as BlockReader>::Block>, Vec<<Self::Provider as ReceiptProvider>::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.