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
574 changes: 284 additions & 290 deletions Cargo.lock

Large diffs are not rendered by default.

21 changes: 12 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,29 @@ resolver = "3"
members = [
"crates/rollup-boost",
"crates/websocket-proxy",
"crates/flashblocks-rpc",
"crates/flashblocks-rpc",
"crates/rollup-boost-types",
]

[workspace.dependencies]
rollup-boost = { path = "crates/rollup-boost" }
rollup-boost-types = { path = "crates/rollup-boost-types" }

tracing = "0.1.4"
tracing-subscriber = { version = "0.3.20", features = ["env-filter", "json"] }
backoff = "0.4.0"
clap = { version = "4", features = ["derive", "env"] }
eyre = "0.6.12"
futures = "0.3.31"
thiserror = "2.0.11"
serde = { version = "1", features = ["derive"] }
serde_json = "1.0.96"
metrics = "0.24.0"
metrics-derive = "0.1"
moka = { version = "0.12.10", features = ["future"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1.0.96"
sha2 = { version = "0.10", default-features = false }
thiserror = "2.0.11"
tokio = { version = "1", features = ["full"] }
eyre = "0.6.12"
tracing = "0.1.4"
tracing-subscriber = { version = "0.3.20", features = ["env-filter", "json"] }
url = "2.2.0"
sha2 = { version = "0.10", default-features = false }
backoff = "0.4.0"

# Reth deps
reth-optimism-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" }
Expand Down
1 change: 1 addition & 0 deletions crates/flashblocks-rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ license = "MIT"

[dependencies]
rollup-boost.workspace = true
rollup-boost-types.workspace = true

reth-optimism-node = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" }
reth-optimism-cli = { git = "https://github.com/paradigmxyz/reth", tag = "v1.9.3" }
Expand Down
6 changes: 3 additions & 3 deletions crates/flashblocks-rpc/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ use reth_primitives_traits::block::body::BlockBody;

use reth_rpc_eth_api::transaction::ConvertReceiptInput;
use reth_rpc_eth_api::{RpcBlock, RpcReceipt};
use rollup_boost::{
FlashblockBuilder, FlashblocksPayloadV1, OpExecutionPayloadEnvelope, PayloadVersion,
};
use rollup_boost::FlashblockBuilder;
use rollup_boost_types::flashblocks::FlashblocksPayloadV1;
use rollup_boost_types::payload::{OpExecutionPayloadEnvelope, PayloadVersion};
use serde::{Deserialize, Serialize};
use std::{collections::HashMap, str::FromStr, sync::Arc};

Expand Down
2 changes: 1 addition & 1 deletion crates/flashblocks-rpc/src/flashblocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use jsonrpsee::core::async_trait;
use op_alloy_network::Optimism;
use reth_optimism_chainspec::OpChainSpec;
use reth_rpc_eth_api::{RpcBlock, RpcReceipt};
use rollup_boost::FlashblocksPayloadV1;
use rollup_boost_types::flashblocks::FlashblocksPayloadV1;
use std::{io::Read, sync::Arc};
use tokio::sync::mpsc;
use tokio_tungstenite::{connect_async, tungstenite::Message};
Expand Down
2 changes: 1 addition & 1 deletion crates/flashblocks-rpc/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ mod tests {
use reth_optimism_primitives::OpReceipt;
use reth_provider::providers::BlockchainProvider;
use reth_tasks::TaskManager;
use rollup_boost::{
use rollup_boost_types::flashblocks::{
ExecutionPayloadBaseV1, ExecutionPayloadFlashblockDeltaV1, FlashblocksPayloadV1,
};
use std::{any::Any, collections::HashMap, net::SocketAddr, str::FromStr, sync::Arc};
Expand Down
17 changes: 17 additions & 0 deletions crates/rollup-boost-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "rollup-boost-types"
version = "0.1.0"
edition = "2024"
license = "MIT"

[dependencies]
alloy-primitives = { workspace = true }
alloy-rpc-types-engine = { workspace = true }
alloy-rpc-types-eth = { workspace = true }
alloy-serde = { workspace = true }
futures = { workspace = true }
moka = { workspace = true }
op-alloy-rpc-types-engine = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
tracing = { workspace = true }
2 changes: 2 additions & 0 deletions crates/rollup-boost-types/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod flashblocks;
pub mod payload;
3 changes: 2 additions & 1 deletion crates/rollup-boost/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ edition = "2024"
license = "MIT"

[dependencies]
rollup-boost-types.workspace = true
tracing.workspace = true
tracing-subscriber.workspace = true
clap.workspace = true
Expand All @@ -17,6 +18,7 @@ tokio.workspace = true
eyre.workspace = true
url.workspace = true
sha2.workspace = true
moka = { workspace = true, features = ["future"] }

reth-optimism-payload-builder.workspace = true
op-alloy-rpc-types-engine.workspace = true
Expand All @@ -29,7 +31,6 @@ tokio-tungstenite.workspace = true
metrics-derive.workspace = true

jsonrpsee = { workspace = true, features = ["server", "http-client", "macros"] }
moka = { version = "0.12.10", features = ["future"] }
http = "1.1.0"
dotenvy = "0.15.7"
tower = { version = "0.5.2", features = ["timeout"] }
Expand Down
4 changes: 2 additions & 2 deletions crates/rollup-boost/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ use tokio::signal::unix::{SignalKind, signal as unix_signal};
use tracing::{Level, info};

use crate::{
BlockSelectionPolicy, ClientArgs, DebugServer, FlashblocksArgs, PayloadSource, ProxyLayer,
RollupBoostServer,
BlockSelectionPolicy, ClientArgs, DebugServer, FlashblocksArgs, ProxyLayer, RollupBoostServer,
client::rpc::{BuilderArgs, L2ClientArgs},
debug_api::ExecutionMode,
get_version, init_metrics,
probe::ProbeLayer,
};
use crate::{FlashblocksService, RpcClient};
use rollup_boost_types::payload::PayloadSource;

#[derive(Clone, Debug, clap::Args)]
pub struct RollupBoostLibArgs {
Expand Down
2 changes: 1 addition & 1 deletion crates/rollup-boost/src/client/http.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::time::Duration;

use crate::client::auth::AuthLayer;
use crate::payload::PayloadSource;
use alloy_primitives::bytes::Bytes;
use alloy_rpc_types_engine::JwtSecret;
use http::Uri;
Expand All @@ -14,6 +13,7 @@ use hyper_util::rt::TokioExecutor;
use jsonrpsee::core::BoxError;
use jsonrpsee::server::HttpBody;
use opentelemetry::trace::SpanKind;
use rollup_boost_types::payload::PayloadSource;
use tower::{
Service as _, ServiceBuilder, ServiceExt,
timeout::{Timeout, TimeoutLayer},
Expand Down
10 changes: 6 additions & 4 deletions crates/rollup-boost/src/client/rpc.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::EngineApiExt;
use crate::client::auth::AuthLayer;
use crate::client::http::HttpClient as RollupBoostHttpClient;
use crate::payload::{NewPayload, OpExecutionPayloadEnvelope, PayloadSource, PayloadVersion};
use crate::server::EngineApiClient;
use crate::version::{CARGO_PKG_VERSION, VERGEN_GIT_SHA};
use alloy_primitives::{B256, Bytes};
Expand All @@ -10,7 +9,7 @@ use alloy_rpc_types_engine::{
PayloadStatus,
};
use alloy_rpc_types_eth::{Block, BlockNumberOrTag};
use clap::{Parser, arg};
use clap::Parser;
use eyre::bail;
use http::{HeaderMap, Uri};
use jsonrpsee::core::async_trait;
Expand All @@ -24,10 +23,13 @@ use op_alloy_rpc_types_engine::{
};
use opentelemetry::trace::SpanKind;
use paste::paste;
use rollup_boost_types::payload::{
NewPayload, OpExecutionPayloadEnvelope, PayloadSource, PayloadVersion,
};
use std::path::PathBuf;
use std::time::Duration;
use thiserror::Error;
use tracing::{error, info, instrument};
use tracing::{info, instrument};

use super::auth::Auth;

Expand Down Expand Up @@ -476,12 +478,12 @@ pub mod tests {
use jsonrpsee::core::client::ClientT;
use parking_lot::Mutex;

use crate::payload::PayloadSource;
use alloy_rpc_types_engine::JwtSecret;
use jsonrpsee::core::client::Error as ClientError;
use jsonrpsee::server::{ServerBuilder, ServerHandle};
use jsonrpsee::{RpcModule, rpc_params};
use predicates::prelude::*;
use rollup_boost_types::payload::PayloadSource;
use std::collections::HashSet;
use std::net::SocketAddr;
use std::net::TcpListener;
Expand Down
3 changes: 2 additions & 1 deletion crates/rollup-boost/src/engine_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ use alloy_rpc_types_eth::{Block, BlockNumberOrTag};
use jsonrpsee::core::async_trait;
use op_alloy_rpc_types_engine::OpPayloadAttributes;

use crate::{ClientResult, NewPayload, OpExecutionPayloadEnvelope, PayloadVersion};
use crate::ClientResult;
use rollup_boost_types::payload::{NewPayload, OpExecutionPayloadEnvelope, PayloadVersion};

#[async_trait]
pub trait EngineApiExt: Send + Sync + 'static {
Expand Down
3 changes: 2 additions & 1 deletion crates/rollup-boost/src/flashblocks/inbound.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use super::{metrics::FlashblocksWsInboundMetrics, primitives::FlashblocksPayloadV1};
use super::metrics::FlashblocksWsInboundMetrics;
use crate::FlashblocksWebsocketConfig;
use backoff::ExponentialBackoff;
use backoff::backoff::Backoff;
use bytes::Bytes;
use futures::{SinkExt, StreamExt};
use lru::LruCache;
use rollup_boost_types::flashblocks::FlashblocksPayloadV1;
use std::io::ErrorKind::TimedOut;
use std::num::NonZeroUsize;
use std::sync::Arc;
Expand Down
3 changes: 0 additions & 3 deletions crates/rollup-boost/src/flashblocks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ mod launcher;

pub use launcher::*;

mod primitives;
mod service;
pub use service::*;

pub use primitives::*;

mod inbound;
mod outbound;

Expand Down
2 changes: 1 addition & 1 deletion crates/rollup-boost/src/flashblocks/outbound.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use super::primitives::FlashblocksPayloadV1;
use core::{
fmt::{Debug, Formatter},
net::SocketAddr,
Expand All @@ -7,6 +6,7 @@ use core::{
task::{Context, Poll},
};
use futures::{Sink, SinkExt, StreamExt};
use rollup_boost_types::flashblocks::FlashblocksPayloadV1;
use std::{io, net::TcpListener, sync::Arc};
use tokio::{
net::TcpStream,
Expand Down
17 changes: 7 additions & 10 deletions crates/rollup-boost/src/flashblocks/service.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
use super::outbound::WebSocketPublisher;
use super::primitives::{
ExecutionPayloadBaseV1, ExecutionPayloadFlashblockDeltaV1, FlashblocksPayloadV1,
};
use crate::flashblocks::metrics::FlashblocksServiceMetrics;
use crate::{
ClientResult, EngineApiExt, NewPayload, OpExecutionPayloadEnvelope, PayloadVersion, RpcClient,
};
use crate::{ClientResult, EngineApiExt, RpcClient};
use alloy_primitives::U256;
use alloy_rpc_types_engine::{
BlobsBundleV1, ExecutionPayloadV1, ExecutionPayloadV2, ExecutionPayloadV3,
Expand All @@ -19,6 +14,10 @@ use op_alloy_rpc_types_engine::{
OpPayloadAttributes,
};
use reth_optimism_payload_builder::payload_id_optimism;
use rollup_boost_types::flashblocks::{
ExecutionPayloadBaseV1, ExecutionPayloadFlashblockDeltaV1, FlashblocksPayloadV1,
};
use rollup_boost_types::payload::{NewPayload, OpExecutionPayloadEnvelope, PayloadVersion};
use std::io;
use std::sync::Arc;
use std::sync::atomic::{AtomicU64, Ordering};
Expand Down Expand Up @@ -390,12 +389,10 @@ impl EngineApiExt for FlashblocksService {
#[cfg(test)]
mod tests {
use super::*;
use crate::{
PayloadSource,
server::tests::{MockEngineServer, spawn_server},
};
use crate::server::tests::{MockEngineServer, spawn_server};
use http::Uri;
use reth_rpc_layer::JwtSecret;
use rollup_boost_types::payload::PayloadSource;
use std::str::FromStr;

/// Test that we fallback to the getPayload method if the flashblocks payload is not available
Expand Down
3 changes: 2 additions & 1 deletion crates/rollup-boost/src/health.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ mod tests {
use tokio::net::TcpListener;

use super::*;
use crate::{Probes, payload::PayloadSource};
use crate::Probes;
use rollup_boost_types::payload::PayloadSource;
use serial_test::serial;

pub struct MockHttpServer {
Expand Down
7 changes: 4 additions & 3 deletions crates/rollup-boost/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ pub use health::*;
#[cfg(test)]
pub mod tests;

mod payload;
pub use payload::*;

mod selection;
pub use selection::*;

Expand All @@ -44,3 +41,7 @@ pub use engine_api::*;

mod version;
pub use version::*;

// re-export rollup-boost-types flashblocks types
// this can be removed once dependent crates migrate to using rollup-boost-types directly
pub use rollup_boost_types::flashblocks::*;
3 changes: 2 additions & 1 deletion crates/rollup-boost/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@ where

#[cfg(test)]
mod tests {
use crate::ClientArgs;
use crate::probe::ProbeLayer;
use crate::{ClientArgs, PayloadSource};
use rollup_boost_types::payload::PayloadSource;

use super::*;
use alloy_primitives::{B256, Bytes, U64, U128, hex};
Expand Down
2 changes: 1 addition & 1 deletion crates/rollup-boost/src/selection.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{OpExecutionPayloadEnvelope, PayloadSource};
use rollup_boost_types::payload::{OpExecutionPayloadEnvelope, PayloadSource};
use serde::{Deserialize, Serialize};

/// Defines the strategy for choosing between the builder block and the L2 client block
Expand Down
8 changes: 4 additions & 4 deletions crates/rollup-boost/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ use crate::{
use crate::{
client::rpc::RpcClient,
health::HealthHandle,
payload::{
NewPayload, NewPayloadV3, NewPayloadV4, OpExecutionPayloadEnvelope, PayloadSource,
PayloadTraceContext, PayloadVersion,
},
probe::{Health, Probes},
};
use alloy_primitives::{B256, Bytes, bytes};
Expand All @@ -36,6 +32,10 @@ use op_alloy_rpc_types_engine::{
};
use opentelemetry::trace::SpanKind;
use parking_lot::Mutex;
use rollup_boost_types::payload::{
NewPayload, NewPayloadV3, NewPayloadV4, OpExecutionPayloadEnvelope, PayloadSource,
PayloadTraceContext, PayloadVersion,
};
use std::net::{IpAddr, SocketAddr};
use std::str::FromStr;
use std::sync::Arc;
Expand Down
6 changes: 4 additions & 2 deletions crates/rollup-boost/src/tests/common/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#![allow(dead_code)]
use crate::DebugClient;
use crate::EngineApiClient;
use crate::{AuthLayer, AuthService};
use crate::{EngineApiClient, OpExecutionPayloadEnvelope, PayloadVersion};
use crate::{NewPayload, PayloadSource};
use alloy_eips::Encodable2718;
use alloy_primitives::{B256, Bytes, TxKind, U256, address, hex};
use alloy_rpc_types_engine::{ExecutionPayload, JwtSecret};
Expand All @@ -23,6 +22,9 @@ use op_alloy_consensus::TxDeposit;
use op_alloy_rpc_types_engine::OpPayloadAttributes;
use parking_lot::Mutex;
use proxy::{BuilderProxyHandler, start_proxy_server};
use rollup_boost_types::payload::{
NewPayload, OpExecutionPayloadEnvelope, PayloadSource, PayloadVersion,
};
use serde_json::Value;
use services::op_reth::{AUTH_RPC_PORT, OpRethConfig, OpRethImage, OpRethMehods, P2P_PORT};
use services::rollup_boost::{RollupBoost, RollupBoostConfig};
Expand Down
2 changes: 1 addition & 1 deletion crates/websocket-proxy/src/subscriber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ mod tests {
use tokio::net::{TcpListener, TcpStream};
use tokio::sync::broadcast;
use tokio::time::{sleep, timeout, Duration};
use tokio_tungstenite::{accept_async, tungstenite::Message};
use tokio_tungstenite::accept_async;

struct MockServer {
addr: SocketAddr,
Expand Down
Loading