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

Feat/test jude pr mutants source #58

Open
wants to merge 13 commits into
base: feat/test-jude-pr-mutants
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Merge branch 'next' into feat/nakamoto-inv-state-machine
jcnelson committed Feb 2, 2024

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
commit 9e1b56ee0ebe295bf499c368cdf0668862a16d64
12 changes: 6 additions & 6 deletions stackslib/src/net/chat.rs
Original file line number Diff line number Diff line change
@@ -5518,14 +5518,14 @@ mod test {
test_debug!("send handshake");
convo_send_recv(&mut convo_1, vec![&mut rh_1], &mut convo_2);
let unhandled_2 = convo_2
.chat(&mut net_2, &sortdb_2, &mut chainstate_2)
.chat(&mut net_2, &sortdb_2, &mut chainstate_2, false)
.unwrap();

// convo_1 has a handshakeaccept
test_debug!("send handshake-accept");
convo_send_recv(&mut convo_2, vec![&mut rh_1], &mut convo_1);
let unhandled_1 = convo_1
.chat(&mut net_1, &sortdb_1, &mut chainstate_1)
.chat(&mut net_1, &sortdb_1, &mut chainstate_1, false)
.unwrap();

let reply_1 = rh_1.recv(0).unwrap();
@@ -5600,14 +5600,14 @@ mod test {
test_debug!("send getnakamotoinv");
convo_send_recv(&mut convo_1, vec![&mut rh_1], &mut convo_2);
let unhandled_2 = convo_2
.chat(&mut net_2, &sortdb_2, &mut chainstate_2)
.chat(&mut net_2, &sortdb_2, &mut chainstate_2, false)
.unwrap();

// convo_1 gets back a nakamotoinv message
test_debug!("send nakamotoinv");
convo_send_recv(&mut convo_2, vec![&mut rh_1], &mut convo_1);
let unhandled_1 = convo_1
.chat(&mut net_1, &sortdb_1, &mut chainstate_1)
.chat(&mut net_1, &sortdb_1, &mut chainstate_1, false)
.unwrap();

let reply_1 = rh_1.recv(0).unwrap();
@@ -5650,14 +5650,14 @@ mod test {
test_debug!("send getnakamotoinv (diverged)");
convo_send_recv(&mut convo_1, vec![&mut rh_1], &mut convo_2);
let unhandled_2 = convo_2
.chat(&mut net_2, &sortdb_2, &mut chainstate_2)
.chat(&mut net_2, &sortdb_2, &mut chainstate_2, false)
.unwrap();

// convo_1 gets back a nack message
test_debug!("send nack (diverged)");
convo_send_recv(&mut convo_2, vec![&mut rh_1], &mut convo_1);
let unhandled_1 = convo_1
.chat(&mut net_1, &sortdb_1, &mut chainstate_1)
.chat(&mut net_1, &sortdb_1, &mut chainstate_1, false)
.unwrap();

let reply_1 = rh_1.recv(0).unwrap();
22 changes: 22 additions & 0 deletions stackslib/src/net/inv/nakamoto.rs
Original file line number Diff line number Diff line change
@@ -153,6 +153,28 @@ impl InvGenerator {

let mut cur_tenure_opt = self.get_processed_tenure(chainstate, &cur_consensus_hash)?;

// loop variables and invariants:
//
// * `cur_height` is a "cursor" that gets used to populate the bitmap. It corresponds
// to a burnchain block height (since inventory bitvectors correspond to sortitions).
// It gets decremented once per loop pass. The loop terminates once the reward cycle
// for `cur_height` is less than the given `reward_cycle`.
//
// * `cur_consensus_hash` refers to the consensus hash of the sortition at `cur_height`. It
// is updated once per loop pass.
//
// * `tenure_status` is the bit vector itself. On each pass of this loop, `true` or
// `false` is pushed to it. When the loop exits, `tenure_status` will have a `true` or
// `false` value for each sortition in the given reward cycle.
//
// `cur_tenure_opt` refers to the tenure that is active as of `cur_height`, if there is one.
// If there is an active tenure in `cur_height`, then if the sortition at `cur_height`
// matches the `tenure_id_consensus_hash` of `cur_tenure_opt`, `cur_tenure_opt` is
// set to its parent tenure, and we push `true` to `tenure_status`. This is the only
// time we do this, since since `cur_tenure_opt`'s `tenure_id_consensus_hash` only
// ever matches `cur_consensus_hash` if a tenure began at `cur_height`. If a tenure did _not_
// begin at `cur_height`, or if there is no active tenure at `cur_height`, then `tenure_status`.
// will have `false` for `cur_height`'s bit.
loop {
let cur_reward_cycle = sortdb
.pox_constants
12 changes: 0 additions & 12 deletions stackslib/src/net/mod.rs
Original file line number Diff line number Diff line change
@@ -2510,18 +2510,6 @@ pub mod test {
let p2p_port = peer_network.bound_neighbor_key().port;
let http_port = peer_network.http.as_ref().unwrap().http_server_addr.port();

peer_network.local_peer.port = p2p_port;
peer_network
.peerdb
.update_local_peer(
peer_network.local_peer.network_id,
peer_network.local_peer.parent_network_id,
peer_network.local_peer.data_url.clone(),
peer_network.local_peer.port,
&config.stacker_dbs,
)
.unwrap();

debug!("Bound to (p2p={}, http={})", p2p_port, http_port);
config.server_port = p2p_port;
config.http_port = http_port;
4 changes: 2 additions & 2 deletions stackslib/src/net/p2p.rs
Original file line number Diff line number Diff line change
@@ -354,7 +354,7 @@ pub struct PeerNetwork {
/// Nakamoto-specific cache for sortition and tenure data, for the purposes of generating
/// tenure inventories
pub nakamoto_inv_generator: InvGenerator,

/// Thread handle for the async block proposal endpoint.
block_proposal_thread: Option<JoinHandle<()>>,
}
@@ -505,7 +505,7 @@ impl PeerNetwork {
fault_last_disconnect: 0,

nakamoto_inv_generator: InvGenerator::new(),

block_proposal_thread: None,
};

Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.