@@ -116,15 +116,23 @@ impl TestBlockBuildBuilder {
116116 /// This creates a `BlockBuild` ready for simulation.
117117 /// Call `.build().await` on the result to execute the simulation and get a `BuiltBlock`.
118118 pub fn build ( self ) -> TestBlockBuild {
119- let builder = self . sim_env_builder . unwrap_or_default ( ) ;
120- let ru_state_source = TestStateSource :: new ( builder. rollup_db ( ) ) ;
121- let host_state_source = TestStateSource :: new ( builder. host_db ( ) ) ;
122-
123- let ( rollup_env, host_env) = match ( self . rollup_env , self . host_env ) {
124- ( Some ( rollup) , Some ( host) ) => ( rollup, host) ,
125- _ => builder. build ( ) ,
119+ let ( rollup_env, host_env, rollup_db, host_db) = match self . env {
120+ TestBlockBuildEnv :: Builder ( builder) => {
121+ let rollup_db = builder. rollup_db ( ) ;
122+ let host_db = builder. host_db ( ) ;
123+ let ( rollup, host) = builder. build ( ) ;
124+ ( rollup, host, rollup_db, host_db)
125+ }
126+ TestBlockBuildEnv :: Built { rollup, host } => {
127+ let rollup_db = TestDb :: new ( Default :: default ( ) ) ;
128+ let host_db = TestDb :: new ( Default :: default ( ) ) ;
129+ ( rollup, host, rollup_db, host_db)
130+ }
126131 } ;
127132
133+ let ru_state_source = TestStateSource :: new ( rollup_db) ;
134+ let host_state_source = TestStateSource :: new ( host_db) ;
135+
128136 // Convert the relative deadline into the absolute instant expected by `BlockBuild`.
129137 let finish_by = Instant :: now ( ) + self . deadline_duration ;
130138
@@ -139,16 +147,14 @@ impl TestBlockBuildBuilder {
139147 ru_state_source,
140148 host_state_source,
141149 )
142- . build ( )
143- . await
144150 }
145151}
146152
147153/// Convenience function to quickly build a block with a cache and optional configuration.
148154/// This is useful for simple test cases where you just want to simulate
149155/// some transactions quickly.
150156pub async fn quick_build_block ( cache : SimCache , deadline : Duration ) -> BuiltBlock {
151- TestBlockBuildBuilder :: new ( ) . with_cache ( cache) . with_deadline ( deadline) . into_block_build ( ) . await
157+ TestBlockBuildBuilder :: new ( ) . with_cache ( cache) . with_deadline ( deadline) . build ( ) . build ( ) . await
152158}
153159
154160#[ cfg( test) ]
0 commit comments