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