@@ -5,18 +5,13 @@ use crate::{
5
5
config:: { BuilderConfig , RuProvider } ,
6
6
tasks:: env:: SimEnv ,
7
7
} ;
8
- use alloy:: {
9
- eips:: BlockId ,
10
- network:: Ethereum ,
11
- providers:: Provider ,
12
- } ;
8
+ use alloy:: { eips:: BlockId , network:: Ethereum , providers:: Provider } ;
13
9
use init4_bin_base:: {
14
10
deps:: tracing:: { debug, error} ,
15
11
utils:: calc:: SlotCalculator ,
16
12
} ;
17
13
use signet_sim:: { BlockBuild , BuiltBlock , SimCache } ;
18
14
use signet_types:: constants:: SignetSystemConstants ;
19
- use tracing:: info;
20
15
use std:: time:: { Duration , Instant } ;
21
16
use tokio:: {
22
17
sync:: {
@@ -25,6 +20,7 @@ use tokio::{
25
20
} ,
26
21
task:: JoinHandle ,
27
22
} ;
23
+ use tracing:: info;
28
24
use trevm:: revm:: {
29
25
context:: BlockEnv ,
30
26
database:: { AlloyDB , WrapDatabaseAsync } ,
@@ -83,8 +79,8 @@ impl Simulator {
83
79
/// Handles building a single block.
84
80
///
85
81
/// 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.
88
84
///
89
85
/// # Arguments
90
86
///
@@ -103,11 +99,7 @@ impl Simulator {
103
99
finish_by : Instant ,
104
100
block_env : BlockEnv ,
105
101
) -> 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" , ) ;
111
103
112
104
let db = self . create_db ( ) . await . unwrap ( ) ;
113
105
@@ -155,15 +147,15 @@ impl Simulator {
155
147
tokio:: spawn ( async move { self . run_simulator ( constants, cache, submit_sender) . await } )
156
148
}
157
149
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
159
151
/// if the current slot is valid before building a block and sending it along for to the submit channel.
160
152
///
161
153
/// If it is authorized for the current slot, then the simulator task
162
154
/// - clones the simulation cache,
163
155
/// - calculates a deadline for block building,
164
156
/// - attempts to build a block using the latest cache and constants,
165
157
/// - then submits the built block through the provided channel.
166
- ///
158
+ ///
167
159
/// If an error occurs during block building or submission, it logs the error and continues the loop.
168
160
///
169
161
/// # Arguments
@@ -191,8 +183,7 @@ impl Simulator {
191
183
// waiting for a new block, and checking current slot authorization.
192
184
let finish_by = self . calculate_deadline ( ) ;
193
185
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 {
196
187
Ok ( block) => {
197
188
debug ! ( block = ?block. block_number( ) , tx_count = block. transactions( ) . len( ) , "built simulated block" ) ;
198
189
let _ = submit_sender. send ( SimResult { block, env : sim_env } ) ;
0 commit comments