Skip to content

fix(protocol,node)!: advertise and accept the empty blob over cdn/probe/v1 - #2528

Merged
thiras merged 3 commits into
mainfrom
fix/empty-blob-probe-2471
Oct 18, 2026
Merged

thiras merged 3 commits into
mainfrom
fix/empty-blob-probe-2471

Conversation

@thiras

@thiras thiras commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Summary

The empty (0-byte) blob spans zero discovery blocks, so its coverage bitmap is empty on every holder. iroh-blobs reports the empty root complete at size 0 on every backend, so every node holds and serves it. The probe handler derived has_blob from the bitmap and signed has_blob: false for it, and the requester's consistency rule (has_blob ⟺ non-empty coverage) rejected a has_blob: true answer for it as malformed. A client saw no holder, dropped the size hint and opened a paid lane for zero bytes; a node pulling through for the empty root found no provider.

  • ProbeResponseExt::consistent_with takes the signed &ProbeResponseBody. For the empty root the bitmap must be empty and has_blob alone decides; every other hash keeps the biconditional. The rule keys on the signed hash, never on the unsigned total_bytes hint.
  • decdn_protocol::EMPTY_ROOT names the hash (blake3 is a dev-dependency only, to prove the literal). The client's two local computations of it read the constant.
  • The probe handler signs has_blob: true for the empty root when its presence check passes. The suppressing arms (chain-stale, max_probe_holds == 0, origin-only miss, refused hash) still answer false.
  • ADR 022 § Consistency rule records the exception and that the empty blob is never DHT-announced (its bitmap is empty). CHANGELOG lists the API change under Changed (BREAKING) and the fix under Fixed.
  • The decdn-protocol public-API snapshot is regenerated.

Closes #2471

Review follow-ups (second commit)

Three review agents found no critical issue. Applied: ADR paragraph order and wording, the Changed (BREAKING) entry, comment precision in the protocol docs, both consumers, the handler and publish_hash, and five tests that pin every suppressing handler arm for the empty root plus the client NonHolder case.

Filed, not fixed here: #2526 (the coverage-union probe round never spans for a zero-block target; latency only, unreachable in production) and #2527 (pre-existing: ADR 022 says a node requester scores a mismatch, the code drops it without scoring).

Test plan

  • Protocol unit tests: full truth table for the empty root and EMPTY_ROOT == blake3("")
  • Probe loopback: held empty blob advertises; chain-stale, chain-denied, holds-disabled and origin-only-miss answer false; a 0-byte fs origin object advertises through Coverage::full(0)
  • Node-origin: Origin::fetch of the empty root through a probe returns AlreadyAdmitted at cap 0 and under a cap (fails with NotFound under the old rule; mutation-checked)
  • Client: classify_probe takes the empty-root holder, takes has_blob: false as a non-holder, drops the pairing for any other hash (mutation-checked)
  • cargo nextest run --workspace (5186 passed), clippy --all-targets --all-features -D warnings, cargo doc with warnings denied, pre-commit run --all-files

🤖 Generated with Claude Code

thiras and others added 2 commits October 18, 2026 19:31
…be/v1

The empty (0-byte) blob spans zero discovery blocks, so its coverage
bitmap is empty on every holder. The probe handler derived `has_blob`
from the bitmap and signed `has_blob: false` for a blob every store
holds and serves (iroh-blobs reports the empty root complete at size 0
on any backend), and the requester's consistency rule
(`has_blob ⟺ non-empty coverage`) rejected a `has_blob: true` answer
for it as malformed. A client saw no holder, dropped the size hint and
opened a paid lane for zero bytes; a node pulling through for the empty
root found no provider.

- `ProbeResponseExt::consistent_with` takes the signed body. For the
  empty root the bitmap must be empty and `has_blob` alone decides; every
  other hash keeps the biconditional. The rule keys on the signed hash,
  never on the unsigned `total_bytes` hint.
- `decdn_protocol::EMPTY_ROOT` names the hash; the client's two local
  computations of it read the constant.
- The probe handler signs `has_blob: true` for the empty root when its
  presence check passes. The suppressing arms (chain-stale, holds
  disabled, origin-only miss) still answer `false`.
- ADR 022 § Consistency rule records the exception and that the empty
  blob is never announced to the DHT, because every node serves it.

Tests: protocol unit tests for both hashes; probe loopback for the held
empty blob and its chain-stale twin; node-origin `Origin::fetch` of the
empty root through a probe at cap 0 and under a cap; a client
`classify_probe` unit test. The public-API snapshot of decdn-protocol is
regenerated for the signature change and the new constant.

Closes #2471

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…idy the rule's docs (#2471)

Review follow-ups on the empty-blob probe change.

- ADR 022 § Consistency rule: the empty-blob exception moves to the end of
  the paragraph so "such a response" keeps its referent, and the DHT
  sentence states the real reason (an empty bitmap), not "every node
  serves it", which the chain-stale arm contradicts. The origin paragraph
  qualifies its biconditional the same way.
