-
-
Notifications
You must be signed in to change notification settings - Fork 132
Open
Labels
A-developer-xpArea: developer experienceArea: developer experienceA-networkingArea: Networking, ring protocol, peer discoveryArea: Networking, ring protocol, peer discoveryE-easyExperience needed to fix/implement: Easy / not muchExperience needed to fix/implement: Easy / not muchP-mediumMedium priorityMedium priorityT-bugType: Something is brokenType: Something is broken
Description
Problem
relay_does_not_accept_when_not_at_terminus (crates/core/src/operations/connect.rs:3084) uses Location::random() for the desired_location. Since Location::random() uses GlobalRng, which is process-global shared state:
- When run concurrently with other tests, the RNG state differs, producing different locations
- The random location may make
self_locthe closest peer todesired_location, turning the relay into a terminus — the test then fails because it expects forwarding, not acceptance
Root Cause
Location::random() at line 3091 is non-deterministic when tests run in parallel.
Fix
Replace Location::random() with a fixed location that guarantees next_hop is closer to the target than self_loc. For example:
desired_location: next_hop.location().unwrap(),This ensures the relay always has a closer peer and is never at terminus.
Reproduction
Run the full test suite; it fails intermittently:
cargo test -p freenet --lib # fails ~5% of the time
cargo test -p freenet --lib relay_does_not_accept_when_not_at_terminus # always passes alone[AI-assisted - Claude]
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-developer-xpArea: developer experienceArea: developer experienceA-networkingArea: Networking, ring protocol, peer discoveryArea: Networking, ring protocol, peer discoveryE-easyExperience needed to fix/implement: Easy / not muchExperience needed to fix/implement: Easy / not muchP-mediumMedium priorityMedium priorityT-bugType: Something is brokenType: Something is broken