From 4512e38c31d22fd8183a4927753fc7263deac149 Mon Sep 17 00:00:00 2001 From: Mihir Wadekar Date: Mon, 2 Feb 2026 19:33:36 -0800 Subject: [PATCH 1/3] chore: We split existing services into binaries and crates We split our services into binaries and crates to make it easy for sharing code. --- Cargo.lock | 23 ++++++++++++-- Cargo.toml | 8 +++-- bin/mempool-rebroadcaster/Cargo.toml | 16 ++++++++++ .../mempool-rebroadcaster/src/main.rs | 2 +- bin/sidecrush/Cargo.toml | 16 ++++++++++ .../sidecrush.rs => bin/sidecrush/src/main.rs | 6 ++-- crates/mempool-rebroadcaster/Cargo.toml | 13 +++----- crates/mempool-rebroadcaster/src/lib.rs | 4 ++- .../mempool-rebroadcaster/tests/e2e_tests.rs | 2 +- crates/sidecrush/Cargo.toml | 13 +++----- .../alloy_client.rs | 0 .../mod.rs | 0 crates/sidecrush/src/lib.rs | 9 ++++-- deny.toml | 31 +++++++++++++++++++ justfile | 2 +- 15 files changed, 113 insertions(+), 32 deletions(-) create mode 100644 bin/mempool-rebroadcaster/Cargo.toml rename {crates => bin}/mempool-rebroadcaster/src/main.rs (96%) create mode 100644 bin/sidecrush/Cargo.toml rename crates/sidecrush/src/bin/sidecrush.rs => bin/sidecrush/src/main.rs (96%) rename crates/sidecrush/src/{blockbuilding_healthcheck => healthcheck}/alloy_client.rs (100%) rename crates/sidecrush/src/{blockbuilding_healthcheck => healthcheck}/mod.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 6c53a24..da17069 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2736,12 +2736,21 @@ dependencies = [ "alloy-rpc-types", "alloy-rpc-types-eth", "alloy-trie", - "clap", - "dotenvy", "serde", "serde_json", "tokio", "tracing", +] + +[[package]] +name = "mempool-rebroadcaster-bin" +version = "0.1.0" +dependencies = [ + "clap", + "dotenvy", + "mempool-rebroadcaster", + "tokio", + "tracing", "tracing-subscriber", ] @@ -3974,8 +3983,18 @@ dependencies = [ "alloy-transport-http", "anyhow", "async-trait", + "cadence", + "tokio", + "tracing", +] + +[[package]] +name = "sidecrush-bin" +version = "0.1.0" +dependencies = [ "cadence", "clap", + "sidecrush", "tokio", "tracing", "tracing-subscriber", diff --git a/Cargo.toml b/Cargo.toml index 9209364..0b8c00b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,6 +44,7 @@ needless-pass-by-ref-mut = "warn" string-lit-as-bytes = "warn" [workspace.dependencies] +cadence = "1.4" clap = { version = "4.0", features = ["derive", "env"] } tokio-tungstenite = { version = "0.26", features = ["native-tls"] } futures-util = "0.3" @@ -57,14 +58,15 @@ dirs = "6.0" arboard = "3.4" dotenvy = "0.15.7" async-trait = "0.1" +mempool-rebroadcaster = { path = "./crates/mempool-rebroadcaster" } +sidecrush = { path = "./crates/sidecrush" } +metrics = "0.24.1" +metrics-derive = "0.1" tracing = "0.1" tracing-subscriber = { version = "0.3", default-features = false, features = ["env-filter", "fmt", "ansi", "json"] } tokio = { version = "1.0", features = ["full"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -metrics = "0.24.1" -metrics-derive = "0.1" -cadence = "1.4" # alloy alloy-primitives = { version = "1.5.2", default-features = false, features = [ diff --git a/bin/mempool-rebroadcaster/Cargo.toml b/bin/mempool-rebroadcaster/Cargo.toml new file mode 100644 index 0000000..dd76e50 --- /dev/null +++ b/bin/mempool-rebroadcaster/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "mempool-rebroadcaster-bin" +version = "0.1.0" +edition = "2021" + +[[bin]] +name = "mempool-rebroadcaster" +path = "src/main.rs" + +[dependencies] +clap = { workspace = true } +dotenvy = "0.15.7" +mempool-rebroadcaster = { workspace = true } +tracing = { workspace = true } +tracing-subscriber = { workspace = true } +tokio = { workspace = true } diff --git a/crates/mempool-rebroadcaster/src/main.rs b/bin/mempool-rebroadcaster/src/main.rs similarity index 96% rename from crates/mempool-rebroadcaster/src/main.rs rename to bin/mempool-rebroadcaster/src/main.rs index 8d18563..57dcc46 100644 --- a/crates/mempool-rebroadcaster/src/main.rs +++ b/bin/mempool-rebroadcaster/src/main.rs @@ -1,6 +1,6 @@ use clap::Parser; use dotenvy::dotenv; -use mempool_rebroadcaster::rebroadcaster::Rebroadcaster; +use mempool_rebroadcaster::Rebroadcaster; use tracing::{Level, error, info}; use tracing_subscriber::EnvFilter; diff --git a/bin/sidecrush/Cargo.toml b/bin/sidecrush/Cargo.toml new file mode 100644 index 0000000..00f528f --- /dev/null +++ b/bin/sidecrush/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "sidecrush-bin" +version = "0.1.0" +edition = "2021" + +[[bin]] +name = "sidecrush" +path = "src/main.rs" + +[dependencies] +clap = { workspace = true } +sidecrush = { workspace = true } +tracing = { workspace = true } +tracing-subscriber = { workspace = true } +tokio = { workspace = true } +cadence = { workspace = true } diff --git a/crates/sidecrush/src/bin/sidecrush.rs b/bin/sidecrush/src/main.rs similarity index 96% rename from crates/sidecrush/src/bin/sidecrush.rs rename to bin/sidecrush/src/main.rs index fa64a05..f34474d 100644 --- a/crates/sidecrush/src/bin/sidecrush.rs +++ b/bin/sidecrush/src/main.rs @@ -3,10 +3,8 @@ use std::net::UdpSocket; use cadence::{StatsdClient, UdpMetricSink}; use clap::Parser; use sidecrush::{ - blockbuilding_healthcheck::{ - BlockProductionHealthChecker, HealthcheckConfig, Node, alloy_client::AlloyEthClient, - }, - metrics::HealthcheckMetrics, + BlockProductionHealthChecker, HealthcheckConfig, HealthcheckMetrics, Node, + alloy_client::AlloyEthClient, }; use tracing::Level; diff --git a/crates/mempool-rebroadcaster/Cargo.toml b/crates/mempool-rebroadcaster/Cargo.toml index 1ad32e3..c562f63 100644 --- a/crates/mempool-rebroadcaster/Cargo.toml +++ b/crates/mempool-rebroadcaster/Cargo.toml @@ -7,18 +7,14 @@ license.workspace = true [lints] workspace = true -[[bin]] -name = "mempool-rebroadcaster" -path = "src/main.rs" +[lib] +path = "src/lib.rs" [dependencies] -clap = { workspace = true } -tracing = { workspace = true } -tracing-subscriber = { workspace = true } -tokio = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } -dotenvy = { workspace = true } +tracing = { workspace = true } +tokio = { workspace = true } # alloy alloy-primitives.workspace = true @@ -28,4 +24,3 @@ alloy-rpc-types-eth.workspace = true alloy-consensus.workspace = true alloy-trie.workspace = true alloy-provider = { workspace = true, features = ["txpool-api"] } - diff --git a/crates/mempool-rebroadcaster/src/lib.rs b/crates/mempool-rebroadcaster/src/lib.rs index 684acd5..d316083 100644 --- a/crates/mempool-rebroadcaster/src/lib.rs +++ b/crates/mempool-rebroadcaster/src/lib.rs @@ -1 +1,3 @@ -pub mod rebroadcaster; +mod rebroadcaster; + +pub use rebroadcaster::{Rebroadcaster, RebroadcasterResult, TxpoolDiff}; diff --git a/crates/mempool-rebroadcaster/tests/e2e_tests.rs b/crates/mempool-rebroadcaster/tests/e2e_tests.rs index 762b29b..5943136 100644 --- a/crates/mempool-rebroadcaster/tests/e2e_tests.rs +++ b/crates/mempool-rebroadcaster/tests/e2e_tests.rs @@ -1,7 +1,7 @@ use std::path::Path; use alloy_rpc_types::txpool::TxpoolContent; -use mempool_rebroadcaster::rebroadcaster::Rebroadcaster; +use mempool_rebroadcaster::Rebroadcaster; fn load_static_mempool_content>( filepath: P, diff --git a/crates/sidecrush/Cargo.toml b/crates/sidecrush/Cargo.toml index c91bc57..10d8d15 100644 --- a/crates/sidecrush/Cargo.toml +++ b/crates/sidecrush/Cargo.toml @@ -7,18 +7,15 @@ license.workspace = true [lints] workspace = true -[[bin]] -name = "sidecrush" -path = "src/bin/sidecrush.rs" +[lib] +path = "src/lib.rs" [dependencies] +anyhow = { workspace = true } +async-trait = { workspace = true } +cadence = { workspace = true } tracing = { workspace = true } -tracing-subscriber = { workspace = true } tokio = { workspace = true } -cadence = { workspace = true } -async-trait = { workspace = true } -anyhow = { workspace = true } -clap = { workspace = true } # Ethereum client deps (will be used for header fetching) alloy-provider = { workspace = true } diff --git a/crates/sidecrush/src/blockbuilding_healthcheck/alloy_client.rs b/crates/sidecrush/src/healthcheck/alloy_client.rs similarity index 100% rename from crates/sidecrush/src/blockbuilding_healthcheck/alloy_client.rs rename to crates/sidecrush/src/healthcheck/alloy_client.rs diff --git a/crates/sidecrush/src/blockbuilding_healthcheck/mod.rs b/crates/sidecrush/src/healthcheck/mod.rs similarity index 100% rename from crates/sidecrush/src/blockbuilding_healthcheck/mod.rs rename to crates/sidecrush/src/healthcheck/mod.rs diff --git a/crates/sidecrush/src/lib.rs b/crates/sidecrush/src/lib.rs index 0dc9056..da01e1e 100644 --- a/crates/sidecrush/src/lib.rs +++ b/crates/sidecrush/src/lib.rs @@ -1,2 +1,7 @@ -pub mod blockbuilding_healthcheck; -pub mod metrics; +mod healthcheck; +mod metrics; + +pub use healthcheck::{ + BlockProductionHealthChecker, EthClient, HeaderSummary, HealthcheckConfig, Node, alloy_client, +}; +pub use metrics::HealthcheckMetrics; diff --git a/deny.toml b/deny.toml index 8337778..5c4adf5 100644 --- a/deny.toml +++ b/deny.toml @@ -44,9 +44,40 @@ skip = [ # Common ecosystem duplicates "getrandom", "hashbrown", + "itertools", + "foldhash", + "lru", + + # Random number generation + "rand", + "rand_chacha", + "rand_core", + + # Proc-macro / derive ecosystem (alloy-tx-macros vs ratatui/instability) + "darling", + "darling_core", + "darling_macro", + + # ratatui vs alloy transitive mismatches + "strum", + "strum_macros", + "unicode-width", + + # crossterm/ratatui vs tempfile (rustix 0.38 vs 1.x) + "rustix", + "linux-raw-sys", # Windows platform crates "windows-sys", + "windows-targets", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] [sources] diff --git a/justfile b/justfile index d36bde0..43fcb90 100644 --- a/justfile +++ b/justfile @@ -100,7 +100,7 @@ docker-image: # Run mempool rebroadcaster service run-mempool-rebroadcaster: - cargo run -p mempool-rebroadcaster -- --geth-mempool-endpoint {{env_var("GETH_MEMPOOL_ENDPOINT")}} --reth-mempool-endpoint {{env_var("RETH_MEMPOOL_ENDPOINT")}} + cargo run --bin mempool-rebroadcaster -- --geth-mempool-endpoint {{env_var("GETH_MEMPOOL_ENDPOINT")}} --reth-mempool-endpoint {{env_var("RETH_MEMPOOL_ENDPOINT")}} # Run basectl with specified config (mainnet, sepolia, devnet, or path) basectl config="mainnet": From 6e7c85c7d1c81eaa933cbe451900a1976f299935 Mon Sep 17 00:00:00 2001 From: Mihir Wadekar Date: Tue, 10 Feb 2026 11:48:48 -0800 Subject: [PATCH 2/3] fix: docker ci --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ca2d1e0..82ba6eb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,7 @@ COPY . . RUN PROFILE_FLAG=$([ "$RELEASE" = "true" ] && echo "--release" || echo "") && \ TARGET_DIR=$([ "$RELEASE" = "true" ] && echo "release" || echo "debug") && \ - cargo build $PROFILE_FLAG --features="$FEATURES" --package=${SERVICE_NAME}; \ + cargo build $PROFILE_FLAG --features="$FEATURES" --bin=${SERVICE_NAME}; \ cp target/$TARGET_DIR/${SERVICE_NAME} /tmp/final_binary # From 284cb2a5b6f6a2f952914a8c6fce61d26c12762b Mon Sep 17 00:00:00 2001 From: Mihir Wadekar Date: Tue, 10 Feb 2026 11:53:00 -0800 Subject: [PATCH 3/3] chore: all bins as default members --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 0b8c00b..79f120b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [workspace] resolver = "2" members = ["crates/*", "bin/*"] -default-members = ["bin/basectl"] +default-members = ["bin/*"] exclude = [".github/"] [workspace.package]