Skip to content

refactor(contracts): remove slash-appeal challenger pool - #1451

Merged
thiras merged 4 commits into
mainfrom
codex/1436-remove-challenger-pool
Jul 25, 2026
Merged

thiras merged 4 commits into
mainfrom
codex/1436-remove-challenger-pool

Conversation

@altanoruc

@altanoruc altanoruc commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • remove the unused SlashAppeal challenger-incentive-pool state, governance surface, deployment wiring, and fixtures
  • burn 100% of every failed appeal bond while preserving the slash principal's 50/50 original-challenger/burn settlement
  • reconcile ADR 028, ADR 016, tokenomics cross-references, architecture, glossary, and local deployment docs

Why

Appeals are operator-only and expose no counter-evidence claimant or pool disbursement path. The former 50/50 appeal-bond split created a fund sink and a transfer-failure branch without an eligible recipient.

Validation

  • strict TDD RED: the focused upheld-appeal regression failed because the former pool received 500 TOKEN
  • FOUNDRY_PROFILE=ci forge build --sizes --deny warnings
  • FOUNDRY_PROFILE=ci forge snapshot --snap .gas-snapshot (804 passed, 0 failed, 12 fork-only skipped)
  • npm run lint
  • Slither with fail-on medium: passed
  • Aderyn v0.6.8: 0 high findings
  • ADR reference/book-list checks and markdownlint
  • cargo check -p decdn-e2e -p decdn-node --all-targets

Closes #1436

Summary by CodeRabbit

  • Updated Behavior

    • Failed appeals now burn the entire appeal bond, including rejected, upheld, and expired appeals.
    • Granted appeals continue to refund the appeal bond in full.
    • Challenger incentive pool handling has been removed from appeal settlement.
  • Documentation

    • Updated deployment instructions to require a non-zero CURRENT_TERMS_HASH.
    • Revised governance, tokenomics, and slashing-appeal documentation to reflect the updated settlement outcomes.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

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

Next review available in: 46 minutes

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: 9e7d3793-858f-476b-91e5-9ac7cea2da0d

📥 Commits

Reviewing files that changed from the base of the PR and between 1b1e779 and 892c98f.

📒 Files selected for processing (3)
  • contracts/.gas-snapshot
  • contracts/script/DeployProtocol.s.sol
  • contracts/test/SlashAppeal.t.sol

Walkthrough

The change removes challenger-incentive-pool support from SlashAppeal, updates uphold settlement to burn the full appeal bond, removes related deployment inputs and wiring, and aligns tests, gas snapshots, ADRs, glossary text, and local deployment documentation.

Changes

Slash appeal settlement and deployment update

