Skip to content

docs(dig-node): correct inbound-demand proximity + gap_fill anchor contract wording - #171

Merged
MichaelTaylor3d merged 2 commits into
mainfrom
harden/2050-inbound-demand-doc-accuracy
Aug 3, 2026
Merged

docs(dig-node): correct inbound-demand proximity + gap_fill anchor contract wording#171
MichaelTaylor3d merged 2 commits into
mainfrom
harden/2050-inbound-demand-doc-accuracy

Conversation

@MichaelTaylor3d

Copy link
Copy Markdown
Contributor

Closes dig_ecosystem#2050 (items 1 + 2). Doc/contract-accuracy follow-up from #2014 — flagged by that PR's adversarial gate + loop-security. No behaviour change.

Why

The inbound-demand proximity docs claimed a stronger security property than the code enforces: that grinding a store key toward this node's peer_id (to steer caching) costs real on-chain mints. An overstated invariant in a normative SPEC is a latent hazard — future work must not rely on it.

What the code actually enforces (traced): note_inbound_demandinbound_demand_pull_admitted (XOR-proximity gate vs node_peer_id) → spawn_capsule_backfillgap_fill_generation(store, peer-supplied root)cache_fetch_and_cachesync_module_from (lands at the served root; does NOT resolve a chain-anchored root itself). The anchor binds downstream: merkle verification against root + the serve-time read-path pin (§14.4) — content is never served as current unless its root equals the chain-anchored tip. The proximity gate imposes no per-key mint cost; a near key naming no real store simply finds no DHT providers and fails cheaply.

What changed (docs/prose only)

  • Item 1 — remove the "costs on-chain mints" overstatement at all three code sites + the SPEC:
    • crates/dig-node-core/src/relevance.rs (INBOUND_DEMAND_MIN_PROXIMITY doc) — now states what the gate binds (confines where a peer can steer caching, near the unmovable peer_id) and what it does NOT (impose a naming/mint cost on triggering the cheap DHT lookup).
    • crates/dig-node-core/src/lib.rs (inbound_demand_pull_admitted doc) — dropped the mint-cost clause.
    • SPEC.md §7.10d — same correction in normative prose.
  • Item 2 — reconcile the gap_fill_generation doc-contract (crates/dig-node-core/src/seams/capsule/capsule_store.rs): it asserted its root is "never a caller-chosen root", but inbound-demand legitimately passes a peer-supplied root. Documented the sanctioned exception (inbound-demand passes a peer-supplied root on purpose; must NOT be re-routed through the anchored-root resolver — that would defeat demand-caching's purpose) with the safety rationale (merkle + serve-time pin bind the anchor → worst case is caching REAL near-neighbourhood content of a possibly-old generation, per #1623, never junk/out-of-neighbourhood/fabricated). Softened the contract's opening "verify against the chain-anchored root" → "merkle-verify against root".

Item 3 deferred (proximity tightening toward k-closest for the DIG_NODE_INBOUND_DEMAND_CACHE default-ON flip) — needs a live network-size signal + a fresh security review; stays open on #2050.

How verified

  • cargo build -p dig-node-core clean; cargo test -p dig-node-core --lib653 passed, 0 failed (doctests unaffected); cargo fmt --all clean.
  • git diff --stat = exactly the intended files; no stray edits. Confirmed the specific overstatement did not propagate elsewhere (the other "grind" mentions in the SPEC are distinct, accurate claims about the 256-bit-preimage XOR signal, not the mint-cost claim).

Version

root [workspace.package].version 0.93.2 → 0.93.3 (patch, docs); Cargo.lock regenerated.


Generated by Claude Code

claude added 2 commits August 3, 2026 14:27
Co-Authored-By: Claude <noreply@anthropic.com>
…ntract wording (#2050)

Make the normative SPEC + doc-comments state ONLY the security properties
the code actually enforces. No behaviour change (docs-only).

Item 1: soften the INBOUND_DEMAND_MIN_PROXIMITY / SPEC §7.10d claim that
naming a near key costs an on-chain mint. The gate binds WHERE a peer can
steer caching (near this node's peer_id, unmovable) — not the cost of
triggering network work: a near key naming no real store just finds no DHT
providers and fails cheaply. The mint + merkle cost binds a later step —
becoming a cached HOLDER (serve-time root-pin + merkle bind the anchor).

Item 2: reconcile the gap_fill_generation contract with its inbound-demand
caller. Document the sanctioned caller-chosen-root exception: inbound-demand
passes a peer-supplied root on purpose (demand-caching warms the requested
capsule); it is safe because merkle + the serve-time pin bind the anchor
regardless of who chose the root, so the worst case is caching REAL
near-neighbourhood content of a possibly-old generation (#1623), never junk.

Version 0.93.2 -> 0.93.3 (patch, docs only).

Co-Authored-By: Claude <noreply@anthropic.com>
@MichaelTaylor3d
MichaelTaylor3d merged commit df90fd9 into main Aug 3, 2026
15 checks passed
@MichaelTaylor3d
MichaelTaylor3d deleted the harden/2050-inbound-demand-doc-accuracy branch August 3, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants