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
490 changes: 250 additions & 240 deletions Cargo.lock

Large diffs are not rendered by default.

102 changes: 54 additions & 48 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,57 +40,61 @@ codegen-units = 1
incremental = false

[workspace.dependencies]
reth = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-chain-state = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-cli = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-cli-commands = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-cli-util = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-db = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-db-common = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-errors = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-node-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-node-ethereum = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-trie = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-trie-parallel = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-basic-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-node-core = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-primitives-traits = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-provider = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7", features = [
reth = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-chain-state = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-cli = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-cli-commands = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-cli-util = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-db = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-db-common = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-errors = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-node-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-rpc-engine-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-node-ethereum = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-trie = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-trie-parallel = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-basic-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-node-core = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-primitives-traits = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-provider = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8", features = [
"test-utils",
] }
reth-chainspec = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-evm = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-evm-ethereum = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-execution-errors = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-exex = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-metrics = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-trie-db = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-payload-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-execution-types = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-revm = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-payload-builder-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-payload-util = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-rpc-layer = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-network-peers = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-testing-utils = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-node-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-rpc-eth-types = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-tracing-otlp = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.7" }
reth-chainspec = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-storage-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-rpc-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-evm = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-evm-ethereum = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-execution-errors = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-exex = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-tasks = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-metrics = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-trie-db = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-payload-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-execution-types = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-revm = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-payload-builder-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-payload-util = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-rpc-layer = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-network-peers = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-testing-utils = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-node-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-rpc-eth-types = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }
reth-tracing-otlp = { git = "https://github.com/paradigmxyz/reth", tag = "v1.4.8" }

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

Expand All @@ -114,6 +118,7 @@ alloy-provider = { version = "1.0.9", features = [
"ipc",
"pubsub",
"txpool-api",
"engine-api",
] }
alloy-pubsub = { version = "1.0.9" }
alloy-eips = { version = "1.0.9" }
Expand Down Expand Up @@ -141,7 +146,7 @@ op-alloy-rpc-types-engine = { version = "0.17.2", default-features = false }
op-alloy-rpc-jsonrpsee = { version = "0.17.2", default-features = false }
op-alloy-network = { version = "0.17.2", default-features = false }
op-alloy-consensus = { version = "0.17.2", default-features = false }
op-alloy-flz = { version = "0.13.0", default-features = false }
op-alloy-flz = { version = "0.13.1", default-features = false }

async-trait = { version = "0.1.83" }
clap = { version = "4.4.3", features = ["derive", "env", "string"] }
Expand All @@ -150,6 +155,7 @@ thiserror = { version = "1.0.64" }
eyre = { version = "0.6.12" }
jsonrpsee = { version = "0.25.1" }
jsonrpsee-types = { version = "0.25.1" }
jsonrpsee-core = { version = "0.25.1" }
parking_lot = { version = "0.12.3" }
tokio = { version = "1.40.0" }
auto_impl = { version = "1.2.0" }
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ lt: lint test ## Run "lint" and "test"
.PHONY: fmt
fmt: ## Format the code
cargo +nightly fmt
cargo +nightly fix --allow-staged
cargo +nightly clippy --features "$(FEATURES)" --fix --allow-staged
cargo +nightly clippy -p op-rbuilder --features "$(FEATURES)" --fix --allow-staged
cargo +nightly clippy --features "$(FEATURES)" --fix --allow-staged --allow-dirty
cargo +nightly clippy -p op-rbuilder --features "$(FEATURES)" --fix --allow-staged --allow-dirty
cargo +nightly fix --allow-staged --allow-dirty

.PHONY: bench
bench: ## Run benchmarks
Expand Down
12 changes: 11 additions & 1 deletion crates/op-rbuilder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ reth-chainspec.workspace = true
reth-primitives.workspace = true
reth-primitives-traits.workspace = true
reth-node-api.workspace = true
reth-rpc-engine-api.workspace = true
reth-node-core.workspace = true
reth-basic-payload-builder.workspace = true
reth-payload-builder.workspace = true
reth-node-ethereum.workspace = true
Expand All @@ -45,8 +47,11 @@ reth-network-peers.workspace = true
reth-testing-utils.workspace = true
reth-optimism-forks.workspace = true
reth-node-builder.workspace = true
reth-storage-api.workspace = true
reth-rpc-api.workspace = true
reth-rpc-eth-types.workspace = true
reth-optimism-rpc.workspace = true
reth-tasks.workspace = true
reth-tracing-otlp = { workspace = true, optional = true }

