Repository navigation
fix(node): drop the requester before the directory fallback is judged - #2535
Merged
Merged
Conversation
…#2534) The serve-miss pull leg never pulls from the node it answers. It dropped the requester after `discover` had chosen between the DHT answer and the origin-directory fallback, so a DHT answer that named only the requester (a partial holder asking for the blocks it lacks) left the leg with no provider and a `NotFound` refusal logged as `source=dht discovered=0`, without reading the directory that lists the origin. `discover` now takes the requester and drops it from both the DHT answer and the directory list before the empty check, so that answer falls back to the directory and the origin fills the serve. The buffered `Origin::fetch` fill passes no requester. The supplement round inside `probe_and_rank` keeps its post-round drop. ADR 022 § FIND_VALUE Flow states the rule; `holder_pull_case` gains a DHT-names-the-requester shape and a test that pulls through it. Closes #2534 Co-Authored-By: Claude Fable 5.1 <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
The focused filtering-order fix updates callers consistently and includes targeted regression coverage, with no unresolved findings.
No open issues 🎉
What changed in this PR
Fixes #2534 by excluding the requester before deciding whether node-origin discovery needs the directory fallback.
Changes:
- Filters the requester from discovery candidates while preserving buffered-fetch behavior.
- Adds a regression test for a DHT answer naming only the requester.
- Documents the corrected fallback behavior.
| File | Description |
|---|---|
| crates/node/tests/node_origin_pull.rs | Adds DHT-backed regression coverage. |
| crates/node/src/node_origin/pull_leg.rs | Passes requester identity into discovery. |
| crates/node/src/node_origin/mod.rs | Filters the requester before fallback selection. |
| CHANGELOG.md | Records the serve-miss fix. |
| adr/022-content-discovery.md | Clarifies requester filtering in discovery. |
Review effort: Balanced
Code coverage overviewLanguages: Rust Rust / code-coverage/cargo-llvm-cov
View coverage of the 6 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The serve-miss pull leg never pulls from the node it answers. It dropped the requester after
discoverhad chosen between the DHT answer and the origin-directory fallback. So when the requester was the hash's only DHT provider (a partial holder asking a bonded non-holder for the blocks it lacks), the leg ended with no provider and refusedNotFound, logged since #2533 aspath=pull_leg_miss source=dht discovered=0, without reading the directory that lists the origin.discovernow takesrequester: Option<DhtNodeId>and drops it from both the DHT answer and the directory list before the empty check, so that answer falls back to the directory and the origin fills the serve. The bufferedOrigin::fetchfill passesNone.Closes #2534
Reviewer notes
discover/directory_originsincrates/node/src/node_origin/mod.rsfirst, then the call inopen_pull_leg.probe_and_rank(ranked.retain(...)) stays: the origin-directory supplement inside the probe round reads the directory without a requester and can list it.PullLegTrail.discoveredalready documented itself as "after the requester drop"; the trail's meaning is unchanged, onlysourcenow reflects the list the walk actually probes.holder_pull_casegains aHolderDiscovery::DhtNamesFirstshape (a realDhtHandlerrecord naming the leaf alone, directory listing the origin).a_dht_answer_naming_only_the_requester_falls_back_to_the_directoryrefused withdelivery refused: Some(NotFound)before the fix and completes after it. The leaf is put instakerson purpose; otherwise the active-staker filter empties the DHT answer and the test passes through the fallback without exercising the bug.Verification
cargo fmt -- --checkCARGO_BUILD_WARNINGS=deny cargo clippy --workspace --all-targets --all-featurescargo nextest run -p decdn-node --test node_origin_pull(106 passed) andcargo nextest run -p decdn-node --lib node_origin wire(127 passed)CARGO_BUILD_WARNINGS=deny cargo doc -p decdn-node --no-deps --document-private-itemsmake -C adr check-refscontracts/changed: n/aCHANGELOG.mdentry addedpr-titlecheck allows, lowercase subject🤖 Generated with Claude Code