Skip to content

Commit 10c460a

Browse files
committed
chore: nightly channel and fmt
1 parent fed74d1 commit 10c460a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+897
-1622
lines changed

crates/op-rbuilder/build.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ fn main() -> Result<(), Box<dyn Error>> {
3232

3333
emitter.add_instructions(&build_builder)?;
3434

35-
let cargo_builder = CargoBuilder::default()
36-
.features(true)
37-
.target_triple(true)
38-
.build()?;
35+
let cargo_builder = CargoBuilder::default().features(true).target_triple(true).build()?;
3936

4037
emitter.add_instructions(&cargo_builder)?;
4138

crates/op-rbuilder/src/args/mod.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@ mod op;
1111
mod playground;
1212

1313
/// This trait is used to extend Reth's CLI with additional functionality that
14-
/// are specific to the OP builder, such as populating default values for CLI arguments
15-
/// when running in the playground mode or checking the builder mode.
16-
///
14+
/// are specific to the OP builder, such as populating default values for CLI
15+
/// arguments when running in the playground mode or checking the builder mode.
1716
pub trait CliExt {
18-
/// Populates the default values for the CLI arguments when the user specifies
19-
/// the `--builder.playground` flag.
17+
/// Populates the default values for the CLI arguments when the user
18+
/// specifies the `--builder.playground` flag.
2019
fn populate_defaults(self) -> Self;
2120

2221
/// Returns the builder mode that the node is started with.
@@ -38,13 +37,15 @@ impl CliExt for Cli {
3837
/// and if so, populates the default values for the CLI arguments from the
3938
/// playground configuration.
4039
///
41-
/// The `--builder.playground` flag is used to populate the CLI arguments with
42-
/// default values for running the builder against the playground environment.
40+
/// The `--builder.playground` flag is used to populate the CLI arguments
41+
/// with default values for running the builder against the playground
42+
/// environment.
4343
///
4444
/// The values are populated from the default directory of the playground
4545
/// configuration, which is `$HOME/.playground/devnet/` by default.
4646
///
47-
/// Any manually specified CLI arguments by the user will override the defaults.
47+
/// Any manually specified CLI arguments by the user will override the
48+
/// defaults.
4849
fn populate_defaults(self) -> Self {
4950
let Commands::Node(ref node_command) = self.command else {
5051
// playground defaults are only relevant if running the node commands.
@@ -65,8 +66,8 @@ impl CliExt for Cli {
6566
Cli::set_version().populate_defaults()
6667
}
6768

68-
/// Returns the type of builder implementation that the node is started with.
69-
/// Currently supports `Standard` and `Flashblocks` modes.
69+
/// Returns the type of builder implementation that the node is started
70+
/// with. Currently supports `Standard` and `Flashblocks` modes.
7071
fn builder_mode(&self) -> BuilderMode {
7172
if let Commands::Node(ref node_command) = self.command {
7273
if node_command.ext.flashblocks.enabled {

crates/op-rbuilder/src/args/op.rs

Lines changed: 29 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ pub struct OpRbuilderArgs {
2626
pub builder_signer: Option<Signer>,
2727

2828
/// chain block time in milliseconds
29-
#[arg(
30-
long = "rollup.chain-block-time",
31-
default_value = "1000",
32-
env = "CHAIN_BLOCK_TIME"
33-
)]
29+
#[arg(long = "rollup.chain-block-time", default_value = "1000", env = "CHAIN_BLOCK_TIME")]
3430
pub chain_block_time: u64,
3531

3632
/// max gas a transaction can use
@@ -41,14 +37,16 @@ pub struct OpRbuilderArgs {
4137
#[arg(long = "builder.log-pool-transactions", default_value = "false")]
4238
pub log_pool_transactions: bool,
4339

44-
/// How much time extra to wait for the block building job to complete and not get garbage collected
40+
/// How much time extra to wait for the block building job to complete and
41+
/// not get garbage collected
4542
#[arg(long = "builder.extra-block-deadline-secs", default_value = "20")]
4643
pub extra_block_deadline_secs: u64,
4744
/// Whether to enable revert protection by default
4845
#[arg(long = "builder.enable-revert-protection", default_value = "false")]
4946
pub enable_revert_protection: bool,
5047

51-
/// Path to builder playgorund to automatically start up the node connected to it
48+
/// Path to builder playground to automatically start up the node connected
49+
/// to it
5250
#[arg(
5351
long = "builder.playground",
5452
num_args = 0..=1,
@@ -70,9 +68,7 @@ pub struct OpRbuilderArgs {
7068
impl Default for OpRbuilderArgs {
7169
fn default() -> Self {
7270
let args = crate::args::Cli::parse_from(["dummy", "node"]);
73-
let Commands::Node(node_command) = args.command else {
74-
unreachable!()
75-
};
71+
let Commands::Node(node_command) = args.command else { unreachable!() };
7672
node_command.ext
7773
}
7874
}
@@ -87,65 +83,44 @@ fn expand_path(s: &str) -> Result<PathBuf> {
8783

8884
/// Parameters for Flashblocks configuration
8985
/// The names in the struct are prefixed with `flashblocks` to avoid conflicts
90-
/// with the standard block building configuration since these args are flattened
91-
/// into the main `OpRbuilderArgs` struct with the other rollup/node args.
86+
/// with the standard block building configuration since these args are
87+
/// flattened into the main `OpRbuilderArgs` struct with the other rollup/node
88+
/// args.
9289
#[derive(Debug, Clone, PartialEq, Eq, clap::Args)]
9390
pub struct FlashblocksArgs {
9491
/// When set to true, the builder will build flashblocks
9592
/// and will build standard blocks at the chain block time.
9693
///
9794
/// The default value will change in the future once the flashblocks
9895
/// feature is stable.
99-
#[arg(
100-
long = "flashblocks.enabled",
101-
default_value = "false",
102-
env = "ENABLE_FLASHBLOCKS"
103-
)]
96+
#[arg(long = "flashblocks.enabled", default_value = "false", env = "ENABLE_FLASHBLOCKS")]
10497
pub enabled: bool,
10598

106-
/// The port that we bind to for the websocket server that provides flashblocks
107-
#[arg(
108-
long = "flashblocks.port",
109-
env = "FLASHBLOCKS_WS_PORT",
110-
default_value = "1111"
111-
)]
99+
/// The port that we bind to for the websocket server that provides
100+
/// flashblocks
101+
#[arg(long = "flashblocks.port", env = "FLASHBLOCKS_WS_PORT", default_value = "1111")]
112102
pub flashblocks_port: u16,
113103

114-
/// The address that we bind to for the websocket server that provides flashblocks
115-
#[arg(
116-
long = "flashblocks.addr",
117-
env = "FLASHBLOCKS_WS_ADDR",
118-
default_value = "127.0.0.1"
119-
)]
104+
/// The address that we bind to for the websocket server that provides
105+
/// flashblocks
106+
#[arg(long = "flashblocks.addr", env = "FLASHBLOCKS_WS_ADDR", default_value = "127.0.0.1")]
120107
pub flashblocks_addr: String,
121108

122109
/// flashblock block time in milliseconds
123-
#[arg(
124-
long = "flashblocks.block-time",
125-
default_value = "250",
126-
env = "FLASHBLOCK_BLOCK_TIME"
127-
)]
110+
#[arg(long = "flashblocks.block-time", default_value = "250", env = "FLASHBLOCK_BLOCK_TIME")]
128111
pub flashblocks_block_time: u64,
129112

130-
/// Builder would always thry to produce fixed number of flashblocks without regard to time of
131-
/// FCU arrival.
113+
/// Builder would always thry to produce fixed number of flashblocks without
114+
/// regard to time of FCU arrival.
132115
/// In cases of late FCU it could lead to partially filled blocks.
133-
#[arg(
134-
long = "flashblocks.fixed",
135-
default_value = "false",
136-
env = "FLASHBLOCK_FIXED"
137-
)]
116+
#[arg(long = "flashblocks.fixed", default_value = "false", env = "FLASHBLOCK_FIXED")]
138117
pub flashblocks_fixed: bool,
139118

140119
/// Time by which blocks would be completed earlier in milliseconds.
141120
///
142-
/// This time used to account for latencies, this time would be deducted from total block
143-
/// building time before calculating number of fbs.
144-
#[arg(
145-
long = "flashblocks.leeway-time",
146-
default_value = "75",
147-
env = "FLASHBLOCK_LEEWAY_TIME"
148-
)]
121+
/// This time used to account for latencies, this time would be deducted
122+
/// from total block building time before calculating number of fbs.
123+
#[arg(long = "flashblocks.leeway-time", default_value = "75", env = "FLASHBLOCK_LEEWAY_TIME")]
149124
pub flashblocks_leeway_time: u64,
150125

