reth_optimism_evm/
config.rs

1pub use alloy_op_evm::{
2    spec as revm_spec, spec_by_timestamp_after_bedrock as revm_spec_by_timestamp_after_bedrock,
3};
4
5use alloy_consensus::BlockHeader;
6use revm::primitives::{Address, Bytes, B256};
7
8/// Context relevant for execution of a next block w.r.t OP.
9#[derive(Debug, Clone, PartialEq, Eq)]
10pub struct OpNextBlockEnvAttributes {
11    /// The timestamp of the next block.
12    pub timestamp: u64,
13    /// The suggested fee recipient for the next block.
14    pub suggested_fee_recipient: Address,
15    /// The randomness value for the next block.
16    pub prev_randao: B256,
17    /// Block gas limit.
18    pub gas_limit: u64,
19    /// The parent beacon block root.
20    pub parent_beacon_block_root: Option<B256>,
21    /// Encoded EIP-1559 parameters to include into block's `extra_data` field.
22    pub extra_data: Bytes,
23}
24
25#[cfg(feature = "rpc")]
26impl<H: BlockHeader> reth_rpc_eth_api::helpers::pending_block::BuildPendingEnv<H>
27    for OpNextBlockEnvAttributes
28{
29    fn build_pending_env(parent: &crate::SealedHeader<H>) -> Self {
30        Self {
31            timestamp: parent.timestamp().saturating_add(12),
32            suggested_fee_recipient: parent.beneficiary(),
33            prev_randao: B256::random(),
34            gas_limit: parent.gas_limit(),
35            parent_beacon_block_root: parent.parent_beacon_block_root(),
36            extra_data: parent.extra_data().clone(),
37        }
38    }
39}