Initial release: v0.1.0
Passphrase-based peer rendezvous for iroh-gossip swarms over the public Mainline DHT. Two nodes that share a passphrase + application salt find each other and join the same gossip topic — no bootstrap server, no prior knowledge of peer addresses. The algorithm is a clock-free variant of HyParView-style partition healing on BEP 44 mutable items, with K-sharded slots, logical aging with random-tie eviction, vouching of up to V neighbors at age 1, and a two-layer AEAD record envelope. Full spec in PROTOCOL.md. Ships with: * 119 tests (unit / property / integration / doctest) all green * 100% mutation-testing catch rate (cargo-mutants) * cargo-fuzz harnesses for the parse surface * Kani proofs of no-UB / no-panic on crypto::epoch_of and wire::decode_entries across their full symbolic input spaces * Stateright distributed-system model: safety invariants S1 + S2 proved exhaustively for N ≤ 6, K ≤ 3; liveness witness under weak fairness * Miri green on the synchronous modules * cargo-deny + cargo-audit clean * criterion benches * Full-matrix CI (Linux + macOS + Windows × stable + MSRV 1.93.0) * Dedicated nightly lane for Miri / mutation / fuzz / Kani / Stateright Pinned iroh 0.98.x. License MIT. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
54 files changed
+16897
No files matched your search
@@ -0,0 +1,55 @@
|
||||
//! Observable runtime state exposed via [`Rendezvous::state`](crate::Rendezvous::state).
|
||||
|
||||
use std::time::Instant;
|
||||
|
||||
use iroh_gossip::TopicId;
|
||||
|
||||
/// Snapshot of rendezvous state at a point in time. Cheap to clone.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct RendezvousState {
|
||||
/// The gossip topic this rendezvous is bootstrapping.
|
||||
pub topic_id: TopicId,
|
||||
/// Number of currently-connected gossip neighbors.
|
||||
pub neighbor_count: usize,
|
||||
/// Status of the underlying DHT client.
|
||||
pub dht_status: DhtStatus,
|
||||
/// When we last published a record to any slot, if ever.
|
||||
pub last_publish: Option<Instant>,
|
||||
/// When the heal loop last ran, if ever.
|
||||
pub last_heal: Option<Instant>,
|
||||
/// Number of shards (K) the rendezvous is sharding across.
|
||||
pub active_shards: usize,
|
||||
}
|
||||
|
||||
/// Health of the underlying DHT client.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum DhtStatus {
|
||||
/// Initial state before any DHT operation has succeeded.
|
||||
Bootstrapping,
|
||||
/// At least one DHT operation has succeeded recently.
|
||||
Ready,
|
||||
/// The most recent DHT publish failed.
|
||||
PublishFailing,
|
||||
}
|
||||
|
||||
impl std::fmt::Display for DhtStatus {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::Bootstrapping => write!(f, "Bootstrapping"),
|
||||
Self::Ready => write!(f, "Ready"),
|
||||
Self::PublishFailing => write!(f, "PublishFailing"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::DhtStatus;
|
||||
|
||||
#[test]
|
||||
fn dht_status_display() {
|
||||
assert_eq!(format!("{}", DhtStatus::Bootstrapping), "Bootstrapping");
|
||||
assert_eq!(format!("{}", DhtStatus::Ready), "Ready");
|
||||
assert_eq!(format!("{}", DhtStatus::PublishFailing), "PublishFailing");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user