Skip to content

Commit c96b500

Browse files
committed
test rblib fix
1 parent f48fe73 commit c96b500

File tree

4 files changed

+93
-53
lines changed

4 files changed

+93
-53
lines changed

.cargo/config.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# TODO: Only enable this for debug builds
2+
[build]
3+
rustflags = ["--cfg", "tokio_unstable"]

.github/workflows/unichain_builder_release.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ on:
2121
description: "Binary Compilation Features"
2222
options:
2323
- ""
24+
- "debug"
2425
required: false
2526
type: choice
2627

Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,24 @@ resolver = "2"
1111
license = "MIT"
1212
version = "0.0.1"
1313
edition = "2024"
14-
rust-version = "1.87"
14+
rust-version = "1.92"
1515
repository = "https://github.com/flashbots/unichain-builder"
1616
homepage = "https://github.com/flashbots/unichain-builder"
1717
authors = ["Flashbots <info@flashbots.net>"]
1818
exclude = [".github/"]
1919

2020
[workspace.dependencies]
21-
rblib = { git = "https://github.com/flashbots/rblib", rev = "6911bba2c9d2db67b58eabc52bd62b9aef070d86" }
21+
rblib = { git = "https://github.com/flashbots/rblib", rev = "c714ef9be7f29c760838daf0e5174ee97ec648ee" }
2222

2323
futures = "0.3"
24-
tokio = "1.46"
25-
tokio-tungstenite = "0.27"
24+
tokio = { version = "1.46", features = ["full", "tracing"] }
25+
tokio-tungstenite = "0.26.2"
2626
parking_lot = "0.12"
2727
eyre = "0.6"
2828
moka = "0.12"
2929
tracing = "0.1"
3030
clap = { version = "4.4", features = ["derive", "env", "string"] }
31-
reqwest = "0.12.24"
31+
reqwest = "0.13.1"
3232
serde = { version = "1.0", features = ["derive"] }
3333
serde_json = "1.0"
3434
serde_yaml = "0.9.33"
@@ -43,8 +43,8 @@ atomic-time = "0.1"
4343

4444
secp256k1 = "0.30"
4545
jsonrpsee = "0.26.0"
46-
console-subscriber = "0.4"
47-
tracing-subscriber = "0.3.20"
46+
console-subscriber = "0.5.0"
47+
tracing-subscriber = "0.3.22"
4848
dashmap = "6.1"
4949
orx-concurrent-vec = "3.7.0"
5050
vergen = "9.0.6"

src/main.rs

Lines changed: 82 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,21 @@ use {
1313
rblib::{
1414
pool::*,
1515
prelude::*,
16-
reth::optimism::{
17-
node::{OpAddOns, OpEngineApiBuilder, OpEngineValidatorBuilder, OpNode},
18-
rpc::OpEthApiBuilder,
16+
reth::{
17+
builder::{NodeBuilder, WithLaunchContext},
18+
cli::commands::launcher::Launcher,
19+
db::DatabaseEnv,
20+
optimism::{
21+
chainspec::OpChainSpec,
22+
cli::chainspec::OpChainSpecParser,
23+
node::{
24+
OpAddOns,
25+
OpEngineApiBuilder,
26+
OpEngineValidatorBuilder,
27+
OpNode,
28+
},
29+
rpc::OpEthApiBuilder,
30+
},
1931
},
2032
steps::*,
2133
},
@@ -40,49 +52,73 @@ mod version;
4052
mod tests;
4153

4254
fn main() {
43-
#[cfg(feature = "debug")]
44-
console_subscriber::init();
45-
46-
Cli::parsed()
47-
.run(|builder, cli_args| async move {
48-
let pool = OrderPool::<Flashblocks>::default();
49-
let pipeline = build_pipeline(&cli_args, &pool)?;
50-
let opnode = OpNode::new(cli_args.rollup_args.clone());
51-
let tx_status_rpc = TransactionStatusRpc::new(&pipeline);
52-
53-
let addons: OpAddOns<
54-
_,
55-
OpEthApiBuilder,
56-
OpEngineValidatorBuilder,
57-
OpEngineApiBuilder<OpEngineValidatorBuilder>,
58-
> = opnode
59-
.add_ons_builder::<types::RpcTypes<Flashblocks>>()
60-
.build();
61-
62-
let handle = builder
63-
.with_types::<OpNode>()
64-
.with_components(
65-
opnode
66-
.components()
67-
.attach_pool(&pool)
68-
.payload(pipeline.into_service()),
69-
)
70-
.with_add_ons(addons)
71-
.extend_rpc_modules(move |mut rpc_ctx| {
72-
pool.attach_rpc(&mut rpc_ctx)?;
73-
tx_status_rpc.attach_rpc(&mut rpc_ctx)?;
74-
Ok(())
75-
})
76-
.on_node_started(move |_ctx| {
77-
set_version_metric();
78-
Ok(())
79-
})
80-
.launch()
81-
.await?;
82-
83-
handle.wait_for_node_exit().await
84-
})
85-
.unwrap();
55+
#[cfg_attr(not(feature = "debug"), allow(unused_mut))]
56+
let mut cli = Cli::parsed().configure();
57+
58+
// TODO: Re-enable once the devops build can set build-time flags
59+
// #[cfg(feature = "debug")]
60+
// {
61+
// let console_layer = console_subscriber::spawn();
62+
// cli
63+
// .access_tracing_layers()
64+
// .expect("failed to access tracing layers")
65+
// .add_layer(console_layer);
66+
// }
67+
68+
let console_layer = console_subscriber::spawn();
69+
cli
70+
.access_tracing_layers()
71+
.expect("failed to access tracing layers")
72+
.add_layer(console_layer);
73+
74+
cli.run(LauncherImpl).unwrap();
75+
}
76+
77+
struct LauncherImpl;
78+
79+
impl Launcher<OpChainSpecParser, BuilderArgs> for LauncherImpl {
80+
async fn entrypoint(
81+
self,
82+
builder: WithLaunchContext<NodeBuilder<Arc<DatabaseEnv>, OpChainSpec>>,
83+
builder_args: BuilderArgs,
84+
) -> eyre::Result<()> {
85+
let pool = OrderPool::<Flashblocks>::default();
86+
let pipeline = build_pipeline(&builder_args, &pool)?;
87+
let opnode = OpNode::new(builder_args.rollup_args.clone());
88+
let tx_status_rpc = TransactionStatusRpc::new(&pipeline);
89+
90+
let addons: OpAddOns<
91+
_,
92+
OpEthApiBuilder,
93+
OpEngineValidatorBuilder,
94+
OpEngineApiBuilder<OpEngineValidatorBuilder>,
95+
> = opnode
96+
.add_ons_builder::<types::RpcTypes<Flashblocks>>()
97+
.build();
98+
99+
let handle = builder
100+
.with_types::<OpNode>()
101+
.with_components(
102+
opnode
103+
.components()
104+
.attach_pool(&pool)
105+
.payload(pipeline.into_service()),
106+
)
107+
.with_add_ons(addons)
108+
.extend_rpc_modules(move |mut rpc_ctx| {
109+
pool.attach_rpc(&mut rpc_ctx)?;
110+
tx_status_rpc.attach_rpc(&mut rpc_ctx)?;
111+
Ok(())
112+
})
113+
.on_node_started(move |_ctx| {
114+
set_version_metric();
115+
Ok(())
116+
})
117+
.launch()
118+
.await?;
119+
120+
handle.wait_for_node_exit().await
121+
}
86122
}
87123

88124
fn build_pipeline(

0 commit comments

Comments
 (0)