Repository navigation
feat(contracts): add SlashJudge evidence verification + challenge bonds (#452) - #717
Merged
Merged
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
Pull request overview
This PR implements the new SlashJudge contract for on-chain verification of slashable evidence and challenge-bond handling, adding the focused interfaces it needs to interact with CapacityBond and ContentBlacklist.
Changes:
- Adds
SlashJudgewith EIP-712 signature verification for phantom, rate manipulation, and blacklist challenges. - Adds narrowed interfaces for SlashJudge consumers/dependencies.
- Adds Foundry tests covering successful slashes, reverts, governance setters, and pause behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
contracts/src/SlashJudge.sol |
Implements evidence verification, challenge bond round-trip, governance setters, pause controls, and slashing calls. |
contracts/src/interfaces/ISlashJudge.sol |
Defines the canonical external SlashJudge challenge API and Slashed event. |
contracts/src/interfaces/ICapacityBondSlasher.sol |
Adds the narrowed CapacityBond interface required by SlashJudge. |
contracts/src/interfaces/IContentBlacklistHashView.sol |
Adds the narrowed ContentBlacklist hash-entry view interface. |
contracts/test/SlashJudge.t.sol |
Adds unit tests and mocks for SlashJudge behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced May 29, 2026
alpergundogdu
commented
May 29, 2026
…ds (#452) ADR 014 SlashJudge: adjudicates phantom, rate-manipulation, and blacklist offenses via secp256k1 EIP-712 slash_sig verification (SignatureChecker, EOA + ERC-1271). All three resolve synchronously (no counter-evidence window); the challenger is recorded by CapacityBond.slash for the 50% finality leg and the challenge bond round-trips. Enforces the evidence-age window + the MAX_EVIDENCE_AGE_US < unbondingPeriod invariant on this side (the CapacityBond mirror check is a tracked follow-up). Adds focused interfaces ISlashJudge (canonical), ICapacityBondSlasher, IContentBlacklistHashView. Second of four stacked PRs for #452. Co-Authored-By: Claude <[email protected]>
thiras
force-pushed
the
452-pr2-slash-judge
branch
from
May 30, 2026 00:24
e782a78 to
9c730a5
Compare
Contracts coverageLine coverage: 86.25% (1505/1745 lines) |
Gas snapshotGas changes vs baseRun: 26669299351 |
…d blacklist, μs units - Add usedEvidenceHash replay guard in _resolve so a signed proof cannot be resubmitted to ratchet lifetimeOffenseCount (CapacityBond has no evidence-level dedup). State set before external calls (CEI). - Reject suspended blacklist entries: a fast-tracked appeal lifts the serving restriction, matching ContentBlacklist._isLive (addedAt != 0 && !suspended). - BlacklistAfterResponse now reports addedAt in microseconds (was raw seconds under a *Us-labelled param), consistent with responseTsUs. - Tests: replay revert, suspended revert, μs expectation; mock returns suspended. Also suppress two static-analysis false positives that blocked the never-yet-run CI on this branch (CI was gated by the now-resolved PaymentChannel conflict): - aderyn reentrancy-state-change on constructor/setMaxEvidenceAge — view read of the trusted immutable capacityBond.unbondingPeriod(), no reentrancy vector. - slither unused-return on _checkRegistered — the nodeIdOf `active` flag is intentionally unused (the nodeId binding, not liveness, is the gate; ADR 014). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
thiras
force-pushed
the
452-pr2-slash-judge
branch
from
May 30, 2026 00:32
9c730a5 to
9f376b9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR 2 of 4 for #452. Stacked on #716 — review/merge that first; this PR's diff is against the PaymentChannel branch.
Implements the ADR 014
SlashJudge— on-chain adjudicator for the three signature-dependent offenses:ProbeResponse{hasBlob:true}+StreamResponse{ok:false}, same hash, <30s), rate manipulation (stream rate > probe rate), blacklist violation (served a hash blacklisted before the response time).slash_sigverification viaSignatureChecker(EOA + ERC-1271);*ResponseDataare ABI-encoded structs matching the typed-data field order.CapacityBond.slash(operator, challenger, offenseType)and emits the canonicalSlashed(slashId, operator, offenseType, amount, evidenceHash)consumed bySlashAppeal.openSlashAppeal.MAX_EVIDENCE_AGE_US < CapacityBond.unbondingPeriod.ISlashJudge(canonical),ICapacityBondSlasher,IContentBlacklistHashView.ADR-drift notes (please confirm)
slashIdis minted byCapacityBond, notSlashJudge. ADR 014 §slashId-allocation saysSlashJudgeowns anextSlashId, but the deployedCapacityBond.slashalready returns(slashId, slashAmount)and keys its escrow records by it.SlashJudgeuses the returned id. Suggest updating ADR 014 to match.counterEvidenceWindowdropped. ADR 016 §step-12 constructor still lists it; ADR 014 removed it (synchronous slashing). Followed ADR 014; constructor is(capacityBond, token, contentBlacklist, challengeBond, maxEvidenceAgeUs, admin). Suggest updating ADR 016 step 12. (ADR 016 also omitscontentBlacklistfrom the SlashJudge constructor, which the blacklist challenge needs.)SlashJudge.setMaxEvidenceAge+ constructor enforce< unbondingPeriod, but the mirror check onCapacityBond.setUnbondingPeriodcan't be added without changing the already-mergedCapacityBond. Flagged as a follow-up (needs aCapacityBondchange).Verification
forge fmt --checkclean;FOUNDRY_PROFILE=ci forge build --deny warningsclean; pre-commit (forge-fmt + solhint) pass.forge test— 20 new tests pass; full suite 353 pass, 0 fail.reentrancy-no-ethdirectives added.Test plan
🤖 Generated with Claude Code