Repository navigation
docs(node): describe both OriginDirectory impls in dht/origin.rs - #1290
Conversation
The module doc claimed ChainOriginDirectory was still a follow-up and that the module shipped only the trait plus a ConfigOriginDirectory reading operator-supplied TOML. Both statements rotted when dht/chain_origin_directory.rs landed: ChainOriginDirectory is a full impl, exported from dht/mod.rs, and selected by the runtime whenever blockchain.origin_assignment_address and blockchain.publisher_registry_address are both configured. Rewrite the module doc and the ConfigOriginDirectory doc comment to describe the trait plus its two implementations and the runtime's selection rule. Also drop the three references to a `dht.static_origins` config field, which does not exist in the schema — the runtime always builds the fallback with an empty map. Docs only; no behavior, signature, or item changes. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Warning Review limit reached
Next review available in: 32 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (2)
WalkthroughUpdated ChangesOrigin directory documentation
Estimated code review effort: 1 (Trivial) | ~2 minutes Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
There was a problem hiding this comment.
Code Review
This pull request updates the documentation in crates/node/src/dht/origin.rs to clarify the roles of the two OriginDirectory implementations: the production ChainOriginDirectory and the fallback ConfigOriginDirectory. It explains how the runtime selects between them and notes that the fallback directory is initialized empty in production. There are no review comments, and I have no additional feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Coverage reportTotal: 81.47% (was 81.47%, ● 0.00%) — 48845/59953 lines
History
|
…tic_origins ref Review of the previous commit turned up three doc claims that do not match the code, all inside this branch's own stated goal of removing origin-directory comment rot. The module-doc bullet claimed ChainOriginDirectory "reads the resolution chain above from RPC". That chain is quoted verbatim from ADR 022 §Bootstrap and is correct as spec, but the implementation does not perform it: there is no namespaceOf call in dht/chain_origin_directory.rs (the hash → namespace view is replayed from ContentClaimed logs), and the active filter comes from the shared StakerSet at lookup time rather than the nodeIdOf tuple. State that the impl yields the same candidate set by a different route, and name both divergences. The module-doc preamble still described an implementation reading from "an operator-supplied file (initial-network bootstrap)", contradicting the new text seven lines below it. It sits above the previously rewritten hunk, which is why it survived. node_origin.rs carried a fourth reference to the nonexistent dht.static_origins field. DhtConfig is #[serde(deny_unknown_fields)], so that key would be rejected at parse time, not ignored. The comment's point — the unfiltered fallback re-serves a non-staker on the cold path — still holds for test-built directories, so it now says that instead. Docs only; no behavior, signature, or item changes. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
crates/node/src/dht/origin.rsstill claimed that the chain-backedChainOriginDirectory"lands with the on-chain origin-directory follow-up" and that the module "ships only the trait + aConfigOriginDirectory". That rotted whencrates/node/src/dht/chain_origin_directory.rslanded —ChainOriginDirectoryis a fullimpl OriginDirectory, exported fromdht/mod.rs, and it is the implementation the runtime selects. The stale comment already caused real harm: PR #1285 scoped an e2e test away from origin recognition on its strength.Changes (docs only)
c412304— initial rewrite (dht/origin.rs)ChainOriginDirectorywhen bothblockchain.origin_assignment_addressandblockchain.publisher_registry_addressare configured,ConfigOriginDirectoryotherwise.ConfigOriginDirectorydoc: reframed from "testnet bring-up before the contracts ship" to what it actually is — the in-memory fallback plus the test constructor.68b3457— post-review corrections (dht/origin.rs,node_origin.rs)Since the deliverable here is prose about code, the new text was itself verified claim-by-claim against the implementation. Most of it held up: the selection rule matches
runtime/mod.rs:699-734exactly, the fallback really is built empty,ConfigOriginDirectory::newreally is the test-fixture constructor, and the intra-doc link resolves viadht/mod.rs:31. Three claims did not hold, all inside this branch own goal of removing origin-directory rot:ChainOriginDirectory"reads the resolution chain above from RPC". That chain is quoted verbatim from ADR 022 §Bootstrap and is correct as spec, but the implementation does not perform it: there is nonamespaceOfcall anywhere inchain_origin_directory.rs(thehash → namespaceview is replayed fromContentClaimedlogs, which leaves a documented coverage hole below the resumed cursor), and theactive == truefilter is applied from the sharedStakerSetat lookup time rather than taken from thenodeIdOftuple. The bullet now states it yields the same candidate set by a different route, and names both divergences.dht.static_originsreference survived innode_origin.rs:1210, outside the edited file.DhtConfigcarries#[serde(deny_unknown_fields)], so that key would be actively rejected at parse time, not silently ignored. The underlying point — the unfiltered fallback re-serves a non-staker on the cold path — still holds for test-built directories, so the comment now says that instead of naming a config field that cannot exist.Discrepancy found and documented, not fixed
The issue framing (and the old doc) said
ConfigOriginDirectory"reads from operator-supplied TOML" via adht.static_originsconfig field. That field does not exist in the config schema —DhtConfig(crates/common/src/config/types.rs:860-865) carries exactly one field,rate_limit. The runtime atcrates/node/src/runtime/mod.rs:729always constructs the fallback withHashMap::new(), so on a node without the chain directory every origin-fallback lookup returns nothing.Per the issue scope I documented the actual behavior and left the runtime alone; all four
dht.static_originsreferences are now gone. If a config-fed static origin map is wanted, that is a separate feature issue.No behavior, signature, or item changes.
Verification
Docs-only, so no behavior to test; ran the exact CI commands instead, all clean:
cargo fmt -- --check— passcargo clippy --workspace --all-targets -- -D warnings—Finished, no warningscargo doc -p decdn-node --no-deps—Generated, no broken intra-doc links (the[crate::dht::ChainOriginDirectory]links resolve)Note: the local
cargo denypre-commit hook fails in this worktree with 7bug[unresolved-workspace-dependency]errors. Reproduced on cleanHEADwith the changes stashed, so it is pre-existing and environment-local — a comment-only edit cannot change dependency resolution. Thecargo denyCI job passes on this branch.Closes #1289
🤖 Generated with Claude Code