@@ -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 } ;
139use init4_bin_base:: {
1410 deps:: tracing:: { debug, error} ,
1511 utils:: calc:: SlotCalculator ,
1612} ;
1713use signet_sim:: { BlockBuild , BuiltBlock , SimCache } ;
1814use signet_types:: constants:: SignetSystemConstants ;
19- use tracing:: info;
2015use std:: time:: { Duration , Instant } ;
2116use tokio:: {
2217 sync:: {
@@ -25,6 +20,7 @@ use tokio::{
2520 } ,
2621 task:: JoinHandle ,
2722} ;
23+ use tracing:: info;
2824use 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 } ) ;
0 commit comments