Skip to content
Draft
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
2,916 changes: 1,420 additions & 1,496 deletions Cargo.lock

Large diffs are not rendered by default.

113 changes: 57 additions & 56 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,63 +46,63 @@ unreachable_pub = "deny"
unused_async = "warn"

[workspace.dependencies]
reth = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-chain-state = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-cli = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-cli-commands = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-cli-util = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-db = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-db-common = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-errors = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-node-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-rpc-engine-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-node-ethereum = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-trie = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-trie-parallel = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-basic-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-node-core = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-primitives-traits = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-provider = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2", features = [
reth = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-chain-state = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-cli = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-cli-commands = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-cli-util = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-db = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-db-common = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-errors = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-node-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-rpc-engine-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-node-ethereum = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-trie = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-trie-parallel = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-basic-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-node-core = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-primitives-traits = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-provider = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3", features = [
"test-utils",
] }

reth-chainspec = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-storage-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-rpc-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-evm = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-evm-ethereum = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-execution-errors = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-exex = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-tasks = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-metrics = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-trie-db = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-payload-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-execution-types = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-revm = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-payload-builder-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-payload-util = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-rpc-layer = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-network-peers = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-testing-utils = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-node-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-rpc-eth-types = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-tracing-otlp = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-ipc = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-chainspec = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-storage-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-rpc-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-evm = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-evm-ethereum = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-execution-errors = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-exex = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-tasks = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-metrics = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-trie-db = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-payload-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-execution-types = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-revm = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-payload-builder-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-payload-util = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-rpc-layer = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-network-peers = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-testing-utils = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-node-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-rpc-eth-types = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-tracing-otlp = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-ipc = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }

# reth optimism
reth-optimism-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-optimism-consensus = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-optimism-cli = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-optimism-forks = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-optimism-evm = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-optimism-node = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-optimism-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-optimism-chainspec = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-optimism-txpool = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2" }
reth-optimism-rpc = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.2", features = [
reth-optimism-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-optimism-consensus = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-optimism-cli = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-optimism-forks = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-optimism-evm = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-optimism-node = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-optimism-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-optimism-chainspec = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-optimism-txpool = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3" }
reth-optimism-rpc = { git = "https://github.com/paradigmxyz/reth", tag = "v1.8.3", features = [
"client",
] }

Expand All @@ -120,14 +120,14 @@ ethereum_ssz = "0.9.0"
alloy-primitives = { version = "1.3.1", default-features = false }
alloy-rlp = "0.3.10"
alloy-chains = "0.2.5"
alloy-contract = { version = "1.0.37" }
alloy-evm = { version = "0.21.0", default-features = false }
alloy-evm = { version = "0.21.3", default-features = false }
alloy-provider = { version = "1.0.37", features = [
"ipc",
"pubsub",
"txpool-api",
"engine-api",
] }
alloy-contract = { version = "1.0.37" }
alloy-pubsub = { version = "1.0.37" }
alloy-eips = { version = "1.0.37" }
alloy-rpc-types = { version = "1.0.37" }
Expand All @@ -139,17 +139,18 @@ alloy-transport = { version = "1.0.37" }
alloy-node-bindings = { version = "1.0.37" }
alloy-consensus = { version = "1.0.37", features = ["kzg"] }
alloy-serde = { version = "1.0.37" }
alloy-sol-types = { version = "1.2.1", features = ["json"] }
alloy-rpc-types-beacon = { version = "1.0.37", features = ["ssz"] }
alloy-rpc-types-engine = { version = "1.0.37", features = ["ssz"] }
alloy-rpc-types-eth = { version = "1.0.37" }
alloy-signer-local = { version = "1.0.37" }
alloy-rpc-client = { version = "1.0.37" }
alloy-genesis = { version = "1.0.37" }

alloy-sol-types = { version = "1.3.1", features = ["json"] }
alloy-trie = { version = "0.9.1" }

# optimism
alloy-op-evm = { version = "0.21.0", default-features = false }
alloy-op-evm = { version = "0.21.3", default-features = false }
op-alloy-rpc-types = { version = "0.20.0", default-features = false }
op-alloy-rpc-types-engine = { version = "0.20.0", default-features = false }
op-alloy-rpc-jsonrpsee = { version = "0.20.0", default-features = false }
Expand Down
4 changes: 2 additions & 2 deletions crates/op-rbuilder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ sha3 = "0.10"
reqwest = "0.12.23"
k256 = "0.13.4"

rollup-boost = { git = "http://github.com/flashbots/rollup-boost", rev = "b86af43969557bee18f17ec1d6bcd3e984f910b2" }

