Skip to content

docs: remove the nonexistent SlashJudge counter-evidence window and two stale code comments - #1469

Merged
thiras merged 2 commits into
mainfrom
docs/slashjudge-counter-evidence-drift
Jul 26, 2026
Merged

thiras merged 2 commits into
mainfrom
docs/slashjudge-counter-evidence-drift

Conversation

@thiras

@thiras thiras commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

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's submit*Challenge call. The contract agrees (SlashJudge.sol:26-31, ISlashJudge.sol:11).

The operator-facing case is the one that matters. docs/runbook.md told 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.openSlashAppeal within 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:

  • A slashable offense that does not exist. The trigger list carried "Missed challenge response — failure to respond to a slash challenge within the 24-hour window". There is no such offense — and every slash requires the operator's own signed messages, so silence is not slashable. Rate manipulation, one of the three real offenses, was missing from the list entirely. Both fixed; the list now matches SlashJudge's three submit*Challenge entry points.
  • A config knob claimed not to exist. Step 3 said "there is no operator-tunable knob for hold capacity in crates/node/src/config/types.rs today; the alert annotations reference max_probe_holds but 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-holds and DECDN_MAX_PROBE_HOLDS, default 256. The cited path is also stale — that module moved to crates/common.

The six sites

Site Was Now
docs/runbook.md triggers "Missed challenge response", 24h window Rate manipulation; note that silence is not slashable
docs/runbook.md remediate Submit counter-evidence within 24h, cites ADR 014 No counter-evidence window; openSlashAppeal(slashId, evidenceBundleHash) within APPEAL_FILING_WINDOW (30d, enforced by CapacityBond.markAppealOpen), APPEAL_BOND 1,000 TOKEN, one accepted appeal per 365d — cites ADR 028
adr/glossary.md SlashJudge "runs counter-evidence windows" "runs the two-phase commit–reveal challenge flow"
adr/glossary.md challenge bond "forfeited on successful node counter (50% burned, 50% to node)" Returned on successful slash; a failing reveal reverts, so it is never transferred and never forfeited after the fact
adr/016-contract-interactions.md:297 (CapacityBond, TOKEN, challengeBond, counterEvidenceWindow (24h)) The real signature — invented one arg and omitted three
adr/003-payments.md:276 Hold violations "fall to the same 24-hour counter-window" Slash at reveal like any phantom announce; recourse is a slash appeal

ADR 016 row 12 was the worst of them: a deploy-time reference table inventing counterEvidenceWindow while omitting contentBlacklist_, maxEvidenceAgeUs_, and admin. Rewritten against SlashJudge.sol:209-216 with the bounds as enforced (challengeBond [1, 1000]e18, maxEvidenceAgeUs [1d, 30d], plus the < CapacityBond.unbondingPeriod invariant) and the deploy values from BaseProtocolDeploy.s.sol:221-222.

Code comments

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) and adr/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 landed ProbeRateLimiter::from_resolved(&cfg.probe, …) / DhtRateLimiter::from_resolved(&cfg.dht, …). The swappable RateLimitConfig locals it describes no longer exist in runtime bring-up; the only remaining RateLimitConfig::from call sites are inside the two from_resolved constructors, where the source type picks the impl. Closed separately with a comment.

Verification

  • make -C adr check-refs — 1665 anchors resolve, no bare references
  • make -C adr check-book-list — in sync
  • pre-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-items
  • cargo nextest run -p decdn-node selection — 39/39, including the three stake tie-break tests the rewritten comment describes
  • Sweep confirms every surviving counter-evidence hit outside adr/_history/ either denies the mechanism or names a different one
  • grep -rn ReputationEngine crates/ adr/ docs/ — no matches

Not in this PR

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

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]>
Copilot AI review requested due to automatic review settings July 26, 2026 15:11
@coderabbitai

coderabbitai Bot commented Jul 26, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@thiras, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 1 minute

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Free

Run ID: a7d6c604-656b-4d47-b4f6-fb3741b01098

📥 Commits

Reviewing files that changed from the base of the PR and between 65172c3 and 41c9cca.

📒 Files selected for processing (5)
  • adr/003-payments.md
  • adr/016-contract-interactions.md
  • adr/glossary.md
  • crates/node/src/selection.rs
  • docs/runbook.md

Note

🎁 Summarized by CodeRabbit Free

Your 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 @coderabbitai help to get the list of available commands.

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.

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 (stake None vs Some(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.

@github-actions

github-actions Bot commented Jul 26, 2026 •

Copy link
Copy Markdown

Coverage report

Total: 81.10% (was 81.10%, ● 0.00%) — 52379/64583 lines

File Coverage Lines Δ
crates/node/src/selection.rs 97.53% 473/485 ● 0.00%
History
Commit Total Δ vs base
c096c8d 81.10% ● 0.00%
41c9cca (HEAD) 81.10% ● 0.00%

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]>
@thiras

thiras commented Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

Review round applied (41c9cca3)

Ran the comment-analyzer and code-reviewer agents over the first commit. Both found real defects — including several the PR itself introduced, which is the failure mode a claim-correction PR is most exposed to. All twelve findings were re-verified against contracts/src/, the ADRs, and the Rust before acting.

Defects this PR introduced, now fixed

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

  • DecdnProbeHoldViolations was 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 signs has_blob: **false**, and the literal "evicted after signing has_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 for monitoring/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-252 and SlashJudge.sol:483-491, which anchor on effectiveAt. 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_holds is 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.

@github-actions

Copy link
Copy Markdown

Gas snapshot

No gas changes vs base.

@github-actions

Copy link
Copy Markdown

Contracts coverage

Line coverage: 89.92% (2615/2908 lines)
▲ +0.00pp vs base (89.92% → 89.92%)
Run: 30208457639

@thiras
thiras merged commit 1ccec3d into main Jul 26, 2026
24 checks passed
@thiras
thiras deleted the docs/slashjudge-counter-evidence-drift branch July 26, 2026 15:44
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