Skip to content

Commit 58577f6

Browse files
committed
Begin upgrading to v1.10.0-rc
1 parent b5a6435 commit 58577f6

File tree

12 files changed

+493
-316
lines changed

12 files changed

+493
-316
lines changed

Cargo.lock

Lines changed: 341 additions & 187 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 97 additions & 92 deletions
Large diffs are not rendered by default.

crates/builder/op-rbuilder/src/builders/builder_tx.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@ use op_alloy_consensus::OpTypedTransaction;
1212
use op_alloy_rpc_types::OpTransactionRequest;
1313
use op_revm::{OpHaltReason, OpTransactionError};
1414
use reth_evm::{
15-
ConfigureEvm, Evm, EvmError, InvalidTxError, eth::receipt_builder::ReceiptBuilderCtx,
16-
precompiles::PrecompilesMap,
15+
ConfigureEvm, Evm, EvmEnv, EvmError, InvalidTxError, eth::receipt_builder::ReceiptBuilderCtx, precompiles::PrecompilesMap, rpc::TryIntoTxEnv
1716
};
1817
use reth_node_api::PayloadBuilderError;
1918
use reth_optimism_primitives::OpTransactionSigned;
2019
use reth_primitives::Recovered;
2120
use reth_provider::{ProviderError, StateProvider};
2221
use reth_revm::{State, database::StateProviderDatabase};
23-
use reth_rpc_api::eth::{EthTxEnvError, transaction::TryIntoTxEnv};
22+
use reth_rpc_api::eth::{EthTxEnvError};
2423
use revm::{
2524
DatabaseCommit, DatabaseRef,
2625
context::{
@@ -323,7 +322,8 @@ pub trait BuilderTransactions<ExtraCtx: Debug + Default = (), Extra: Debug + Def
323322
expected_logs: Vec<B256>,
324323
evm: &mut OpEvm<impl Database, NoOpInspector, PrecompilesMap>,
325324
) -> Result<SimulationSuccessResult<T>, BuilderTransactionError> {
326-
let tx_env = tx.try_into_tx_env(evm.cfg(), evm.block())?;
325+
let evm_env = EvmEnv { cfg_env: evm.cfg().clone(), block_env: evm.block().clone() };
326+
let tx_env = tx.try_into_tx_env(&evm_env)?;
327327
let to = tx_env.base.kind.into_to().unwrap_or_default();
328328

329329
let ResultAndState { result, state } = match evm.transact(tx_env) {

crates/builder/op-rbuilder/src/builders/flashblocks/payload.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ use core::time::Duration;
2121
use eyre::WrapErr as _;
2222
use reth::payload::PayloadBuilderAttributes;
2323
use reth_basic_payload_builder::BuildOutcome;
24-
use reth_chain_state::ExecutedBlock;
2524
use reth_chainspec::EthChainSpec;
2625
use reth_evm::{ConfigureEvm, execute::BlockBuilder};
27-
use reth_node_api::{Block, NodePrimitives, PayloadBuilderError};
26+
use reth_node_api::{Block, BuiltPayloadExecutedBlock, NodePrimitives, PayloadBuilderError};
2827
use reth_optimism_consensus::{calculate_receipt_root_no_memo_optimism, isthmus};
2928
use reth_optimism_evm::{OpEvmConfig, OpNextBlockEnvAttributes};
3029
use reth_optimism_forks::OpHardforks;
@@ -336,7 +335,7 @@ where
336335
.map_err(|e| PayloadBuilderError::Other(e.into()))?;
337336

338337
let state_provider = self.client.state_by_block_hash(ctx.parent().hash())?;
339-
let db = StateProviderDatabase::new(&state_provider);
338+
let db = StateProviderDatabase::new(state_provider);
340339
self.address_gas_limiter.refresh(ctx.block_number());
341340

342341
// 1. execute the pre steps and seal an early block with that
@@ -346,6 +345,8 @@ where
346345
.with_bundle_update()
347346
.build();
348347

348+
let state_provider = self.client.state_by_block_hash(ctx.parent().hash())?;
349+
349350
let mut info = execute_pre_steps(&mut state, &ctx)?;
350351
let sequencer_tx_time = sequencer_tx_start_time.elapsed();
351352
ctx.metrics.sequencer_tx_duration.record(sequencer_tx_time);
@@ -537,13 +538,15 @@ where
537538
return Ok(());
538539
}
539540

541+
let state_provider = self.client.state_by_block_hash(ctx.parent().hash())?;
542+
540543
// build first flashblock immediately
541544
let next_flashblocks_ctx = match self
542545
.build_next_flashblock(
543546
&ctx,
544547
&mut info,
545548
&mut state,
546-
&state_provider,
549+
state_provider,
547550
&mut best_txs,
548551
&block_cancel,
549552
&best_payload,
@@ -601,7 +604,7 @@ where
601604
ctx: &OpPayloadBuilderCtx<FlashblocksExtraCtx>,
602605
info: &mut ExecutionInfo<FlashblocksExecutionInfo>,
603606
state: &mut State<DB>,
604-
state_provider: impl reth::providers::StateProvider + Clone,
607+
state_provider: impl reth::providers::StateProvider,
605608
best_txs: &mut NextBestFlashblocksTxs<Pool>,
606609
block_cancel: &CancellationToken,
607610
best_payload: &BlockCell<OpBuiltPayload>,
@@ -1110,11 +1113,11 @@ where
11101113
RecoveredBlock::new_unhashed(block.clone(), info.executed_senders.clone());
11111114
// create the executed block data
11121115

1113-
let executed = ExecutedBlock {
1116+
let executed = BuiltPayloadExecutedBlock {
11141117
recovered_block: Arc::new(recovered_block),
11151118
execution_output: Arc::new(execution_outcome),
1116-
hashed_state: Arc::new(hashed_state),
1117-
trie_updates: Arc::new(trie_output),
1119+
hashed_state: either::Either::Left(Arc::new(hashed_state)),
1120+
trie_updates: either::Either::Left(Arc::new(trie_output)),
11181121
};
11191122
debug!(target: "payload_builder", message = "Executed block created");
11201123

crates/builder/op-rbuilder/src/builders/generator.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -470,8 +470,7 @@ mod tests {
470470
use alloy_primitives::U256;
471471
use rand::rng;
472472
use reth::tasks::TokioTaskExecutor;
473-
use reth_chain_state::ExecutedBlock;
474-
use reth_node_api::NodePrimitives;
473+
use reth_node_api::{BuiltPayloadExecutedBlock, NodePrimitives};
475474
use reth_optimism_payload_builder::{OpPayloadPrimitives, payload::OpPayloadBuilderAttributes};
476475
use reth_optimism_primitives::OpPrimitives;
477476
use reth_primitives::SealedBlock;
@@ -590,7 +589,7 @@ mod tests {
590589
}
591590

592591
/// Returns the entire execution data for the built block, if available.
593-
fn executed_block(&self) -> Option<ExecutedBlock<Self::Primitives>> {
592+
fn executed_block(&self) -> Option<BuiltPayloadExecutedBlock<Self::Primitives>> {
594593
None
595594
}
596595

crates/builder/op-rbuilder/src/builders/standard/payload.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ use alloy_evm::Database;
1414
use alloy_primitives::U256;
1515
use reth::payload::PayloadBuilderAttributes;
1616
use reth_basic_payload_builder::{BuildOutcome, BuildOutcomeKind, MissingPayloadBehaviour};
17-
use reth_chain_state::ExecutedBlock;
1817
use reth_evm::{ConfigureEvm, execute::BlockBuilder};
19-
use reth_node_api::{Block, PayloadBuilderError};
18+
use reth_node_api::{Block, BuiltPayloadExecutedBlock, PayloadBuilderError};
2019
use reth_optimism_consensus::{calculate_receipt_root_no_memo_optimism, isthmus};
2120
use reth_optimism_evm::{OpEvmConfig, OpNextBlockEnvAttributes};
2221
use reth_optimism_forks::OpHardforks;
@@ -586,16 +585,16 @@ impl<Txs: PayloadTxsBounds> OpBuilder<'_, Txs> {
586585
info!(target: "payload_builder", id=%ctx.attributes().payload_id(), "sealed built block");
587586

588587
// create the executed block data
589-
let executed = ExecutedBlock {
588+
let executed = BuiltPayloadExecutedBlock {
590589
recovered_block: Arc::new(
591590
RecoveredBlock::<alloy_consensus::Block<OpTransactionSigned>>::new_sealed(
592591
sealed_block.as_ref().clone(),
593592
info.executed_senders,
594593
),
595594
),
596595
execution_output: Arc::new(execution_outcome),
597-
hashed_state: Arc::new(hashed_state),
598-
trie_updates: Arc::new(trie_output),
596+
hashed_state: either::Either::Left(Arc::new(hashed_state)),
597+
trie_updates: either::Either::Left(Arc::new(trie_output)),
599598
};
600599

601600
let no_tx_pool = ctx.attributes().no_tx_pool;

crates/builder/op-rbuilder/src/primitives/reth/engine_api_builder.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ where
7878
EngineCapabilities::new(OP_ENGINE_CAPABILITIES.iter().copied()),
7979
engine_validator,
8080
ctx.config.engine.accept_execution_requests_hash,
81+
ctx.node.network().clone(),
8182
);
8283

8384
Ok(OpEngineApiExt::new(OpEngineApi::new(inner)))

crates/builder/op-rbuilder/src/tests/framework/instance.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,18 @@ pub fn default_node_config() -> NodeConfig<OpChainSpec> {
337337
let data_path = tempdir
338338
.join(format!("rbuilder.{random_id}.datadir"))
339339
.to_path_buf();
340+
341+
let rocksdb_path = tempdir
342+
.join(format!("rbuilder.{random_id}.rocksdb"))
343+
.to_path_buf();
344+
345+
let pprof_dumps_path = tempdir
346+
.join(format!("rbuilder.{random_id}.pprof-dumps"))
347+
.to_path_buf();
340348

341349
std::fs::create_dir_all(&data_path).expect("Failed to create temporary data directory");
350+
std::fs::create_dir_all(&rocksdb_path).expect("Failed to create temporary rocksdb directory");
351+
std::fs::create_dir_all(&pprof_dumps_path).expect("Failed to create temporary pprof dumps directory");
342352

343353
let rpc_ipc_path = tempdir
344354
.join(format!("rbuilder.{random_id}.rpc-ipc"))
@@ -363,6 +373,8 @@ pub fn default_node_config() -> NodeConfig<OpChainSpec> {
363373
.to_string_lossy()
364374
.parse()
365375
.expect("Failed to parse data dir path"),
376+
rocksdb_path: Some(rocksdb_path),
377+
pprof_dumps_path: Some(pprof_dumps_path),
366378
static_files_path: None,
367379
};
368380

crates/client/flashblocks/src/rpc/eth.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,9 @@ where
253253
// state hasn't been cleared yet after canonical block commit
254254
if let Some(canonical_tx) = EthTransactions::transaction_by_hash(&self.eth_api, tx_hash)
255255
.await?
256-
.map(|tx| tx.into_transaction(self.eth_api.tx_resp_builder()))
257-
.transpose()?
256+
.map(|tx| tx.into_transaction(self.eth_api.converter()))
257+
.transpose()
258+
.map_err(Eth::Error::from)?
258259
{
259260
return Ok(Some(canonical_tx));
260261
}

crates/client/flashblocks/src/state_builder.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use alloy_op_evm::block::receipt_builder::OpReceiptBuilder;
88
use alloy_primitives::B256;
99
use alloy_rpc_types::TransactionTrait;
1010
use alloy_rpc_types_eth::state::StateOverride;
11-
use op_alloy_consensus::{OpDepositReceipt, OpTxEnvelope};
11+
use op_alloy_consensus::{OpDepositReceipt, OpReceipt, OpTxEnvelope};
1212
use op_alloy_rpc_types::{OpTransactionReceipt, Transaction};
1313
use reth::revm::{Database, DatabaseCommit, context::result::ResultAndState, state::EvmState};
1414
use reth_evm::{
@@ -131,11 +131,12 @@ where
131131
effective_gas_price: u128,
132132
) -> Result<ExecutedPendingTransaction, StateProcessorError> {
133133
let (deposit_receipt_version, deposit_nonce) = if transaction.is_deposit() {
134-
let deposit_receipt = receipt
134+
let OpReceipt::Deposit(deposit_receipt) = &receipt
135135
.inner
136136
.inner
137-
.as_deposit_receipt()
138-
.ok_or(ExecutionError::DepositReceiptMismatch)?;
137+
.receipt else {
138+
return Err(ExecutionError::DepositReceiptMismatch.into());
139+
};
139140

140141
(deposit_receipt.deposit_receipt_version, deposit_receipt.deposit_nonce)
141142
} else {
@@ -261,11 +262,12 @@ where
261262
self.next_log_index += receipt.logs().len();
262263

263264
let (deposit_receipt_version, deposit_nonce) = if transaction.is_deposit() {
264-
let deposit_receipt = op_receipt
265+
let OpReceipt::Deposit(deposit_receipt) = &op_receipt
265266
.inner
266267
.inner
267-
.as_deposit_receipt()
268-
.ok_or(ExecutionError::DepositReceiptMismatch)?;
268+
.receipt else {
269+
return Err(ExecutionError::DepositReceiptMismatch.into());
270+
};
269271

270272
(deposit_receipt.deposit_receipt_version, deposit_receipt.deposit_nonce)
271273
} else {

0 commit comments

Comments
 (0)