33//! for testing block simulation.
44
55use super :: {
6- db:: TestDb ,
6+ db:: { TestDb , TestStateSource } ,
77 env:: { TestHostEnv , TestRollupEnv , TestSimEnvBuilder } ,
88} ;
99use signet_sim:: { BlockBuild , BuiltBlock , SimCache } ;
@@ -12,7 +12,8 @@ use tokio::time::Instant;
1212use trevm:: revm:: inspector:: NoOpInspector ;
1313
1414/// Test block builder type using in-memory databases.
15- pub type TestBlockBuild = BlockBuild < TestDb , TestDb , NoOpInspector , NoOpInspector > ;
15+ pub type TestBlockBuild =
16+ BlockBuild < TestDb , TestDb , TestStateSource , TestStateSource , NoOpInspector , NoOpInspector > ;
1617
1718/// Builder for creating test `BlockBuild` instances.
1819/// Configures all the parameters needed for block simulation
@@ -110,12 +111,13 @@ impl TestBlockBuildBuilder {
110111 /// This creates a `BlockBuild` ready for simulation.
111112 /// Call `.build().await` on the result to execute the simulation and get a `BuiltBlock`.
112113 pub fn build ( self ) -> TestBlockBuild {
114+ let builder = self . sim_env_builder . unwrap_or_default ( ) ;
115+ let ru_state_source = TestStateSource :: new ( builder. rollup_db ( ) ) ;
116+ let host_state_source = TestStateSource :: new ( builder. host_db ( ) ) ;
117+
113118 let ( rollup_env, host_env) = match ( self . rollup_env , self . host_env ) {
114119 ( Some ( rollup) , Some ( host) ) => ( rollup, host) ,
115- _ => {
116- let builder = self . sim_env_builder . unwrap_or_default ( ) ;
117- builder. build ( )
118- }
120+ _ => builder. build ( ) ,
119121 } ;
120122
121123 let finish_by = Instant :: now ( ) + self . deadline_duration ;
@@ -128,6 +130,8 @@ impl TestBlockBuildBuilder {
128130 self . sim_cache ,
129131 self . max_gas ,
130132 self . max_host_gas ,
133+ ru_state_source,
134+ host_state_source,
131135 )
132136 }
133137}
0 commit comments