11use crate :: {
22 config:: { BuilderConfig , HostProvider , RuProvider } ,
3+ quincey:: Quincey ,
34 tasks:: block:: cfg:: SignetCfgEnv ,
45} ;
56use alloy:: {
@@ -31,21 +32,6 @@ pub type SimRollupEnv = RollupEnv<RollupAlloyDatabaseProvider, NoOpInspector>;
3132/// Type aliases for simulation environments.
3233pub type SimHostEnv = HostEnv < HostAlloyDatabaseProvider , NoOpInspector > ;
3334
34- /// A task that constructs a BlockEnv for the next block in the rollup chain.
35- #[ derive( Debug , Clone ) ]
36- pub struct EnvTask {
37- /// Builder configuration values.
38- config : BuilderConfig ,
39-
40- /// Host provider is used to get the latest host block header for
41- /// constructing the next block environment.
42- host_provider : HostProvider ,
43-
44- /// Rollup provider is used to get the latest rollup block header for
45- /// simulation.
46- ru_provider : RuProvider ,
47- }
48-
4935/// An environment for simulating a block.
5036#[ derive( Debug , Clone ) ]
5137pub struct Environment {
@@ -196,14 +182,33 @@ impl SimEnv {
196182 }
197183}
198184
185+ /// A task that constructs a BlockEnv for the next block in the rollup chain.
186+ #[ derive( Debug , Clone ) ]
187+ pub struct EnvTask {
188+ /// Builder configuration values.
189+ config : BuilderConfig ,
190+
191+ /// Host provider is used to get the latest host block header for
192+ /// constructing the next block environment.
193+ host_provider : HostProvider ,
194+
195+ /// Quincey instance for slot checking.
196+ quincey : Quincey ,
197+
198+ /// Rollup provider is used to get the latest rollup block header for
199+ /// simulation.
200+ ru_provider : RuProvider ,
201+ }
202+
199203impl EnvTask {
200204 /// Create a new [`EnvTask`] with the given config and providers.
201205 pub const fn new (
202206 config : BuilderConfig ,
203207 host_provider : HostProvider ,
208+ quincey : Quincey ,
204209 ru_provider : RuProvider ,
205210 ) -> Self {
206- Self { config, host_provider, ru_provider }
211+ Self { config, host_provider, quincey , ru_provider }
207212 }
208213
209214 /// Construct a [`BlockEnv`] for the next host block from the previous host header.
@@ -271,11 +276,23 @@ impl EnvTask {
271276
272277 let span = info_span ! ( "SimEnv" , %host_block_number, %rollup_header. hash, %rollup_header. number) ;
273278
279+ let ( host_block_res, quincey_res) = tokio:: join!(
280+ self . host_provider. get_block_by_number( host_block_number. into( ) ) ,
281+ self . quincey. preflight_check( & self . config. constants, host_block_number)
282+ ) ;
283+
284+ res_unwrap_or_continue ! (
285+ quincey_res,
286+ span,
287+ error!( "error checking quincey slot - skipping block submission" ) ,
288+ ) ;
289+
274290 let host_block_opt = res_unwrap_or_continue ! (
275- self . host_provider . get_block_by_number ( host_block_number . into ( ) ) . await ,
291+ host_block_res ,
276292 span,
277293 error!( "error fetching previous host block - skipping block submission" )
278294 ) ;
295+
279296 let host_header = opt_unwrap_or_continue ! (
280297 host_block_opt,
281298 span,
@@ -284,6 +301,16 @@ impl EnvTask {
284301 . header
285302 . inner ;
286303
304+ if rollup_header. timestamp != host_header. timestamp {
305+ span_warn ! (
306+ span,
307+ rollup_timestamp = rollup_header. timestamp,
308+ host_timestamp = host_header. timestamp,
309+ "rollup block timestamp differs from host block timestamp. - skipping block submission"
310+ ) ;
311+ continue ;
312+ }
313+
287314 // Construct the block env using the previous block header
288315 let rollup_env = self . construct_rollup_env ( rollup_header. into ( ) ) ;
289316 let host_env = self . construct_host_env ( host_header) ;
0 commit comments