Repository navigation
refactor(slashing): retire the phantom-announcement offense - #1512
Conversation
On-chain slashing only binds a forkable node when every signature in the
evidence sits on a benefit-taking action (get paid / get selected). Phantom
announcement failed that test: its second half was a signed StreamResponse
{ok:false}, coerced by nothing — a malicious fork just drops the stream — so
the offense only ever slashed honest operators running the reference binary.
"Advertised but didn't serve" is an availability failure and now lives solely
in local reputation (ADR 008).
Contracts:
- OffenseType renumbered to { RateManipulation, Blacklist } (pre-launch, no
reserved slot).
- Remove submitPhantomChallenge, NotPhantom, and the phantom arm of
_verifyPair. _verifyPair, SLASH_WINDOW_US, ProbeMsg/StreamMsg, and the
signature machinery stay — shared with rate manipulation.
- Add the `s.ok == true` guard to rate manipulation: you cannot overcharge on
a delivery you declined, so a signed refusal is never rate evidence. This is
what makes signing ok:false provably safe. New test locks it.
- Retarget the commit-reveal/pause vehicle tests to submitRateChallenge; regen
gas snapshot.
Rust:
- Drop the submitPhantomChallenge binding and the Phantom OffenseType variant;
move the discriminant docs/constants in lockstep (0=Rate, 1=Blacklist).
- Reword the now-void phantom-slash rationale across the probe/hold/serve
paths; the 35s probe hold is reframed as an availability feature.
- Rewire the e2e lib (chain.rs) slash inducers to rate manipulation.
Behavior unchanged in this commit beyond the offense removal; the probe-hold
reshape and the e2e G-GOV-03 redesign follow. anvil-e2e gate is red until the
G-GOV-03 rewrite lands next.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Rewrite the ADRs and runbook to reflect two slashing offenses (rate manipulation, blacklist violation) instead of three. "Advertised but didn't serve" is documented as a local-reputation matter (ADR 008), not slashable, and rate manipulation is stated to require a delivery (ok:true). The probe slash_sig and the 35s probe hold are retained — the hold reframed as an availability guarantee. No phantom heading was a cross-reference target, so no anchors break; adr/_history/ is left as a frozen archive. Touches ADRs 003, 005, 011, 014, 016, 024, 026, 028, 037, README, architecture, the fraud-detection / observability / operator-key-rotation / operator-upgrade-path appendices, docs/runbook.md, and CHANGELOG.md. Co-Authored-By: Claude Opus 4.8 <[email protected]>
The phantom offense is gone, so node A's phantom arc is deleted. Node B's old
capture relied on a signed *refusal* (ok:false) at a raised rate, which the new
`s.ok == true` rate guard correctly rejects — so the journey now captures a real
*delivery* (ok:true) at the raised rate instead.
- Add ClientFixture::capture_delivery_response: reads the daemon's signed
open-stage StreamResponse{ok:true} for a held blob at a caller-chosen
timestamp (no payment needed — the open response is signed before any
voucher), giving the delivery half of a real rate-manipulation pair inside
the 30s window.
- G-GOV-03 becomes a single-node rate-manipulation journey: probe at the
configured rate, hot-reload a higher rate, capture the raised-rate delivery,
then exercise the same real-evidence negatives (out-of-window, forged probe
sig, forged stream sig, replay), the positive slash, escrow, and the 50/50
finality split.
Compiles under `--features anvil-e2e` and is clippy-clean; the anvil journey
itself runs in CI.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (29)
🚧 Files skipped from review as they are similar to previous changes (17)
WalkthroughThe change removes phantom-announcement slashing from ChangesTwo-offense SlashJudge model
Estimated code review effort: 4 (Complex) | ~50 minutes Sequence Diagram(s)sequenceDiagram
participant E2ETest
participant ClientFixture
participant Daemon
participant SlashJudge
E2ETest->>ClientFixture: capture_delivery_response
ClientFixture->>Daemon: send StreamRequest
Daemon-->>ClientFixture: StreamResponse(ok=true, higher rate)
E2ETest->>SlashJudge: submitRateChallenge(probe, stream, signatures)
SlashJudge->>SlashJudge: verify signatures, timing, delivery, and rate
SlashJudge-->>E2ETest: Slashed or validation error
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 |
The first ADR pass reframed some deleted phantom sections into prose that explains what is *not* an offense — a ghost of the removed mechanism that reads as confusing dead weight to anyone who never knew phantom existed. Delete it and state only what the protocol does: - adr/003-payments.md: drop the "Advertised-then-unavailable blob" threat subsection (already covered by "Content withholding") and the eviction-hold note's "availability/reputation failure" tail. - adr/005-protocol.md: drop the "…is a local-reputation failure" and "…not falsely slashed" asides from the eviction-hold / hold-budget specs. Also retire `decdn_slash_evidence_exposure_total` / `DecdnSlashEvidenceExposure` entirely: it was a phantom self-detection signal, never emitted by any Rust code, and a `has_blob:true` → `ok:false` sequence is now completely benign. Removed from appendix-observability, the runbook, the Prometheus alert (which still carried a `slash_risk: phantom_announcement` label), and the Grafana panel. Co-Authored-By: Claude Opus 4.8 <[email protected]>
main advanced with #1508 (origin-aware discovery), #1504 (event-log replay elimination), and #1509. One real conflict + one semantic reconciliation: - crates/node/src/slash_watcher.rs: #1504 replaced the SlashJudge.Slashed event with CapacityBond.SlashRecorded (no offenseType field), so the Phase A test fixture edit is obsolete — took main's structure. - crates/node/src/handlers/client/wire.rs: #1508 added a drop-instead-of-sign block for origin-held CacheMiss whose ENTIRE rationale was avoiding phantom-announcement evidence. With phantom retired and ok:false inert, that defense is unnecessary — removed it so origin-held CacheMiss signs like every other refusal. Blacklisted hashes still route to ChainHashDenied via the refuses() guard. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Contracts coverageLine coverage: 89.90% (2510/2792 lines) |
Gas snapshotNo gas changes vs base. |
Coverage reportTotal: 80.15% (was 80.21%, ▼ 0.06%) — 54175/67591 lines
History
|
With phantom retired, the probe-triggered eviction hold is no longer a
slash-safety obligation — it is a self-interested availability optimization
(keep a just-advertised blob resident for the imminent, paid pull). So the
`has_blob` answer decouples from whether a hold slot is available:
- Budget-exhausted / stake-lane-shed probes now still answer `has_blob: true`
(the blob is present) and simply place no hold. A probe flood that fills the
best-effort hold cache can no longer suppress an honest answer — a blob
evicted before the pull is a reputation miss (ADR 008), never a slash.
- `max_probe_holds == 0` (HoldsDisabled) is kept as the operator's explicit
opt-out from probe-advertised serving — it still answers `has_blob: false`.
This is the one knob whose meaning would otherwise vanish.
The hold-not-placed metrics (`probe_hold_unavailable{reason=...}`) still fire;
they now measure forgone holds, not suppressed answers. Docs updated across
probe_hold.rs, metrics.rs, config/types.rs, and ADR 005 §Probe-triggered
eviction hold / §Hold budget. Two probe_loopback tests updated to assert the
new advertise-anyway behavior.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Review follow-up to the phantom-offense retirement. The behaviour change that
rode along with it — probe holds became best-effort, so `BudgetExhausted` and
the stake-lane shed now advertise `has_blob: true` — was correct, but its
justification was wrong and its blast radius under-swept.
The rationale. Five sites justified advertising-without-holding as "a
reputation miss (ADR 008), not a slash". Traced: an evicted-before-pull blob
yields `NotFound` -> `RefusalVerdict::Transient` -> a 30s (peer, hash)
suppression with no `record_outcome`, and `node_origin.rs` says so in as many
words ("without tarring reputation"). Rather than override that deliberate
choice, the claim is struck; every site now states the real cost — one wasted
round trip — and `probe.rs` carries a note so it does not creep back.
Operator-facing docs. `appendix-observability.md` and its four copies (both
Prometheus annotations, the runbook alert list and step 4) still told an
on-call engineer the node answers `has_blob: false` under `exhausted`, and that
"evicted after signing has_blob: true" is unreachable by construction. Both are
now false; the second is the point of the change.
`max_probe_holds = 0`. Six sites newly claimed "every probe answers
has_blob: false". `fold_origin_held` runs after the `HoldsDisabled` arm, so
origin-servable content is still advertised — correctly, since it takes no
hold. Scoped the claim to store-backed content rather than change the code.
Also:
- probe.rs: the stake-lane arm swallowed a cache `Err` in a catch-all with no
log, while the sibling arm 50 lines below warns on the same condition. Adds
the `Err` arm; folds three `inspect().ok()` swallows into one logging helper.
- ProbeHoldOutcome: `advertises()` / `hold_placed()` put the has_blob mapping
back in the type — it had leaked into the caller and the type's own summary
docs still asserted the retired "only Held" invariant.
- ISlashJudge: the reorder warning named `SlashAppeal`, which is offense-
agnostic. Replaced with the four sites where the ordinal is actually durable
(SlashRecord storage, both Slashed events, the evidenceHash preimage keying
usedEvidenceHash and commitments), and pinned the ordinals in
InterfaceFreeze.t.sol — selectors are invariant under a reorder.
- ADR 003 §Admission and Priority claimed probe time is the congestion lever
and that `ok: false` is slash evidence. Both untrue now; congestion moves to
stream time, which is safe precisely because a refusal is inert.
- ADR 014: `##### Rate manipulation` is a heading again, so the only pair
offense has a citable anchor; both interface descriptions gained the
load-bearing `ok == true` predicate.
- Fixtures asserting `offense_type: 2`, a value that no longer names an offense.
Tests. Three probe-hold tests asserted only a counter, so #757 had no
behavioural coverage: a mutation making end-client probes consume reserved
slots left 17/17 green. They now assert `probe_hold_slots_used()` directly and
the mutation fails. Two new tests, each verified to fail against the pre-change
code: a `client_loopback` case pinning that an origin-held serve miss signs a
refusal instead of dropping the stream, and a G-GOV-03 negative feeding a real
daemon-signed `ok: false` to `submitRateChallenge` — isolating the new guard,
and retiring the orphaned `ClientFixture::refused_stream` in the process.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…content (#1130) The #1130 `origin_held` index is built from `enumerate()` ∪ pins, and neither http nor s3 enumerates — so for remote origins the index holds *pinned* hashes only. A non-pinned object sitting in the configured bucket therefore probes `false` everywhere and `decdn fetch` auto-discovery fails outright, even though the node could serve it reactively. Close that gap with a per-probe fallback: when the store and the zero-I/O `origin_held` index both miss, consult the origin directly with a live `HEAD`/`HeadObject` (`Origin::size`, no body fetched) and advertise `has_blob: true` + `total_bytes`. Answers — positive `Present(size)` AND negative `Absent` — are memoised under one TTL, so a random-hash probe flood costs at most one origin round-trip per hash per window rather than one per probe. A slow origin is bounded by a per-probe timeout; on overrun the probe answers `has_blob: false`, which post-#1512 is never slashable (an unservable advertisement, or a later `NotFound` on the serve, costs only local reputation). - `crates/cache/src/origin_probe.rs`: bounded, lazily-expiring TTL memo with an injected clock (deterministic unit tests, no new dep, no background sweeper). - `CacheEngine::origin_probe_size`: refused-guard -> memo -> timeout-bounded live `size()` -> memoise; `set_origin_probe_config` installs the knobs once at bring-up (restart-required, like `max_probe_holds`). - probe seam: consulted only when `has_blob` is still false after the index fold. - config: `cache.origin_probe_ttl_sec` (15), `origin_probe_timeout_ms` (2000), `origin_probe_memo_capacity` (4096) across raw + resolved layers, with the reload restart-required classification. Serve-side stream-while-store (the whole-blob TTFB win via a publisher `.obao4`) is the larger follow-up; this PR is discovery only. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…content (#1130) (#1523) * refactor: remove the residual authorized-origin content-authorization gate The `pull_through_require_authorized_origin` gate refused to initiate a backend pull/warm for a request whose `namespaceId` had no on-chain authorized origin. But ADR 002 is explicit that the request namespace is a **routing hint, not a trust anchor** — so using it as a serve-authorization decision was residual: a husk left after the per-hash on-chain claim layer was removed. ADR 037 already documented that the gate was namespace-scoped, not operator-scoped (#1368), and authorized nothing per-content (it admitted a serve for any hash in any namespace that had *any* registered origin, even one assigned to a different operator). Remove the gate and everything specific to it: `pull_origin_gate` / `pull_origin_gate_blocks`, `OriginDirectory::has_origin` (its only consumer), `ServeRejectReason::UnauthorizedOrigin` and its wire mapping + metric, the `cache.pull_through_require_authorized_origin` config across all three layers, the `launch_authorized_origin` e2e fixture, and the three `g_node_08_*` tests that existed only to exercise the gate. KEEP the origin directory and `lookup_origins`: that is the legitimate node→node *routing* mechanism (find which upstream origins to pull from for a namespace), which ADR 002/022 sanction. Namespace stays routing-only. Safe by construction: the gate was opt-in and default-off, and the real protections are untouched — `pull_authorized` (channel ownership, the actual unpaid-egress guard), the seed-leech caps, `ContentBlacklist`, and BLAKE3 verification. ADRs 037/022/019/011 updated to match. Co-Authored-By: Claude Opus 4.8 <[email protected]> * feat(cache): live http/s3 probe-HEAD discovery for non-pinned origin content (#1130) The #1130 `origin_held` index is built from `enumerate()` ∪ pins, and neither http nor s3 enumerates — so for remote origins the index holds *pinned* hashes only. A non-pinned object sitting in the configured bucket therefore probes `false` everywhere and `decdn fetch` auto-discovery fails outright, even though the node could serve it reactively. Close that gap with a per-probe fallback: when the store and the zero-I/O `origin_held` index both miss, consult the origin directly with a live `HEAD`/`HeadObject` (`Origin::size`, no body fetched) and advertise `has_blob: true` + `total_bytes`. Answers — positive `Present(size)` AND negative `Absent` — are memoised under one TTL, so a random-hash probe flood costs at most one origin round-trip per hash per window rather than one per probe. A slow origin is bounded by a per-probe timeout; on overrun the probe answers `has_blob: false`, which post-#1512 is never slashable (an unservable advertisement, or a later `NotFound` on the serve, costs only local reputation). - `crates/cache/src/origin_probe.rs`: bounded, lazily-expiring TTL memo with an injected clock (deterministic unit tests, no new dep, no background sweeper). - `CacheEngine::origin_probe_size`: refused-guard -> memo -> timeout-bounded live `size()` -> memoise; `set_origin_probe_config` installs the knobs once at bring-up (restart-required, like `max_probe_holds`). - probe seam: consulted only when `has_blob` is still false after the index fold. - config: `cache.origin_probe_ttl_sec` (15), `origin_probe_timeout_ms` (2000), `origin_probe_memo_capacity` (4096) across raw + resolved layers, with the reload restart-required classification. Serve-side stream-while-store (the whole-blob TTFB win via a publisher `.obao4`) is the larger follow-up; this PR is discovery only. Co-Authored-By: Claude Opus 4.8 <[email protected]> * test(node): add origin-probe config fields to the anvil-e2e ResolvedCache literal The settlement/journeys CI jobs build `decdn-node --features anvil-e2e`, which compiles `tests/anvil_bringup_shutdown_e2e.rs` — a full `ResolvedCache` literal the default `cargo nextest` never builds. It was missing the three new `origin_probe_*` fields (E0063). No logic change. Co-Authored-By: Claude Opus 4.8 <[email protected]> --------- Co-authored-by: Claude Opus 4.8 <[email protected]>
Why
On-chain slashing only binds a forkable node when every signature in the evidence sits on a benefit-taking action (get paid / get selected). Phantom announcement fails that test: its second half is a signed
StreamResponse{ok:false}, coerced by nothing — a malicious fork just drops the stream or runs a one-line patch. So the phantom offense could never catch the adversary it targeted; it only ever slashed honest operators running the reference binary. "Advertised but didn't serve" is an availability failure and now lives solely in local reputation (ADR 008).The other two offenses are sound (their evidence is all benefit-side) and are kept: rate manipulation and blacklist violation.
Commits
refactor(slashing)— phantom removal (contracts + Rust).OffenseType → { RateManipulation, Blacklist }; removesubmitPhantomChallenge/NotPhantom/ the phantom arm of_verifyPair. Add thes.ok == trueguard to rate manipulation — you cannot overcharge on a delivery you declined, so a signed refusal is never rate evidence. This is what makes signingok:falseprovably safe. Locked by a new test. Gas snapshot regenerated.docs(adr)— ADRs + runbook rewritten to two offenses (present-tense canon).adr/_history/left frozen.test(e2e)— G-GOV-03 rewrite. Theok:trueguard means the old capture (a signed refusal at a raised rate) is now correctly rejected, so the journey captures a realok:truedelivery at the raised rate via a newClientFixture::capture_delivery_responsehelper. Validated end-to-end by theanvil e2e (journeys)CI job.docs— ghost cleanup. Removes "here's what is not an offense" prose left by the ADR pass, and retiresdecdn_slash_evidence_exposure_total/DecdnSlashEvidenceExposure— a phantom self-detection artifact never emitted by any code (removed from the observability appendix, runbook, Prometheus alert, and Grafana panel).origin/main— integrates feat: origin-aware discovery — advertise origin-held content before pull-through (#1130) #1508/refactor: eliminate on-chain event-log replay across every watcher #1504/build: tighten the release profile to fat LTO and one codegen unit #1509. Also removes feat: origin-aware discovery — advertise origin-held content before pull-through (#1130) #1508's origin-held drop-instead-of-sign block, whose only rationale was avoiding phantom evidence (now inert).feat(probe)— Phase B: decouplehas_blobfrom the hold budget. With phantom gone the eviction hold is a best-effort availability optimization, not a slash-safety obligation. Budget-exhausted / stake-lane-shed probes now still answerhas_blob: trueand simply place no hold, so a probe flood can never suppress an honest answer.max_probe_holds == 0is kept as the operator's explicit opt-out (has_blob: false).Verification
forge build --deny warnings+ 795 forge tests; gas snapshot +forge fmtclean.cargo build,clippy,fmt --checkclean; 2645 nextest tests pass.anvil e2e (journeys)andanvil e2e (settlement)and thepublic API snapshotcheck.Deferred follow-up (flagged, not blocking)
With
ok:falsenow inert, theclient-pullUpstreamRefusedrefusal-evidence retention (Kind::Open's storedStreamResponse+evidence()) is dead weight. It is harmless and documented in-code as vestigial; removing it cascades into the e2erefused_streamhelper, aclient_loopbacktest, and the publicevidence()API, so it is left as a focused standalone cleanup.🤖 Generated with Claude Code
Summary by CodeRabbit
ok: true).