Skip to content

chore(contracts): triage slither + aderyn findings (closes #690) - #692

Merged
thiras merged 3 commits into
mainfrom
chore/690-slither-aderyn-triage
May 28, 2026
Merged

thiras merged 3 commits into
mainfrom
chore/690-slither-aderyn-triage

Conversation

@thiras

@thiras thiras commented May 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • PR feat(contracts): implement ADR 026/028/030/031/033/036 deltas #684's test plan deferred the slither + aderyn pass to a follow-up. Both CI gates were already green on main (slither 31 findings, all sub-medium; aderyn 0 High, 80 Low). This PR is the explicit triage: fix root causes where cheap, suppress where intent is documented, leave sub-threshold noise alone.
  • Slither: 31 → 21 findings. The 3 detector categories with anything actionable (missing-zero-check, missing-inheritance, unimplemented-functions) all clear; only the ~21 timestamp lows on intentional time-gated state machines remain. Exit code 0 preserved against fail-on: medium.
  • Aderyn: L-3 address-set-without-checks 6 → 3 (real fixes for 3 sites; the remaining 3 are documented-intentional); L-5 unused-error 1 → 0. 0 High preserved against fail-on: high.

Triage decisions

Root-cause fixes

  • Hoist interfaces: ICapacityBondEjector and ICapacityBondReporter were inline in ContentBlacklist.sol and FeeRouter.sol respectively. Moved to new files under src/interfaces/. CapacityBond now declares is ICapacityBondEjector, ICapacityBondReporter, and ejectNode / recordSettlement / epochLength are marked override. Clears 2× missing-inheritance.
  • Zero-checks added to SafetyReserve.setBalancerPool, SafetyReserve.setChallengerIncentivePool, and CapacityBond.setSafetyReserve — none had a documented intent for zero, and writing zero would brick the slash-routing flow.
  • Remove dead error error NoPendingCredit() from CapacityBond (confirmed unused via grep). Clears aderyn L-5.

Inline suppressions (intent already documented in NatSpec)

  • BuybackBurner.setPool / setVault: address(0) is the "not wired" mode; executeBuyback reverts with PoolNotWired.
  • CapacityBond.setTreasury: address(0) documented as the burn-as-fallback path.
  • FeeRouter constructor safetyReserve_ / buybackBurner_: allowed iff matching share is zero; cross-validated in _setShares.
  • abstract BuybackBurner: _performSwap virtual-without-body is the documented seam for the Balancer V3 deployment-PR subclass.

Left alone (sub-threshold, by design)

  • Slither timestamp (~21 sites): intentional time-gated guards on unlock / appeal / vest windows. Low severity; suppressing each would add ~15 directives of noise.
  • Aderyn centralization-risk (53): intentional onlyRole(GOVERNANCE_ROLE) / EMERGENCY_MULTISIG_ROLE administration.
  • Aderyn unchecked-return (18): all on OZ Checkpoints.Trace208.push / _grantRole / SafeERC20 calls where the return value is correctly ignored by the library contract.
  • Aderyn large-numeric-literal (2): 10_000 BPS denominators where readability beats scientific notation.

Test plan

  • forge fmt --check clean
  • FOUNDRY_PROFILE=ci forge build --sizes --deny warnings clean (no solc / forge-lint warnings)
  • forge test — 153/153 passing
  • aderyn -o /tmp/aderyn.md --no-snippets --skip-update-check — 0 High preserved; L-3 6→3, L-5 1→0
  • slither . --config-file slither.config.json — exit 0; 31→21 findings (only timestamp remains)
  • CI green: solidity-fmt, solidity-build-test, solidity-slither, solidity-aderyn

Closes #690.

🤖 Generated with Claude Code

PR #684's test plan deferred the slither + aderyn static-analysis pass to a
follow-up. Both CI gates were already green on main (slither 31 findings, all
sub-medium; aderyn 0 High, 80 Low), so this commit handles the explicit triage:
fix root causes where cheap, suppress with inline directives where intent is
documented, leave sub-threshold noise alone.

Slither (31 → 21):
- Hoist `ICapacityBondEjector` (was inline in ContentBlacklist) and
  `ICapacityBondReporter` (was inline in FeeRouter) into dedicated files
  under `src/interfaces/`. Declare them on `CapacityBond`, mark `ejectNode`,
  `recordSettlement`, `epochLength` `override`. Clears 2x `missing-inheritance`.
- Suppress `missing-zero-check` at the 5 sites where zero address is
  documented-intentional: `BuybackBurner.setPool`/`setVault` ("not wired"
  state — `executeBuyback` reverts with `PoolNotWired`), `CapacityBond.
  setTreasury` (forfeit burns as fallback), and the two `FeeRouter`
  constructor params for `safetyReserve_` / `buybackBurner_` (allowed iff
  matching share is zero; cross-validated in `_setShares`).
- Suppress `unimplemented-functions` on the `abstract BuybackBurner` — the
  `_performSwap` virtual-without-body is the documented seam for the
  Balancer V3 deployment-PR subclass.

Aderyn (L-3: 6 → 3, L-5: 1 → 0):
- Real zero-checks added to `SafetyReserve.setBalancerPool`,
  `SafetyReserve.setChallengerIncentivePool`, and
  `CapacityBond.setSafetyReserve` — none had a documented intent for zero,
  and writing zero would brick the slash-routing flow.
- Remove the unused `error NoPendingCredit()` from CapacityBond.

Remaining sub-threshold findings (~21 slither timestamp lows on time-gated
state machines + aderyn centralization-risk / unchecked-return / large-numeric
lows) are accepted by design — suppressing each would add ~30 directives of
noise without clearing any gate.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings May 28, 2026 15:50
@github-actions

github-actions Bot commented May 28, 2026 •

Copy link
Copy Markdown

Gas snapshot

Gas changes vs base
Compiling 93 files with Solc 0.8.28
Solc 0.8.28 finished in 6.10s
Compiler run successful!

Ran 26 tests for test/CapacityBond.t.sol:CapacityBondTest
[PASS] test_claimVestedCredit_movesIntoActiveStake() (gas: 214330)
[PASS] test_claimVestedCredit_multiClaimFollowsLinearCurve() (gas: 218946)
[PASS] test_claimVestedCredit_revertsWhenNoActiveStake() (gas: 144394)
[PASS] test_claimVestedCredit_revertsWhenSlashedInWindow() (gas: 478976)
[PASS] test_claimVestedCredit_succeedsAfterSlashGateExpires() (gas: 482020)
[PASS] test_clearSlashedAtEpoch_clears() (gas: 389628)
[PASS] test_clearSlashedAtEpoch_requiresRole() (gas: 13524)
[PASS] test_creditSlash_routesThroughChallengerAndSafety() (gas: 475913)
[PASS] test_declaredMbps_storesValue() (gas: 37816)
[PASS] test_firstBondedAt_immutableAcrossReBonds() (gas: 111434)
[PASS] test_firstBondedAt_setsOnFirstStake() (gas: 102522)
[PASS] test_forfeitUnvestedCredit_burnsWhenNoTreasury() (gas: 246086)
[PASS] test_forfeitUnvestedCredit_doesNotClawBackVestedUnclaimed() (gas: 281790)
[PASS] test_forfeitUnvestedCredit_onUnbond() (gas: 290469)
[PASS] test_genesisCredit_fullVestAfterDuration() (gas: 141147)
[PASS] test_genesisCredit_grantWithinWindow() (gas: 139043)
[PASS] test_genesisCredit_revertsAfterWindow() (gas: 82695)
[PASS] test_genesisCredit_vestsLinearly() (gas: 141493)
[PASS] test_pendingCreditSlash_reducesOriginalGrant() (gas: 473127)
[PASS] test_slashHitsVestedAndUnvestedTogether() (gas: 516233)
[PASS] test_slashHitsVestedButUnclaimed() (gas: 483695)
[PASS] test_slashId_persistsRecord() (gas: 374509)
[PASS] test_slash_stampsSlashedAtEpoch() (gas: 374635)
[PASS] test_slash_succeedsEvenWhenInflowCallbackReverts() (gas: 335597)
[PASS] test_slashedAtEpoch_zeroBeforeSlash() (gas: 10130)
[PASS] test_updateRegion_cooldownAndPrevSnapshot() (gas: 506989)
Suite result: ok. 26 passed; 0 failed; 0 skipped; finished in 13.76ms (12.40ms CPU time)

Ran 13 tests for test/ContentBlacklist.t.sol:ContentBlacklistTest
[PASS] test_addHashGlobal_andQuery() (gas: 38191)
[PASS] test_addHashRegional_globalTakesPrecedence() (gas: 42002)
[PASS] test_addOperator_callsEjectOnCapacityBond() (gas: 91592)
[PASS] test_fullAppealFlow_ratifyRemovesHash() (gas: 275630)
[PASS] test_hasActiveAppeal_clearedOnLapseOpen() (gas: 242204)
[PASS] test_hasActiveAppeal_clearedOnReject() (gas: 433904)
[PASS] test_hasActiveAppeal_clearedOnReverse() (gas: 255003)
[PASS] test_openBlacklistAppeal_revertsDuplicatePerHash() (gas: 356697)
[PASS] test_openBlacklistAppeal_revertsOnEntryNotBlacklisted() (gas: 18678)
[PASS] test_openBlacklistAppeal_revertsOnZeroRegion() (gas: 16243)
[PASS] test_regionalCap_blocksMoreThanThreeActiveAppeals() (gas: 706600)
[PASS] test_rejectAppeal_burnsBond() (gas: 247916)
[PASS] test_reverseAppeal_clearsSuspendedAndBurnsBond() (gas: 261628)
Suite result: ok. 13 passed; 0 failed; 0 skipped; finished in 2.55ms (1.81ms CPU time)

Ran 11 tests for test/DecdnGovernor.t.sol:DecdnGovernorTest
[PASS] test_getVotes_halfRamp() (gas: 173099)
[PASS] test_getVotes_historicalSnapshotIgnoresFutureSlash() (gas: 221405)
[PASS] test_getVotes_ramp() (gas: 173019)
[PASS] test_getVotes_recoversAfterWindowSlidesPastSlash() (gas: 196807)
[PASS] test_getVotes_uncappedWhenBelowCap() (gas: 173050)
[PASS] test_getVotes_zeroIfNeverBonded() (gas: 93615)
[PASS] test_getVotes_zeroWhenSlashedInWindow() (gas: 119032)
[PASS] test_proposalThreshold_isPointOnePercent() (gas: 71784)
[PASS] test_quorum_isFourPercentOfTotalBytesInWindow() (gas: 71639)
[PASS] test_setVoteCapBps_enforcesBounds() (gas: 10766)
[PASS] test_voteCapBpsAt_preservesPriorReadAfterLaterPush() (gas: 4089459)
Suite result: ok. 11 passed; 0 failed; 0 skipped; finished in 4.18ms (2.88ms CPU time)

Ran 9 tests for test/FeeRouter.t.sol:FeeRouterTest
[PASS] test_bytesInWindow_sumsTrailingWindow() (gas: 540826)
[PASS] test_bytesInWindow_zeroWindowReturnsZero() (gas: 9304)
[PASS] test_routeSettlement_distributesFourLegs() (gas: 265962)
[PASS] test_routeSettlement_dustRoutesToOperatorWhenSafetyUnset() (gas: 157187)
[PASS] test_routeSettlement_incrementsBytesPerEpoch() (gas: 251733)
[PASS] test_routeSettlement_revertsWithoutRouterRole() (gas: 89206)
[PASS] test_setShares_rejectsNonZeroShareWithoutDestination() (gas: 15980)
[PASS] test_setShares_rejectsSumNot10000() (gas: 14436)
[PASS] test_setWindowEpochs_enforcesBounds() (gas: 32980)
Suite result: ok. 9 passed; 0 failed; 0 skipped; finished in 2.12ms (1.53ms CPU time)

Ran 44 tests for test/TestnetFaucet.t.sol:TestnetFaucetTest
[PASS] testFuzz_claim_atOrAboveCooldown(uint256) (runs: 1024, μ: 91481, ~: 91528)
[PASS] testFuzz_claim_belowCooldown(uint256) (runs: 1024, μ: 85158, ~: 85389)
[PASS] test_admin_canGrantAndRevokeRoles() (gas: 56401)
[PASS] test_claim_blocksReentrancy() (gas: 1550228)
[PASS] test_claim_happyPath() (gas: 82821)
[PASS] test_claim_perCallerCooldownIndependence() (gas: 133478)
[PASS] test_claim_revertsBeforeCooldown() (gas: 83092)
[PASS] test_claim_revertsOnInsufficientBalance() (gas: 50715)
[PASS] test_claim_revertsOneSecondBeforeCooldownBoundary() (gas: 82996)
[PASS] test_claim_revertsWhenPaused() (gas: 39998)
[PASS] test_claim_succeedsAfterCooldown() (gas: 90430)
[PASS] test_claim_succeedsAtExactCooldownBoundary() (gas: 87103)
[PASS] test_constructor_allowsZeroCooldown() (gas: 1810378)
[PASS] test_constructor_revertsOnCooldownExceedingMax() (gas: 1015061)
[PASS] test_constructor_revertsOnMainnetChainId() (gas: 988198)
[PASS] test_constructor_revertsOnZeroAdmin() (gas: 985898)
[PASS] test_constructor_revertsOnZeroClaimAmount() (gas: 988045)
[PASS] test_constructor_revertsOnZeroFunding() (gas: 988061)
[PASS] test_constructor_revertsOnZeroGovernance() (gas: 985864)
[PASS] test_constructor_revertsOnZeroPauser() (gas: 985954)
[PASS] test_constructor_revertsOnZeroTokenAddress() (gas: 70468)
[PASS] test_constructor_revertsOnZeroTreasury() (gas: 987830)
[PASS] test_constructor_revertsWhenTreasuryNotApproved() (gas: 1110690)
[PASS] test_constructor_setsStateAndRoles() (gas: 43070)
[PASS] test_nonAdmin_cannotGrantRoles() (gas: 17889)
[PASS] test_pause_blocksClaimUnpauseRestores() (gas: 91691)
[PASS] test_pause_revertsOnNonPauser() (gas: 14607)
[PASS] test_setClaimAmount_revertsOnNonGovernance() (gas: 14702)
[PASS] test_setClaimAmount_revertsOnZero() (gas: 13338)
[PASS] test_setClaimAmount_updatesAndEmits() (gas: 22083)
[PASS] test_setCooldown_acceptsMaxCooldown() (gas: 20228)
[PASS] test_setCooldown_allowsZero() (gas: 94920)
[PASS] test_setCooldown_revertsOnExceedingMax() (gas: 13790)
[PASS] test_setCooldown_revertsOnNonGovernance() (gas: 14705)
[PASS] test_setCooldown_updatesAndEmits() (gas: 22231)
[PASS] test_timeUntilNext_tracksCooldownWindow() (gas: 82615)
[PASS] test_timeUntilNext_zeroBeforeFirstClaim() (gas: 10099)
[PASS] test_unpause_revertsOnNonPauser() (gas: 43483)
[PASS] test_withdraw_revertsOnInsufficientBalance() (gas: 26877)
[PASS] test_withdraw_revertsOnNonGovernance() (gas: 17089)
[PASS] test_withdraw_revertsOnZeroAmount() (gas: 20838)
[PASS] test_withdraw_revertsOnZeroTo() (gas: 18662)
[PASS] test_withdraw_transfersAndEmits() (gas: 44129)
[PASS] test_withdraw_worksWhilePaused() (gas: 68286)
Suite result: ok. 44 passed; 0 failed; 0 skipped; finished in 246.32ms (244.73ms CPU time)

Ran 10 tests for test/Token.t.sol:TokenTest
[PASS] testFuzz_burn_reducesSupplyByExactAmount(uint256) (runs: 1024, μ: 27799, ~: 27700)
[PASS] test_burnFrom_consumesAllowance() (gas: 38534)
[PASS] test_burn_reducesTotalSupplyAndBalance() (gas: 26044)
[PASS] test_constructor_metadata() (gas: 17896)
[PASS] test_constructor_mintsFullSupplyToHolder() (gas: 12954)
[PASS] test_constructor_revertsOnZeroInitialHolder() (gas: 83264)
[PASS] test_constructor_totalSupplyConstantMatches() (gas: 9364)
[PASS] test_noMintFunctionExposed() (gas: 10765)
[PASS] test_noVotesSurfaceExposed() (gas: 11991)
[PASS] test_permit_setsAllowance() (gas: 67380)
Suite result: ok. 10 passed; 0 failed; 0 skipped; finished in 74.19ms (73.70ms CPU time)

Ran 14 tests for test/SafetyReserve.t.sol:SafetyReserveTest
[PASS] test_availableUsdc_subtractsEscrowLien() (gas: 334020)
[PASS] test_cleanupExpiredAppeal_openLapse() (gas: 247701)
[PASS] test_disbursePending_drainsAfterRefill() (gas: 448281)
[PASS] test_disbursePending_emitsSkippedWhenEmpty() (gas: 15301)
[PASS] test_fullAppealFlow_ratify() (gas: 459773)
[PASS] test_fullAppealFlow_reverseClearsSlashedAtEpoch() (gas: 329364)
[PASS] test_openSlashAppeal_revertsDuplicateSlashId() (gas: 339791)
[PASS] test_openSlashAppeal_revertsUnknownSlash() (gas: 28338)
[PASS] test_openSlashAppeal_validatesOperatorFromCapacityBond() (gas: 275621)
[PASS] test_payout_immediatePay() (gas: 202893)
[PASS] test_payout_queueOnInsufficientLiquidity() (gas: 124540)
[PASS] test_recordSlashInflow_attributesToOperator() (gas: 69520)
[PASS] test_rejectAppeal_burnsBond() (gas: 252406)
[PASS] test_swapAccumulatedTokens_revertsUntilImplemented() (gas: 75861)
Suite result: ok. 14 passed; 0 failed; 0 skipped; finished in 2.79ms (1.85ms CPU time)

Ran 26 tests for test/PublisherRegistry.t.sol:PublisherRegistryTest
[PASS] testFuzz_createNamespace_idsAreSequentialAndOwned(uint8) (runs: 1024, μ: 750396, ~: 427148)
[PASS] test_claimContent_multiClaimAcrossNamespaces() (gas: 233820)
[PASS] test_claimContent_recordsClaim() (gas: 134733)
[PASS] test_claimContent_revertsForDefaultOpenNamespace() (gas: 13756)
[PASS] test_claimContent_revertsIfNotOwner() (gas: 66829)
[PASS] test_claimContent_revertsOnDuplicateSameNamespace() (gas: 135341)
[PASS] test_constructor_revertsZeroAdmin() (gas: 36674)
[PASS] test_constructor_setsDefaultsAndRoles() (gas: 19037)
[PASS] test_createNamespace_assignsIdsFromOne() (gas: 92750)
[PASS] test_createNamespace_revertsAtCap() (gas: 98492)
[PASS] test_createNamespace_zeroIsNeverAssigned() (gas: 65471)
[PASS] test_namespaceOf_emptyForUnclaimed() (gas: 8273)
[PASS] test_setMaxNamespaces_revertsOutOfBounds() (gas: 17627)
[PASS] test_setMaxNamespaces_revertsWithoutRole() (gas: 13384)
[PASS] test_setMaxNamespaces_withinBounds() (gas: 20687)
[PASS] test_setTransferTimelock_revertsOutOfBounds() (gas: 17706)
[PASS] test_setTransferTimelock_withinBounds() (gas: 20560)
[PASS] test_transfer_cancelByOwner() (gas: 78690)
[PASS] test_transfer_cancelRevertsIfNotOwner() (gas: 93302)
[PASS] test_transfer_finalizeRevertsIfNotPendingOwner() (gas: 93817)
[PASS] test_transfer_finalizeRevertsNoPending() (gas: 68566)
[PASS] test_transfer_fullFlow() (gas: 98658)
[PASS] test_transfer_initiateRevertsIfNotOwner() (gas: 66923)
[PASS] test_transfer_initiateRevertsZeroNewOwner() (gas: 64330)
[PASS] test_transfer_revertsWhenRecipientAtCap() (gas: 150145)
[PASS] test_transfer_selfTransferExemptFromCap() (gas: 95404)
Suite result: ok. 26 passed; 0 failed; 0 skipped; finished in 654.20ms (654.70ms CPU time)

Ran 8 test suites in 660.72ms (1.00s CPU time): 153 tests passed, 0 failed, 0 skipped (153 total tests)
━ CapacityBondTest::test_claimVestedCredit_movesIntoActiveStake() (gas: 214330 → 214330 | 0 0.000%)
━ CapacityBondTest::test_claimVestedCredit_multiClaimFollowsLinearCurve() (gas: 218946 → 218946 | 0 0.000%)
━ CapacityBondTest::test_claimVestedCredit_revertsWhenNoActiveStake() (gas: 144394 → 144394 | 0 0.000%)
━ CapacityBondTest::test_claimVestedCredit_revertsWhenSlashedInWindow() (gas: 478976 → 478976 | 0 0.000%)
━ CapacityBondTest::test_claimVestedCredit_succeedsAfterSlashGateExpires() (gas: 482020 → 482020 | 0 0.000%)
━ CapacityBondTest::test_clearSlashedAtEpoch_clears() (gas: 389628 → 389628 | 0 0.000%)
━ CapacityBondTest::test_clearSlashedAtEpoch_requiresRole() (gas: 13524 → 13524 | 0 0.000%)
━ CapacityBondTest::test_creditSlash_routesThroughChallengerAndSafety() (gas: 475913 → 475913 | 0 0.000%)
━ CapacityBondTest::test_declaredMbps_storesValue() (gas: 37816 → 37816 | 0 0.000%)
━ CapacityBondTest::test_firstBondedAt_immutableAcrossReBonds() (gas: 111434 → 111434 | 0 0.000%)
━ CapacityBondTest::test_firstBondedAt_setsOnFirstStake() (gas: 102522 → 102522 | 0 0.000%)
━ CapacityBondTest::test_forfeitUnvestedCredit_burnsWhenNoTreasury() (gas: 246086 → 246086 | 0 0.000%)
━ CapacityBondTest::test_forfeitUnvestedCredit_doesNotClawBackVestedUnclaimed() (gas: 281790 → 281790 | 0 0.000%)
━ CapacityBondTest::test_forfeitUnvestedCredit_onUnbond() (gas: 290469 → 290469 | 0 0.000%)
━ CapacityBondTest::test_genesisCredit_fullVestAfterDuration() (gas: 141147 → 141147 | 0 0.000%)
━ CapacityBondTest::test_genesisCredit_grantWithinWindow() (gas: 139043 → 139043 | 0 0.000%)
━ CapacityBondTest::test_genesisCredit_revertsAfterWindow() (gas: 82695 → 82695 | 0 0.000%)
━ CapacityBondTest::test_genesisCredit_vestsLinearly() (gas: 141493 → 141493 | 0 0.000%)
━ CapacityBondTest::test_pendingCreditSlash_reducesOriginalGrant() (gas: 473127 → 473127 | 0 0.000%)
━ CapacityBondTest::test_slashHitsVestedAndUnvestedTogether() (gas: 516233 → 516233 | 0 0.000%)
━ CapacityBondTest::test_slashHitsVestedButUnclaimed() (gas: 483695 → 483695 | 0 0.000%)
━ CapacityBondTest::test_slashId_persistsRecord() (gas: 374509 → 374509 | 0 0.000%)
━ CapacityBondTest::test_slash_stampsSlashedAtEpoch() (gas: 374635 → 374635 | 0 0.000%)
━ CapacityBondTest::test_slash_succeedsEvenWhenInflowCallbackReverts() (gas: 335597 → 335597 | 0 0.000%)
━ CapacityBondTest::test_slashedAtEpoch_zeroBeforeSlash() (gas: 10130 → 10130 | 0 0.000%)
━ CapacityBondTest::test_updateRegion_cooldownAndPrevSnapshot() (gas: 506989 → 506989 | 0 0.000%)
━ ContentBlacklistTest::test_addHashGlobal_andQuery() (gas: 38191 → 38191 | 0 0.000%)
━ ContentBlacklistTest::test_addHashRegional_globalTakesPrecedence() (gas: 42002 → 42002 | 0 0.000%)
━ ContentBlacklistTest::test_addOperator_callsEjectOnCapacityBond() (gas: 91592 → 91592 | 0 0.000%)
━ ContentBlacklistTest::test_fullAppealFlow_ratifyRemovesHash() (gas: 275630 → 275630 | 0 0.000%)
━ ContentBlacklistTest::test_hasActiveAppeal_clearedOnLapseOpen() (gas: 242204 → 242204 | 0 0.000%)
━ ContentBlacklistTest::test_hasActiveAppeal_clearedOnReject() (gas: 433904 → 433904 | 0 0.000%)
━ ContentBlacklistTest::test_hasActiveAppeal_clearedOnReverse() (gas: 255003 → 255003 | 0 0.000%)
━ ContentBlacklistTest::test_openBlacklistAppeal_revertsDuplicatePerHash() (gas: 356697 → 356697 | 0 0.000%)
━ ContentBlacklistTest::test_openBlacklistAppeal_revertsOnEntryNotBlacklisted() (gas: 18678 → 18678 | 0 0.000%)
━ ContentBlacklistTest::test_openBlacklistAppeal_revertsOnZeroRegion() (gas: 16243 → 16243 | 0 0.000%)
━ ContentBlacklistTest::test_regionalCap_blocksMoreThanThreeActiveAppeals() (gas: 706600 → 706600 | 0 0.000%)
━ ContentBlacklistTest::test_rejectAppeal_burnsBond() (gas: 247916 → 247916 | 0 0.000%)
━ ContentBlacklistTest::test_reverseAppeal_clearsSuspendedAndBurnsBond() (gas: 261628 → 261628 | 0 0.000%)
━ DecdnGovernorTest::test_getVotes_halfRamp() (gas: 173099 → 173099 | 0 0.000%)
━ DecdnGovernorTest::test_getVotes_historicalSnapshotIgnoresFutureSlash() (gas: 221405 → 221405 | 0 0.000%)
━ DecdnGovernorTest::test_getVotes_ramp() (gas: 173019 → 173019 | 0 0.000%)
━ DecdnGovernorTest::test_getVotes_recoversAfterWindowSlidesPastSlash() (gas: 196807 → 196807 | 0 0.000%)
━ DecdnGovernorTest::test_getVotes_uncappedWhenBelowCap() (gas: 173050 → 173050 | 0 0.000%)
━ DecdnGovernorTest::test_getVotes_zeroIfNeverBonded() (gas: 93615 → 93615 | 0 0.000%)
━ DecdnGovernorTest::test_getVotes_zeroWhenSlashedInWindow() (gas: 119032 → 119032 | 0 0.000%)
━ DecdnGovernorTest::test_proposalThreshold_isPointOnePercent() (gas: 71784 → 71784 | 0 0.000%)
━ DecdnGovernorTest::test_quorum_isFourPercentOfTotalBytesInWindow() (gas: 71639 → 71639 | 0 0.000%)
━ DecdnGovernorTest::test_setVoteCapBps_enforcesBounds() (gas: 10766 → 10766 | 0 0.000%)
━ DecdnGovernorTest::test_voteCapBpsAt_preservesPriorReadAfterLaterPush() (gas: 4089459 → 4089459 | 0 0.000%)
━ FeeRouterTest::test_bytesInWindow_sumsTrailingWindow() (gas: 540826 → 540826 | 0 0.000%)
━ FeeRouterTest::test_bytesInWindow_zeroWindowReturnsZero() (gas: 9304 → 9304 | 0 0.000%)
━ FeeRouterTest::test_routeSettlement_distributesFourLegs() (gas: 265962 → 265962 | 0 0.000%)
━ FeeRouterTest::test_routeSettlement_dustRoutesToOperatorWhenSafetyUnset() (gas: 157187 → 157187 | 0 0.000%)
━ FeeRouterTest::test_routeSettlement_incrementsBytesPerEpoch() (gas: 251733 → 251733 | 0 0.000%)
━ FeeRouterTest::test_routeSettlement_revertsWithoutRouterRole() (gas: 89206 → 89206 | 0 0.000%)
━ FeeRouterTest::test_setShares_rejectsNonZeroShareWithoutDestination() (gas: 15980 → 15980 | 0 0.000%)
━ FeeRouterTest::test_setShares_rejectsSumNot10000() (gas: 14436 → 14436 | 0 0.000%)
━ FeeRouterTest::test_setWindowEpochs_enforcesBounds() (gas: 32980 → 32980 | 0 0.000%)
━ PublisherRegistryTest::test_claimContent_multiClaimAcrossNamespaces() (gas: 233820 → 233820 | 0 0.000%)
━ PublisherRegistryTest::test_claimContent_recordsClaim() (gas: 134733 → 134733 | 0 0.000%)
━ PublisherRegistryTest::test_claimContent_revertsForDefaultOpenNamespace() (gas: 13756 → 13756 | 0 0.000%)
━ PublisherRegistryTest::test_claimContent_revertsIfNotOwner() (gas: 66829 → 66829 | 0 0.000%)
━ PublisherRegistryTest::test_claimContent_revertsOnDuplicateSameNamespace() (gas: 135341 → 135341 | 0 0.000%)
━ PublisherRegistryTest::test_constructor_revertsZeroAdmin() (gas: 36674 → 36674 | 0 0.000%)
━ PublisherRegistryTest::test_constructor_setsDefaultsAndRoles() (gas: 19037 → 19037 | 0 0.000%)
━ PublisherRegistryTest::test_createNamespace_assignsIdsFromOne() (gas: 92750 → 92750 | 0 0.000%)
━ PublisherRegistryTest::test_createNamespace_revertsAtCap() (gas: 98492 → 98492 | 0 0.000%)
━ PublisherRegistryTest::test_createNamespace_zeroIsNeverAssigned() (gas: 65471 → 65471 | 0 0.000%)
━ PublisherRegistryTest::test_namespaceOf_emptyForUnclaimed() (gas: 8273 → 8273 | 0 0.000%)
━ PublisherRegistryTest::test_setMaxNamespaces_revertsOutOfBounds() (gas: 17627 → 17627 | 0 0.000%)
━ PublisherRegistryTest::test_setMaxNamespaces_revertsWithoutRole() (gas: 13384 → 13384 | 0 0.000%)
━ PublisherRegistryTest::test_setMaxNamespaces_withinBounds() (gas: 20687 → 20687 | 0 0.000%)
━ PublisherRegistryTest::test_setTransferTimelock_revertsOutOfBounds() (gas: 17706 → 17706 | 0 0.000%)
━ PublisherRegistryTest::test_setTransferTimelock_withinBounds() (gas: 20560 → 20560 | 0 0.000%)
━ PublisherRegistryTest::test_transfer_cancelByOwner() (gas: 78690 → 78690 | 0 0.000%)
━ PublisherRegistryTest::test_transfer_cancelRevertsIfNotOwner() (gas: 93302 → 93302 | 0 0.000%)
━ PublisherRegistryTest::test_transfer_finalizeRevertsIfNotPendingOwner() (gas: 93817 → 93817 | 0 0.000%)
━ PublisherRegistryTest::test_transfer_finalizeRevertsNoPending() (gas: 68566 → 68566 | 0 0.000%)
━ PublisherRegistryTest::test_transfer_fullFlow() (gas: 98658 → 98658 | 0 0.000%)
━ PublisherRegistryTest::test_transfer_initiateRevertsIfNotOwner() (gas: 66923 → 66923 | 0 0.000%)
━ PublisherRegistryTest::test_transfer_initiateRevertsZeroNewOwner() (gas: 64330 → 64330 | 0 0.000%)
━ PublisherRegistryTest::test_transfer_revertsWhenRecipientAtCap() (gas: 150145 → 150145 | 0 0.000%)
━ PublisherRegistryTest::test_transfer_selfTransferExemptFromCap() (gas: 95404 → 95404 | 0 0.000%)
━ SafetyReserveTest::test_availableUsdc_subtractsEscrowLien() (gas: 334020 → 334020 | 0 0.000%)
━ SafetyReserveTest::test_cleanupExpiredAppeal_openLapse() (gas: 247701 → 247701 | 0 0.000%)
━ SafetyReserveTest::test_disbursePending_drainsAfterRefill() (gas: 448281 → 448281 | 0 0.000%)
━ SafetyReserveTest::test_disbursePending_emitsSkippedWhenEmpty() (gas: 15301 → 15301 | 0 0.000%)
━ SafetyReserveTest::test_fullAppealFlow_ratify() (gas: 459773 → 459773 | 0 0.000%)
━ SafetyReserveTest::test_fullAppealFlow_reverseClearsSlashedAtEpoch() (gas: 329364 → 329364 | 0 0.000%)
━ SafetyReserveTest::test_openSlashAppeal_revertsDuplicateSlashId() (gas: 339791 → 339791 | 0 0.000%)
━ SafetyReserveTest::test_openSlashAppeal_revertsUnknownSlash() (gas: 28338 → 28338 | 0 0.000%)
━ SafetyReserveTest::test_openSlashAppeal_validatesOperatorFromCapacityBond() (gas: 275621 → 275621 | 0 0.000%)
━ SafetyReserveTest::test_payout_immediatePay() (gas: 202893 → 202893 | 0 0.000%)
━ SafetyReserveTest::test_payout_queueOnInsufficientLiquidity() (gas: 124540 → 124540 | 0 0.000%)
━ SafetyReserveTest::test_recordSlashInflow_attributesToOperator() (gas: 69520 → 69520 | 0 0.000%)
━ SafetyReserveTest::test_rejectAppeal_burnsBond() (gas: 252406 → 252406 | 0 0.000%)
━ TestnetFaucetTest::testFuzz_claim_atOrAboveCooldown(uint256) (gas: 91528 → 91528 | 0 0.000%)
━ TestnetFaucetTest::testFuzz_claim_belowCooldown(uint256) (gas: 85389 → 85389 | 0 0.000%)
━ TestnetFaucetTest::test_admin_canGrantAndRevokeRoles() (gas: 56401 → 56401 | 0 0.000%)
━ TestnetFaucetTest::test_claim_blocksReentrancy() (gas: 1550228 → 1550228 | 0 0.000%)
━ TestnetFaucetTest::test_claim_happyPath() (gas: 82821 → 82821 | 0 0.000%)
━ TestnetFaucetTest::test_claim_perCallerCooldownIndependence() (gas: 133478 → 133478 | 0 0.000%)
━ TestnetFaucetTest::test_claim_revertsBeforeCooldown() (gas: 83092 → 83092 | 0 0.000%)
━ TestnetFaucetTest::test_claim_revertsOnInsufficientBalance() (gas: 50715 → 50715 | 0 0.000%)
━ TestnetFaucetTest::test_claim_revertsOneSecondBeforeCooldownBoundary() (gas: 82996 → 82996 | 0 0.000%)
━ TestnetFaucetTest::test_claim_revertsWhenPaused() (gas: 39998 → 39998 | 0 0.000%)
━ TestnetFaucetTest::test_claim_succeedsAfterCooldown() (gas: 90430 → 90430 | 0 0.000%)
━ TestnetFaucetTest::test_claim_succeedsAtExactCooldownBoundary() (gas: 87103 → 87103 | 0 0.000%)
━ TestnetFaucetTest::test_constructor_allowsZeroCooldown() (gas: 1810378 → 1810378 | 0 0.000%)
━ TestnetFaucetTest::test_constructor_revertsOnCooldownExceedingMax() (gas: 1015061 → 1015061 | 0 0.000%)
━ TestnetFaucetTest::test_constructor_revertsOnMainnetChainId() (gas: 988198 → 988198 | 0 0.000%)
━ TestnetFaucetTest::test_constructor_revertsOnZeroAdmin() (gas: 985898 → 985898 | 0 0.000%)
━ TestnetFaucetTest::test_constructor_revertsOnZeroClaimAmount() (gas: 988045 → 988045 | 0 0.000%)
━ TestnetFaucetTest::test_constructor_revertsOnZeroFunding() (gas: 988061 → 988061 | 0 0.000%)
━ TestnetFaucetTest::test_constructor_revertsOnZeroGovernance() (gas: 985864 → 985864 | 0 0.000%)
━ TestnetFaucetTest::test_constructor_revertsOnZeroPauser() (gas: 985954 → 985954 | 0 0.000%)
━ TestnetFaucetTest::test_constructor_revertsOnZeroTokenAddress() (gas: 70468 → 70468 | 0 0.000%)
━ TestnetFaucetTest::test_constructor_revertsOnZeroTreasury() (gas: 987830 → 987830 | 0 0.000%)
━ TestnetFaucetTest::test_constructor_revertsWhenTreasuryNotApproved() (gas: 1110690 → 1110690 | 0 0.000%)
━ TestnetFaucetTest::test_constructor_setsStateAndRoles() (gas: 43070 → 43070 | 0 0.000%)
━ TestnetFaucetTest::test_nonAdmin_cannotGrantRoles() (gas: 17889 → 17889 | 0 0.000%)
━ TestnetFaucetTest::test_pause_blocksClaimUnpauseRestores() (gas: 91691 → 91691 | 0 0.000%)
━ TestnetFaucetTest::test_pause_revertsOnNonPauser() (gas: 14607 → 14607 | 0 0.000%)
━ TestnetFaucetTest::test_setClaimAmount_revertsOnNonGovernance() (gas: 14702 → 14702 | 0 0.000%)
━ TestnetFaucetTest::test_setClaimAmount_revertsOnZero() (gas: 13338 → 13338 | 0 0.000%)
━ TestnetFaucetTest::test_setClaimAmount_updatesAndEmits() (gas: 22083 → 22083 | 0 0.000%)
━ TestnetFaucetTest::test_setCooldown_acceptsMaxCooldown() (gas: 20228 → 20228 | 0 0.000%)
━ TestnetFaucetTest::test_setCooldown_allowsZero() (gas: 94920 → 94920 | 0 0.000%)
━ TestnetFaucetTest::test_setCooldown_revertsOnExceedingMax() (gas: 13790 → 13790 | 0 0.000%)
━ TestnetFaucetTest::test_setCooldown_revertsOnNonGovernance() (gas: 14705 → 14705 | 0 0.000%)
━ TestnetFaucetTest::test_setCooldown_updatesAndEmits() (gas: 22231 → 22231 | 0 0.000%)
━ TestnetFaucetTest::test_timeUntilNext_tracksCooldownWindow() (gas: 82615 → 82615 | 0 0.000%)
━ TestnetFaucetTest::test_timeUntilNext_zeroBeforeFirstClaim() (gas: 10099 → 10099 | 0 0.000%)
━ TestnetFaucetTest::test_unpause_revertsOnNonPauser() (gas: 43483 → 43483 | 0 0.000%)
━ TestnetFaucetTest::test_withdraw_revertsOnInsufficientBalance() (gas: 26877 → 26877 | 0 0.000%)
━ TestnetFaucetTest::test_withdraw_revertsOnNonGovernance() (gas: 17089 → 17089 | 0 0.000%)
━ TestnetFaucetTest::test_withdraw_revertsOnZeroAmount() (gas: 20838 → 20838 | 0 0.000%)
━ TestnetFaucetTest::test_withdraw_revertsOnZeroTo() (gas: 18662 → 18662 | 0 0.000%)
━ TestnetFaucetTest::test_withdraw_transfersAndEmits() (gas: 44129 → 44129 | 0 0.000%)
━ TestnetFaucetTest::test_withdraw_worksWhilePaused() (gas: 68286 → 68286 | 0 0.000%)
━ TokenTest::testFuzz_burn_reducesSupplyByExactAmount(uint256) (gas: 27700 → 27700 | 0 0.000%)
━ TokenTest::test_burnFrom_consumesAllowance() (gas: 38534 → 38534 | 0 0.000%)
━ TokenTest::test_burn_reducesTotalSupplyAndBalance() (gas: 26044 → 26044 | 0 0.000%)
━ TokenTest::test_constructor_metadata() (gas: 17896 → 17896 | 0 0.000%)
━ TokenTest::test_constructor_mintsFullSupplyToHolder() (gas: 12954 → 12954 | 0 0.000%)
━ TokenTest::test_constructor_revertsOnZeroInitialHolder() (gas: 83264 → 83264 | 0 0.000%)
━ TokenTest::test_constructor_totalSupplyConstantMatches() (gas: 9364 → 9364 | 0 0.000%)
━ TokenTest::test_noMintFunctionExposed() (gas: 10765 → 10765 | 0 0.000%)
━ TokenTest::test_noVotesSurfaceExposed() (gas: 11991 → 11991 | 0 0.000%)
━ TokenTest::test_permit_setsAllowance() (gas: 67380 → 67380 | 0 0.000%)
↑ SafetyReserveTest::test_swapAccumulatedTokens_revertsUntilImplemented() (gas: 75826 → 75861 | 35 0.046%)
↓ PublisherRegistryTest::testFuzz_createNamespace_idsAreSequentialAndOwned(uint8) (gas: 427490 → 427148 | -342 -0.080%)

--------------------------------------------------------------------------------
Total tests: 153, ↑ 1, ↓ 1, ━ 151
Overall gas change: -307 (-0.001%)

Run: 26586508188

@github-actions

github-actions Bot commented May 28, 2026 •

Copy link
Copy Markdown

Contracts coverage

Line coverage: 67.88% (856/1261 lines)
▲ +0.08pp vs base (67.81% → 67.88%)
Run: 26586508188

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request refactors the codebase by extracting the ICapacityBondEjector and ICapacityBondReporter interfaces into standalone files and having CapacityBond explicitly inherit and override their functions. It also introduces zero-address validation checks in CapacityBond.setSafetyReserve and SafetyReserve setter functions, alongside adding several Slither static analysis disable annotations. The feedback recommends correcting an outdated line number reference in a comment within FeeRouter.sol to ensure accuracy.

Comment thread contracts/src/FeeRouter.sol Resolved

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

This PR triages Solidity static-analysis findings (Slither + Aderyn) from the post-#684 contract suite by addressing low-effort root causes (e.g., missing inheritance declarations, missing zero checks, unused error) and adding narrowly-scoped inline suppressions where address(0) is intentionally supported.

Changes:

  • Hoists ICapacityBondEjector / ICapacityBondReporter into standalone src/interfaces/ files and updates contracts/tests to import them.
  • Adds explicit zero-address guards to governance setters where zero would break critical wiring (SafetyReserve pools, CapacityBond.setSafetyReserve).
  • Documents intentional address(0) allowances with Slither suppressions and removes an unused custom error.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
contracts/test/FeeRouter.t.sol Updates interface import path after interface hoist.
contracts/test/ContentBlacklist.t.sol Updates interface import path after interface hoist.
contracts/src/SafetyReserve.sol Adds zero-address checks for pool wiring setters.
contracts/src/interfaces/ICapacityBondReporter.sol New standalone reporter interface used by FeeRouter and implemented by CapacityBond.
contracts/src/interfaces/ICapacityBondEjector.sol New standalone ejector interface used by ContentBlacklist and implemented by CapacityBond.
contracts/src/FeeRouter.sol Replaces inline interface with import; adds documented Slither suppressions for intentional zero-address cases.
contracts/src/ContentBlacklist.sol Replaces inline interface with import.
contracts/src/CapacityBond.sol Declares interface inheritance + overrides, removes unused error, adds zero-check for setSafetyReserve, and documents intentional zero in setTreasury.
contracts/src/BuybackBurner.sol Adds Slither suppression for abstract hook and documents intentional zero-address “not wired” mode in setters.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread contracts/src/FeeRouter.sol Resolved
thiras and others added 2 commits May 28, 2026 18:56
Bot reviewers flagged the `// See NatSpec on lines 161-164` reference as
both wrong (the @PARAM NatSpec is above the constructor signature) and
brittle (hard-coded line numbers drift). The @PARAM NatSpec already
documents the zero-allowed semantics — the inline comment was redundant.
Keep the two `slither-disable-next-line missing-zero-check` directives.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…rface NatSpec

- Add `override` to the four pre-existing `ICapacityBond` implementations
  on `CapacityBond` (`clearSlashedAtEpoch`, `firstBondedAt`, `slashedAtEpoch`,
  `slashRecords`) so the file no longer mixes styles with the three new
  `override` markers added for the hoisted `ICapacityBondEjector` /
  `ICapacityBondReporter` interfaces.
- Document on `ICapacityBondReporter.epochLength` why the interface is
  declared `view` rather than `pure` despite the production implementor
  being `pure` — test mocks need to return a constructor-stored value per
  instance, which `pure` (which can't read state or immutables) would block.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@thiras
thiras merged commit c27395b into main May 28, 2026
19 checks passed
@thiras
thiras deleted the chore/690-slither-aderyn-triage branch May 28, 2026 16:06
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.

ci(contracts): run slither + aderyn against the post-PR-#684 contract suite and resolve findings

2 participants