Repository navigation
feat(contracts): add OriginAssignment publisher-propose / DAO-ratify authority (#452) - #718
Conversation
ADR 003 PaymentChannel: USDC-denominated off-chain payment channels with EIP-712 vouchers (SignatureChecker for EOA + ERC-1271), 48h dispute window, operator early-withdraw-while-open, and same-tx settlement routing through FeeRouter.routeSettlement. openChannel gates on CapacityBond.isActive; the forced-inclusion deadline extension sits behind an overridable L2 seam. Adds focused consumer interfaces IFeeRouterSettlement + ICapacityBondActivity (mirroring the existing ICapacityBondReporter/Ejector split). First of four stacked PRs closing the remaining #452 contract surface. Co-Authored-By: Claude <[email protected]>
…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]>
…authority (#452) ADR 011 OriginAssignment: the DAO's positive origin authority. Registered namespaces use a publisher-propose / governance-ratify flow gated by an assignment timelock with operator re-validation (active + not blacklisted) at activation; the default-open namespace (id 0) is a governance-maintained global allow-list under the same EnumerableSet storage. Permissionless pruneBlacklistedAssignment cleans up blacklisted operators one entry at a time. Reuses ICapacityBondActivity; adds IPublisherRegistryOwnership + IContentBlacklistOriginView. Third of four stacked PRs for #452. Co-Authored-By: Claude <[email protected]>
|
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
Implements the OriginAssignment contract (ADR 011) to manage DAO-governed origin authorization: publisher-propose / DAO-ratify flows for registered namespaces plus a governance-managed default-open (namespaceId == 0) allow-list, with optional ContentBlacklist integration for activation re-validation and permissionless pruning.
Changes:
- Added
OriginAssignmentcontract with pending proposals, timelocked activation, revocation, default-open allow-list management, and blacklist-prune support. - Added focused consumer interfaces for
PublisherRegistry.ownerOfandContentBlacklist.isOriginBlacklisted. - Added a comprehensive Foundry test suite covering propose/activate/cancel/revoke/prune and default-open allow-list behaviors.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| contracts/src/OriginAssignment.sol | New contract implementing the origin authorization lifecycle (propose/activate/cancel/revoke/prune) and default-open allow-list + blacklist wiring. |
| contracts/src/interfaces/IPublisherRegistryOwnership.sol | New minimal interface for PublisherRegistry.ownerOf(namespaceId) lookups. |
| contracts/src/interfaces/IContentBlacklistOriginView.sol | New minimal interface for ContentBlacklist.isOriginBlacklisted(operator) lookups. |
| contracts/test/OriginAssignment.t.sol | New unit tests for OriginAssignment covering core flows and governance controls. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /// @notice Publisher cancels their own pending proposal before activation. | ||
| function cancelAssignmentProposal(uint256 namespaceId) external nonReentrant { |
There was a problem hiding this comment.
Verified against slither . --config-file slither.config.json (CI's fail-on: medium): cancelAssignmentProposal does not trigger reentrancy-no-eth. Its single ownerOf view + delete doesn't match the cross-function pattern of the loop-bearing propose/activate/revoke/prune functions (those already carry the directive), so adding the suggested directive would be a no-op suppression and leave CI red.
The function does fail slither, but on a different medium detector: the ownerOf external read taints the struct field for incorrect-equality, flagging _pending[namespaceId].readyAt == 0. Fixed with the correct directive on that comparison line.
The same run surfaced three more unsuppressed medium findings in this PR's diff that this comment didn't cover, now also fixed:
OriginAssignment._replaceSet—unused-returnonset.remove(...)SlashJudge.submitBlacklistChallenge—unused-returnon the(addedAt,) = getHashEntry(...)destructuringSlashJudge._checkRegistered—unused-returnon the(bound,) = nodeIdOf(...)destructuring
Slither result count 43 → 39; medium gate clean.
9c730a5 to
9f376b9
Compare
…SlashJudge (#452) CI slither (fail-on: medium) flagged four unsuppressed medium findings in PR #718's cumulative diff: - OriginAssignment.cancelAssignmentProposal: incorrect-equality on the `_pending[...].readyAt == 0` sentinel — the preceding `ownerOf` external read taints the struct field for the strict-equality detector. - OriginAssignment._replaceSet: unused-return on `set.remove(...)`. - SlashJudge.submitBlacklistChallenge / _checkRegistered: unused-return on the `(addedAt,)` / `(bound,)` tuple destructuring of external view calls. Directive placement follows existing conventions (call-line for direct calls per FeeRouter; function-decl for tuple destructuring per SlashAppeal). No behavioral change — comment-only suppressions. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…ment # Conflicts: # contracts/src/PaymentChannel.sol # contracts/src/SlashJudge.sol # contracts/test/PaymentChannel.t.sol # contracts/test/SlashJudge.t.sol
Contracts coverageLine coverage: 86.47% (1611/1863 lines) |
Gas snapshotGas changes vs baseRun: 26682413039 |
… call in OriginAssignment (#452) aderyn's reentrancy-state-change detector flags every external call that precedes a state write, not just the first. proposeAssignment and activateAssignment each make two view-only external calls before their state write, but only the first was suppressed — leaving the in-loop capacityBond.isActive (propose) and IContentBlacklistOriginView. isOriginBlacklisted (activate) calls reported as HIGH, failing the `fail-on: high` aderyn CI gate. Add the missing directive to each. The calls are views and both functions are nonReentrant; the contract holds no funds, so the finding is a false positive per the file's existing suppression convention. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…720) * feat(contracts): add PaymentChannel USDC settlement gateway (#452) ADR 003 PaymentChannel: USDC-denominated off-chain payment channels with EIP-712 vouchers (SignatureChecker for EOA + ERC-1271), 48h dispute window, operator early-withdraw-while-open, and same-tx settlement routing through FeeRouter.routeSettlement. openChannel gates on CapacityBond.isActive; the forced-inclusion deadline extension sits behind an overridable L2 seam. Adds focused consumer interfaces IFeeRouterSettlement + ICapacityBondActivity (mirroring the existing ICapacityBondReporter/Ejector split). First of four stacked PRs closing the remaining #452 contract surface. Co-Authored-By: Claude <[email protected]> * feat(contracts): add SlashJudge evidence verification + challenge bonds (#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]> * feat(contracts): add OriginAssignment publisher-propose / DAO-ratify authority (#452) ADR 011 OriginAssignment: the DAO's positive origin authority. Registered namespaces use a publisher-propose / governance-ratify flow gated by an assignment timelock with operator re-validation (active + not blacklisted) at activation; the default-open namespace (id 0) is a governance-maintained global allow-list under the same EnumerableSet storage. Permissionless pruneBlacklistedAssignment cleans up blacklisted operators one entry at a time. Reuses ICapacityBondActivity; adds IPublisherRegistryOwnership + IContentBlacklistOriginView. Third of four stacked PRs for #452. Co-Authored-By: Claude <[email protected]> * fix(contracts): suppress slither medium findings in OriginAssignment/SlashJudge (#452) CI slither (fail-on: medium) flagged four unsuppressed medium findings in PR #718's cumulative diff: - OriginAssignment.cancelAssignmentProposal: incorrect-equality on the `_pending[...].readyAt == 0` sentinel — the preceding `ownerOf` external read taints the struct field for the strict-equality detector. - OriginAssignment._replaceSet: unused-return on `set.remove(...)`. - SlashJudge.submitBlacklistChallenge / _checkRegistered: unused-return on the `(addedAt,)` / `(bound,)` tuple destructuring of external view calls. Directive placement follows existing conventions (call-line for direct calls per FeeRouter; function-decl for tuple destructuring per SlashAppeal). No behavioral change — comment-only suppressions. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * feat(contracts): extend DeployProtocol with new contracts + E2E (#452) Deploys PaymentChannel, SlashJudge, and OriginAssignment in BaseProtocolDeploy and wires the post-deploy role grants (ROUTER_CALLER_ROLE -> PaymentChannel, SLASH_ROLE -> SlashJudge, OriginAssignment.setContentBlacklist), growing the governance-handoff set to 8 targets and the manifest. Launch params seeded as constants (48h dispute, 90d channel, 100 TOKEN challenge bond, 5d evidence age). Adds the acceptance E2E (register -> bond -> open channel -> settle through FeeRouter -> 3-bucket distribution -> slash -> escrow -> auto-eject -> appeal) on the deployed, handed-off surface, plus an ABI-freeze snapshot for the new public surfaces. Fourth of four stacked PRs for #452. BuybackBurner concrete binding remains deferred to #686. Co-Authored-By: Claude <[email protected]> * fix(contracts): grant PAUSER_ROLE to emergency multisig at deploy (#452) No constructor grants PAUSER_ROLE, and the deploy wiring only granted EMERGENCY_MULTISIG_ROLE. Post-handoff the sole PAUSER_ROLE admin is the Timelock, so the first emergency pause would have needed a 48h-delayed governance proposal — defeating the emergency path. Grant PAUSER_ROLE to the emergency multisig on all 5 deployed Pausable targets (CapacityBond, FeeRouter, SlashAppeal, PaymentChannel, SlashJudge) in _wireCrossContractRoles, before the governance handoff. Matches ADR 016 § Role Inventory (EMERGENCY_ROLE holds pause() on Pausable contracts) and the documented intent in PaymentChannel. Add a role-matrix test asserting the grant on every target. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * test(contracts): close PR review gaps in deploy wiring + E2E (#452) Addresses review findings on #720: - Add phase-7 `_assertPeerRolesWired`: a reverting in-script post-condition that re-reads every phase-4 peer grant (SETTLEMENT_REPORTER/SLASH_APPEAL/ BLACKLIST/SLASH/GENESIS_GRANTOR/ROUTER_CALLER/EMERGENCY_MULTISIG/PAUSER) and both address bindings (OriginAssignment→ContentBlacklist, challenger pool). `_assertNoBackDoors` only covered governance/admin, so a wrong or dropped peer grant — a dead slash trigger, unroutable payments, no live pauser, or an unwired blacklist check — would have shipped silently (grantRole to a wrong address does not revert). New PeerRoleNotWired / BindingNotWired errors. - Prove the emergency multisig can ACTUALLY pause (not just hold PAUSER_ROLE): pause via the multisig, assert a whenNotPaused entrypoint reverts, unpause. - Add behavioral E2E for the blacklist→CapacityBond ejection edge (BLACKLIST_ROLE wiring), previously only asserted as a role bit. - Move the new-contract peer-role assertions into the canonical role-matrix test so a wiring regression fails independently of the heavier E2E flow. - Strengthen the E2E: assert each slash tier escrows a strictly larger amount, and that a granted appeal releases the appealed slash's escrow and refunds the appeal bond (net delta == released escrow); read FeeRouter shares from cfg. - Fix stale/inaccurate NatSpec: _governedTargets "five"→"eight" (+ invariant note), phase-2/phase-4 enumerations, the upholdAppeal degrade-vs-revert comment, and narrow the InterfaceFreeze docstring to the three #452 contracts. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> --------- Co-authored-by: Claude <[email protected]> Co-authored-by: Ant Somers <[email protected]>
Summary
PR 3 of 4 for #452. Stacked on #717 (which is stacked on #716) — merge bottom-up; this diff is against the SlashJudge branch.
Implements the ADR 011
OriginAssignment— the DAO's positive origin authority:proposeAssignment(owns namespace, operators active, ≤maxOriginsPerNamespace, no dupes) → pending withreadyAt = now + assignmentTimelock→ governanceactivateAssignmentafter the timelock, re-validating each operator is still active and not blacklisted, replacing the authorized set atomically.cancelAssignmentProposal/revokeAssignment(publisher own / governance any).namespaceId == 0): governance-maintained global allow-list (setDefaultOpenAllowlist/add/remove) under the sameEnumerableSetstorage —isAuthorizedOrigin(0, op)is the same view, no special case.pruneBlacklistedAssignment(the contract checksContentBlacklist.isOriginBlacklisteditself; O(1) per call).ContentBlacklistbound post-deploy viasetContentBlacklist(reverts onaddress(0)to prevent regressing to the skip-blacklist deployment window).ICapacityBondActivity(from PR1); addsIPublisherRegistryOwnership+IContentBlacklistOriginView.Notes / decisions
activateAssignmentreverts (does not in-tx clear) when an operator went stale. ADR 011 says the pending is "auto-cleared on revert," which is physically impossible (a revert rolls back the clear). Implemented as: activation reverts with a specific error; the publisher re-proposes andproposeAssignmentoverwrites the stale pending set — same net effect, no separate cancel. Suggest updating ADR 011 §Edge cases / §Lifecycle to describe the overwrite path rather than an in-revert clear.assignmentTimelock = 3 days([24h, 14d]),maxOriginsPerNamespace = 10([1, 50]),defaultOpenMaxOrigins = 100([20, 500]). All governance-tunable.ReentrancyGuard+reentrancy-no-eth/reentrancy-state-changedirectives on the external-view-then-write functions, matching the repo pattern (all cross-contract reads here are views).Verification
forge fmt --checkclean;FOUNDRY_PROFILE=ci forge build --deny warningsclean; pre-commit pass; solhint clean onsrc/.forge test— 28 new tests pass; full suite 381 pass, 0 fail.Test plan
activateAssignmentrevert-vs-auto-clear interpretation🤖 Generated with Claude Code