Skip to content

refactor: regtest controller cleanup #6243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
998 changes: 725 additions & 273 deletions stacks-node/src/burnchains/bitcoin_regtest_controller.rs

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion stacks-node/src/burnchains/mocknet_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ impl BurnchainController for MocknetController {
_epoch_id: StacksEpochId,
operation: BlockstackOperationType,
_op_signer: &mut BurnchainOpSigner,
_attempt: u64,
) -> Result<Txid, BurnchainControllerError> {
let txid = operation.txid();
self.queued_operations.push_back(operation);
Expand Down
1 change: 0 additions & 1 deletion stacks-node/src/burnchains/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ pub trait BurnchainController {
epoch_id: StacksEpochId,
operation: BlockstackOperationType,
op_signer: &mut BurnchainOpSigner,
attempt: u64,
) -> Result<Txid, Error>;
fn sync(&mut self, target_block_height_opt: Option<u64>) -> Result<(BurnchainTip, u64), Error>;
fn sortdb_ref(&self) -> &SortitionDB;
Expand Down
3 changes: 1 addition & 2 deletions stacks-node/src/nakamoto_node/relayer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ impl RelayerThread {
let mut op_signer = self.keychain.generate_op_signer();
if let Ok(txid) = self
.bitcoin_controller
.submit_operation(cur_epoch, op, &mut op_signer, 1)
.submit_operation(cur_epoch, op, &mut op_signer)
{
// advance key registration state
self.last_vrf_key_burn_height = Some(burn_block.block_height);
Expand Down Expand Up @@ -1664,7 +1664,6 @@ impl RelayerThread {
*last_committed.get_epoch_id(),
BlockstackOperationType::LeaderBlockCommit(last_committed.get_block_commit().clone()),
&mut op_signer,
1,
);
let txid = match res {
Ok(txid) => txid,
Expand Down
4 changes: 2 additions & 2 deletions stacks-node/src/neon_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2745,7 +2745,7 @@ impl BlockMinerThread {
..
} = self.config.get_node_config(false);

let res = bitcoin_controller.submit_operation(target_epoch_id, op, &mut op_signer, attempt);
let res = bitcoin_controller.submit_operation(target_epoch_id, op, &mut op_signer);
match res {
Ok(_) => {
self.failed_to_submit_last_attempt = false;
Expand Down Expand Up @@ -3613,7 +3613,7 @@ impl RelayerThread {
let mut one_off_signer = self.keychain.generate_op_signer();
if let Ok(txid) =
self.bitcoin_controller
.submit_operation(cur_epoch, op, &mut one_off_signer, 1)
.submit_operation(cur_epoch, op, &mut one_off_signer)
{
// advance key registration state
self.last_vrf_key_burn_height = burn_block.block_height;
Expand Down
4 changes: 2 additions & 2 deletions stacks-node/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ impl Node {
let key_reg_op = self.generate_leader_key_register_op(vrf_pk, &consensus_hash);
let mut op_signer = self.keychain.generate_op_signer();
let key_txid = burnchain_controller
.submit_operation(cur_epoch.epoch_id, key_reg_op, &mut op_signer, 1)
.submit_operation(cur_epoch.epoch_id, key_reg_op, &mut op_signer)
.expect("FATAL: failed to submit leader key register operation");

self.leader_key_registers.insert(key_txid);
Expand Down Expand Up @@ -768,7 +768,7 @@ impl Node {

let mut op_signer = self.keychain.generate_op_signer();
let txid = burnchain_controller
.submit_operation(cur_epoch.epoch_id, op, &mut op_signer, 1)
.submit_operation(cur_epoch.epoch_id, op, &mut op_signer)
.expect("FATAL: failed to submit block-commit");

self.block_commits.insert(txid);
Expand Down
8 changes: 2 additions & 6 deletions stacks-node/src/tests/epoch_205.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,12 +627,8 @@ fn transition_empty_blocks() {
commit_outs,
});
let mut op_signer = keychain.generate_op_signer();
let res = bitcoin_controller.submit_operation(
StacksEpochId::Epoch2_05,
op,
&mut op_signer,
1,
);
let res =
bitcoin_controller.submit_operation(StacksEpochId::Epoch2_05, op, &mut op_signer);
assert!(res.is_ok(), "Failed to submit block-commit");
}

Expand Down
6 changes: 1 addition & 5 deletions stacks-node/src/tests/epoch_21.rs
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,6 @@ fn transition_fixes_bitcoin_rigidity() {
StacksEpochId::Epoch2_05,
BlockstackOperationType::PreStx(pre_stx_op),
&mut miner_signer,
1
)
.is_ok(),
"Pre-stx operation should submit successfully"
Expand Down Expand Up @@ -705,7 +704,6 @@ fn transition_fixes_bitcoin_rigidity() {
StacksEpochId::Epoch2_05,
BlockstackOperationType::TransferStx(transfer_stx_op),
&mut spender_signer,
1
)
.is_ok(),
"Transfer operation should submit successfully"
Expand Down Expand Up @@ -826,7 +824,6 @@ fn transition_fixes_bitcoin_rigidity() {
StacksEpochId::Epoch21,
BlockstackOperationType::PreStx(pre_stx_op),
&mut miner_signer,
1
)
.is_ok(),
"Pre-stx operation should submit successfully"
Expand Down Expand Up @@ -857,7 +854,6 @@ fn transition_fixes_bitcoin_rigidity() {
StacksEpochId::Epoch2_05,
BlockstackOperationType::TransferStx(transfer_stx_op),
&mut spender_signer,
1
)
.is_ok(),
"Transfer operation should submit successfully"
Expand Down Expand Up @@ -1899,7 +1895,7 @@ fn transition_empty_blocks() {
});
let mut op_signer = keychain.generate_op_signer();
let res =
bitcoin_controller.submit_operation(StacksEpochId::Epoch21, op, &mut op_signer, 1);
bitcoin_controller.submit_operation(StacksEpochId::Epoch21, op, &mut op_signer);
assert!(res.is_ok(), "Failed to submit block-commit");
}

Expand Down
10 changes: 0 additions & 10 deletions stacks-node/src/tests/nakamoto_integrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3490,7 +3490,6 @@ fn vote_for_aggregate_key_burn_op() {
StacksEpochId::Epoch30,
BlockstackOperationType::PreStx(pre_stx_op),
&mut miner_signer,
1
)
.is_ok(),
"Pre-stx operation should submit successfully"
Expand Down Expand Up @@ -3560,7 +3559,6 @@ fn vote_for_aggregate_key_burn_op() {
StacksEpochId::Epoch30,
vote_for_aggregate_key_op,
&mut signer_burnop_signer,
1
)
.is_ok(),
"Vote for aggregate key operation should submit successfully"
Expand Down Expand Up @@ -4594,7 +4592,6 @@ fn burn_ops_integration_test() {
StacksEpochId::Epoch30,
BlockstackOperationType::PreStx(pre_stx_op),
&mut miner_signer_1,
1
)
.is_ok(),
"Pre-stx operation should submit successfully"
Expand All @@ -4618,7 +4615,6 @@ fn burn_ops_integration_test() {
StacksEpochId::Epoch30,
BlockstackOperationType::PreStx(pre_stx_op_2),
&mut miner_signer_2,
1
)
.is_ok(),
"Pre-stx operation should submit successfully"
Expand All @@ -4639,7 +4635,6 @@ fn burn_ops_integration_test() {
StacksEpochId::Epoch30,
BlockstackOperationType::PreStx(pre_stx_op_3),
&mut miner_signer_3,
1
)
.is_ok(),
"Pre-stx operation should submit successfully"
Expand All @@ -4660,7 +4655,6 @@ fn burn_ops_integration_test() {
StacksEpochId::Epoch30,
BlockstackOperationType::PreStx(pre_stx_op_4),
&mut miner_signer_4,
1
)
.is_ok(),
"Pre-stx operation should submit successfully"
Expand Down Expand Up @@ -4791,7 +4785,6 @@ fn burn_ops_integration_test() {
StacksEpochId::Epoch30,
BlockstackOperationType::TransferStx(transfer_stx_op),
&mut stacker_burnop_signer_1,
1
)
.is_ok(),
"Transfer STX operation should submit successfully"
Expand All @@ -4817,7 +4810,6 @@ fn burn_ops_integration_test() {
StacksEpochId::Epoch30,
BlockstackOperationType::DelegateStx(del_stx_op),
&mut stacker_burnop_signer_2,
1
)
.is_ok(),
"Delegate STX operation should submit successfully"
Expand Down Expand Up @@ -4847,7 +4839,6 @@ fn burn_ops_integration_test() {
StacksEpochId::Epoch30,
BlockstackOperationType::StackStx(stack_stx_op_with_some_signer_key),
&mut signer_burnop_signer_1,
1
)
.is_ok(),
"Stack STX operation should submit successfully"
Expand All @@ -4874,7 +4865,6 @@ fn burn_ops_integration_test() {
StacksEpochId::Epoch30,
BlockstackOperationType::StackStx(stack_stx_op_with_no_signer_key),
&mut signer_burnop_signer_2,
1
)
.is_ok(),
"Stack STX operation should submit successfully"
Expand Down
10 changes: 0 additions & 10 deletions stacks-node/src/tests/neon_integrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1997,7 +1997,6 @@ fn stx_transfer_btc_integration_test() {
StacksEpochId::Epoch2_05,
BlockstackOperationType::PreStx(pre_stx_op),
&mut miner_signer,
1
)
.is_ok(),
"Pre-stx operation should submit successfully"
Expand Down Expand Up @@ -2027,7 +2026,6 @@ fn stx_transfer_btc_integration_test() {
StacksEpochId::Epoch2_05,
BlockstackOperationType::TransferStx(transfer_stx_op),
&mut spender_signer,
1
)
.is_ok(),
"Transfer operation should submit successfully"
Expand Down Expand Up @@ -2266,7 +2264,6 @@ fn stx_delegate_btc_integration_test() {
StacksEpochId::Epoch21,
BlockstackOperationType::PreStx(pre_stx_op),
&mut miner_signer,
1
)
.is_ok(),
"Pre-stx operation should submit successfully"
Expand Down Expand Up @@ -2295,7 +2292,6 @@ fn stx_delegate_btc_integration_test() {
StacksEpochId::Epoch21,
BlockstackOperationType::DelegateStx(del_stx_op),
&mut spender_signer,
1
)
.is_ok(),
"Delegate operation should submit successfully"
Expand Down Expand Up @@ -2555,7 +2551,6 @@ fn stack_stx_burn_op_test() {
StacksEpochId::Epoch25,
BlockstackOperationType::PreStx(pre_stx_op_1),
&mut miner_signer_1,
1
)
.is_ok(),
"Pre-stx operation should submit successfully"
Expand All @@ -2576,7 +2571,6 @@ fn stack_stx_burn_op_test() {
StacksEpochId::Epoch25,
BlockstackOperationType::PreStx(pre_stx_op_2),
&mut miner_signer_2,
1
)
.is_ok(),
"Pre-stx operation should submit successfully"
Expand Down Expand Up @@ -2663,7 +2657,6 @@ fn stack_stx_burn_op_test() {
StacksEpochId::Epoch25,
stack_stx_op_with_some_signer_key,
&mut spender_signer_1,
1
)
.is_ok(),
"Stack STX operation with some signer key should submit successfully"
Expand Down Expand Up @@ -2691,7 +2684,6 @@ fn stack_stx_burn_op_test() {
StacksEpochId::Epoch25,
stack_stx_op_with_no_signer_key,
&mut spender_signer_2,
1
)
.is_ok(),
"Stack STX operation with no signer key should submit successfully"
Expand Down Expand Up @@ -2991,7 +2983,6 @@ fn vote_for_aggregate_key_burn_op_test() {
StacksEpochId::Epoch25,
BlockstackOperationType::PreStx(pre_stx_op),
&mut miner_signer,
1
)
.is_ok(),
"Pre-stx operation should submit successfully"
Expand Down Expand Up @@ -3048,7 +3039,6 @@ fn vote_for_aggregate_key_burn_op_test() {
StacksEpochId::Epoch25,
vote_for_aggregate_key_op,
&mut spender_signer,
1
)
.is_ok(),
"Vote for aggregate key operation should submit successfully"
Expand Down
4 changes: 1 addition & 3 deletions stacks-node/src/tests/signer/v0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3799,7 +3799,6 @@ fn tx_replay_btc_on_stx_invalidation() {
StacksEpochId::Epoch30,
BlockstackOperationType::PreStx(pre_stx_op),
&mut miner_keychain,
1
)
.is_ok(),
"Pre-stx operation should submit successfully"
Expand Down Expand Up @@ -3828,8 +3827,7 @@ fn tx_replay_btc_on_stx_invalidation() {
.submit_operation(
StacksEpochId::Epoch30,
BlockstackOperationType::TransferStx(transfer_stx_op),
&mut sender_burnop_signer,
1
&mut sender_burnop_signer
)
.is_ok(),
"Transfer STX operation should submit successfully"
Expand Down
Loading