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
996 changes: 648 additions & 348 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ ethereum_ssz_derive = "0.8"
ethereum_ssz = "0.8"

alloy-primitives = { version = "0.8.15", default-features = false }
alloy-rlp = "0.3.10"
alloy-rlp = "0.3.11"
alloy-chains = "0.1.33"
alloy-provider = { version = "0.11.1", features = ["ipc", "pubsub"] }
alloy-pubsub = { version = "0.11.1" }
Expand All @@ -137,6 +137,10 @@ op-alloy-rpc-jsonrpsee = { version = "0.10.3", default-features = false }
op-alloy-network = { version = "0.10.3", default-features = false }
op-alloy-consensus = { version = "0.10.3", default-features = false }

# kona
kona-rpc = { git="https://github.com/op-rs/kona", rev="0493d8479e2ca9f0eb6d5c6154e2bedc61de7217", features = ["client", "interop", "jsonrpsee"]}
kona-interop = { git="https://github.com/op-rs/kona", rev="0493d8479e2ca9f0eb6d5c6154e2bedc61de7217"}

async-trait = { version = "0.1.83" }
clap = { version = "4.4.3", features = ["derive", "env"] }
clap_builder = { version = "4.5.19" }
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.op-rbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
ARG FEATURES
ARG RBUILDER_BIN="op-rbuilder"

FROM rust:1.82 AS base
FROM rust:1.85 AS base
ARG TARGETPLATFORM

RUN apt-get update \
Expand Down
7 changes: 6 additions & 1 deletion crates/op-rbuilder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ op-alloy-consensus.workspace = true
op-alloy-rpc-types-engine.workspace = true
op-alloy-network.workspace = true

# kona
kona-rpc = {workspace = true, optional = true}
kona-interop = {workspace = true, optional = true}

revm.workspace = true

tracing.workspace = true
Expand Down Expand Up @@ -85,6 +89,7 @@ alloy-serde = "0.7"
tracing-subscriber = { version = "0.3.18", features = ["env-filter", "json"] }

rollup-boost = { git = "https://github.com/flashbots/rollup-boost", rev = "e74a1fd01366e4ddd13515da4efda59cdc8fbce0" }
url = "2.5.3"

[target.'cfg(unix)'.dependencies]
tikv-jemallocator = { version = "0.6", optional = true }
Expand Down Expand Up @@ -113,7 +118,7 @@ min-info-logs = ["tracing/release_max_level_info"]
min-debug-logs = ["tracing/release_max_level_debug"]
min-trace-logs = ["tracing/release_max_level_trace"]

optimism = ["reth-optimism-node/optimism", "reth-optimism-cli/optimism"]
optimism = ["reth-optimism-node/optimism", "reth-optimism-cli/optimism", "kona-rpc", "kona-interop"]

integration = []
flashblocks = []
Expand Down
12 changes: 11 additions & 1 deletion crates/op-rbuilder/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use reth_optimism_node::args::RollupArgs;

use crate::tx_signer::Signer;
use alloy_transport_http::reqwest::Url;

/// Parameters for rollup configuration
#[derive(Debug, Clone, Default, PartialEq, Eq, clap::Args)]
Expand Down Expand Up @@ -38,7 +39,16 @@ pub struct OpRbuilderArgs {
env = "FLASHBLOCK_BLOCK_TIME"
)]
pub flashblock_block_time: u64,

/// URL of the supervisor service for transaction validation
#[arg(long = "rollup.supervisor-url", env = "SUPERVISOR_URL")]
pub supervisor_url: Option<Url>,
/// URL of the supervisor service for transaction validation
#[arg(
long = "rollup.supervisor_safety_level",
env = "SUPERVISOR_SAFETY_LEVEL",
help = "Safety level to pass to supervisor, values: finalized, safe, local-safe, cross-unsafe, unsafe, invalid"
)]
pub supervisor_safety_level: Option<String>,
/// Signals whether to log pool transactions events
#[arg(long = "builder.log-pool-transactions", default_value = "false")]
pub log_pool_transactions: bool,
Expand Down
1 change: 1 addition & 0 deletions crates/op-rbuilder/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod integration;
pub mod primitives;
pub mod tester;
pub mod tx_signer;
2 changes: 2 additions & 0 deletions crates/op-rbuilder/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ fn main() {
builder_args.flashblocks_ws_url,
builder_args.chain_block_time,
builder_args.flashblock_block_time,
builder_args.supervisor_url,
builder_args.supervisor_safety_level,
)))
.with_add_ons(
OpAddOnsBuilder::default()
Expand Down
24 changes: 24 additions & 0 deletions crates/op-rbuilder/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ pub struct OpRBuilderMetrics {
pub tx_byte_size: Histogram,
/// Number of reverted transactions
pub num_reverted_tx: Counter,
/// Number of cross-chain transactions
pub num_cross_chain_tx: Counter,
/// Number of cross-chain transactions that didn't pass supervisor validation
pub num_cross_chain_tx_fail: Counter,
/// Number of cross-chain transactions that weren't verified because of the timeout
pub num_cross_chain_tx_timeout: Counter,
/// Number of cross-chain transactions that weren't verified because of the server error
pub num_cross_chain_tx_server_error: Counter,
}

impl OpRBuilderMetrics {
Expand All @@ -70,4 +78,20 @@ impl OpRBuilderMetrics {
pub fn set_builder_balance(&self, balance: f64) {
self.builder_balance.set(balance);
}

pub fn inc_num_cross_chain_tx_fail(&self) {
self.num_cross_chain_tx_fail.increment(1);
}

pub fn inc_num_cross_chain_tx(&self) {
self.num_cross_chain_tx.increment(1);
}

pub fn inc_num_cross_chain_tx_timeout(&self) {
self.num_cross_chain_tx_timeout.increment(1);
}

pub fn inc_num_cross_chain_tx_server_error(&self) {
self.num_cross_chain_tx_server_error.increment(1);
}
}
11 changes: 10 additions & 1 deletion crates/op-rbuilder/src/payload_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ use tokio::net::{TcpListener, TcpStream};
use tokio::sync::mpsc;
use tokio_tungstenite::accept_async;
use tokio_tungstenite::WebSocketStream;
use url::Url;

use serde::{Deserialize, Serialize};

Expand All @@ -88,11 +89,15 @@ struct FlashblocksMetadata<N: NodePrimitives> {
#[derive(Debug, Clone, Default)]
#[non_exhaustive]
pub struct CustomOpPayloadBuilder {
#[allow(dead_code)]
#[expect(dead_code)]
builder_signer: Option<Signer>,
flashblocks_ws_url: String,
chain_block_time: u64,
flashblock_block_time: u64,
#[expect(dead_code)]
supervisor_url: Option<Url>,
#[expect(dead_code)]
supervisor_safety_level: Option<String>,
}

impl CustomOpPayloadBuilder {
Expand All @@ -101,12 +106,16 @@ impl CustomOpPayloadBuilder {
flashblocks_ws_url: String,
chain_block_time: u64,
flashblock_block_time: u64,
supervisor_url: Option<Url>,
supervisor_safety_level: Option<String>,
) -> Self {
Self {
builder_signer,
flashblocks_ws_url,
chain_block_time,
flashblock_block_time,
supervisor_url,
supervisor_safety_level,
}
}
}
Expand Down
Loading
Loading