@@ -17,6 +17,7 @@ mod tests {
17
17
} ;
18
18
use tokio:: { sync:: mpsc:: unbounded_channel, time:: timeout} ;
19
19
20
+ /// Tests a single block build.
20
21
#[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
21
22
async fn test_handle_build ( ) {
22
23
setup_logging ( ) ;
@@ -100,12 +101,12 @@ mod tests {
100
101
let builder = Arc :: new ( BlockBuilder :: new ( & config, ru_provider. clone ( ) , slot_calculator) ) ;
101
102
102
103
// Create a sim cache and start filling it with items
103
- let _ =
104
- builder. clone ( ) . spawn_cache_handler ( tx_receiver, bundle_receiver, sim_cache. clone ( ) ) ;
104
+ builder. clone ( ) . spawn_cache_handler ( tx_receiver, bundle_receiver, sim_cache. clone ( ) ) ;
105
105
106
106
// Finally, Kick off the block builder task.
107
- let _ = builder. clone ( ) . spawn_builder_task ( constants, sim_cache. clone ( ) , block_sender) ;
107
+ builder. clone ( ) . spawn_builder_task ( constants, sim_cache. clone ( ) , block_sender) ;
108
108
109
+ // Feed in transactions to the tx_sender and wait for the block to be simulated
109
110
let tx_1 = new_signed_tx ( & test_key_0, 0 , U256 :: from ( 1_f64 ) , 11_000 ) . unwrap ( ) ;
110
111
let tx_2 = new_signed_tx ( & test_key_1, 0 , U256 :: from ( 2_f64 ) , 10_000 ) . unwrap ( ) ;
111
112
tx_sender. send ( tx_1) . unwrap ( ) ;
@@ -114,8 +115,9 @@ mod tests {
114
115
// Wait for a block with timeout
115
116
let result = timeout ( Duration :: from_secs ( 5 ) , block_receiver. recv ( ) ) . await ;
116
117
assert ! ( result. is_ok( ) , "Did not receive block within 5 seconds" ) ;
118
+
119
+ // Assert on the block
117
120
let block = result. unwrap ( ) ;
118
- dbg ! ( & block) ;
119
121
assert ! ( block. is_some( ) , "Block channel closed without receiving a block" ) ;
120
122
assert ! ( block. unwrap( ) . tx_count( ) == 2 ) ; // TODO: Why is this failing? I'm seeing EVM errors but haven't tracked them down yet.
121
123
}
0 commit comments