151126
/// Should we calculate state root for each flashblock
@@ -160,9 +135,7 @@ pub struct FlashblocksArgs {
160135
impl Default for FlashblocksArgs {
161136
fn default() -> Self {
162137
let args = crate::args::Cli::parse_from(["dummy", "node"]);
163-
let Commands::Node(node_command) = args.command else {
164-
unreachable!()
165-
};
138+
let Commands::Node(node_command) = args.command else { unreachable!() };
166139
node_command.ext.flashblocks
167140
}
168141
}
@@ -178,11 +151,10 @@ pub struct TelemetryArgs {
178151
#[arg(long = "telemetry.otlp-headers", env = "OTEL_EXPORTER_OTLP_HEADERS")]
179152
pub otlp_headers: Option<String>,
180153

181-
/// Inverted sampling frequency in blocks. 1 - each block, 100 - every 100th block.
182-
#[arg(
183-
long = "telemetry.sampling-ratio",
184-
env = "SAMPLING_RATIO",
185-
default_value = "100"
186-
)]
154+
/// Inverted sampling frequency in blocks.
155+
///
156+
/// 1 - each block
157+
/// 100 - every 100th block.
158+
#[arg(long = "telemetry.sampling-ratio", env = "SAMPLING_RATIO", default_value = "100")]
187159
pub sampling_ratio: u64,
188160
}

