Skip to content

Commit 6ed7d4e

Browse files
obycodekantai
authored andcommitted
test: reduce flakiness in partial_tenure_fork integration test
1 parent 804f6f3 commit 6ed7d4e

File tree

1 file changed

+13
-8
lines changed
  • testnet/stacks-node/src/tests/signer

1 file changed

+13
-8
lines changed

testnet/stacks-node/src/tests/signer/v0.rs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3567,7 +3567,7 @@ fn partial_tenure_fork() {
35673567
}
35683568

35693569
let num_signers = 5;
3570-
let max_nakamoto_tenures = 20;
3570+
let max_nakamoto_tenures = 30;
35713571
let inter_blocks_per_tenure = 5;
35723572

35733573
// setup sender + recipient for a test stx transfer
@@ -3611,13 +3611,18 @@ fn partial_tenure_fork() {
36113611
config.burnchain.local_mining_public_key = Some(btc_miner_1_pk.to_hex());
36123612
config.miner.mining_key = Some(Secp256k1PrivateKey::from_seed(&[1]));
36133613

3614+
// Increase the reward cycle length to avoid missing a prepare phase
3615+
// while we are intentionally forking.
3616+
config.burnchain.pox_reward_length = Some(40);
3617+
config.burnchain.pox_prepare_length = Some(10);
3618+
36143619
// Move epoch 2.5 and 3.0 earlier, so we have more time for the
36153620
// test before re-stacking is required.
36163621
if let Some(epochs) = config.burnchain.epochs.as_mut() {
3617-
epochs[6].end_height = 121;
3618-
epochs[7].start_height = 121;
3619-
epochs[7].end_height = 151;
3620-
epochs[8].start_height = 151;
3622+
epochs[6].end_height = 131;
3623+
epochs[7].start_height = 131;
3624+
epochs[7].end_height = 166;
3625+
epochs[8].start_height = 166;
36213626
} else {
36223627
panic!("Expected epochs to be set");
36233628
}
@@ -3694,8 +3699,8 @@ fn partial_tenure_fork() {
36943699
let mut min_miner_2_tenures = u64::MAX;
36953700
let mut ignore_block = 0;
36963701

3697-
while !(miner_1_tenures >= min_miner_1_tenures && miner_2_tenures >= min_miner_2_tenures) {
3698-
if btc_blocks_mined > max_nakamoto_tenures {
3702+
while miner_1_tenures < min_miner_1_tenures || miner_2_tenures < min_miner_2_tenures {
3703+
if btc_blocks_mined >= max_nakamoto_tenures {
36993704
panic!("Produced {btc_blocks_mined} sortitions, but didn't cover the test scenarios, aborting");
37003705
}
37013706

@@ -3851,7 +3856,7 @@ fn partial_tenure_fork() {
38513856
Err(e) => {
38523857
if e.to_string().contains("TooMuchChaining") {
38533858
info!("TooMuchChaining error, skipping block");
3854-
continue;
3859+
break;
38553860
} else {
38563861
panic!("Failed to submit tx: {}", e);
38573862
}

0 commit comments

Comments
 (0)