@@ -154,17 +154,17 @@ impl TestRig {
154154 }
155155 }
156156
157- fn create_canonical_block ( & mut self ) -> SignedBeaconBlock < E > {
157+ async fn create_canonical_block ( & mut self ) -> SignedBeaconBlock < E > {
158158 self . harness . advance_slot ( ) ;
159159
160- let block_root =
161- tokio :: runtime :: Runtime :: new ( )
162- . unwrap ( )
163- . block_on ( self . harness . extend_chain (
164- 1 ,
165- BlockStrategy :: OnCanonicalHead ,
166- AttestationStrategy :: AllValidators ,
167- ) ) ;
160+ let block_root = self
161+ . harness
162+ . extend_chain (
163+ 1 ,
164+ BlockStrategy :: OnCanonicalHead ,
165+ AttestationStrategy :: AllValidators ,
166+ )
167+ . await ;
168168 self . harness
169169 . chain
170170 . store
@@ -173,14 +173,10 @@ impl TestRig {
173173 . unwrap ( )
174174 }
175175
176- fn remember_block ( & mut self , block : SignedBeaconBlock < E > ) {
177- tokio:: runtime:: Runtime :: new ( )
178- . unwrap ( )
179- . block_on ( self . harness . process_block (
180- block. slot ( ) ,
181- block. canonical_root ( ) ,
182- ( block. into ( ) , None ) ,
183- ) )
176+ async fn remember_block ( & mut self , block : SignedBeaconBlock < E > ) {
177+ self . harness
178+ . process_block ( block. slot ( ) , block. canonical_root ( ) , ( block. into ( ) , None ) )
179+ . await
184180 . unwrap ( ) ;
185181 }
186182}
@@ -210,8 +206,8 @@ fn head_chain_removed_while_finalized_syncing() {
210206 rig. assert_state ( RangeSyncType :: Finalized ) ;
211207}
212208
213- #[ test]
214- fn state_update_while_purging ( ) {
209+ #[ tokio :: test]
210+ async fn state_update_while_purging ( ) {
215211 // NOTE: this is a regression test.
216212 // Added in PR https://github.com/sigp/lighthouse/pull/2827
217213 let mut rig = TestRig :: test_setup ( ) ;
@@ -220,9 +216,9 @@ fn state_update_while_purging() {
220216 let mut rig_2 = TestRig :: test_setup ( ) ;
221217 // Need to create blocks that can be inserted into the fork-choice and fit the "known
222218 // conditions" below.
223- let head_peer_block = rig_2. create_canonical_block ( ) ;
219+ let head_peer_block = rig_2. create_canonical_block ( ) . await ;
224220 let head_peer_root = head_peer_block. canonical_root ( ) ;
225- let finalized_peer_block = rig_2. create_canonical_block ( ) ;
221+ let finalized_peer_block = rig_2. create_canonical_block ( ) . await ;
226222 let finalized_peer_root = finalized_peer_block. canonical_root ( ) ;
227223
228224 // Get a peer with an advanced head
@@ -240,8 +236,8 @@ fn state_update_while_purging() {
240236 let _ = rig. find_blocks_by_range_request ( & finalized_peer) ;
241237
242238 // Now the chain knows both chains target roots.
243- rig. remember_block ( head_peer_block) ;
244- rig. remember_block ( finalized_peer_block) ;
239+ rig. remember_block ( head_peer_block) . await ;
240+ rig. remember_block ( finalized_peer_block) . await ;
245241
246242 // Add an additional peer to the second chain to make range update it's status
247243 rig. add_finalized_peer ( ) ;
0 commit comments