Skip to content

Commit c8468ad

Browse files
Fix bootstrap setup of a few tests
Signed-off-by: Jacinta Ferrant <jacinta@stackslabs.com>
1 parent 02c7ee4 commit c8468ad

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

stacks-node/src/burnchains/bitcoin_regtest_controller.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3567,6 +3567,7 @@ mod tests {
35673567

35683568
let mut config = utils::create_miner_config();
35693569
config.burnchain.local_mining_public_key = Some(miner_pubkey.to_hex());
3570+
config.burnchain.pox_reward_length = Some(11);
35703571

35713572
let mut btcd_controller = BitcoinCoreController::from_stx_config(&config);
35723573
btcd_controller
@@ -3626,6 +3627,7 @@ mod tests {
36263627

36273628
let mut config = utils::create_miner_config();
36283629
config.burnchain.local_mining_public_key = Some(miner_pubkey.to_hex());
3630+
config.burnchain.pox_reward_length = Some(11);
36293631

36303632
let mut btcd_controller = BitcoinCoreController::from_stx_config(&config);
36313633
btcd_controller
@@ -3675,6 +3677,7 @@ mod tests {
36753677

36763678
let mut config = utils::create_miner_config();
36773679
config.burnchain.local_mining_public_key = Some(miner_pubkey.to_hex());
3680+
config.burnchain.pox_reward_length = Some(11);
36783681

36793682
let mut btcd_controller = BitcoinCoreController::from_stx_config(&config);
36803683
btcd_controller
@@ -3726,6 +3729,7 @@ mod tests {
37263729

37273730
let mut config = utils::create_miner_config();
37283731
config.burnchain.local_mining_public_key = Some(miner_pubkey.to_hex());
3732+
config.burnchain.pox_reward_length = Some(11);
37293733

37303734
let mut btcd_controller = BitcoinCoreController::from_stx_config(&config);
37313735
btcd_controller
@@ -3809,6 +3813,7 @@ mod tests {
38093813

38103814
let mut config = utils::create_miner_config();
38113815
config.burnchain.local_mining_public_key = Some(miner_pubkey.to_hex());
3816+
config.burnchain.pox_reward_length = Some(11);
38123817

38133818
let mut btcd_controller = BitcoinCoreController::from_stx_config(&config);
38143819
btcd_controller
@@ -3882,6 +3887,7 @@ mod tests {
38823887

38833888
let mut config = utils::create_miner_config();
38843889
config.burnchain.local_mining_public_key = Some(miner_pubkey.to_hex());
3890+
config.burnchain.pox_reward_length = Some(11);
38853891

38863892
let mut btcd_controller = BitcoinCoreController::from_stx_config(&config);
38873893
btcd_controller
@@ -3927,6 +3933,7 @@ mod tests {
39273933

39283934
let mut config = utils::create_miner_config();
39293935
config.burnchain.local_mining_public_key = Some(miner_pubkey.to_hex());
3936+
config.burnchain.pox_reward_length = Some(11);
39303937

39313938
let mut btcd_controller = BitcoinCoreController::from_stx_config(&config);
39323939
btcd_controller
@@ -4063,6 +4070,7 @@ mod tests {
40634070

40644071
let mut config = utils::create_miner_config();
40654072
config.burnchain.local_mining_public_key = Some(miner_pubkey.to_hex());
4073+
config.burnchain.pox_reward_length = Some(11);
40664074

40674075
let mut btcd_controller = BitcoinCoreController::from_stx_config(&config);
40684076
btcd_controller

stacks-node/src/tests/epoch_205.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use stacks::core::test_util::{
1818
};
1919
use stacks::core::{
2020
self, EpochList, StacksEpoch, StacksEpochId, PEER_VERSION_EPOCH_1_0, PEER_VERSION_EPOCH_2_0,
21-
PEER_VERSION_EPOCH_2_05, PEER_VERSION_EPOCH_2_1,
21+
PEER_VERSION_EPOCH_2_05, PEER_VERSION_EPOCH_2_1, STACKS_EPOCH_MAX,
2222
};
2323
use stacks_common::codec::StacksMessageCodec;
2424
use stacks_common::types::chainstate::{BlockHeaderHash, BurnchainHeaderHash, VRFSeed};
@@ -53,6 +53,8 @@ fn test_exact_block_costs() {
5353
let mut epochs = EpochList::new(&*core::STACKS_EPOCHS_REGTEST);
5454
epochs[StacksEpochId::Epoch20].end_height = epoch_205_transition_height;
5555
epochs[StacksEpochId::Epoch2_05].start_height = epoch_205_transition_height;
56+
epochs[StacksEpochId::Epoch2_05].end_height = STACKS_EPOCH_MAX;
57+
epochs.truncate_after(StacksEpochId::Epoch2_05);
5658

5759
conf.burnchain.epochs = Some(epochs);
5860
conf.node.mine_microblocks = true;
@@ -299,6 +301,8 @@ fn test_dynamic_db_method_costs() {
299301
let mut epochs = EpochList::new(&*core::STACKS_EPOCHS_REGTEST);
300302
epochs[StacksEpochId::Epoch20].end_height = epoch_205_transition_height;
301303
epochs[StacksEpochId::Epoch2_05].start_height = epoch_205_transition_height;
304+
epochs[StacksEpochId::Epoch2_05].end_height = STACKS_EPOCH_MAX;
305+
epochs.truncate_after(StacksEpochId::Epoch2_05);
302306

303307
conf.burnchain.epochs = Some(epochs);
304308

@@ -501,6 +505,8 @@ fn transition_empty_blocks() {
501505
let mut epochs = EpochList::new(&*core::STACKS_EPOCHS_REGTEST);
502506
epochs[StacksEpochId::Epoch20].end_height = epoch_2_05;
503507
epochs[StacksEpochId::Epoch2_05].start_height = epoch_2_05;
508+
epochs[StacksEpochId::Epoch2_05].end_height = STACKS_EPOCH_MAX;
509+
epochs.truncate_after(StacksEpochId::Epoch2_05);
504510

505511
conf.burnchain.epochs = Some(epochs);
506512

stacks-node/src/tests/epoch_21.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use stacks::chainstate::stacks::StacksBlockHeader;
2626
use stacks::clarity_cli::vm_execute as execute;
2727
use stacks::config::{Config, InitialBalance};
2828
use stacks::core::test_util::make_contract_call;
29-
use stacks::core::{self, EpochList, BURNCHAIN_TX_SEARCH_WINDOW};
29+
use stacks::core::{self, EpochList, BURNCHAIN_TX_SEARCH_WINDOW, STACKS_EPOCH_MAX};
3030
use stacks::util_lib::boot::boot_code_id;
3131
use stacks_common::types::chainstate::{
3232
BlockHeaderHash, BurnchainHeaderHash, StacksAddress, StacksBlockId, VRFSeed,
@@ -79,6 +79,8 @@ fn advance_to_2_1(
7979
epochs[StacksEpochId::Epoch2_05].start_height = epoch_2_05;
8080
epochs[StacksEpochId::Epoch2_05].end_height = epoch_2_1;
8181
epochs[StacksEpochId::Epoch21].start_height = epoch_2_1;
82+
epochs[StacksEpochId::Epoch21].end_height = STACKS_EPOCH_MAX;
83+
epochs.truncate_after(StacksEpochId::Epoch21);
8284

8385
conf.burnchain.epochs = Some(epochs);
8486

@@ -580,6 +582,8 @@ fn transition_fixes_bitcoin_rigidity() {
580582
epochs[StacksEpochId::Epoch2_05].start_height = epoch_2_05;
581583
epochs[StacksEpochId::Epoch2_05].end_height = epoch_2_1;
582584
epochs[StacksEpochId::Epoch21].start_height = epoch_2_1;
585+
epochs[StacksEpochId::Epoch21].end_height = STACKS_EPOCH_MAX;
586+
epochs.truncate_after(StacksEpochId::Epoch21);
583587

584588
conf.burnchain.epochs = Some(epochs);
585589

@@ -1476,6 +1480,8 @@ fn transition_removes_pox_sunset() {
14761480
epochs[StacksEpochId::Epoch2_05].start_height = 1;
14771481
epochs[StacksEpochId::Epoch2_05].end_height = epoch_21;
14781482
epochs[StacksEpochId::Epoch21].start_height = epoch_21;
1483+
epochs[StacksEpochId::Epoch21].end_height = STACKS_EPOCH_MAX;
1484+
epochs.truncate_after(StacksEpochId::Epoch21);
14791485

14801486
conf.burnchain.epochs = Some(epochs);
14811487

@@ -1731,6 +1737,8 @@ fn transition_empty_blocks() {
17311737
epochs[StacksEpochId::Epoch2_05].start_height = epoch_2_05;
17321738
epochs[StacksEpochId::Epoch2_05].end_height = epoch_2_1;
17331739
epochs[StacksEpochId::Epoch21].start_height = epoch_2_1;
1740+
epochs[StacksEpochId::Epoch21].end_height = STACKS_EPOCH_MAX;
1741+
epochs.truncate_after(StacksEpochId::Epoch21);
17341742

17351743
conf.node.mine_microblocks = false;
17361744
conf.burnchain.max_rbf = 1000000;
@@ -2006,6 +2014,8 @@ fn test_sortition_divergence_pre_21() {
20062014
epochs[StacksEpochId::Epoch2_05].start_height = 101;
20072015
epochs[StacksEpochId::Epoch2_05].end_height = 241;
20082016
epochs[StacksEpochId::Epoch21].start_height = 241;
2017+
epochs[StacksEpochId::Epoch21].end_height = STACKS_EPOCH_MAX;
2018+
epochs.truncate_after(StacksEpochId::Epoch21);
20092019
conf_template.burnchain.epochs = Some(epochs);
20102020

20112021
let privks: Vec<_> = (0..5).map(|_| StacksPrivateKey::random()).collect();
@@ -2438,6 +2448,8 @@ fn trait_invocation_cross_epoch() {
24382448
epochs[StacksEpochId::Epoch2_05].start_height = epoch_2_05;
24392449
epochs[StacksEpochId::Epoch2_05].end_height = epoch_2_1;
24402450
epochs[StacksEpochId::Epoch21].start_height = epoch_2_1;
2451+
epochs[StacksEpochId::Epoch21].end_height = STACKS_EPOCH_MAX;
2452+
epochs.truncate_after(StacksEpochId::Epoch21);
24412453
conf.burnchain.epochs = Some(epochs);
24422454

24432455
let mut burnchain_config = Burnchain::regtest(&conf.get_burn_db_path());
@@ -2703,6 +2715,8 @@ fn test_v1_unlock_height_with_current_stackers() {
27032715
epochs[StacksEpochId::Epoch2_05].start_height = epoch_2_05;
27042716
epochs[StacksEpochId::Epoch2_05].end_height = epoch_2_1;
27052717
epochs[StacksEpochId::Epoch21].start_height = epoch_2_1;
2718+
epochs[StacksEpochId::Epoch21].end_height = STACKS_EPOCH_MAX;
2719+
epochs.truncate_after(StacksEpochId::Epoch21);
27062720
conf.burnchain.epochs = Some(epochs);
27072721

27082722
let mut burnchain_config = Burnchain::regtest(&conf.get_burn_db_path());
@@ -2956,6 +2970,8 @@ fn test_v1_unlock_height_with_delay_and_current_stackers() {
29562970
epochs[StacksEpochId::Epoch2_05].start_height = epoch_2_05;
29572971
epochs[StacksEpochId::Epoch2_05].end_height = epoch_2_1;
29582972
epochs[StacksEpochId::Epoch21].start_height = epoch_2_1;
2973+
epochs[StacksEpochId::Epoch21].end_height = STACKS_EPOCH_MAX;
2974+
epochs.truncate_after(StacksEpochId::Epoch21);
29592975
conf.burnchain.epochs = Some(epochs);
29602976

29612977
let mut burnchain_config = Burnchain::regtest(&conf.get_burn_db_path());

0 commit comments

Comments
 (0)