Layer / File(s) Summary
Appeal settlement semantics
contracts/src/SlashAppeal.sol, adr/016-contract-interactions.md, adr/026-tokenomics.md, adr/028-slashing-appeals.md, adr/glossary.md
SlashAppeal removes challenger-pool storage, events, and governance configuration; upholdAppeal burns the full appeal bond, while ADR and glossary descriptions document the revised outcomes.
Deployment configuration and environment wiring
contracts/script/*, contracts/dev-deploy.sh, crates/e2e/src/chain.rs, crates/node/tests/*, CONTRIBUTING.md
Deployment configuration and commands stop accepting or passing CHALLENGER_INCENTIVE_POOL; local deployment documentation lists CURRENT_TERMS_HASH instead.
Test and gas validation updates
contracts/test/*, contracts/.gas-snapshot
Deployment, lifecycle, buyback, E2E, and appeal tests remove challenger-pool assumptions, assert full-bond burning, and refresh recorded gas measurements.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SlashAppeal
  participant CapacityBond
  participant token
  SlashAppeal->>CapacityBond: settleAppealUpheld()
  SlashAppeal->>token: burn(full appeal bond)
Loading

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.

@github-actions

Copy link
Copy Markdown

Gas snapshot

No gas changes vs base.

@github-actions

github-actions Bot commented Jul 24, 2026 •

Copy link
Copy Markdown

Contracts coverage

Line coverage: 89.74% (2616/2915 lines)
▲ +0.16pp vs base (89.58% → 89.74%)
Run: 30166512599

@github-actions

github-actions Bot commented Jul 24, 2026 •

Copy link
Copy Markdown

Coverage report

Total: 81.07% (was 81.07%, ● 0.00%) — 52384/64615 lines

File Coverage Lines Δ
crates/e2e/src/chain.rs 1.73% 21/1212 ● 0.00%
History
Commit Total Δ vs base
74d69ae 81.13% ▲ +0.05%
b29c9ad 81.13% ▲ +0.05%
55127b7 81.13% ▲ +0.05%
1b1e779 81.07% ● 0.00%
892c98f (HEAD) 81.07% ● 0.00%

Copy link
Copy Markdown
Contributor Author

Review

Verdict: approve after nits. No blocking issues. The removal is complete and correctly reasoned — no dangling references outside adr/_history/ (correctly left alone), and the doc reconciliation across ADR 016/026/028 + architecture + glossary is thorough.

What it does

Deletes SlashAppeal.challengerIncentivePool storage, the setChallengerIncentivePool setter, ChallengerIncentivePoolUpdated, and the 50/50 bond split + try/catch degrade in upholdAppeal. Narrows AppealUpheld from 3 fields to 2. Drops DeployConfig.challengerIncentivePool, its zero-address guard, the phase-4 setter call, and the _assertPeerRolesWired binding check; removes the CHALLENGER_INCENTIVE_POOL env var from DeployProtocol.s.sol, dev-deploy.sh, and three Rust anvil harnesses.

Correctness — checked, nothing wrong

  • Removing the try/catch is a safety win, not a regression. That block existed solely to stop a hostile or blocklisting challengerIncentivePool from reverting the uphold and letting cleanupExpiredAppeal flip it to an operator-favorable grant. With the pool gone, the only external calls left in upholdAppeal are CapacityBond and Token — both protocol-owned — so the griefing path it defended against no longer exists. ADR 016's external-call table was updated to match.
  • Effects-before-interactions preserved: a.bond = 0; a.status = Resolved still precede settleAppealUpheld / burn.
  • No unused imports or errors under --deny warnings: IERC20 / SafeERC20 / ZeroAddress are all still live elsewhere in the contract (lines 164, 220, 276, 332).
  • ISlashAppeal never declared the pool, so no interface churn.
  • The BindingNotWired natspec rewrite is accurate — it's still thrown for CapacityBond.slashJudge (BaseProtocolDeploy.s.sol:660), OriginAssignment.contentBlacklist (664), ContentBlacklist.registry (671), and FeeRouter.buybackBurner (1023).
  • "Five fields" matches the five remaining ZeroAddress guards (usdc, ed25519Verifier, deployer, emergencyMultisig, initialTokenHolder).
  • Storage-layout shift is safe. appealBond moves up a slot, but SlashAppeal is non-upgradeable (no proxy/Initializable anywhere in src/) and is redeployed by DeployProtocol; dev-deploy.sh already deletes the stale deployments/31337.json each run.
  • ACC2_ADDR in dev-deploy.sh was only used for the pool — clean removal.

Nits

1. contracts/test/SlashAppeal.t.sol:23 — local event redeclaration goes against repo convention. The suite elsewhere uses emit Contract.Event(...) (BuybackBurner.t.sol:256, BuybackBurnerBalancerV3.t.sol:458, …); only TestnetFaucet.t.sol redeclares locally. Prefer emit SlashAppeal.AppealUpheld(slashId, APPEAL_BOND); and drop line 23, so the test doesn't carry a private copy of the signature that can drift.

2. contracts/test/SlashAppeal.t.sol:222-224 — the legacy-setter probe is fragile and mixes concerns. assertFalse(legacySetterSucceeded) asserts an ABI absence via a raw call; it passes today only because SlashAppeal has no fallback()/receive(). If one is ever added, this fails for a reason unrelated to the challenger pool, inside a test named test_uphold_distributesEscrowAndBurnsFullBond. The expectEmit + supplyBefore - totalSupply == SLASH_AMT / 2 + APPEAL_BOND + balanceOf(formerPool) unchanged assertions already fully pin this PR's semantics — the probe adds no coverage of them. Suggest dropping it, or splitting it into its own test_legacyChallengerPoolSetter_isRemoved(). (The TDD-RED framing motivated it, but a RED probe against deleted code doesn't need to live in the permanent suite.)

3. contracts/script/BaseProtocolDeploy.s.sol:80-82 — leftover plural. "…the deployer-only OriginAssignment.setContentBlacklist setter that MUST run before the GOVERNANCE_ROLE handoff because they become Timelock-gated post-handoff." → "because it becomes".

4. contracts/script/BaseProtocolDeploy.s.sol:382-385 — parenthetical lost its separator. "(emergencyMultisig skips SlashAppeal's constructor grant and ContentBlacklist would grant EMERGENCY_MULTISIG_ROLE to address(0))" now reads as one clause about emergencyMultisig doing two things. A ; — or "…constructor grant, and ContentBlacklist would…" — restores the two-item sense.

5. CONTRIBUTING.md:249-260 — good catch on CURRENT_TERMS_HASH, but the prose doesn't cover it. Swapping in CURRENT_TERMS_HASH is a genuine fix (_readConfig uses vm.envBytes32 with no default, so the documented command would have reverted), but the comment above the block still only explains the three addresses and a reader now hits an unexplained bytes32. One clause would close it: "CURRENT_TERMS_HASH is any non-zero bytes32 for local testing — CapacityBond rejects the zero sentinel." Worth a line in the PR body too, since it's an unrelated fix riding along.

6. adr/028-slashing-appeals.md — one stale ADR 014 cross-ref. § Appeal bond correctly drops "Bond economics mirror [ADR 014 § Bond Handling]", but § Consequences (line 168) still lists "ADR 014 § Bond Handling bond economics" among reused primitives. With a flat 100% burn on every failed path that's now the weakest of the listed reuses — ADR 014 challenger bonds are returned on success and never forfeited post-verification. Either drop it or restore a scoped version of the removed sentence.

Test coverage

Net-positive (+0.13pp, 89.58 → 89.71). Removing test_uphold_poolUnset_burnsFullBond is right — the degrade branch it covered no longer exists. The uphold path is now pinned on event + supply delta + challenger delta + escrowedTotal() == 0. The other failed-appeal terminal paths (rejectAppeal, review-window lapse) already burned 100% and are untouched, so no new coverage is owed there.

Security / economics

Strictly reduces surface: one fewer governance-settable address, one fewer untrusted external call. Economic effect is slightly more TOKEN burned per failed appeal — bounded at 10,000 TOKEN by the APPEAL_BOND ceiling — and it's documented in ADR 026 and 028.

One thing worth stating explicitly in the PR body: AppealUpheld loses its third field, so its topic0 changes. Any indexer or subgraph decoding the 3-field signature will silently stop matching. Pre-mainnet so likely a non-issue, but cheap to note if anything already consumes it.

CI

All 23 checks green — build+test, slither, aderyn, solhint, fmt, coverage, both anvil e2e journeys. Gas snapshot regenerated, no regression reported.


Generated by Claude Code

altanoruc and others added 3 commits July 25, 2026 19:36
Follow-up to the SlashAppeal challenger-incentive-pool removal.

- SlashAppeal.t.sol: use the repo's `emit Contract.Event(...)` convention
  (`SlashAppeal.AppealUpheld`) instead of redeclaring the event locally, so
  the test cannot carry a signature that drifts from the contract.
- SlashAppeal.t.sol: drop the raw-call probe for the deleted
  `setChallengerIncentivePool` selector. It asserted an ABI absence that the
  source deletion already guarantees, and passed only because SlashAppeal has
  no fallback/receive — adding one later would have failed a test named for
  uphold semantics. The expectEmit plus the supply-delta assertion already
  pin the full-bond burn.
- BaseProtocolDeploy.s.sol: fix a plural left behind when the setter list
  became a single entry, and restore the separator in the zero-address
  fail-fast parenthetical so it no longer reads as one clause.
- CONTRIBUTING.md: document CURRENT_TERMS_HASH in the local-deploy block; it
  is read with vm.envBytes32 and has no default, so it is required.
- ADR 028: the appeal bond no longer mirrors ADR 014 bond economics, so state
  the contrast explicitly instead of listing it as a reused primitive.
- Regenerate .gas-snapshot for the trimmed uphold test.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011Fkfn2edYpVuoumwZ1vkwH
@thiras
thiras force-pushed the codex/1436-remove-challenger-pool branch from 55127b7 to 1b1e779 Compare July 25, 2026 16:39
…deploy env-var list

Two review follow-ups on the challenger-pool removal.

Removing `test_lifecycle_SlashAppeal_setChallengerIncentivePool_outOfBounds`
took out the only test exercising `SlashAppeal.ZeroAddress`, leaving the
constructor's three-way `||` guard uncovered — every peer contract
(Token, BuybackBurner, PaymentChannel) has this test, so SlashAppeal was
the outlier. Adds one case per clause plus a positive case pinning
`emergencyMultisig == address(0)` as deliberately allowed. Verified
load-bearing by mutation: dropping each clause in turn fails exactly the
matching test and no others.

The same commit that dropped `CHALLENGER_INCENTIVE_POOL` from the deploy
script's env-var docstring also corrected the parallel list in
CONTRIBUTING.md to include `CURRENT_TERMS_HASH`, but left the script's own
list at three entries. `_readConfig` reads it via `vm.envBytes32` with no
default, so an unset value hard-reverts the deploy with nothing in the file
the operator was reading to explain it.

Gas snapshot regenerated under FOUNDRY_PROFILE=ci for the four new entries.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@thiras
thiras merged commit 1f75ba9 into main Jul 25, 2026
24 checks passed
@thiras
thiras deleted the codex/1436-remove-challenger-pool branch July 25, 2026 17:04
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.

Remove the slash-appeal challenger-incentive pool; burn upheld bond 100% (ADR 028)

3 participants