@@ -431,7 +431,8 @@ impl SignerTest<SpawnedSigner> {
431
431
/// The stacks node is advanced to epoch 3.0 reward set calculation to ensure the signer set is determined.
432
432
/// An invalid block proposal is forcibly written to the miner's slot to simulate the miner proposing a block.
433
433
/// The signers process the invalid block by first verifying it against the stacks node block proposal endpoint.
434
- /// The signers then broadcast a rejection of the miner's proposed block back to the respective .signers-XXX-YYY contract.
434
+ /// The signer that submitted the initial block validation request, should issue a broadcast a rejection of the
435
+ /// miner's proposed block back to the respective .signers-XXX-YYY contract.
435
436
///
436
437
/// Test Assertion:
437
438
/// Each signer successfully rejects the invalid block proposal.
@@ -6240,8 +6241,9 @@ fn block_commit_delay() {
6240
6241
signer_test. shutdown ( ) ;
6241
6242
}
6242
6243
6243
- // Ensures that a signer will issue ConnectivityIssues rejections if a block submission
6244
- // times out. Also ensures that no other proposal gets submitted for validation if we
6244
+ // Ensures that a signer that successfully submits a block to the node for validation
6245
+ // will issue ConnectivityIssues rejections if a block submission times out.
6246
+ // Also ensures that no other proposal gets submitted for validation if we
6245
6247
// are already waiting for a block submission response.
6246
6248
#[ test]
6247
6249
#[ ignore]
@@ -6344,11 +6346,8 @@ fn block_validation_response_timeout() {
6344
6346
std:: thread:: sleep ( timeout. saturating_sub ( elapsed) ) ;
6345
6347
6346
6348
info ! ( "------------------------- Wait for Block Rejection Due to Timeout -------------------------" ) ;
6347
- // Verify the signers rejected the first block due to timeout
6348
- let mut rejected_signers = vec ! [ ] ;
6349
- let start = Instant :: now ( ) ;
6350
- while rejected_signers. len ( ) < num_signers {
6351
- std:: thread:: sleep ( Duration :: from_secs ( 1 ) ) ;
6349
+ // Verify that the signer that submits the block to the node will issue a ConnectivityIssues rejection
6350
+ wait_for ( 30 , || {
6352
6351
let chunks = test_observer:: get_stackerdb_chunks ( ) ;
6353
6352
for chunk in chunks. into_iter ( ) . flat_map ( |chunk| chunk. modified_slots ) {
6354
6353
let Ok ( message) = SignerMessage :: consensus_deserialize ( & mut chunk. data . as_slice ( ) )
@@ -6359,7 +6358,6 @@ fn block_validation_response_timeout() {
6359
6358
reason : _reason,
6360
6359
reason_code,
6361
6360
signer_signature_hash,
6362
- signature,
6363
6361
..
6364
6362
} ) ) = message
6365
6363
else {
@@ -6372,27 +6370,43 @@ fn block_validation_response_timeout() {
6372
6370
"Received a rejection for the wrong block"
6373
6371
) ;
6374
6372
if matches ! ( reason_code, RejectCode :: ConnectivityIssues ) {
6375
- rejected_signers . push ( signature ) ;
6373
+ return Ok ( true ) ;
6376
6374
}
6377
6375
}
6378
- assert ! (
6379
- start. elapsed( ) <= timeout,
6380
- "Timed out after waiting for ConenctivityIssues block rejection"
6381
- ) ;
6382
- }
6376
+ Ok ( false )
6377
+ } )
6378
+ . expect ( "Timed out waiting for block proposal rejections" ) ;
6383
6379
// Make sure our chain has still not advanced
6384
6380
let info_after = get_chain_info ( & signer_test. running_nodes . conf ) ;
6385
6381
assert_eq ! ( info_before, info_after) ;
6386
-
6382
+ let info_before = info_after ;
6387
6383
info ! ( "Unpausing block validation" ) ;
6388
- // Disable the stall and wait for the block to be processed
6384
+ // Disable the stall and wait for the block to be processed successfully
6389
6385
TEST_VALIDATE_STALL . lock ( ) . unwrap ( ) . replace ( false ) ;
6386
+ wait_for ( 30 , || {
6387
+ let info = get_chain_info ( & signer_test. running_nodes . conf ) ;
6388
+ Ok ( info. stacks_tip_height > info_before. stacks_tip_height )
6389
+ } )
6390
+ . expect ( "Timed out waiting for block to be processed" ) ;
6390
6391
6392
+ let info_after = get_chain_info ( & signer_test. running_nodes . conf ) ;
6393
+ assert_eq ! (
6394
+ info_after. stacks_tip_height,
6395
+ info_before. stacks_tip_height + 1 ,
6396
+ ) ;
6391
6397
info ! ( "------------------------- Test Mine and Verify Confirmed Nakamoto Block -------------------------" ) ;
6398
+ let info_before = info_after;
6392
6399
signer_test. mine_and_verify_confirmed_naka_block ( timeout, num_signers) ;
6393
6400
6401
+ wait_for ( 30 , || {
6402
+ let info = get_chain_info ( & signer_test. running_nodes . conf ) ;
6403
+ Ok ( info. stacks_tip_height > info_before. stacks_tip_height )
6404
+ } )
6405
+ . unwrap ( ) ;
6406
+
6407
+ let info_after = get_chain_info ( & signer_test. running_nodes . conf ) ;
6394
6408
assert_eq ! (
6395
- get_chain_info ( & signer_test . running_nodes . conf ) . stacks_tip_height,
6409
+ info_after . stacks_tip_height,
6396
6410
info_before. stacks_tip_height + 1 ,
6397
6411
) ;
6398
6412
}
0 commit comments