reth_execution_types/
execute.rs

1use alloy_eips::eip7685::Requests;
2use alloy_primitives::U256;
3use revm::db::BundleState;
4
5/// A helper type for ethereum block inputs that consists of a block and the total difficulty.
6#[derive(Debug)]
7pub struct BlockExecutionInput<'a, Block> {
8    /// The block to execute.
9    pub block: &'a Block,
10    /// The total difficulty of the block.
11    pub total_difficulty: U256,
12}
13
14impl<'a, Block> BlockExecutionInput<'a, Block> {
15    /// Creates a new input.
16    pub const fn new(block: &'a Block, total_difficulty: U256) -> Self {
17        Self { block, total_difficulty }
18    }
19}
20
21impl<'a, Block> From<(&'a Block, U256)> for BlockExecutionInput<'a, Block> {
22    fn from((block, total_difficulty): (&'a Block, U256)) -> Self {
23        Self::new(block, total_difficulty)
24    }
25}
26
27/// The output of an ethereum block.
28///
29/// Contains the state changes, transaction receipts, and total gas used in the block.
30#[derive(Debug, Clone, PartialEq, Eq)]
31pub struct BlockExecutionOutput<T> {
32    /// The changed state of the block after execution.
33    pub state: BundleState,
34    /// All the receipts of the transactions in the block.
35    pub receipts: Vec<T>,
36    /// All the EIP-7685 requests in the block.
37    pub requests: Requests,
38    /// The total gas used by the block.
39    pub gas_used: u64,
40}