diff --git a/based/crates/reth/src/exec.rs b/based/crates/reth/src/exec.rs index 64fc06b81..08bdcd438 100644 --- a/based/crates/reth/src/exec.rs +++ b/based/crates/reth/src/exec.rs @@ -165,7 +165,10 @@ where let mut state_overrides = ub.get_state_overrides().unwrap_or_default(); let block: OpBlock = build_op_block_from_ub_and_frag(&ub, &frag)?; - let mut l1_block_info = reth_optimism_evm::extract_l1_info(&block.body)?; + + let mut l1_block_info = + ub.l1_block_info.clone().map(Ok).unwrap_or_else(|| reth_optimism_evm::extract_l1_info(&block.body))?; + let header = block.header.clone().seal_slow(); let block_env_attributes = OpNextBlockEnvAttributes { @@ -280,7 +283,6 @@ where let receipt = OpReceiptBuilder::new(chain_spec.as_ref(), input, &mut l1_block_info)?.build(); - // TODO: Is this correct?q next_log_index += receipt.inner.logs().len(); ub.with_transaction_receipt(tx_hash, receipt.clone()); receipts.push(receipt); @@ -298,7 +300,8 @@ where ub = ub .with_db_cache(db.cache) .with_state_overrides(Some(state_overrides)) - .with_bundle_state(db.db.bundle_state); + .with_bundle_state(db.db.bundle_state) + .with_l1_block_info(l1_block_info); ub.accept_frag_execution(frag, logs, receipts, gas_used); diff --git a/based/crates/reth/src/unsealed_block.rs b/based/crates/reth/src/unsealed_block.rs index 8e71f2287..8f4af1896 100644 --- a/based/crates/reth/src/unsealed_block.rs +++ b/based/crates/reth/src/unsealed_block.rs @@ -8,6 +8,7 @@ use op_alloy_consensus::{OpBlock, OpTxEnvelope}; use op_alloy_network::{Optimism, TransactionResponse}; use op_alloy_rpc_types::{OpTransactionReceipt, Transaction}; use reth::revm::db::{BundleState, Cache}; +use reth_evm::op_revm::L1BlockInfo; use reth_optimism_primitives::OpTransactionSigned; use reth_rpc_eth_api::RpcBlock; use tokio::sync::broadcast; @@ -37,6 +38,8 @@ pub struct UnsealedBlock { /// Cumulative blob gas used across all blob-carrying transactions in the block. pub cumulative_blob_gas_used: u64, pub is_prague: bool, + // Current unsealed block l1 block info + pub l1_block_info: Option, transaction_count: HashMap, transactions: Vec, @@ -71,6 +74,7 @@ impl UnsealedBlock { new_block_sender, db_cache: Default::default(), bundle_state: Default::default(), + l1_block_info: None, } } @@ -226,6 +230,12 @@ impl UnsealedBlock { self } + /// Attach/replace the l1 block info. + pub fn with_l1_block_info(mut self, l1_block_info: L1BlockInfo) -> Self { + self.l1_block_info = Some(l1_block_info); + self + } + /// Returns the database cache. pub fn get_db_cache(&self) -> Cache { self.db_cache.clone() @@ -255,6 +265,7 @@ impl UnsealedBlock { new_block_sender: self.new_block_sender.clone(), transaction_receipts: self.transaction_receipts.clone(), bundle_state: self.bundle_state.clone(), + l1_block_info: self.l1_block_info.clone(), } }