fix(hs): probe onion reachability instead of waiting on Bootstrapping
All checks were successful
ci / test (push) Successful in 2m59s
All checks were successful
ci / test (push) Successful in 2m59s
Arti combined status stays Bootstrapping through a 5 min HsDir upload round. Treat a successful connect as published, floor cbtinitialtimeout with cbtmintimeout at 20s, and skip preemptive 80/443 circuits so IPT and HsDir builds are not starved. PUBLISH_WAIT stays 360s fail-closed.
This commit is contained in:
parent
e63203ff56
commit
e902a9041d
5 changed files with 130 additions and 24 deletions
47
tests/hs.rs
47
tests/hs.rs
|
|
@ -3,6 +3,7 @@
|
|||
use std::time::Duration;
|
||||
|
||||
use onionwire::hs;
|
||||
use tor_hsservice::status::State;
|
||||
|
||||
#[test]
|
||||
fn publish_wait_covers_hsdir_retries() {
|
||||
|
|
@ -20,3 +21,49 @@ fn cbt_min_timeout_floor_is_at_least_10s() {
|
|||
let floor_ms = hs::CBT_MIN_TIMEOUT_MS;
|
||||
assert!(floor_ms >= 10_000, "learned CBT ~1s kills HsDir circuits");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cbt_initial_timeout_matches_the_floor() {
|
||||
// Consensus cbtinitialtimeout can be ~2s; 4-hop vanguard HS circuits
|
||||
// need the same floor as cbtmintimeout before the estimator has samples.
|
||||
let initial = hs::CBT_INITIAL_TIMEOUT_MS;
|
||||
let floor = hs::CBT_MIN_TIMEOUT_MS;
|
||||
assert!(initial >= floor, "initial CBT below min floor");
|
||||
assert!(initial >= 10_000, "initial CBT too low for HsDir circuits");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_preemptive_exit_ports() {
|
||||
// Default predicted 80/443 circuits compete with IPT + HsDir builds.
|
||||
// OnionWire never exits; keep the predicted list empty.
|
||||
assert!(
|
||||
hs::PREEMPTIVE_PREDICTED_PORTS.is_empty(),
|
||||
"preemptive exit circuits starve HS publish"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn arti_status_running_is_ready_without_probe() {
|
||||
assert!(hs::hs_is_ready(State::Running, false));
|
||||
assert!(hs::hs_is_ready(State::DegradedReachable, false));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bootstrapping_is_not_ready_until_a_probe_connects() {
|
||||
// Combined status stays Bootstrapping through Arti's 5 min HsDir upload
|
||||
// round even after some descriptors are already fetchable.
|
||||
assert!(!hs::hs_is_ready(State::Bootstrapping, false));
|
||||
assert!(hs::hs_is_ready(State::Bootstrapping, true));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn degraded_unreachable_is_ready_only_if_probe_connects() {
|
||||
assert!(!hs::hs_is_ready(State::DegradedUnreachable, false));
|
||||
assert!(hs::hs_is_ready(State::DegradedUnreachable, true));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn broken_or_shutdown_never_ready() {
|
||||
assert!(!hs::hs_is_ready(State::Broken, true));
|
||||
assert!(!hs::hs_is_ready(State::Shutdown, true));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,10 +124,10 @@ async fn two_node_byte_pipe_restart_and_dormant() {
|
|||
eprintln!("bob onion={bob_onion}");
|
||||
assert_ne!(alice_onion, bob_onion, "separate HS identities");
|
||||
|
||||
hs::wait_until_published(&alice_svc, "alice")
|
||||
hs::wait_until_published(&alice, &alice_svc, &alice_onion, "alice")
|
||||
.await
|
||||
.expect("alice publish");
|
||||
hs::wait_until_published(&bob_svc, "bob")
|
||||
hs::wait_until_published(&bob, &bob_svc, &bob_onion, "bob")
|
||||
.await
|
||||
.expect("bob publish");
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue