Skip to content

Commit e8b21fa

Browse files
committed
Update tests/signer/v0.rs for scenario modules
1 parent 1b1d353 commit e8b21fa

File tree

1 file changed

+40
-2
lines changed
  • testnet/stacks-node/src/tests/signer

1 file changed

+40
-2
lines changed

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

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ use libsigner::v0::messages::{
2929
use libsigner::{
3030
BlockProposal, BlockProposalData, SignerSession, StackerDBSession, VERSION_STRING,
3131
};
32+
use madhouse::{execute_commands, prop_allof, scenario, Command};
33+
use proptest::prelude::Strategy;
3234
use rand::{thread_rng, Rng};
3335
use rusqlite::Connection;
3436
use stacks::address::AddressHashMode;
@@ -51,6 +53,7 @@ use stacks::core::test_util::{
5153
};
5254
use stacks::core::{StacksEpochId, CHAIN_ID_TESTNET};
5355
use stacks::libstackerdb::StackerDBChunkData;
56+
use stacks::net::api::getinfo::RPCPeerInfoData;
5457
use stacks::net::api::getsigner::GetSignerResponse;
5558
use stacks::net::api::postblock_proposal::{
5659
BlockValidateResponse, ValidateRejectCode, TEST_VALIDATE_DELAY_DURATION_SECS,
@@ -93,7 +96,7 @@ use crate::nakamoto_node::miner::{
9396
TEST_P2P_BROADCAST_STALL,
9497
};
9598
use crate::nakamoto_node::stackerdb_listener::TEST_IGNORE_SIGNERS;
96-
use crate::neon::Counters;
99+
use crate::neon::{Counters, RunLoopCounter};
97100
use crate::run_loop::boot_nakamoto;
98101
use crate::tests::nakamoto_integrations::{
99102
boot_to_epoch_25, boot_to_epoch_3_reward_set, next_block_and, next_block_and_controller,
@@ -104,9 +107,18 @@ use crate::tests::neon_integrations::{
104107
get_account, get_chain_info, get_chain_info_opt, get_sortition_info, get_sortition_info_ch,
105108
next_block_and_wait, run_until_burnchain_height, submit_tx, submit_tx_fallible, test_observer,
106109
};
110+
use crate::tests::signer::commands::*;
107111
use crate::tests::{self, gen_random_port};
108112
use crate::{nakamoto_node, BitcoinRegtestController, BurnchainController, Config, Keychain};
109113

114+
pub fn get_chain_info_wrapper(conf: &Config) -> RPCPeerInfoData {
115+
get_chain_info(conf)
116+
}
117+
118+
pub fn test_mine_stall_set(value: bool) {
119+
TEST_MINE_STALL.set(value)
120+
}
121+
110122
impl SignerTest<SpawnedSigner> {
111123
/// Run the test until the first epoch 2.5 reward cycle.
112124
/// Will activate pox-4 and register signers for the first full Epoch 2.5 reward cycle.
@@ -616,6 +628,32 @@ impl MultipleMinerTest {
616628
}
617629
}
618630

631+
pub fn get_primary_skip_commit_flag(&self) -> stacks::util::tests::TestFlag<bool> {
632+
self.signer_test
633+
.running_nodes
634+
.counters
635+
.naka_skip_commit_op
636+
.clone()
637+
}
638+
639+
pub fn get_secondary_skip_commit_flag(&self) -> stacks::util::tests::TestFlag<bool> {
640+
self.rl2_counters.naka_skip_commit_op.clone()
641+
}
642+
643+
pub fn get_primary_last_stacks_tip_counter(&self) -> RunLoopCounter {
644+
self.signer_test
645+
.running_nodes
646+
.counters
647+
.naka_submitted_commit_last_stacks_tip
648+
.clone()
649+
}
650+
651+
pub fn get_secondary_last_stacks_tip_counter(&self) -> RunLoopCounter {
652+
self.rl2_counters
653+
.naka_submitted_commit_last_stacks_tip
654+
.clone()
655+
}
656+
619657
/// Boot node 1 to epoch 3.0 and wait for node 2 to catch up.
620658
pub fn boot_to_epoch_3(&mut self) {
621659
info!(
@@ -1160,7 +1198,7 @@ fn wait_for_block_pushed(
11601198
}
11611199

11621200
/// Waits for a block with the provided expected height to be proposed and pushed by the miner with the provided public key.
1163-
fn wait_for_block_pushed_by_miner_key(
1201+
pub fn wait_for_block_pushed_by_miner_key(
11641202
timeout_secs: u64,
11651203
expected_height: u64,
11661204
miner_key: &StacksPublicKey,

0 commit comments

Comments
 (0)