- CHANGELOG: the `consistent_with` signature change is listed under
  Changed (BREAKING), and the Fixed entry points there.
- Comment precision: `EMPTY_ROOT`'s doc says what `consistent_with`
  checks for it; the `coverage` field doc names both signed fields; the
  two consumer comments no longer call `has_blob` unsigned; the handler
  names the coverage-read fault arm and qualifies the chain-stale arm;
  `publish_hash` lists the empty blob among the empty-coverage cases.
- Tests pin every suppressing handler arm for the empty root: a
  chain-denied hash, `max_probe_holds == 0` (with the disabled counter
  proving the arm ran), the origin-only policy with no origin object, and
  the origin-only policy with a 0-byte origin object (the one path that
  builds `Coverage::full(0)`). The client `classify_probe` test also
  covers `has_blob: false` for the empty root as a non-holder.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 18, 2026 16:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The empty-root fallback can override a concurrent refusal and sign an advertisement for denied content.

1 open issue
What changed in this PR

Fixes empty-blob discovery over cdn/probe/v1 by making coverage validation depend on the signed hash.

Changes:

  • Adds EMPTY_ROOT and updates probe validation and consumers.
  • Advertises eligible empty-blob holders and adds regression tests.
  • Updates protocol documentation, changelog, and API snapshot.
File Description
crates/​protocol/​tests/​snapshots/​public_api__public_api.snap Records public API changes.
crates/​protocol/​src/​message/​tests.rs Tests empty-root consistency and hash literal.
crates/​protocol/​src/​message.rs Adds constant and hash-aware validation.
crates/​protocol/​src/​lib.rs Exports EMPTY_ROOT.
crates/​protocol/​Cargo.toml Adds test-only hashing dependency.
crates/​node/​tests/​probe_loopback.rs Tests advertisements and suppression cases.
crates/​node/​tests/​node_origin_pull.rs Tests probe-driven empty-blob discovery.
crates/​node/​src/​node_origin/​mod.rs Updates node probe validation.
crates/​node/​src/​handlers/​probe.rs Enables empty-root advertisements.
crates/​node/​src/​dht/​publish.rs Clarifies empty-blob publishing behavior in comments.
crates/​client/​src/​targets/​tests.rs Tests empty-root response classification.
crates/​client/​src/​targets.rs Updates client probe validation.
crates/​client/​src/​ranged_store.rs Uses the shared empty-root constant.
crates/​client/​src/​lib.rs Uses the constant for empty-claim checks.
crates/​client/​src/​discovery.rs Documents empty holder coverage.
crates/​client/​examples/​common/​mod.rs Updates example probe validation.
CHANGELOG.md Documents the fix and breaking API change.
Cargo.lock Records the test dependency.
adr/​022-content-discovery.md Specifies the empty-root exception.

Review effort: Balanced

Comment thread crates/node/src/handlers/probe.rs Resolved
The empty-root term reads the presence verdict settled before the
`inspect_size` and coverage awaits. A denial or eviction that lands in
that window empties the coverage for every other blob through
`coverage_sized`'s own refusal gate, but the empty root's coverage is
empty anyway, so the stale verdict would sign `has_blob: true` for a
hash the node refuses to serve. Signing that for a blacklisted hash is a
blacklist-violation offense (ADR 014). The term now re-checks
`cache.refuses(hash)` so the later refusal wins, the same narrowing the
stake-lane branch applies.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@github-code-quality

github-code-quality Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Code coverage overview

Languages: Rust

Rust / code-coverage/cargo-llvm-cov

main 6a9fbf5 fix/empty-blob-probe... ed33385 +/-
76% 76% 0%
View coverage of the 10 most impacted files.
File main 6a9fbf5 fix/empty-blob-probe... ed33385 +/-
crates/node/src...s/client/mod.rs 91% 91% 0%
crates/client/s...undle/engine.rs 65% 65% 0%
crates/node/src...ndlers/probe.rs 86% 86% 0%
crates/node/src...gin/pull_leg.rs 85% 85% 0%
crates/cache/src/engine.rs 91% 91% 0%
crates/client/s...ranged_store.rs 89% 89% 0%
crates/node/src...e_origin/mod.rs 88% 88% 0%
crates/protocol/src/message.rs 100% 100% 0%
crates/node/src...nt/serve_leg.rs 90% 91% +1%
crates/client/src/targets.rs 51% 57% +6%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated October 18, 2026 17:04 UTC

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The signed-hash exception preserves refusal checks, updates both consumers, and has regression coverage with no unresolved blocking findings.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@thiras
thiras merged commit 261414e into main Oct 18, 2026
34 checks passed
@thiras
thiras deleted the fix/empty-blob-probe-2471 branch October 18, 2026 17:09
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.

probe: an empty-blob holder is dropped as a has_blob/coverage mismatch

2 participants