Repository navigation
docs: remove the nonexistent SlashJudge counter-evidence window and two stale code comments - #1469
Conversation
Five documentation sites described a 24-hour counter-evidence window on SlashJudge — a mechanism ADR 014 says deliberately never shipped. All three offenses slash synchronously at reveal time; the operator's actual recourse is SlashAppeal.openSlashAppeal, which none of the five mentioned. Also corrects two stale code comments in selection.rs that name a type that does not exist and describe a tie-break rule the tests contradict. Closes #1466 Closes #1464 Closes #1459 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Warning Review limit reached
Next review available in: 1 minute 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 (5)
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.
Pull request overview
Removes a repeatedly documented-but-nonexistent 24-hour “counter-evidence window” for SlashJudge and aligns operator runbook + ADR documentation/comments with the actual commit–reveal slashing flow and the real post-slash recourse (SlashAppeal with a 30-day filing window).
Changes:
- Updates the operator runbook slashing section to list the real three slashable offenses and to direct operators to
SlashAppeal.openSlashAppeal(...)(no counter-evidence window). - Fixes two stale / incorrect comments in
crates/node/src/selection.rs(stakeNonevsSome(0)semantics and the reputation producer type name/return type). - Corrects ADR glossary + ADR tables/prose that previously referenced the nonexistent window or an incorrect constructor signature.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| docs/runbook.md | Removes the nonexistent 24h counter-evidence guidance; documents slash appeals and correct trigger list. |
| crates/node/src/selection.rs | Updates comments to match actual stake ordering semantics and the real reputation producer (LocalReputation). |
| adr/glossary.md | Replaces “counter-evidence windows” wording and corrects challenge-bond behavior description. |
| adr/016-contract-interactions.md | Fixes SlashJudge constructor row to match actual parameters/bounds and removes invented counterEvidenceWindow. |
| adr/003-payments.md | Removes stale “24-hour counter-window” claim and points to slash-at-reveal + appeal recourse. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Coverage reportTotal: 81.10% (was 81.10%, ● 0.00%) — 52379/64583 lines
History
|
Review of the first commit surfaced defects it introduced or left behind: - ADR 016 row 12 stated the unbonding invariant without the seconds-to- microseconds conversion, making it false at the shipped defaults, and said three constructor addresses are zero-checked when it is four. The deploy graph also lacked the SlashJudge -> ContentBlacklist edge the rewritten row asserts. - The runbook described rate manipulation as any rate disagreement; SlashJudge reverts unless the stream rate strictly exceeds the quoted rate, so only an upward reprice must wait out the window. - The blacklist trigger anchored on addedAt, contradicting the same file's ContentBlacklist section and SlashJudge, which anchor on effectiveAt. - DecdnProbeHoldViolations was described as phantom-announce evidence. Per appendix-observability that case is unreachable by construction; the counter is budget pressure and lost revenue. Filed #1471 for the alert file, which carries the same error plus an inverted 25% bound. - The appeal step prescribed a raw contract call; decdn appeal slash ships for exactly this and handles the TOKEN allowance. Named admin_v1_slashes as the slashId source, and noted max_probe_holds is restart-required. - ADR 003 implied any OOM hold violation is slashable. A bare timeout is reputation-only; the evidence requires a signed refusal. - Dropped ADR 008 from the offense-taxonomy citation (it defines no offense and routes to ADR 028), and the stale dispute-monitor root cause (that watcher is payment-channel stale-close and is deferred, #324). Filed #1470 for the unknown-stake lookup-layer decision so the selection.rs comments point at a live issue rather than one this PR closes. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Review round applied (
|
| ADR 016 row 12 — unit mismatch made the invariant false | Wrote maxEvidenceAgeUs < CapacityBond.unbondingPeriod. unbondingPeriod is seconds, evidence age is microseconds; SlashJudge.sol:625-627 enforces ageUs >= unbondingSeconds * 1_000_000 → revert. Read literally the row is violated at the shipped defaults (4.32e11 vs 1_209_600). Now states × 1e6 explicitly. |
| ADR 016 row 12 — "all three non-zero" | The constructor rejects four zero addresses; admin is also checked (SlashJudge.sol:217-222). |
| ADR 016 deploy graph | Row 12 now asserts the ContentBlacklist dependency and deploy ordering, but the mermaid graph 20 lines above showed only SJ --> CBOND and SJ --> TOKEN. Added SJ --> CB. |
| Runbook — rate manipulation over-broad in the slashable direction | Said "two signed messages disagreeing about rate_per_mb". SlashJudge.sol:428 reverts NotRateManipulation unless s.ratePerMb > p.ratePerMb — quoting high and serving cheap is never an offense, and only an upward reprice must wait out the window. ADR 014:188 uses the same loose prose, but a runbook is where the direction matters. |
| ADR 003 over-corrected | Claimed a hold violation "produces exactly the same two contradictory signed messages" as a phantom announce. The preceding paragraph says a bare timeout is reputation-only — the evidence requires the node to sign a refusal. Now conditioned on that. |
| Runbook — ADR 008 cited for the offense taxonomy | ADR 008 defines no slashable offense and explicitly routes away (:115 — "Provable faults are handled by slashing (ADR 028), not reputation"). Dropped from that citation; the ADR 008 cite for reputation impact stays. |
Pre-existing errors in the rewritten section, fixed rather than left
DecdnProbeHoldViolationswas described as phantom-announce evidence — in both the Detect list and the remediation step I had rewritten around. Per appendix-observability § Slash-Safety Metrics the counter fires when a blob is present but un-holdable, the node signshas_blob: **false**, and the literal "evicted after signinghas_blob: true" case is "unreachable by construction"; it is "an availability/budget-pressure signal, not a slash risk". I had grafted the correct remedy onto the wrong diagnosis. Filed monitoring: DecdnProbeHoldViolations annotation describes an unreachable failure mode, and contradicts ADR 005 on the 25% guidance #1471 formonitoring/prometheus-alerts.yml, which carries the same error plus an inverted≥25%where ADR 005 says≤25%and scopes it to small caches.- Blacklist trigger anchored on
addedAt— contradicting this same file at:250-252andSlashJudge.sol:483-491, which anchor oneffectiveAt. Wrapping the list in "the three, and only three, offenses" made the wrong bullet more load-bearing, so it had to go. - "dispute monitor down" as a slash root cause — carried over from the deleted "missed challenge response" step. That watcher is the payment-channel stale-close monitor (unrelated to
SlashJudge) and is not implemented (crates/incentive/src/lib.rs:20, deferred to Implement cdn/watchtower/v1 channel dispute monitoring protocol #324). Replaced with per-offense causes. max_probe_holdsis restart-required (reload.rs,cache_has_restart_required_field) — an operator editing it mid-incident and reloading would have seen nothing happen. Now stated.
The appeal step now points at the shipped CLI
decdn appeal slash exists for exactly this, reads the governable bond, sets the TOKEN allowance, and has --dry-run. Prescribing the raw openSlashAppeal call would have left an operator hand-rolling the ERC-20 approve and hitting an opaque transferFrom failure — and the runbook never said where slashId comes from. Both fixed.
While writing that I nearly invented a decdn node slashes subcommand; it does not exist. admin_v1_slashes is admin-RPC only, so the runbook now shows the curl against the loopback admin port, matching the style already used at :64.
Tracking
#1470 filed for the substantive design question behind #1459 — resolving unknown-vs-zero stake at the lookup layer before on-chain stake is wired. Both selection.rs comments now point there rather than at an issue this PR closes.
Not changed
APPEAL_FILING_WINDOW 30d, APPEAL_BOND 1,000 TOKEN bounded [100, 10,000], full burn on failure, operator-only filing, challengeBond bounds, the three offenses, "silence is not slashable", the glossary bond-disposition rewrite, and every selection.rs claim were all independently verified correct. The git diff on selection.rs remains comment-only — zero executable lines.
Gas snapshotNo gas changes vs base. |
Contracts coverageLine coverage: 89.92% (2615/2908 lines) |
Why
Six documentation sites described a 24-hour counter-evidence window on
SlashJudge. It does not exist and, per ADR 014 § Bond Handling, deliberately never shipped: all three offenses slash synchronously at reveal time, inside the challenger'ssubmit*Challengecall. The contract agrees (SlashJudge.sol:26-31,ISlashJudge.sol:11).The operator-facing case is the one that matters.
docs/runbook.mdtold an operator mid-slash-incident to "submit counter-evidence on-chain within the 24-hour challenge window" — a transaction they cannot send. Following it burns the remediation window while the real recourse,SlashAppeal.openSlashAppealwithin a 30-day filing window, went unmentioned in the runbook entirely.Docs and comments only. No contract, Rust behavior, ABI, or gas change.
Beyond the filed issues
Two extra drifts found in the same runbook section and fixed here, since leaving them would have meant re-editing the same paragraphs:
SlashJudge's threesubmit*Challengeentry points.crates/node/src/config/types.rstoday; the alert annotations referencemax_probe_holdsbut it is not yet a config field." It has been one for a while:[cache] max_probe_holds(crates/common/src/config/types.rs:467), with--max-probe-holdsandDECDN_MAX_PROBE_HOLDS, default 256. The cited path is also stale — that module moved tocrates/common.The six sites
docs/runbook.mdtriggersdocs/runbook.mdremediateopenSlashAppeal(slashId, evidenceBundleHash)withinAPPEAL_FILING_WINDOW(30d, enforced byCapacityBond.markAppealOpen),APPEAL_BOND1,000 TOKEN, one accepted appeal per 365d — cites ADR 028adr/glossary.mdSlashJudgeadr/glossary.mdchallenge bondadr/016-contract-interactions.md:297(CapacityBond, TOKEN, challengeBond, counterEvidenceWindow (24h))adr/003-payments.md:276ADR 016 row 12 was the worst of them: a deploy-time reference table inventing
counterEvidenceWindowwhile omittingcontentBlacklist_,maxEvidenceAgeUs_, andadmin. Rewritten againstSlashJudge.sol:209-216with the bounds as enforced (challengeBond[1, 1000]e18,maxEvidenceAgeUs[1d, 30d], plus the< CapacityBond.unbondingPeriodinvariant) and the deploy values fromBaseProtocolDeploy.s.sol:221-222.Code comments
selection.rs:585namedReputationEngine::score()returning f32.ReputationEngineexists nowhere in the workspace — that comment was its only occurrence. The real producer isLocalReputation::score(crates/reputation/src/local.rs:255), returning f64; narrowing happens later atpeer_reputation. The file had started contradicting itself since fix(selection): bound reputation above 1.0 in compute_score #1461 added a sibling comment naming the real type. (Stale type name in selection.rs test comment:ReputationEngine::score()does not exist #1464)selection.rs:351tie-break tier 2 claimedNoneis "the lowest possible stake".filter_mapdropsNonebeforemax, so unknown ranks strictly belowSome(0)— a provably-zero-stake node outranks an unlooked-up one. That behavior is deliberate and pinned by three tests dating to feat(node): selection algorithm + ADR 008 §9 tie-break (#322) #380, so the comment was the bug, not the code. Rewritten to state the actual rule, plus the caveat that matters when stake lookup lands: a failed on-chain read must not be encoded asNonealongside successful ones, or one flaky RPC call sinks a well-staked peer below a zero-stake one. TheCandidate.stakefield doc now carries the two-axis meaning (None= unknown,Some(0)= known-zero) so the invariant is visible at the type. (selection: tie-break tier 2 ranksSome(0)stake aboveNone, contradicting its own comment #1459)Not "fixed" — verified correct, deliberately untouched
adr/014-*.md:{80,116,153,188,204},adr/028-*.md:{20,169}all state the absence of the window.adr/028-*.md:81(multisig review window) andadr/011-*.md:359(blacklist-appeal flow) are different mechanisms.adr/_history/is archived.Also closes
#1463 needs no diff — it was already fixed by #1462 (
519fba2f), which landedProbeRateLimiter::from_resolved(&cfg.probe, …)/DhtRateLimiter::from_resolved(&cfg.dht, …). The swappableRateLimitConfiglocals it describes no longer exist in runtime bring-up; the only remainingRateLimitConfig::fromcall sites are inside the twofrom_resolvedconstructors, where the source type picks the impl. Closed separately with a comment.Verification
make -C adr check-refs— 1665 anchors resolve, no bare referencesmake -C adr check-book-list— in syncpre-commit run --files <the five touched files>— all hooks pass (markdownlint, clippy, cargo doc, adr hygiene)cargo clippy --workspace --all-targets -- -D warnings,RUSTDOCFLAGS=-D warnings cargo doc --workspace --no-deps --document-private-itemscargo nextest run -p decdn-node selection— 39/39, including the three stake tie-break tests the rewritten comment describescounter-evidencehit outsideadr/_history/either denies the mechanism or names a different onegrep -rn ReputationEngine crates/ adr/ docs/— no matchesNot in this PR
CapacityBond.setSlashJudgeis a real post-deploy wiring step (BaseProtocolDeploy.s.sol:536) that ADR 016's § Post-Deployment Initialization does not list. Mentioned in row 12 here; adding it as a numbered step is a separate drift axis.adr/016-contract-interactions.md:663still saysSlashJudgecallsContentBlacklist.getEntry()— docs(adr): correct region-scope enforcement drift in ADRs 011/014/016/030/031 #1446 is already fixing that.{reason}label) is a behavior-changing observability decision under the Protocol simplifications milestone, left open.Conflicts
Open PR #1446 also edits
adr/016-contract-interactions.md, but in different sections (region-scope claims, the call graph). Row 12 of the deploy table is disjoint. Rebase rather than hand-resolving if #1446 lands first.🤖 Generated with Claude Code