crates/op-rbuilder/src/args/playground.rs

Lines changed: 21 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
//! Automatic builder playground configuration.
22
//!
33
//! This module is used mostly for testing purposes. It allows op-rbuilder to
4-
//! automatically configure itself to run against a running op-builder playground.
4+
//! automatically configure itself to run against a running op-builder
5+
//! playground.
56
//!
67
//! To setup the playground, checkout this repository:
78
//!
@@ -11,8 +12,8 @@
1112
//!
1213
//! go run main.go cook opstack --external-builder http://host.docker.internal:4444
1314
//!
14-
//! Wait until the playground is up and running, then run the following command to build
15-
//! op-rbuilder with flashblocks support:
15+
//! Wait until the playground is up and running, then run the following command
16+
//! to build op-rbuilder with flashblocks support:
1617
//!
1718
//! cargo build --bin op-rbuilder -p op-rbuilder
1819
//!
@@ -77,13 +78,11 @@ pub struct PlaygroundOptions {
7778
}
7879

7980
impl PlaygroundOptions {
80-
/// Creates a new `PlaygroundOptions` instance with the specified genesis path.
81+
/// Creates a new `PlaygroundOptions` instance with the specified genesis
82+
/// path.
8183
pub fn new(path: &Path) -> Result<Self> {
8284
if !path.exists() {
83-
return Err(eyre!(
84-
"Playground data directory {} does not exist",
85-
path.display()
86-
));
85+
return Err(eyre!("Playground data directory {} does not exist", path.display()));
8786
}
8887

8988
let chain = OpChainSpecParser::parse(&existing_path(path, "l2-genesis.json")?)?;
@@ -127,9 +126,8 @@ impl PlaygroundOptions {
127126
// either via the command line or an environment variable. Otherwise, don't
128127
// override the user provided values.
129128
let matches = Cli::command().get_matches();
130-
let matches = matches
131-
.subcommand_matches("node")
132-
.expect("validated that we are in the node command");
129+
let matches =
130+
matches.subcommand_matches("node").expect("validated that we are in the node command");
133131

134132
if matches.value_source("chain").is_default() {
135133
node.chain = self.chain;
@@ -223,9 +221,7 @@ fn extract_chain_block_time(basepath: &Path) -> Result<Duration> {
223221

224222
fn extract_deterministic_p2p_key(basepath: &Path) -> Result<SecretKey> {
225223
let key = read_to_string(existing_path(basepath, "enode-key-1.txt")?)?;
226-
Ok(SecretKey::from_slice(
227-
&hex::decode(key).map_err(|e| eyre!("Invalid hex key: {e}"))?,
228-
)?)
224+
Ok(SecretKey::from_slice(&hex::decode(key).map_err(|e| eyre!("Invalid hex key: {e}"))?)?)
229225
}
230226

231227
fn read_docker_compose(basepath: &Path) -> Result<serde_yaml::Value> {
@@ -238,9 +234,7 @@ fn extract_service_command_flag(basepath: &Path, service: &str, flag: &str) -> R
238234
let docker_compose = read_docker_compose(basepath)?;
239235
let args = docker_compose["services"][service]["command"]
240236
.as_sequence()
241-
.ok_or(eyre!(
242-
"docker-compose.yaml is missing command line arguments for {service}"
243-
))?
237+
.ok_or(eyre!("docker-compose.yaml is missing command line arguments for {service}"))?
244238
.iter()
245239
.map(|s| {
246240
s.as_str().ok_or_else(|| {
@@ -254,9 +248,8 @@ fn extract_service_command_flag(basepath: &Path, service: &str, flag: &str) -> R
254248
.position(|arg| *arg == flag)
255249
.ok_or_else(|| eyre!("docker_compose: {flag} not found on {service} service"))?;
256250

257-
let value = args
258-
.get(index + 1)
259-
.ok_or_else(|| eyre!("docker_compose: {flag} value not found"))?;
251+
let value =
252+
args.get(index + 1).ok_or_else(|| eyre!("docker_compose: {flag} value not found"))?;
260253

261254
Ok(value.to_string())
262255
}
@@ -270,13 +263,12 @@ fn extract_authrpc_port(basepath: &Path) -> Result<u16> {
270263
fn extract_trusted_peer_port(basepath: &Path) -> Result<u16> {
271264
let docker_compose = read_docker_compose(basepath)?;
272265

273-
// first we need to find the internal port of the op-geth service from the docker-compose.yaml
274-
// command line arguments used to start the op-geth service
266+
// first we need to find the internal port of the op-geth service from the
267+
// docker-compose.yaml command line arguments used to start the op-geth
268+
// service
275269

276270
let Some(opgeth_args) = docker_compose["services"]["op-geth"]["command"][1].as_str() else {
277-
return Err(eyre!(
278-
"docker-compose.yaml is missing command line arguments for op-geth"
279-
));
271+
return Err(eyre!("docker-compose.yaml is missing command line arguments for op-geth"));
280272
};
281273

282274
let opgeth_args = opgeth_args.split_whitespace().collect::<Vec<_>>();
@@ -289,16 +281,12 @@ fn extract_trusted_peer_port(basepath: &Path) -> Result<u16> {
289281
.get(port_param_position + 1)
290282
.ok_or_else(|| eyre!("docker_compose: --port value not found"))?;
291283

292-
let port_value = port_value
293-
.parse::<u16>()
294-
.map_err(|e| eyre!("Invalid port value: {e}"))?;
284+
let port_value = port_value.parse::<u16>().map_err(|e| eyre!("Invalid port value: {e}"))?;
295285

296-
// now we need to find the external port of the op-geth service from the docker-compose.yaml
297-
// ports mapping used to start the op-geth service
286+
// now we need to find the external port of the op-geth service from the
287+
// docker-compose.yaml ports mapping used to start the op-geth service
298288
let Some(opgeth_ports) = docker_compose["services"]["op-geth"]["ports"].as_sequence() else {
299-
return Err(eyre!(
300-
"docker-compose.yaml is missing ports mapping for op-geth"
301-
));
289+
return Err(eyre!("docker-compose.yaml is missing ports mapping for op-geth"));
302290
};
303291
let ports_mapping = opgeth_ports
304292
.iter()

crates/op-rbuilder/src/bin/tester/main.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ pub async fn run_system(validation: bool) -> eyre::Result<()> {
7474
let mut driver = ChainDriver::<Http>::remote(provider, engine_api);
7575

7676
if validation {
77-
driver = driver
78-
.with_validation_node(ExternalNode::reth().await?)
79-
.await?;
77+
driver = driver.with_validation_node(ExternalNode::reth().await?).await?;
8078
}
8179

8280
// Infinite loop generating blocks

0 commit comments

Comments
 (0)