Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Commit

Permalink
chore: get all unit tests to pass
Browse files Browse the repository at this point in the history
  • Loading branch information
jcnelson committed May 3, 2024
1 parent 1f6e129 commit d6f5ce6
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions stackslib/src/net/tests/inv/epoch2x.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1248,12 +1248,15 @@ fn test_sync_inv_2_peers_plain() {
let mut peer_1_config = TestPeerConfig::new(function_name!(), 0, 0);
let mut peer_2_config = TestPeerConfig::new(function_name!(), 0, 0);

peer_1_config.add_neighbor(&peer_2_config.to_neighbor());
peer_2_config.add_neighbor(&peer_1_config.to_neighbor());
peer_1_config.connection_opts.inv_reward_cycles = 10;
peer_2_config.connection_opts.inv_reward_cycles = 10;

let mut peer_1 = TestPeer::new(peer_1_config);
let mut peer_2 = TestPeer::new(peer_2_config);

peer_1.add_neighbor(&mut peer_2.to_neighbor(), None, true);
peer_2.add_neighbor(&mut peer_1.to_neighbor(), None, true);

let num_blocks = (GETPOXINV_MAX_BITLEN * 2) as u64;
let first_stacks_block_height = {
let sn =
Expand Down Expand Up @@ -1422,12 +1425,15 @@ fn test_sync_inv_2_peers_stale() {
let mut peer_1_config = TestPeerConfig::new(function_name!(), 0, 0);
let mut peer_2_config = TestPeerConfig::new(function_name!(), 0, 0);

peer_1_config.add_neighbor(&peer_2_config.to_neighbor());
peer_2_config.add_neighbor(&peer_1_config.to_neighbor());
peer_1_config.connection_opts.inv_reward_cycles = 10;
peer_2_config.connection_opts.inv_reward_cycles = 10;

let mut peer_1 = TestPeer::new(peer_1_config);
let mut peer_2 = TestPeer::new(peer_2_config);

peer_1.add_neighbor(&mut peer_2.to_neighbor(), None, true);
peer_2.add_neighbor(&mut peer_1.to_neighbor(), None, true);

let num_blocks = (GETPOXINV_MAX_BITLEN * 2) as u64;
let first_stacks_block_height = {
let sn =
Expand Down Expand Up @@ -1525,14 +1531,17 @@ fn test_sync_inv_2_peers_unstable() {
let mut peer_1_config = TestPeerConfig::new(function_name!(), 0, 0);
let mut peer_2_config = TestPeerConfig::new(function_name!(), 0, 0);

let stable_confs = peer_1_config.burnchain.stable_confirmations as u64;
peer_1_config.connection_opts.inv_reward_cycles = 10;
peer_2_config.connection_opts.inv_reward_cycles = 10;

peer_1_config.add_neighbor(&peer_2_config.to_neighbor());
peer_2_config.add_neighbor(&peer_1_config.to_neighbor());
let stable_confs = peer_1_config.burnchain.stable_confirmations as u64;

let mut peer_1 = TestPeer::new(peer_1_config);
let mut peer_2 = TestPeer::new(peer_2_config);

peer_1.add_neighbor(&mut peer_2.to_neighbor(), None, true);
peer_2.add_neighbor(&mut peer_1.to_neighbor(), None, true);

let num_blocks = (GETPOXINV_MAX_BITLEN * 2) as u64;

let first_stacks_block_height = {
Expand All @@ -1559,7 +1568,7 @@ fn test_sync_inv_2_peers_unstable() {
} else {
// peer 1 diverges
test_debug!("Peer 1 diverges at {}", i + first_stacks_block_height);
peer_1.next_burnchain_block(vec![]);
peer_1.next_burnchain_block_diverge(vec![burn_ops[0].clone()]);
}
}

Expand Down Expand Up @@ -1734,15 +1743,18 @@ fn test_sync_inv_2_peers_different_pox_vectors() {
let mut peer_1_config = TestPeerConfig::new(function_name!(), 0, 0);
let mut peer_2_config = TestPeerConfig::new(function_name!(), 0, 0);

peer_1_config.add_neighbor(&peer_2_config.to_neighbor());
peer_2_config.add_neighbor(&peer_1_config.to_neighbor());
peer_1_config.connection_opts.inv_reward_cycles = 10;
peer_2_config.connection_opts.inv_reward_cycles = 10;

let reward_cycle_length = peer_1_config.burnchain.pox_constants.reward_cycle_length as u64;
assert_eq!(reward_cycle_length, 5);

let mut peer_1 = TestPeer::new(peer_1_config);
let mut peer_2 = TestPeer::new(peer_2_config);

peer_1.add_neighbor(&mut peer_2.to_neighbor(), None, true);
peer_2.add_neighbor(&mut peer_1.to_neighbor(), None, true);

let num_blocks = (GETPOXINV_MAX_BITLEN * 3) as u64;

let first_stacks_block_height = {
Expand Down

0 comments on commit d6f5ce6

Please sign in to comment.