Skip to content

Commit 47bbfe1

Browse files
committed
fix lint
1 parent 7a58b6a commit 47bbfe1

File tree

6 files changed

+27
-19
lines changed

6 files changed

+27
-19
lines changed

crates/node/src/add_ons/rollup.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
use crate::{args::ScrollRollupNodeConfig, pprof::{PprofConfig, start_pprof_server}};
1+
use crate::{
2+
args::ScrollRollupNodeConfig,
3+
pprof::{start_pprof_server, PprofConfig},
4+
};
25

36
use reth_chainspec::NamedChain;
47
use reth_network::NetworkProtocols;
@@ -14,7 +17,7 @@ use scroll_alloy_hardforks::ScrollHardforks;
1417
use scroll_wire::ScrollWireEvent;
1518
use std::sync::Arc;
1619
use tokio::sync::mpsc::{Sender, UnboundedReceiver};
17-
use tracing::{info, error};
20+
use tracing::{error, info};
1821

1922
/// Implementing the trait allows the type to return whether it is configured for dev chain.
2023
#[auto_impl::auto_impl(Arc)]
@@ -64,8 +67,9 @@ impl RollupManagerAddOn {
6467
{
6568
// Start pprof server if enabled
6669
if self.config.pprof_args.enabled {
67-
let addr = self.config.pprof_args.addr.parse()
68-
.map_err(|e| eyre::eyre!("Invalid pprof address '{}': {}", self.config.pprof_args.addr, e))?;
70+
let addr = self.config.pprof_args.addr.parse().map_err(|e| {
71+
eyre::eyre!("Invalid pprof address '{}': {}", self.config.pprof_args.addr, e)
72+
})?;
6973

7074
let pprof_config = PprofConfig::new(addr)
7175
.with_default_duration(self.config.pprof_args.default_duration);

crates/node/src/args.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -848,11 +848,7 @@ pub struct PprofArgs {
848848

849849
impl Default for PprofArgs {
850850
fn default() -> Self {
851-
Self {
852-
enabled: false,
853-
addr: "127.0.0.1:6060".to_string(),
854-
default_duration: 30,
855-
}
851+
Self { enabled: false, addr: "127.0.0.1:6060".to_string(), default_duration: 30 }
856852
}
857853
}
858854

crates/node/src/pprof.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ use hyper::{
3030
Method, Request, Response, StatusCode,
3131
};
3232
use hyper_util::rt::TokioIo;
33+
use pprof::protos::Message;
3334
use std::{net::SocketAddr, time::Duration};
3435
use tokio::net::TcpListener;
3536
use tracing::{error, info, warn};
@@ -56,7 +57,7 @@ impl PprofConfig {
5657
}
5758

5859
/// Set the default profiling duration
59-
pub fn with_default_duration(mut self, seconds: u64) -> Self {
60+
pub const fn with_default_duration(mut self, seconds: u64) -> Self {
6061
self.default_duration = seconds;
6162
self
6263
}
@@ -148,7 +149,7 @@ async fn handle_request(
148149
info!("Starting CPU profile for {} seconds", duration);
149150
handle_cpu_profile(duration).await
150151
}
151-
(&Method::GET, "/") | (&Method::GET, "/debug/pprof") => handle_index().await,
152+
(&Method::GET, "/" | "/debug/pprof") => handle_index().await,
152153
_ => {
153154
warn!("Not found: {} {}", req.method(), req.uri().path());
154155
Ok(Response::builder()
@@ -195,9 +196,6 @@ async fn handle_cpu_profile(duration_secs: u64) -> Result<Response<Full<Bytes>>,
195196
// Encode as protobuf
196197
match report.pprof() {
197198
Ok(profile) => {
198-
// Serialize the profile using protobuf
199-
use protobuf::Message;
200-
201199
// The profile object needs to be converted to bytes
202200
let body = match profile.write_to_bytes() {
203201
Ok(bytes) => bytes,

crates/node/tests/e2e.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use rollup_node::{
2727
generate_tx, setup_engine,
2828
},
2929
BlobProviderArgs, ChainOrchestratorArgs, ConsensusAlgorithm, ConsensusArgs, EngineDriverArgs,
30-
L1ProviderArgs, RollupNodeContext, RollupNodeDatabaseArgs, RollupNodeExtApiClient,
30+
L1ProviderArgs, PprofArgs, RollupNodeContext, RollupNodeDatabaseArgs, RollupNodeExtApiClient,
3131
RollupNodeGasPriceOracleArgs, RollupNodeNetworkArgs as ScrollNetworkArgs, RpcArgs,
3232
ScrollRollupNode, ScrollRollupNodeConfig, SequencerArgs,
3333
};
@@ -80,6 +80,7 @@ async fn can_bridge_l1_messages() -> eyre::Result<()> {
8080
consensus_args: ConsensusArgs::noop(),
8181
database: None,
8282
rpc_args: RpcArgs::default(),
83+
pprof_args: PprofArgs::default(),
8384
};
8485
let (mut nodes, _tasks, _wallet) = setup_engine(node_args, 1, chain_spec, false, false).await?;
8586
let node = nodes.pop().unwrap();
@@ -179,6 +180,7 @@ async fn can_sequence_and_gossip_blocks() {
179180
consensus_args: ConsensusArgs::noop(),
180181
database: None,
181182
rpc_args: RpcArgs::default(),
183+
pprof_args: PprofArgs::default(),
182184
};
183185

184186
let (nodes, _tasks, wallet) =
@@ -274,6 +276,7 @@ async fn can_penalize_peer_for_invalid_block() {
274276
chain_orchestrator_args: ChainOrchestratorArgs::default(),
275277
database: None,
276278
rpc_args: RpcArgs::default(),
279+
pprof_args: PprofArgs::default(),
277280
};
278281

279282
let (nodes, _tasks, _) =

crates/node/tests/sync.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ use rollup_node::{
1313
generate_tx, setup_engine,
1414
},
1515
BlobProviderArgs, ChainOrchestratorArgs, ConsensusArgs, EngineDriverArgs, L1ProviderArgs,
16-
RollupNodeDatabaseArgs, RollupNodeGasPriceOracleArgs, RollupNodeNetworkArgs, RpcArgs,
17-
ScrollRollupNodeConfig, SequencerArgs,
16+
PprofArgs, RollupNodeDatabaseArgs, RollupNodeGasPriceOracleArgs, RollupNodeNetworkArgs,
17+
RpcArgs, ScrollRollupNodeConfig, SequencerArgs,
1818
};
1919
use rollup_node_chain_orchestrator::ChainOrchestratorEvent;
2020
use rollup_node_primitives::BlockInfo;
@@ -75,6 +75,7 @@ async fn test_should_consolidate_to_block_15k() -> eyre::Result<()> {
7575
consensus_args: ConsensusArgs::noop(),
7676
database: None,
7777
rpc_args: RpcArgs::default(),
78+
pprof_args: PprofArgs::default(),
7879
};
7980

8081
let chain_spec = (*SCROLL_SEPOLIA).clone();
@@ -266,6 +267,7 @@ async fn test_should_consolidate_after_optimistic_sync() -> eyre::Result<()> {
266267
consensus_args: ConsensusArgs::noop(),
267268
database: None,
268269
rpc_args: RpcArgs::default(),
270+
pprof_args: PprofArgs::default(),
269271
};
270272

271273
// Create the chain spec for scroll dev with Feynman activated and a test genesis.
@@ -482,6 +484,7 @@ async fn test_consolidation() -> eyre::Result<()> {
482484
consensus_args: ConsensusArgs::noop(),
483485
database: None,
484486
rpc_args: RpcArgs::default(),
487+
pprof_args: PprofArgs::default(),
485488
};
486489

487490
// Create the chain spec for scroll dev with Feynman activated and a test genesis.
@@ -696,6 +699,7 @@ async fn test_chain_orchestrator_fork_choice(
696699
consensus_args: ConsensusArgs::noop(),
697700
database: None,
698701
rpc_args: RpcArgs::default(),
702+
pprof_args: PprofArgs::default(),
699703
};
700704

701705
// Create the chain spec for scroll dev with Feynman activated and a test genesis.
@@ -814,6 +818,7 @@ async fn test_chain_orchestrator_l1_reorg() -> eyre::Result<()> {
814818
consensus_args: ConsensusArgs::noop(),
815819
database: None,
816820
rpc_args: RpcArgs::default(),
821+
pprof_args: PprofArgs::default(),
817822
};
818823

819824
// Create the chain spec for scroll dev with Feynman activated and a test genesis.

crates/sequencer/tests/e2e.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use rollup_node::{
1010
constants::SCROLL_GAS_LIMIT,
1111
test_utils::{default_test_scroll_rollup_node_config, setup_engine},
1212
BlobProviderArgs, ChainOrchestratorArgs, ConsensusArgs, EngineDriverArgs, L1ProviderArgs,
13-
RollupNodeDatabaseArgs, RollupNodeGasPriceOracleArgs, RollupNodeNetworkArgs, RpcArgs,
14-
ScrollRollupNodeConfig, SequencerArgs, SignerArgs,
13+
PprofArgs, RollupNodeDatabaseArgs, RollupNodeGasPriceOracleArgs, RollupNodeNetworkArgs,
14+
RpcArgs, ScrollRollupNodeConfig, SequencerArgs, SignerArgs,
1515
};
1616
use rollup_node_chain_orchestrator::ChainOrchestratorEvent;
1717
use rollup_node_primitives::{sig_encode_hash, BlockInfo, L1MessageEnvelope};
@@ -508,6 +508,7 @@ async fn can_sequence_blocks_with_private_key_file() -> eyre::Result<()> {
508508
consensus_args: ConsensusArgs::noop(),
509509
database: None,
510510
rpc_args: RpcArgs::default(),
511+
pprof_args: PprofArgs::default(),
511512
};
512513

513514
let (nodes, _tasks, wallet) =
@@ -608,6 +609,7 @@ async fn can_sequence_blocks_with_hex_key_file_without_prefix() -> eyre::Result<
608609
consensus_args: ConsensusArgs::noop(),
609610
database: None,
610611
rpc_args: RpcArgs::default(),
612+
pprof_args: PprofArgs::default(),
611613
};
612614

613615
let (nodes, _tasks, wallet) =

0 commit comments

Comments
 (0)