Skip to content

Commit 44bc5cd

Browse files
committed
clippy + fmt
1 parent f7defa3 commit 44bc5cd

File tree

3 files changed

+19
-24
lines changed

3 files changed

+19
-24
lines changed

src/tasks/block/sim.rs

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,13 @@ use crate::{
55
config::{BuilderConfig, RuProvider},
66
tasks::env::SimEnv,
77
};
8-
use alloy::{
9-
eips::BlockId,
10-
network::Ethereum,
11-
providers::Provider,
12-
};
8+
use alloy::{eips::BlockId, network::Ethereum, providers::Provider};
139
use init4_bin_base::{
1410
deps::tracing::{debug, error},
1511
utils::calc::SlotCalculator,
1612
};
1713
use signet_sim::{BlockBuild, BuiltBlock, SimCache};
1814
use signet_types::constants::SignetSystemConstants;
19-
use tracing::info;
2015
use std::time::{Duration, Instant};
2116
use tokio::{
2217
sync::{
@@ -25,6 +20,7 @@ use tokio::{
2520
},
2621
task::JoinHandle,
2722
};
23+
use tracing::info;
2824
use trevm::revm::{
2925
context::BlockEnv,
3026
database::{AlloyDB, WrapDatabaseAsync},
@@ -83,8 +79,8 @@ impl Simulator {
8379
/// Handles building a single block.
8480
///
8581
/// Builds a block in the block environment with items from the simulation cache
86-
/// against the database state. When the `finish_by` deadline is reached, it
87-
/// stops simulating and returns the block.
82+
/// against the database state. When the `finish_by` deadline is reached, it
83+
/// stops simulating and returns the block.
8884
///
8985
/// # Arguments
9086
///
@@ -103,11 +99,7 @@ impl Simulator {
10399
finish_by: Instant,
104100
block_env: BlockEnv,
105101
) -> eyre::Result<BuiltBlock> {
106-
debug!(
107-
block_number = block_env.number,
108-
tx_count = sim_items.len(),
109-
"starting block build",
110-
);
102+
debug!(block_number = block_env.number, tx_count = sim_items.len(), "starting block build",);
111103

112104
let db = self.create_db().await.unwrap();
113105

@@ -155,15 +147,15 @@ impl Simulator {
155147
tokio::spawn(async move { self.run_simulator(constants, cache, submit_sender).await })
156148
}
157149

158-
/// This function runs indefinitely, waiting for the block environment to be set and checking
150+
/// This function runs indefinitely, waiting for the block environment to be set and checking
159151
/// if the current slot is valid before building a block and sending it along for to the submit channel.
160152
///
161153
/// If it is authorized for the current slot, then the simulator task
162154
/// - clones the simulation cache,
163155
/// - calculates a deadline for block building,
164156
/// - attempts to build a block using the latest cache and constants,
165157
/// - then submits the built block through the provided channel.
166-
///
158+
///
167159
/// If an error occurs during block building or submission, it logs the error and continues the loop.
168160
///
169161
/// # Arguments
@@ -191,8 +183,7 @@ impl Simulator {
191183
// waiting for a new block, and checking current slot authorization.
192184
let finish_by = self.calculate_deadline();
193185
let sim_cache = cache.clone();
194-
match self.handle_build(constants, sim_cache, finish_by, sim_env.signet.clone()).await
195-
{
186+
match self.handle_build(constants, sim_cache, finish_by, sim_env.signet.clone()).await {
196187
Ok(block) => {
197188
debug!(block = ?block.block_number(), tx_count = block.transactions().len(), "built simulated block");
198189
let _ = submit_sender.send(SimResult { block, env: sim_env });

src/tasks/env.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,11 @@ impl EnvTask {
8989
info_span!("EnvTask::task_fut::loop", %block_hash, number = tracing::field::Empty);
9090

9191
// Get the rollup header for rollup block simulation environment configuration
92-
let rollup_header = match self.get_latest_rollup_header(&sender, block_hash, &span).await {
93-
Some(value) => value,
94-
None => continue,
95-
};
92+
let rollup_header =
93+
match self.get_latest_rollup_header(&sender, block_hash, &span).await {
94+
Some(value) => value,
95+
None => continue,
96+
};
9697
debug!(?rollup_header.number, "pulled rollup block for simulation");
9798

9899
// Get the host header for blob transaction submission gas pricing
@@ -108,7 +109,10 @@ impl EnvTask {
108109

109110
// Construct the block env using the previous block header
110111
let signet_env = self.construct_block_env(&host_header);
111-
debug!(block_number = signet_env.number, signet_env.basefee, "constructed signet block env");
112+
debug!(
113+
block_number = signet_env.number,
114+
signet_env.basefee, "constructed signet block env"
115+
);
112116

113117
if sender.send(Some(SimEnv { signet: signet_env, host: host_header })).is_err() {
114118
// The receiver has been dropped, so we can stop the task.

src/tasks/submit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,10 +552,10 @@ fn calculate_gas(retry_count: usize, prev_header: Header) -> (u128, u128, u128)
552552
parent_blob_basefee
553553
} else {
554554
// Fallback to a default value if no blob base fee is set
555-
fallback_blob_basefee
555+
fallback_blob_basefee
556556
};
557557

558-
bump_gas_from_retries(retry_count, base_fee_per_gas, blob_basefee as u128)
558+
bump_gas_from_retries(retry_count, base_fee_per_gas, blob_basefee)
559559
}
560560

561561
/// Bumps the gas parameters based on the retry count, base fee, and blob base fee.

0 commit comments

Comments
 (0)