Skip to content

Commit e077304

Browse files
committed
ci: attempt to fix naka mock mining test
1 parent 5aa1ed5 commit e077304

File tree

2 files changed

+26
-21
lines changed

2 files changed

+26
-21
lines changed

testnet/stacks-node/src/run_loop/boot_nakamoto.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,12 @@ impl BootRunLoop {
160160
info!("Shutting down epoch-2/3 transition thread");
161161
return;
162162
}
163-
info!("Reached Epoch-3.0 boundary, starting nakamoto node");
163+
164+
info!(
165+
"Reached Epoch-3.0 boundary, starting nakamoto node";
166+
"with_neon_data" => data_to_naka.is_some(),
167+
"with_p2p_stack" => data_to_naka.as_ref().map(|x| x.peer_network.is_some()).unwrap_or(false)
168+
);
164169
termination_switch.store(true, Ordering::SeqCst);
165170
let naka = NakaRunLoop::new(
166171
self.config.clone(),

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

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7127,19 +7127,31 @@ fn mock_mining() {
71277127
}
71287128

71297129
let (mut naka_conf, _miner_account) = naka_neon_integration_conf(None);
7130-
let http_origin = format!("http://{}", &naka_conf.node.rpc_bind);
71317130
naka_conf.miner.wait_on_interim_blocks = Duration::from_secs(1);
71327131
let sender_sk = Secp256k1PrivateKey::new();
71337132
let sender_signer_sk = Secp256k1PrivateKey::new();
71347133
let sender_signer_addr = tests::to_addr(&sender_signer_sk);
71357134
let mut signers = TestSigners::new(vec![sender_signer_sk.clone()]);
7136-
let tenure_count = 5;
7137-
let inter_blocks_per_tenure = 9;
7135+
let tenure_count = 3;
7136+
let inter_blocks_per_tenure = 3;
71387137
// setup sender + recipient for some test stx transfers
71397138
// these are necessary for the interim blocks to get mined at all
71407139
let sender_addr = tests::to_addr(&sender_sk);
71417140
let send_amt = 100;
71427141
let send_fee = 180;
7142+
7143+
let node_1_rpc = 51024;
7144+
let node_1_p2p = 51023;
7145+
let node_2_rpc = 51026;
7146+
let node_2_p2p = 51025;
7147+
7148+
let localhost = "127.0.0.1";
7149+
naka_conf.node.rpc_bind = format!("{}:{}", localhost, node_1_rpc);
7150+
naka_conf.node.p2p_bind = format!("{}:{}", localhost, node_1_p2p);
7151+
naka_conf.node.data_url = format!("http://{}:{}", localhost, node_1_rpc);
7152+
naka_conf.node.p2p_address = format!("{}:{}", localhost, node_1_p2p);
7153+
let http_origin = format!("http://{}", &naka_conf.node.rpc_bind);
7154+
71437155
naka_conf.add_initial_balance(
71447156
PrincipalData::from(sender_addr.clone()).to_string(),
71457157
(send_amt + send_fee) * tenure_count * inter_blocks_per_tenure,
@@ -7212,11 +7224,7 @@ fn mock_mining() {
72127224
blind_signer(&naka_conf, &signers, proposals_submitted);
72137225

72147226
// Wait one block to confirm the VRF register, wait until a block commit is submitted
7215-
next_block_and(&mut btc_regtest_controller, 60, || {
7216-
let commits_count = commits_submitted.load(Ordering::SeqCst);
7217-
Ok(commits_count >= 1)
7218-
})
7219-
.unwrap();
7227+
wait_for_first_naka_block_commit(60, &commits_submitted);
72207228

72217229
let mut follower_conf = naka_conf.clone();
72227230
follower_conf.node.mock_mining = true;
@@ -7225,18 +7233,10 @@ fn mock_mining() {
72257233
follower_conf.node.seed = vec![0x01; 32];
72267234
follower_conf.node.local_peer_seed = vec![0x02; 32];
72277235

7228-
let mut rng = rand::thread_rng();
7229-
let mut buf = [0u8; 8];
7230-
rng.fill_bytes(&mut buf);
7231-
7232-
let rpc_port = u16::from_be_bytes(buf[0..2].try_into().unwrap()).saturating_add(1025) - 1; // use a non-privileged port between 1024 and 65534
7233-
let p2p_port = u16::from_be_bytes(buf[2..4].try_into().unwrap()).saturating_add(1025) - 1; // use a non-privileged port between 1024 and 65534
7234-
7235-
let localhost = "127.0.0.1";
7236-
follower_conf.node.rpc_bind = format!("{}:{}", &localhost, rpc_port);
7237-
follower_conf.node.p2p_bind = format!("{}:{}", &localhost, p2p_port);
7238-
follower_conf.node.data_url = format!("http://{}:{}", &localhost, rpc_port);
7239-
follower_conf.node.p2p_address = format!("{}:{}", &localhost, p2p_port);
7236+
follower_conf.node.rpc_bind = format!("{}:{}", localhost, node_2_rpc);
7237+
follower_conf.node.p2p_bind = format!("{}:{}", localhost, node_2_p2p);
7238+
follower_conf.node.data_url = format!("http://{}:{}", localhost, node_2_rpc);
7239+
follower_conf.node.p2p_address = format!("{}:{}", localhost, node_2_p2p);
72407240

72417241
let node_info = get_chain_info(&naka_conf);
72427242
follower_conf.node.add_bootstrap_node(

0 commit comments

Comments
 (0)