Skip to content

Commit 5713197

Browse files
committed
Merge branch 'develop' of https://github.com/stacks-network/stacks-core into feat/signer-sends-replay-set-in-update
2 parents c068de1 + a5b5137 commit 5713197

File tree

7 files changed

+353
-215
lines changed

7 files changed

+353
-215
lines changed

CONTRIBUTING.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,17 +361,31 @@ A non-exhaustive list of examples of consensus-critical changes include:
361361

362362
- Every consensus-critical change needs an integration test to verify that the feature activates only when the hard fork activates.
363363

364-
PRs must include test coverage. However, if your PR includes large tests or tests which cannot run in parallel
364+
- PRs must include test coverage. However, if your PR includes large tests or tests which cannot run in parallel
365365
(which is the default operation of the `cargo test` command), these tests should be decorated with `#[ignore]`.
366-
367366
A test should be marked `#[ignore]` if:
368367

369-
1. It does not _always_ pass `cargo test` in a vanilla environment
368+
1. It does not _always_ pass `cargo test` in a vanilla environment
370369
(i.e., it does not need to run with `--test-threads 1`).
371370

372-
2. Or, it runs for over a minute via a normal `cargo test` execution
371+
2. Or, it runs for over a minute via a normal `cargo test` execution
373372
(the `cargo test` command will warn if this is not the case).
374373

374+
- **Integration tests need to be properly tagged** using [pinny-rs](https://github.com/BitcoinL2-Labs/pinny-rs/) crate. Tagging requires two fundamental steps:
375+
1. Define allowed tags in the package `Cargo.toml` file (if needed).
376+
2. Apply relevant tags to the tests, picking from the allowed set.
377+
378+
Then it will be possible to run tests with filtering based on the tags using `cargo test` and `cargo nextest` runner.
379+
> For more information and examples on how tagging works, refer to the [pinny-rs](https://github.com/BitcoinL2-Labs/pinny-rs/) readme.
380+
381+
Below the tag set currently defined with related purpose:
382+
383+
| Tag | Description |
384+
|-----------------|----------------------------------------------|
385+
| `slow` | tests running over a minute |
386+
| `bitcoind` | tests requiring bitcoin daemon |
387+
| `flaky` | tests that exhibit flaky behavior |
388+
375389
## Formatting
376390

377391
PRs will be checked against `rustfmt` and will _fail_ if not properly formatted.

Cargo.lock

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

stackslib/src/net/tests/convergence.rs

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fn stacker_db_id(i: usize) -> QualifiedContractIdentifier {
5252

5353
fn make_stacker_db_ids(i: usize) -> Vec<QualifiedContractIdentifier> {
5454
let mut dbs = vec![];
55-
for j in 0..i {
55+
for j in 0..i + 1 {
5656
dbs.push(stacker_db_id(j));
5757
}
5858
dbs
@@ -1053,6 +1053,45 @@ fn run_topology_test_ex<F>(
10531053
(100.0 * (peer_counts as f64)) / ((peer_count * peer_count) as f64),
10541054
);
10551055

1056+
// wait for stacker DBs to converge
1057+
for (i, peer) in peers.iter().enumerate() {
1058+
if i % 2 != 0 {
1059+
continue;
1060+
}
1061+
for (j, other_peer) in peers.iter().enumerate() {
1062+
if i == j {
1063+
continue;
1064+
}
1065+
1066+
let all_neighbors =
1067+
PeerDB::get_all_peers(other_peer.network.peerdb.conn()).unwrap();
1068+
1069+
if (all_neighbors.len() as u64) < ((peer_count - 1) as u64) {
1070+
// this is a simulated-NAT'ed node -- it won't learn about other NAT'ed nodes'
1071+
// DBs
1072+
continue;
1073+
}
1074+
1075+
if j % 2 != 0 {
1076+
continue; // this peer doesn't support Stacker DBs
1077+
}
1078+
let dbs = peer
1079+
.network
1080+
.peerdb
1081+
.get_peer_stacker_dbs(&other_peer.config.to_neighbor())
1082+
.unwrap();
1083+
if dbs.is_empty() {
1084+
test_debug!(
1085+
"waiting for peer {i} {} to learn about peer {j} {}'s stacker DBs",
1086+
&peer.config.to_neighbor(),
1087+
&other_peer.config.to_neighbor()
1088+
);
1089+
finished = false;
1090+
break;
1091+
}
1092+
}
1093+
}
1094+
10561095
if finished {
10571096
break;
10581097
}

testnet/stacks-node/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ http-types = "2.12"
5151
tempfile = "3.3"
5252
mockito = "1.5"
5353
serial_test = "3.2.0"
54+
pinny = { git = "https://github.com/BitcoinL2-Labs/pinny-rs.git", rev = "54ba9d533a7b84525a5e65a3eae1a3ae76b9ea49" } #v0.0.2
5455
madhouse = { git = "https://github.com/stacks-network/madhouse-rs.git", rev = "fc651ddcbaf85e888b06d4a87aa788c4b7ba9309" }
5556
proptest = { git = "https://github.com/proptest-rs/proptest.git", rev = "c9bdf18c232665b2b740c667c81866b598d06dc7" }
5657

@@ -68,3 +69,6 @@ slog_json = ["stacks/slog_json", "stacks-common/slog_json", "clarity/slog_json"]
6869
prod-genesis-chainstate = []
6970
default = []
7071
testing = []
72+
73+
[package.metadata.pinny]
74+
allowed = ["bitcoind", "flaky", "slow"]

0 commit comments

Comments
 (0)