rollup-boost = { git = "http://github.com/flashbots/rollup-boost", rev = "dd12e8e8366004b4758bfa0cfa98efa6929b7e9f" }
eth-sparse-mpt = { git = "https://github.com/flashbots/rbuilder", rev = "36da77bb723e23b8058adc35a7ada5f19950642f" }
nanoid = { version = "0.4", optional = true }
reth-ipc = { workspace = true, optional = true }
tar = { version = "0.4", optional = true }
Expand Down
9 changes: 9 additions & 0 deletions crates/op-rbuilder/src/builders/builder_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,19 @@ pub trait BuilderTransactions<ExtraCtx: Debug + Default = (), Extra: Debug + Def
cumulative_gas_used: info.cumulative_gas_used,
};
info.receipts.push(builder_ctx.build_receipt(ctx, None));
info.incremental_changes.push(state.keys().collect());

// Commit changes
evm.db_mut().commit(state);

// Send changes to prefetcher
let _ = builder_ctx
.prefetcher_tx
.send(state.clone())
.inspect_err(|err| {
warn!("Failed to send prefetch state: {}", err);
});

// Append sender and transaction to the respective lists
info.executed_senders.push(builder_tx.signed_tx.signer());
info.executed_transactions
Expand Down
26 changes: 20 additions & 6 deletions crates/op-rbuilder/src/builders/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ use alloy_op_evm::block::receipt_builder::OpReceiptBuilder;
use alloy_primitives::{BlockHash, Bytes, U256};
use alloy_rpc_types_eth::Withdrawals;
use core::fmt::Debug;
use eth_sparse_mpt::{ChangedAccountData, SparseTrieLocalCache, SparseTrieSharedCache};
use op_alloy_consensus::OpDepositReceipt;
use op_revm::OpSpecId;
use reth::payload::PayloadBuilderAttributes;
use reth::{payload::PayloadBuilderAttributes, revm::state::AccountStatus};
use reth_basic_payload_builder::PayloadConfig;
use reth_chainspec::{EthChainSpec, EthereumHardforks};
use reth_evm::{
Expand All @@ -30,10 +31,12 @@ use reth_primitives::SealedHeader;
use reth_primitives_traits::{InMemorySize, SignedTransaction};
use reth_revm::{State, context::Block};
use reth_transaction_pool::{BestTransactionsAttributes, PoolTransaction};
use revm::{DatabaseCommit, context::result::ResultAndState, interpreter::as_u64_saturated};
use revm::{
DatabaseCommit, context::result::ResultAndState, interpreter::as_u64_saturated, state::EvmState,
};
use std::{sync::Arc, time::Instant};
use tokio_util::sync::CancellationToken;
use tracing::{debug, info, trace};
use tracing::{debug, info, trace, warn};

use crate::{
gas_limiter::AddressGasLimiter,
Expand Down Expand Up @@ -71,6 +74,10 @@ pub struct OpPayloadBuilderCtx<ExtraCtx: Debug + Default = ()> {
pub max_gas_per_txn: Option<u64>,
/// Rate limiting based on gas. This is an optional feature.
pub address_gas_limiter: AddressGasLimiter,
/// channel to send applied changed to state root hasher prefetcher
pub prefetcher_tx: std::sync::mpsc::Sender<EvmState>,
/// shared cache used by state root calculator
pub sparse_trie_shared_cache: SparseTrieSharedCache,
}

impl<ExtraCtx: Debug + Default> OpPayloadBuilderCtx<ExtraCtx> {
Expand Down Expand Up @@ -314,7 +321,7 @@ impl<ExtraCtx: Debug + Default> OpPayloadBuilderCtx<ExtraCtx> {
cumulative_gas_used: info.cumulative_gas_used,
};
info.receipts.push(self.build_receipt(ctx, depositor_nonce));

info.incremental_changes.push(state.keys().collect());
// commit changes
evm.db_mut().commit(state);

Expand All @@ -336,6 +343,7 @@ impl<ExtraCtx: Debug + Default> OpPayloadBuilderCtx<ExtraCtx> {
best_txs: &mut impl PayloadTxsBounds,
block_gas_limit: u64,
block_da_limit: Option<u64>,
prefetcher_tx: std::sync::mpsc::Sender<EvmState>,
) -> Result<Option<()>, PayloadBuilderError> {
let execute_txs_start_time = Instant::now();
let mut num_txs_considered = 0;
Expand Down Expand Up @@ -529,9 +537,15 @@ impl<ExtraCtx: Debug + Default> OpPayloadBuilderCtx<ExtraCtx> {
cumulative_gas_used: info.cumulative_gas_used,
};
info.receipts.push(self.build_receipt(ctx, None));

info.incremental_changes.push(state.keys().collect());
// commit changes
evm.db_mut().commit(state);
evm.db_mut().commit(state.clone());

let _ = prefetcher_tx
.send(state)
.inspect_err(|err| {
warn!("Failed to send prefetch state: {}", err);
});

// update add to total fees
let miner_fee = tx
Expand Down
Loading
Loading