Skip to content

Commit 4e2a5ac

Browse files
committed
test: remove unsused mutable from test utils (phase 2), #6104
1 parent ea68752 commit 4e2a5ac

File tree

4 files changed

+125
-125
lines changed

4 files changed

+125
-125
lines changed

testnet/stacks-node/src/burnchains/bitcoin_regtest_controller.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2121,7 +2121,7 @@ impl BitcoinRegtestController {
21212121
/// Produce `num_blocks` regtest bitcoin blocks, sending the bitcoin coinbase rewards
21222122
/// to the bitcoin single sig addresses corresponding to `pks` in a round robin fashion.
21232123
#[cfg(test)]
2124-
pub fn bootstrap_chain_to_pks(&mut self, num_blocks: usize, pks: &[Secp256k1PublicKey]) {
2124+
pub fn bootstrap_chain_to_pks(&self, num_blocks: usize, pks: &[Secp256k1PublicKey]) {
21252125
info!("Creating wallet if it does not exist");
21262126
if let Err(e) = self.create_wallet_if_dne() {
21272127
error!("Error when creating wallet: {e:?}");

testnet/stacks-node/src/tests/nakamoto_integrations.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ pub fn next_block_and_mine_commit(
750750
/// Mine a bitcoin block, and wait until a block-commit has been issued, **or** a timeout occurs
751751
/// (timeout_secs)
752752
pub fn next_block_and_commits_only(
753-
btc_controller: &mut BitcoinRegtestController,
753+
btc_controller: &BitcoinRegtestController,
754754
timeout_secs: u64,
755755
node_conf: &Config,
756756
node_counters: &Counters,
@@ -1234,7 +1234,7 @@ pub fn setup_epoch_3_reward_set(
12341234
blocks_processed: &Arc<AtomicU64>,
12351235
stacker_sks: &[StacksPrivateKey],
12361236
signer_sks: &[StacksPrivateKey],
1237-
btc_regtest_controller: &mut BitcoinRegtestController,
1237+
btc_regtest_controller: &BitcoinRegtestController,
12381238
num_stacking_cycles: Option<u64>,
12391239
) {
12401240
assert_eq!(stacker_sks.len(), signer_sks.len());
@@ -1326,7 +1326,7 @@ pub fn boot_to_epoch_3_reward_set_calculation_boundary(
13261326
blocks_processed: &Arc<AtomicU64>,
13271327
stacker_sks: &[StacksPrivateKey],
13281328
signer_sks: &[StacksPrivateKey],
1329-
btc_regtest_controller: &mut BitcoinRegtestController,
1329+
btc_regtest_controller: &BitcoinRegtestController,
13301330
num_stacking_cycles: Option<u64>,
13311331
) {
13321332
setup_epoch_3_reward_set(
@@ -1371,7 +1371,7 @@ pub fn boot_to_epoch_3_reward_set_calculation_boundary(
13711371
pub fn boot_to_epoch_25(
13721372
naka_conf: &Config,
13731373
blocks_processed: &Arc<AtomicU64>,
1374-
btc_regtest_controller: &mut BitcoinRegtestController,
1374+
btc_regtest_controller: &BitcoinRegtestController,
13751375
) {
13761376
let epochs = naka_conf.burnchain.epochs.clone().unwrap();
13771377
let epoch_25 = &epochs[StacksEpochId::Epoch25];
@@ -1414,7 +1414,7 @@ pub fn boot_to_epoch_3_reward_set(
14141414
blocks_processed: &Arc<AtomicU64>,
14151415
stacker_sks: &[StacksPrivateKey],
14161416
signer_sks: &[StacksPrivateKey],
1417-
btc_regtest_controller: &mut BitcoinRegtestController,
1417+
btc_regtest_controller: &BitcoinRegtestController,
14181418
num_stacking_cycles: Option<u64>,
14191419
) {
14201420
boot_to_epoch_3_reward_set_calculation_boundary(

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

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ impl<S: Signer<T> + Send + 'static, T: SignerEventTrait + 'static> SignerTest<Sp
233233
}
234234
}
235235

236-
pub fn wait_for_registered(&mut self) {
236+
pub fn wait_for_registered(&self) {
237237
let mut finished_signers = HashSet::new();
238238
wait_for(120, || {
239239
self.send_status_request(&finished_signers);
@@ -253,7 +253,7 @@ impl<S: Signer<T> + Send + 'static, T: SignerEventTrait + 'static> SignerTest<Sp
253253
}
254254

255255
/// Send a status request to the signers to ensure they are registered for both reward cycles.
256-
pub fn wait_for_registered_both_reward_cycles(&mut self) {
256+
pub fn wait_for_registered_both_reward_cycles(&self) {
257257
let mut finished_signers = HashSet::new();
258258
wait_for(120, || {
259259
self.send_status_request(&finished_signers);
@@ -279,7 +279,7 @@ impl<S: Signer<T> + Send + 'static, T: SignerEventTrait + 'static> SignerTest<Sp
279279
.expect("Timed out while waiting for the signers to be registered for both reward cycles");
280280
}
281281

282-
pub fn wait_for_cycle(&mut self, timeout_secs: u64, reward_cycle: u64) {
282+
pub fn wait_for_cycle(&self, timeout_secs: u64, reward_cycle: u64) {
283283
let mut finished_signers = HashSet::new();
284284
wait_for(timeout_secs, || {
285285
self.send_status_request(&finished_signers);
@@ -299,9 +299,9 @@ impl<S: Signer<T> + Send + 'static, T: SignerEventTrait + 'static> SignerTest<Sp
299299
}).unwrap();
300300
}
301301

302-
pub fn mine_bitcoin_block(&mut self) {
302+
pub fn mine_bitcoin_block(&self) {
303303
let info = self.get_peer_info();
304-
next_block_and(&mut self.running_nodes.btc_regtest_controller, 60, || {
304+
next_block_and(&self.running_nodes.btc_regtest_controller, 60, || {
305305
Ok(get_chain_info(&self.running_nodes.conf).burn_block_height > info.burn_block_height)
306306
})
307307
.unwrap();
@@ -314,7 +314,7 @@ impl<S: Signer<T> + Send + 'static, T: SignerEventTrait + 'static> SignerTest<Sp
314314
/// 1. Having a valid sortition
315315
/// 2. The active miner is the winner of that sortition
316316
/// 3. The active miner is building off of the prior tenure
317-
pub fn check_signer_states_normal(&mut self) {
317+
pub fn check_signer_states_normal(&self) {
318318
let (state_machines, info_cur) = self.get_burn_updated_states();
319319

320320
let sortition_latest =
@@ -375,7 +375,7 @@ impl<S: Signer<T> + Send + 'static, T: SignerEventTrait + 'static> SignerTest<Sp
375375
/// latest burn block:
376376
/// 1. Having an invalid miner
377377
/// 2. The active miner is the winner of the prior sortition
378-
pub fn check_signer_states_revert_to_prior(&mut self) {
378+
pub fn check_signer_states_revert_to_prior(&self) {
379379
let (state_machines, info_cur) = self.get_burn_updated_states();
380380

381381
let sortition_latest =
@@ -431,7 +431,7 @@ impl<S: Signer<T> + Send + 'static, T: SignerEventTrait + 'static> SignerTest<Sp
431431

432432
/// Submit a stacks transfer just to trigger block production
433433
pub fn submit_transfer_tx(
434-
&mut self,
434+
&self,
435435
sender_sk: &StacksPrivateKey,
436436
send_fee: u64,
437437
send_amt: u64,
@@ -454,7 +454,7 @@ impl<S: Signer<T> + Send + 'static, T: SignerEventTrait + 'static> SignerTest<Sp
454454
/// Submit a burn block dependent contract for publishing
455455
/// and wait until it is included in a block
456456
pub fn submit_burn_block_contract_and_wait(
457-
&mut self,
457+
&self,
458458
sender_sk: &StacksPrivateKey,
459459
) -> Result<String, String> {
460460
let http_origin = format!("http://{}", &self.running_nodes.conf.node.rpc_bind);
@@ -485,7 +485,7 @@ impl<S: Signer<T> + Send + 'static, T: SignerEventTrait + 'static> SignerTest<Sp
485485
/// Submit a burn block dependent contract-call
486486
/// and wait until it is included in a block
487487
pub fn submit_burn_block_call_and_wait(
488-
&mut self,
488+
&self,
489489
sender_sk: &StacksPrivateKey,
490490
) -> Result<String, String> {
491491
let http_origin = format!("http://{}", &self.running_nodes.conf.node.rpc_bind);
@@ -582,7 +582,7 @@ impl<S: Signer<T> + Send + 'static, T: SignerEventTrait + 'static> SignerTest<Sp
582582
/// 1. Not having a sortition!
583583
/// 2. The active miner is the winner of the last sortition
584584
/// 3. The active miner is building off of the prior tenure
585-
pub fn check_signer_states_normal_missed_sortition(&mut self) {
585+
pub fn check_signer_states_normal_missed_sortition(&self) {
586586
let (state_machines, info_cur) = self.get_burn_updated_states();
587587
let non_sortition_latest =
588588
get_sortition_info_ch(&self.running_nodes.conf, &info_cur.pox_consensus);
@@ -653,7 +653,7 @@ impl<S: Signer<T> + Send + 'static, T: SignerEventTrait + 'static> SignerTest<Sp
653653
/// 2. The active miner is the winner of that sortition
654654
/// 3. The active miner is building off of the prior tenure
655655
pub fn check_signer_states_reorg(
656-
&mut self,
656+
&self,
657657
accepting_reorg: &[StacksPublicKey],
658658
rejecting_reorg: &[StacksPublicKey],
659659
) {
@@ -841,15 +841,15 @@ impl<S: Signer<T> + Send + 'static, T: SignerEventTrait + 'static> SignerTest<Sp
841841
}
842842

843843
fn mine_block_wait_on_processing(
844-
&mut self,
844+
&self,
845845
node_confs: &[&NeonConfig],
846846
node_counters: &[&Counters],
847847
timeout: Duration,
848848
) {
849849
let blocks_len = test_observer::get_blocks().len();
850850
let mined_block_time = Instant::now();
851851
next_block_and_wait_for_commits(
852-
&mut self.running_nodes.btc_regtest_controller,
852+
&self.running_nodes.btc_regtest_controller,
853853
timeout.as_secs(),
854854
node_confs,
855855
node_counters,
@@ -872,7 +872,7 @@ impl<S: Signer<T> + Send + 'static, T: SignerEventTrait + 'static> SignerTest<Sp
872872
/// Chain information is captured before `f` is called, and then again after `f`
873873
/// to ensure that the block was mined.
874874
/// Note: this function does _not_ mine a BTC block.
875-
fn wait_for_nakamoto_block(&mut self, timeout_secs: u64, f: impl FnOnce() -> ()) {
875+
fn wait_for_nakamoto_block(&self, timeout_secs: u64, f: impl FnOnce() -> ()) {
876876
let blocks_before = self.running_nodes.counters.naka_mined_blocks.get();
877877
let info_before = self.get_peer_info();
878878

@@ -891,7 +891,7 @@ impl<S: Signer<T> + Send + 'static, T: SignerEventTrait + 'static> SignerTest<Sp
891891
/// Wait for a confirmed block and return a list of individual
892892
/// signer signatures
893893
fn wait_for_confirmed_block_v0(
894-
&mut self,
894+
&self,
895895
block_signer_sighash: &Sha512Trunc256Sum,
896896
timeout: Duration,
897897
) -> Vec<MessageSignature> {
@@ -911,7 +911,7 @@ impl<S: Signer<T> + Send + 'static, T: SignerEventTrait + 'static> SignerTest<Sp
911911
/// Wait for a confirmed block and return a list of individual
912912
/// signer signatures
913913
fn wait_for_confirmed_block_with_hash(
914-
&mut self,
914+
&self,
915915
block_signer_sighash: &Sha512Trunc256Sum,
916916
timeout: Duration,
917917
) -> serde_json::Map<String, serde_json::Value> {
@@ -938,7 +938,7 @@ impl<S: Signer<T> + Send + 'static, T: SignerEventTrait + 'static> SignerTest<Sp
938938
panic!("Timed out while waiting for confirmation of block with signer sighash = {block_signer_sighash}")
939939
}
940940

941-
fn wait_for_validate_ok_response(&mut self, timeout: Duration) -> BlockValidateOk {
941+
fn wait_for_validate_ok_response(&self, timeout: Duration) -> BlockValidateOk {
942942
// Wait for the block to show up in the test observer
943943
let t_start = Instant::now();
944944
loop {
@@ -958,7 +958,7 @@ impl<S: Signer<T> + Send + 'static, T: SignerEventTrait + 'static> SignerTest<Sp
958958
}
959959

960960
fn wait_for_validate_reject_response(
961-
&mut self,
961+
&self,
962962
timeout: Duration,
963963
signer_signature_hash: Sha512Trunc256Sum,
964964
) -> BlockValidateReject {
@@ -983,14 +983,14 @@ impl<S: Signer<T> + Send + 'static, T: SignerEventTrait + 'static> SignerTest<Sp
983983
}
984984

985985
// Must be called AFTER booting the chainstate
986-
fn run_until_epoch_3_boundary(&mut self) {
986+
fn run_until_epoch_3_boundary(&self) {
987987
let epochs = self.running_nodes.conf.burnchain.epochs.clone().unwrap();
988988
let epoch_3 = &epochs[StacksEpochId::Epoch30];
989989

990990
let epoch_30_boundary = epoch_3.start_height - 1;
991991
// advance to epoch 3.0 and trigger a sign round (cannot vote on blocks in pre epoch 3.0)
992992
run_until_burnchain_height(
993-
&mut self.running_nodes.btc_regtest_controller,
993+
&self.running_nodes.btc_regtest_controller,
994994
&self.running_nodes.counters.blocks_processed,
995995
epoch_30_boundary,
996996
&self.running_nodes.conf,

0 commit comments

Comments
 (0)