Skip to content

Commit 7ff6fe1

Browse files
authored
In-process rbuilder (#228)
- Refactors `LiveBuilderConfig::new_builder` to take a generic provider - Refactors `WalletBalanceWatcher` to take a generic provider - Adds new crate `reth-rbuilder` that runs rbuilder in-process with reth - Changes config default ports that overlap with reth
1 parent ccd9cb5 commit 7ff6fe1

File tree

17 files changed

+272
-62
lines changed

17 files changed

+272
-62
lines changed

Cargo.lock

Lines changed: 21 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[workspace]
22
members = [
33
"crates/rbuilder",
4+
"crates/reth-rbuilder",
45
"crates/rbuilder/src/test_utils",
56
"crates/rbuilder/src/telemetry/metrics_macros"
67
]
@@ -23,12 +24,16 @@ edition = "2021"
2324

2425
[workspace.dependencies]
2526
reth = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
27+
reth-cli-util = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
2628
reth-db = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
29+
reth-db-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
2730
reth-db-common = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
2831
reth-errors = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
2932
reth-libmdbx = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
3033
reth-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
3134
reth-node-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
35+
reth-node-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
36+
reth-node-ethereum = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
3237
reth-trie = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
3338
reth-trie-parallel = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
3439
reth-basic-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
@@ -75,3 +80,12 @@ alloy-rpc-types-engine = { version = "0.3.0", features = [
7580
] }
7681
alloy-rpc-types-eth = { version = "0.3.0" }
7782
alloy-signer-local = { version = "0.3.0" }
83+
84+
clap = { version = "4.4.3" }
85+
eyre = { version = "0.6.8" }
86+
libc = { version = "0.2.161" }
87+
tikv-jemallocator = { version = "0.5.4" }
88+
tokio = "1.38.0"
89+
tokio-util = "0.7.11"
90+
tracing = "0.1.37"
91+

config-live-example.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,4 @@ drop_failed_orders = true
6161
name = "parallel"
6262
algo = "parallel-builder"
6363
discard_txs = true
64-
num_threads = 25
64+
num_threads = 25

crates/rbuilder/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ build = "build.rs"
77
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
88

99
[dependencies]
10-
tokio = "1.38.0"
10+
tokio.workspace = true
1111
serde = "1.0.188"
1212
serde_json = "1.0.105"
1313
thiserror = "1.0.47"
14-
eyre = "0.6.8"
14+
eyre.workspace = true
1515
reth.workspace = true
1616
reth-db.workspace = true
1717
reth-db-common.workspace = true
@@ -70,7 +70,7 @@ sqlx = { version = "0.7.1", features = [
7070
"time",
7171
"uuid",
7272
] }
73-
tracing = "0.1.37"
73+
tracing.workspace = true
7474
tracing-subscriber = { version = "0.3.18", features = ["env-filter", "json"] }
7575
csv = "1.2.2"
7676
zip = "0.6.6"
@@ -81,7 +81,7 @@ bigdecimal = "0.4.1"
8181
mempool-dumpster = "0.1.1"
8282
itertools = "0.11.0"
8383
tokio-stream = "0.1.14"
84-
clap = { version = "4.4.3", features = ["derive", "env"] }
84+
clap = { workspace = true, features = ["derive", "env"] }
8585
priority-queue = "2.0.3"
8686
secp256k1 = { version = "0.29", features = [
8787
"global-context",
@@ -97,7 +97,7 @@ ssz_rs = { git = "https://github.com/ralexstokes/ssz-rs.git", version = "0.9.0"
9797
beacon-api-client = { git = "https://github.com/ralexstokes/ethereum-consensus/", rev = "cf3c404043230559660810bc0c9d6d5a8498d819" }
9898
ethereum-consensus = { git = "https://github.com/ralexstokes/ethereum-consensus/", rev = "cf3c404043230559660810bc0c9d6d5a8498d819" }
9999
ssz_rs_derive = { git = "https://github.com/ralexstokes/ssz-rs.git", version = "0.9.0" }
100-
tokio-util = "0.7.11"
100+
tokio-util = { workspace = true }
101101
uuid = { version = "1.6.1", features = ["serde", "v5", "v4"] }
102102
prometheus = "0.13.4"
103103
hyper = { version = "1.3.1", features = ["server", "full"] }

crates/rbuilder/src/backtest/backtest_build_block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ where
6565
let cli = Cli::parse();
6666

6767
let config: ConfigType = load_config_toml_and_env(cli.config)?;
68-
config.base_config().setup_tracing_subsriber()?;
68+
config.base_config().setup_tracing_subscriber()?;
6969

7070
let block_data = read_block_data(
7171
&config.base_config().backtest_fetch_output_file,

crates/rbuilder/src/backtest/backtest_build_range.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ where
7474
));
7575
}
7676
let config: ConfigType = load_config_toml_and_env(cli.config.clone())?;
77-
config.base_config().setup_tracing_subsriber()?;
77+
config.base_config().setup_tracing_subscriber()?;
7878

7979
let builders_names = config.base_config().backtest_builders.clone();
8080

crates/rbuilder/src/backtest/redistribute/cli/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ where
5252
let cli = Cli::parse();
5353

5454
let config: ConfigType = load_config_toml_and_env(cli.config)?;
55-
config.base_config().setup_tracing_subsriber()?;
55+
config.base_config().setup_tracing_subscriber()?;
5656

5757
let mut historical_data_storage =
5858
HistoricalDataStorage::new_from_path(&config.base_config().backtest_fetch_output_file)

crates/rbuilder/src/bin/backtest-fetch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ async fn main() -> eyre::Result<()> {
5454
let cli = Cli::parse();
5555

5656
let config: Config = load_config_toml_and_env(cli.config)?;
57-
config.base_config().setup_tracing_subsriber()?;
57+
config.base_config().setup_tracing_subscriber()?;
5858

5959
match cli.command {
6060
Commands::Fetch(cli) => {

crates/rbuilder/src/bin/debug-bench-machine.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ async fn main() -> eyre::Result<()> {
3636
let cli = Cli::parse();
3737

3838
let config: Config = load_config_toml_and_env(cli.config)?;
39-
config.base_config().setup_tracing_subsriber()?;
39+
config.base_config().setup_tracing_subscriber()?;
4040

4141
let rpc = http_provider(cli.rpc_url.parse()?);
4242

crates/rbuilder/src/live_builder/base_config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ pub fn load_config_toml_and_env<T: serde::de::DeserializeOwned>(
140140
}
141141

142142
impl BaseConfig {
143-
pub fn setup_tracing_subsriber(&self) -> eyre::Result<()> {
143+
pub fn setup_tracing_subscriber(&self) -> eyre::Result<()> {
144144
let log_level = self.log_level.value()?;
145145
let config = LoggerConfig {
146146
env_filter: log_level,

0 commit comments

Comments
 (0)