alloy-primitives.workspace = true
Expand Down Expand Up @@ -81,7 +86,8 @@ serde.workspace = true
secp256k1.workspace = true
tokio.workspace = true
jsonrpsee = { workspace = true }
jsonrpsee-types.workspace = true
jsonrpsee-core = { workspace = true }
jsonrpsee-types = { workspace = true }
async-trait = { workspace = true }
clap_builder = { workspace = true }
clap.workspace = true
Expand All @@ -92,6 +98,7 @@ tokio-util.workspace = true
thiserror.workspace = true
parking_lot.workspace = true
url.workspace = true
anyhow = "1"

tower = "0.5"
futures = "0.3"
Expand Down Expand Up @@ -120,6 +127,7 @@ vergen-git2.workspace = true
alloy-provider = { workspace = true, default-features = true, features = [
"txpool-api",
] }
tempfile = "3.8"

[features]
default = ["jemalloc"]
Expand Down Expand Up @@ -148,6 +156,8 @@ interop = []

telemetry = ["reth-tracing-otlp"]

custom-engine-api = []

[[bin]]
name = "op-rbuilder"
path = "src/main.rs"
Expand Down
14 changes: 7 additions & 7 deletions crates/op-rbuilder/src/args/op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
//! Copied from OptimismNode to allow easy extension.

//! clap [Args](clap::Args) for optimism rollup configuration
use std::path::PathBuf;

use crate::tx_signer::Signer;
use anyhow::{anyhow, Result};
use reth_optimism_node::args::RollupArgs;
use std::path::PathBuf;

/// Parameters for rollup configuration
#[derive(Debug, Clone, Default, PartialEq, Eq, clap::Args)]
#[derive(Debug, Clone, Default, clap::Args)]
#[command(next_help_heading = "Rollup")]
pub struct OpRbuilderArgs {
/// Rollup configuration
Expand Down Expand Up @@ -38,6 +38,7 @@ pub struct OpRbuilderArgs {
#[arg(long = "builder.enable-revert-protection", default_value = "false")]
pub enable_revert_protection: bool,

/// Path to builder playgorund to automatically start up the node connected to it
#[arg(
long = "builder.playground",
num_args = 0..=1,
Expand All @@ -46,17 +47,16 @@ pub struct OpRbuilderArgs {
env = "PLAYGROUND_DIR",
)]
pub playground: Option<PathBuf>,

#[command(flatten)]
pub flashblocks: FlashblocksArgs,
}

