Repository navigation
Description
Summary
A holder can advertise an inflated total_bytes at the node-to-node handshake to make finite-ceiling relaying nodes refuse to pull/cache/serve a blob, while ungated clients (default post-#1891) still pull directly. The holder monopolizes that blob's traffic and revenue, and no replication happens. The refuse decision today trusts a peer-controlled, unverified size claim.
Where it bites
- Discovery carries no size.
FindValueResponse/StoreRequest(crates/protocol/src/dht.rs:222,:244) advertise onlyhash+ providers — nobody learns a size until a live handshake. So the attack is not a discovery-poisoning; it lives entirely at the handshake. - The size is peer-controlled at the handshake.
StreamResponseBody.total_bytesis EIP-712 signed but its value is never bounded —StreamResponse::validate()(crates/protocol/src/client.rs:431) checks rate/sig/ok, nevertotal_bytes.ProbeResponse.total_bytesis unsigned. - The refuse decision trusts the claim. On a cache-miss, relaying node B reads the upstream's claimed
total_bytesat the free header handshake (crates/node/src/node_origin/pull_leg.rs:407) and refuses withBlobTooLargeif the claim exceedsmax_blob_size_bytes— before any bytes flow. Gate sites:crates/node/src/handlers/client/window.rs:167and:499; buyer sidecrates/client-pull/src/lib.rs:1844and:2355.
Net: over-claim on a small blob → every finite-ceiling relay refuses → holder is the sole server. The holder still serves the real (smaller) blob to clients, who verify BLAKE3 normally.
The deterrent we'd hope for does not exist
total_bytes is in the signed StreamMsg struct, but the on-chain offense taxonomy is only { RateManipulation, Blacklist } (crates/incentive/src/slash_judge.rs:38). Signing an inflated total_bytes is not a slashable offense today — the lie is free.
Making it slashable would need an on-chain BLAKE3/bao length-proof verifier (no BLAKE3 precompile on Arbitrum; contracts ship only Ed25519Verifier), i.e. a new Blake3Verifier.sol + OffenseType + evidence path + ADR. A working reference implementation already exists: https://github.com/alpergundogdu/solidity-bao-length-verifier (src/BaoLengthVerifier.sol), with a Yul BLAKE3 compression, differential tests against the official BLAKE3 binding, and gas benchmarks.
Soundness note (from that repo): a byte-free proof — right-edge sibling CVs only, no final-chunk bytes — is unsound. A right-edge fold binds only siblingCount, which is non-injective in chunk count (2, 3, 5, 9… chunks all share siblingCount 1), so a malicious challenger could re-present an honest witness under a false length and slash an honest signer (counterexample: a 1500-byte file "proves" length 2049). The sound proof supplies the final chunk's actual bytes (≤1024) and recomputes its CV with counter = n-1, pinning both the chunk count and the exact byte length via block_len. So the evidence is (root, actualLength, finalChunk[≤1024], rightEdge[]).
Offense predicate: claimed > actual (over-claim only), not claimed != actual. Over-claim is the harmful direction — it's what trips relays into refusing. Under-claim (claimed < actual) is self-defeating (caught in-stream by cumulative_received > expected_wire), gives no payment edge (buyers pay for actual received bytes, never the claim), and slashing it would risk punishing honest under-estimates. The predicate is ceiling-independent: it depends only on root, signed claimed, and proven actual. [your call] on a materiality margin (claimed > actual + δ) vs strict > — lean strict, since a content-addressed blob's exact size is knowable to its holder, so any over-claim is deliberate.
Our content address is the plain native BLAKE3 root (bao-tree's chunk_group_log changes only outboard granularity, never the root), so the base verifier applies directly — no 16 KiB-group generalization needed. Cost is not the blocker: measured ~1.02M gas for 1 MiB, ~1.43M for a synthetic 1 GiB-depth proof (~39k gas per BLAKE3 block compression), which on Arbitrum L2 is a fraction of a cent of compute plus ~1.5KB calldata (dominated by the ≤1024-byte final chunk) — low single digits worst case, against a refundable challenge bond.
The tail-based proof is fine here even though it was rejected for the handshake: the handshake objections (free tail leakage, tail-first access) are about the unpaid, per-request, front-to-back hot serve path. A slash challenge is rare, adversarial, and one-time — a challenger deliberately reveals one blob's tail as public on-chain evidence, off the serve path. So the objections don't apply.
Still, this is deferred and not needed to close this issue: once the refuse decision runs on received bytes (below), the lie is inert — it causes no refusal, so there's nothing left to deter for this attack. Slashing would be pure defense-in-depth. Filed as cheap-and-viable-on-L2, not heavy.
Decision: enforce the ceiling on received bytes, not on the claim
The attack only pays because relays refuse based on the claim. Stop trusting the claim for the refuse decision:
- Remove the up-front claim gate on the miss-pull leg (the
total_bytes > max_blob_size_bytescomparisons at thewindow.rsandclient-pullsites above). - Add a claim-independent cap in the receive loop:
cumulative_received > max_blob_size_bytes → abort. The ceiling is now enforced against real, BLAKE3-verified bytes. - Lies cost ~nothing: a false size can't produce bytes that verify against the true root, so a small-blob/huge-claim liar is exposed as its real stream completes under the ceiling — B caches and serves the real blob. Centralization defeated.
- Residual cost is honest giants (blob genuinely larger than the ceiling): B streams and pays up to one ceiling's worth before aborting. Bound it with a negative cache ("this hash exceeds my local ceiling") so the discovery cost is paid at most once per oversized hash, not per request.
- Payment hygiene on abort: release reserved-but-unspent floor (
release_unspent, Anvil e2e for the node-to-node reactive mid-pull top-up #1598) so B is charged only for bytes actually received. ProbeResponse.total_bytesstays a pure advisory cost-hint — nothing refuses on it, so a lie there is harmless.
No wire changes, no on-chain surface, no tail/random access — node-local logic on the miss-pull leg.
Rejected alternative: verified size at handshake
Verifying a bao length-proof at the handshake was considered and rejected: proving length needs the rightmost chunk's content, which (a) leaks paid content on the unpaid probe/handshake channel (tails across ~1024 blobs = a free MB), breaking the paid-bytes invariant, and (b) forces tail-first random access, inverting front-to-back content-addressed streaming.
Scope
- v1: remove claim gate + received-byte cap + abort payment hygiene.
- Fast-follow (or v1, TBD): negative cache for over-ceiling hashes.
- Changes the documented meaning of
max_blob_size_mbfrom "claim gate" to "received-byte cap" — ADR 005 (BlobTooLargeenforcement) update, in-scope vs follow-up TBD. - Deferred (defense-in-depth only, not required by this fix): making an inflated signed
total_bytesslashable via an on-chain BLAKE3 exact-length proof (final chunk bytes + right-edge CVs; ~1–1.5M gas; cheap on L2). Reference implementation: https://github.com/alpergundogdu/solidity-bao-length-verifier
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Projects
- StatusShow more project fieldsDone
Activity
fix(node,client-pull): enforce max_blob_size on received bytes, not t…
fix(node): drop the redundant serve-side blob-size ceiling (#1959)
fix(client-pull): one receive loop — verify every chunk group as it l…
fix(node): peer spine never refuses a range on a peer-claimed total; …
feat(node): stream bounded and resumed cache-miss requests through th…
fix(client,node): drop the claim-bounded end gate, order pull-through…
fix(client,node,cli): bar refused pull-through, refuse over-ceiling r…
fix(node,client)!: max_blob_size caps bytes held per blob, not offset…