Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ env:

jobs:
msrv:
name: Rust 1.91 MSRV
name: Rust 1.95 MSRV
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.91.0
- uses: dtolnay/rust-toolchain@1.95.0
- uses: Swatinem/rust-cache@v2
- run: cargo check --all-targets --all-features --locked

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
repository = "https://github.com/WithAutonomi/ant-node"
keywords = ["p2p", "decentralized", "quantum-safe", "post-quantum", "dht"]
categories = ["network-programming", "cryptography"]
rust-version = "1.91"
rust-version = "1.95"

[lib]
name = "ant_node"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ ant-node

### Prerequisites

- Rust 1.91+ (for building from source)
- Rust 1.95+ (for building from source)
- Linux, macOS, or Windows

### Build from Source
Expand Down
2 changes: 1 addition & 1 deletion docs/WEBRTC_DIRECT_TESTNET.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ and serves browser bootstrap metadata; the companion site lives in the sibling

## Start the node testnet

Rust 1.91 or newer is the shared native/WASM baseline.
Rust 1.95 or newer is the shared native/WASM baseline.
The startup and transport policy is recorded in [ADR-0015](adr/ADR-0015-direct-browser-clients-over-webrtc-direct.md).

```bash
Expand Down
12 changes: 10 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -825,15 +825,23 @@ mod tests {
let toml_str = r"peers = []";
let config: BootstrapPeersConfig =
toml::from_str(toml_str).expect("empty peers should parse");
assert!(config.peers.is_empty());
assert!(
config.peers.is_empty(),
"expected no peers, got {:?}",
config.peers
);
}

#[test]
fn test_bootstrap_peers_parse_missing_peers_field() {
let toml_str = "";
let config: BootstrapPeersConfig =
toml::from_str(toml_str).expect("missing field should use default");
assert!(config.peers.is_empty());
assert!(
config.peers.is_empty(),
"expected no peers, got {:?}",
config.peers
);
}

#[test]
Expand Down
4 changes: 2 additions & 2 deletions src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1537,15 +1537,15 @@ mod tests {
fn test_scan_identity_dirs_empty_dir() {
let tmp = tempfile::tempdir().unwrap();
let dirs = NodeBuilder::scan_identity_dirs(tmp.path()).unwrap();
assert!(dirs.is_empty());
assert!(dirs.is_empty(), "expected no identity dirs, got {dirs:?}");
}

#[test]
fn test_scan_identity_dirs_nonexistent_dir() {
let tmp = tempfile::tempdir().unwrap();
let path = tmp.path().join("nonexistent_identity_dir");
let dirs = NodeBuilder::scan_identity_dirs(&path).unwrap();
assert!(dirs.is_empty());
assert!(dirs.is_empty(), "expected no identity dirs, got {dirs:?}");
}

#[test]
Expand Down
18 changes: 15 additions & 3 deletions src/replication/admission.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,21 @@ mod tests {
rejected_keys: Vec::new(),
};

assert!(result.replica_keys.is_empty());
assert!(result.paid_only_keys.is_empty());
assert!(result.rejected_keys.is_empty());
assert!(
result.replica_keys.is_empty(),
"expected no replica keys, got {:?}",
result.replica_keys
);
assert!(
result.paid_only_keys.is_empty(),
"expected no paid-only keys, got {:?}",
result.paid_only_keys
);
assert!(
result.rejected_keys.is_empty(),
"expected no rejected keys, got {:?}",
result.rejected_keys
);
}

#[test]
Expand Down
7 changes: 6 additions & 1 deletion src/replication/audit_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,11 @@ mod tests {
assert_eq!(snapshot.origins[0].total_avg_ms(), 55);
assert_eq!(snapshot.origins[0].peak_global_inflight, 31);
assert_eq!(snapshot.total.global_pool_drops, 1);
assert!(metrics.take_snapshot().origins.is_empty());
let drained = metrics.take_snapshot();
assert!(
drained.origins.is_empty(),
"expected the snapshot to have been drained, got {:?}",
drained.origins
);
}
}
24 changes: 19 additions & 5 deletions src/replication/neighbor_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ mod tests {

let batch = select_sync_batch(&mut state, 4, Duration::from_secs(0));

assert!(batch.is_empty());
assert!(batch.is_empty(), "expected an empty batch, got {batch:?}");
assert_eq!(state.cursor, 0);
}

Expand All @@ -671,8 +671,15 @@ mod tests {
let cooldown = Duration::from_hours(1);
let batch = select_sync_batch(&mut state, 4, cooldown);

assert!(batch.is_empty());
assert!(state.order.is_empty());
assert!(
batch.is_empty(),
"expected an empty batch while every peer is in cooldown, got {batch:?}"
);
assert!(
state.order.is_empty(),
"expected an empty order, got {:?}",
state.order
);
}

// -- handle_sync_failure -------------------------------------------------
Expand Down Expand Up @@ -735,7 +742,11 @@ mod tests {
let replacement =
handle_sync_failure(&mut state, &peer_id_from_byte(1), Duration::from_secs(0));

assert!(state.order.is_empty());
assert!(
state.order.is_empty(),
"expected the order to be exhausted, got {:?}",
state.order
);
assert!(replacement.is_none());
}

Expand Down Expand Up @@ -1154,7 +1165,10 @@ mod tests {

// Extra call after cycle complete returns empty.
let round4 = select_sync_batch(&mut state, batch_size, no_cooldown);
assert!(round4.is_empty());
assert!(
round4.is_empty(),
"expected an empty batch once the cycle is complete, got {round4:?}"
);
}

/// Scenario 37: Non-`LocalRT` inbound sync behavior.
Expand Down
6 changes: 5 additions & 1 deletion src/replication/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2262,7 +2262,11 @@ mod tests {
assert_eq!(decoded.request_id, 6);
if let ReplicationMessageBody::NeighborSyncResponse(resp) = decoded.body {
assert_eq!(resp.replica_hints.len(), 1);
assert!(resp.paid_hints.is_empty());
assert!(
resp.paid_hints.is_empty(),
"expected no paid hints, got {:?}",
resp.paid_hints
);
assert!(!resp.bootstrapping);
assert_eq!(resp.rejected_keys.len(), 2);
} else {
Expand Down
5 changes: 4 additions & 1 deletion src/replication/pruning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2258,7 +2258,10 @@ mod tests {

// The same evidence fails a quorum of 3.
let confirmed = confirmed_keys_from_presence(&candidates, &present_by_key, 3);
assert!(confirmed.is_empty());
assert!(
confirmed.is_empty(),
"expected no confirmed keys at a quorum of 3, got {confirmed:?}"
);
}

#[test]
Expand Down
12 changes: 10 additions & 2 deletions src/replication/scheduling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1871,7 +1871,11 @@ mod tests {
let mut first = test_entry(1);
first.next_verify_at = Instant::now() + Duration::from_mins(1);
assert!(queues.add_pending_verify(key, first).admitted());
assert!(queues.ready_pending_keys(Instant::now()).is_empty());
let ready = queues.ready_pending_keys(Instant::now());
assert!(
ready.is_empty(),
"expected no ready pending keys before the retry delay elapses, got {ready:?}"
);
assert!(!queues.add_pending_verify(key, test_entry(2)).admitted());
assert_eq!(queues.pending_count(), 1);
assert_eq!(
Expand Down Expand Up @@ -1990,7 +1994,11 @@ mod tests {
vec![source_a, source_b],
));

assert!(queues.remove_hint_source(&source_a).is_empty());
let orphaned = queues.remove_hint_source(&source_a);
assert!(
orphaned.is_empty(),
"expected no orphaned keys while source_b still advertises, got {orphaned:?}"
);
let candidate = queues.dequeue_fetch().expect("candidate remains fetchable");
assert_eq!(candidate.sources, vec![source_b]);
assert_eq!(
Expand Down
2 changes: 1 addition & 1 deletion src/replication/storage_commitment_audit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2371,7 +2371,7 @@ mod tests {
assert!(structure(&built, &proof, &nonce, &peer).is_ok());
// Round 2: honest responder opens real slices for the sample.
let s = sample(&proof, &nonce, built.commitment().key_count);
assert!(!s.is_empty());
assert!(!s.is_empty(), "expected a non-empty sample");
let openings = openings_for(&s);
let items = served_honest_items(&openings, &nonce, &peer);
match verify_slice_response(&openings, &nonce, &peer, &items) {
Expand Down
30 changes: 25 additions & 5 deletions src/storage/chunk_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3203,7 +3203,11 @@ mod tests {
.await
.expect("copy rest");
assert_eq!(rest.copied, 3);
assert!(store.legacy_only_keys().is_empty());
let legacy = store.legacy_only_keys();
assert!(
legacy.is_empty(),
"expected no legacy-only keys, got {legacy:?}"
);
assert_eq!(store.current_chunks().expect("count"), 5);
}

Expand Down Expand Up @@ -4684,7 +4688,11 @@ mod tests {
.copy_batch(&keys, 0, 0, &never_cancelled())
.await
.expect("copy");
assert!(store.legacy_only_keys().is_empty());
let legacy = store.legacy_only_keys();
assert!(
legacy.is_empty(),
"expected no legacy-only keys, got {legacy:?}"
);

let victim = keys.first().copied().expect("a key");
let path = dir
Expand Down Expand Up @@ -4788,7 +4796,11 @@ mod tests {
.copy_batch(&late, 0, 0, &never_cancelled())
.await
.expect("copy");
assert!(store.legacy_only_keys().is_empty());
let legacy = store.legacy_only_keys();
assert!(
legacy.is_empty(),
"expected no legacy-only keys, got {legacy:?}"
);
assert_eq!(
store
.get(late.first().expect("a key"))
Expand Down Expand Up @@ -4844,7 +4856,11 @@ mod tests {
.copy_batch(&keys, 0, 0, &never_cancelled())
.await
.expect("copy");
assert!(store.legacy_only_keys().is_empty());
let legacy = store.legacy_only_keys();
assert!(
legacy.is_empty(),
"expected no legacy-only keys, got {legacy:?}"
);

// Remove the file without telling the store, which is what the pruner's own
// delete looks like if it lands mid-pass. Republishing from the legacy copy here
Expand Down Expand Up @@ -4986,7 +5002,11 @@ mod tests {
.expect("copy");
assert_eq!(report.copied, 0);
assert_eq!(report.unusable, 1);
assert!(store.legacy_only_keys().is_empty());
let legacy = store.legacy_only_keys();
assert!(
legacy.is_empty(),
"expected no legacy-only keys, got {legacy:?}"
);

// And it is gone from the environment, so the pass below cannot find it and put
// it back. That is the loop this is about.
Expand Down
2 changes: 1 addition & 1 deletion src/storage/lmdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1807,7 +1807,7 @@ mod tests {

// Empty storage
let keys = storage.all_keys().await.expect("all_keys empty");
assert!(keys.is_empty());
assert!(keys.is_empty(), "expected empty storage, got {keys:?}");

// Store some chunks
let content1 = b"chunk one for keys";
Expand Down
10 changes: 8 additions & 2 deletions src/upgrade/apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,10 @@ mod tests {
#[test]
fn test_auto_apply_upgrader_creation() {
let upgrader = AutoApplyUpgrader::new();
assert!(!upgrader.current_version().to_string().is_empty());
assert!(
!upgrader.current_version().to_string().is_empty(),
"expected a non-empty current version"
);
}

#[test]
Expand All @@ -743,7 +746,10 @@ mod tests {
#[test]
fn test_default_impl() {
let upgrader = AutoApplyUpgrader::default();
assert!(!upgrader.current_version().to_string().is_empty());
assert!(
!upgrader.current_version().to_string().is_empty(),
"expected a non-empty current version"
);
}

/// Helper: create a tar.gz archive containing a fake binary.
Expand Down
5 changes: 4 additions & 1 deletion src/upgrade/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,10 @@ mod tests {
fn test_default_impl() {
let upgrader = Upgrader::default();
// Should not panic and should have a valid version
assert!(!upgrader.current_version().to_string().is_empty());
assert!(
!upgrader.current_version().to_string().is_empty(),
"expected a non-empty current version"
);
}

/// Test 11: Backup with special characters in filename
Expand Down
4 changes: 2 additions & 2 deletions src/web_rtc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ impl ByteBudget {
error: &'static str,
) -> ServerResult<ByteReservation> {
self.in_use
.fetch_update(Ordering::AcqRel, Ordering::Acquire, |current| {
.try_update(Ordering::AcqRel, Ordering::Acquire, |current| {
current
.checked_add(amount)
.filter(|next| *next <= self.limit)
Expand Down Expand Up @@ -199,7 +199,7 @@ impl ByteReservation {
fn try_grow(&mut self, amount: usize) -> ServerResult<()> {
self.budget
.in_use
.fetch_update(Ordering::AcqRel, Ordering::Acquire, |current| {
.try_update(Ordering::AcqRel, Ordering::Acquire, |current| {
current
.checked_add(amount)
.filter(|next| *next <= self.budget.limit)
Expand Down
5 changes: 4 additions & 1 deletion tests/e2e/anvil.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,10 @@ mod tests {
async fn test_anvil_creation() {
let anvil = TestAnvil::new().await.unwrap();
let _network = anvil.to_network();
assert!(!anvil.default_wallet_key().unwrap().is_empty());
assert!(
!anvil.default_wallet_key().unwrap().is_empty(),
"expected a non-empty default wallet key"
);
}

#[test]
Expand Down
5 changes: 4 additions & 1 deletion tests/e2e/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ async fn test_network_with_evm() {
let anvil = harness.anvil().expect("Anvil should be present");
// Verify the Anvil testnet is usable by checking we can get a network config
let _network = anvil.to_network();
assert!(!anvil.default_wallet_key().expect("wallet key").is_empty());
assert!(
!anvil.default_wallet_key().expect("wallet key").is_empty(),
"expected a non-empty default wallet key"
);

harness.teardown().await.expect("Failed to teardown");
}
Expand Down
5 changes: 4 additions & 1 deletion tests/e2e/payment_flow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ mod helper_tests {

// Verify we can create wallets
let wallet = env.create_funded_wallet()?;
assert!(!wallet.address().to_string().is_empty());
assert!(
!wallet.address().to_string().is_empty(),
"expected a non-empty wallet address"
);

// Verify harness is accessible
assert!(env.harness.node(0).is_some(), "Node 0 should exist");
Expand Down
Loading
Loading