Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions based/crates/reth/src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand All @@ -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);

Expand Down
11 changes: 11 additions & 0 deletions based/crates/reth/src/unsealed_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<L1BlockInfo>,

transaction_count: HashMap<Address, U256>,
transactions: Vec<Transaction>,
Expand Down Expand Up @@ -71,6 +74,7 @@ impl UnsealedBlock {
new_block_sender,
db_cache: Default::default(),
bundle_state: Default::default(),
l1_block_info: None,
}
}

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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(),
}
}

Expand Down
Loading