fn expand_path(s: &str) -> Result<PathBuf, String> {
fn expand_path(s: &str) -> Result<PathBuf> {
shellexpand::full(s)
.map_err(|e| format!("expansion error for `{s}`: {e}"))?
.map_err(|e| anyhow!("expansion error for `{s}`: {e}"))?
.into_owned()
.parse()
.map_err(|e| format!("invalid path after expansion: {e}"))
.map_err(|e| anyhow!("invalid path after expansion: {e}"))
}

/// Parameters for Flashblocks configuration
Expand Down
9 changes: 3 additions & 6 deletions crates/op-rbuilder/src/builders/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -586,12 +586,9 @@ impl OpPayloadBuilderCtx {
// Create and sign the transaction
let builder_tx =
signed_builder_tx(db, builder_tx_gas, message, signer, base_fee, chain_id)?;
Ok(
op_alloy_flz::tx_estimated_size_fjord(builder_tx.encoded_2718().as_slice())
// Downscaled by 1e6 to be compliant with op-geth estimate size function
// https://github.com/ethereum-optimism/op-geth/blob/optimism/core/types/rollup_cost.go#L563
.wrapping_div(1_000_000),
)
Ok(op_alloy_flz::tx_estimated_size_fjord_bytes(
builder_tx.encoded_2718().as_slice(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am confused now, we are not dividing anymore?

Copy link
Collaborator Author

@SozinM SozinM Jun 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, i used the fixed version of the call (from fix i made for reth)

))
})
.transpose()
.unwrap_or_else(|err: PayloadBuilderError| {
Expand Down
4 changes: 2 additions & 2 deletions crates/op-rbuilder/src/builders/standard/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use alloy_eips::{eip7685::EMPTY_REQUESTS_HASH, merge::BEACON_NONCE};
use alloy_primitives::U256;
use reth::payload::PayloadBuilderAttributes;
use reth_basic_payload_builder::{BuildOutcome, BuildOutcomeKind, MissingPayloadBehaviour};
use reth_chain_state::{ExecutedBlock, ExecutedBlockWithTrieUpdates};
use reth_chain_state::{ExecutedBlock, ExecutedBlockWithTrieUpdates, ExecutedTrieUpdates};
use reth_evm::{execute::BlockBuilder, ConfigureEvm};
use reth_node_api::{Block, PayloadBuilderError};
use reth_node_builder::{components::PayloadBuilderBuilder, BuilderContext};
Expand Down Expand Up @@ -543,7 +543,7 @@ impl<Txs: PayloadTxsBounds> OpBuilder<'_, Txs> {
execution_output: Arc::new(execution_outcome),
hashed_state: Arc::new(hashed_state),
},
trie: Arc::new(trie_output),
trie: ExecutedTrieUpdates::Present(Arc::new(trie_output)),
};

let no_tx_pool = ctx.attributes().no_tx_pool;
Expand Down
3 changes: 3 additions & 0 deletions crates/op-rbuilder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ pub mod tx_signer;

#[cfg(any(test, feature = "testing"))]
pub mod tests;

pub mod traits;
pub mod tx;
27 changes: 19 additions & 8 deletions crates/op-rbuilder/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ use core::fmt::Debug;
use metrics::VERSION;
use moka::future::Cache;
use monitor_tx_pool::monitor_tx_pool;
use primitives::reth::engine_api_builder::OpEngineApiBuilder;
use reth::builder::{NodeBuilder, WithLaunchContext};
use reth_cli_commands::launcher::Launcher;
use reth_db::mdbx::DatabaseEnv;
use reth_optimism_chainspec::OpChainSpec;
use reth_optimism_cli::chainspec::OpChainSpecParser;
use reth_optimism_node::{
node::{OpAddOnsBuilder, OpPoolBuilder},
node::{OpAddOns, OpAddOnsBuilder, OpEngineValidatorBuilder, OpPoolBuilder},
OpNode,
};
use reth_transaction_pool::TransactionPool;
Expand Down Expand Up @@ -101,12 +102,28 @@ where
) -> Result<()> {
let builder_config = BuilderConfig::<B::Config>::try_from(builder_args.clone())
.expect("Failed to convert rollup args to builder config");

let da_config = builder_config.da_config.clone();
let rollup_args = builder_args.rollup_args;
let op_node = OpNode::new(rollup_args.clone());
let reverted_cache = Cache::builder().max_capacity(100).build();
let reverted_cache_copy = reverted_cache.clone();

let mut addons: OpAddOns<
_,
_,
OpEngineValidatorBuilder,
OpEngineApiBuilder<OpEngineValidatorBuilder>,
> = OpAddOnsBuilder::default()
.with_sequencer(rollup_args.sequencer.clone())
.with_enable_tx_conditional(rollup_args.enable_tx_conditional)
.with_da_config(da_config)
.build();
if cfg!(feature = "custom-engine-api") {
let engine_builder: OpEngineApiBuilder<OpEngineValidatorBuilder> =
OpEngineApiBuilder::default();
addons = addons.with_engine_api(engine_builder);
}
let handle = builder
.with_types::<OpNode>()
.with_components(
Expand All @@ -127,13 +144,7 @@ where
)
.payload(B::new_service(builder_config)?),
)
.with_add_ons(
OpAddOnsBuilder::default()
.with_sequencer(rollup_args.sequencer.clone())
.with_enable_tx_conditional(rollup_args.enable_tx_conditional)
.with_da_config(da_config)
.build(),
)
.with_add_ons(addons)
.extend_rpc_modules(move |ctx| {
if builder_args.enable_revert_protection {
tracing::info!("Revert protection enabled");
Expand Down
Loading
Loading