You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(contracts): SafetyReserve.ratifyAppeal strands a fast-tracked appeal if maxAppealRestitution is lowered below its escrow #702
ratifyAppeal then refuses to pay out if the recorded escrow now exceeds the cap:
SafetyReserve.sol:476-478
if (a.escrowAmount > maxAppealRestitution) {
revertRestitutionExceedsCap(a.escrowAmount, maxAppealRestitution);
}
But setMaxAppealRestitution has no floor and no guard against in-flight appeals:
SafetyReserve.sol:605-609
Consequence
If governance lowers maxAppealRestitution while an appeal is fast-tracked (escrowed at the old, higher cap), ratifyAppeal reverts permanently for that appeal. A validated, multisig-fast-tracked appellant can no longer be made whole. The escrow lien (totalEscrowLien) stays held against availableUsdc(), and the only exit is letting the window lapse and calling cleanupExpiredAppeal, which refunds the bond but pays zero restitution — denying recourse governance already approved and tying up reserve capacity in the meantime.
This is not a duplicate of #687 (TWAP-based MAX_APPEAL_RESTITUTION). In fact, making the cap track a TWAP would make this strictly more likely, since the cap would move on its own between fast-track and ratify.
Suggested direction
Either:
Clamp at ratify: uint256 restitution = a.escrowAmount < maxAppealRestitution ? a.escrowAmount : maxAppealRestitution; (and drop the revert), or
Treat the fast-track snapshot as binding: the escrow was already solvency-checked and lien-reserved, so honor a.escrowAmount regardless of later cap changes.
Test gap
test/SafetyReserve.t.sol exercises ratifyAppeal and setMaxAppealRestitution only in isolation; add a test that fast-tracks, lowers the cap, then ratifies.
SafetyReserve.ratifyAppeal has a state-inconsistency bug: it permanently reverts for any appeal that was fast-tracked (escrowed) at a cap higher than the cap at ratify-time, because it compares the snapshot escrow amount against the currentmaxAppealRestitution and reverts instead of clamping. The only escape is cleanupExpiredAppeal, which refunds the bond but pays zero restitution — denying recourse that governance already approved and holding a totalEscrowLien against available reserve until the window expires. Making the cap TWAP-driven (#687) would make this strictly more likely.
📊 Assessment
Dimension
Value
Reasoning
Type
Bug
Confirmed logic error with a permanent-revert consequence
Labels
bug, security, technical, medium (already applied)
Correctness/security issue in a payment-path contract; medium severity (requires a governance tx to trigger, but consequence is fund lock + denial of approved restitution)
Coding agent
Suitable
Root cause is well-scoped, two concrete fix options are provided, and a specific test gap is identified
Root cause:ratifyAppeal checks a.escrowAmount > maxAppealRestitution and hard-reverts rather than clamping. The escrow was already solvency-checked and lien-reserved at fast-track time, so honoring the snapshot is both logically consistent and gas-safe.
Preferred fix (binding snapshot):
// SafetyReserve.sol ratifyAppeal — replace the revert block with:uint256 restitution = a.escrowAmount; // honor the governance-approved snapshot
The lien already covers this amount, so no additional solvency check is needed.
Alternative fix (clamp at ratify):
uint256 restitution = a.escrowAmount < maxAppealRestitution
? a.escrowAmount
: maxAppealRestitution;
// drop the RestitutionExceedsCap revert
This is simpler but silently reduces an appellant's payout after governance lowers the cap — arguably a policy choice that should be explicit.
Recommended test to add in test/SafetyReserve.t.sol:
1. Fast-track an appeal → escrow recorded at cap C1
2. Call setMaxAppealRestitution(C1 / 2)
3. Call ratifyAppeal → assert it succeeds and pays out correctly (not C1 / 2 depends on chosen fix)
4. Assert totalEscrowLien returns to 0
setMaxAppealRestitution hardening (optional follow-up): Consider adding a floor that prevents the cap from being set below the maximum currently-escrowed appeal amount (totalEscrowLien is insufficient — it aggregates; you need per-appeal tracking or a simpler "no in-flight appeals" guard).
CLAUDE.md note: This is a Solidity contract fix; run (cd contracts && FOUNDRY_PROFILE=ci forge build --sizes --deny warnings && forge test) and both slither/aderyn checks before pushing. Watch for W5740 unreachable-code warnings if the revert RestitutionExceedsCap block is removed.
Recommend closing as not-planned — the vulnerability is structurally eliminated by the SafetyReserve removal (#708, ADR 033 retired).
The bug was specific to SafetyReserve.ratifyAppeal: a governance-lowered maxAppealRestitution USDC cap could strand a fast-tracked appeal escrowed at the old cap. That contract is gone, and the new SlashAppeal has none of the moving parts:
No ratifyAppeal, no maxAppealRestitution, no escrowAmount-vs-cap check — SlashAppeal never moves USDC (ADR 028: "No MAX_APPEAL_RESTITUTION cap exists").
Slashed TOKEN sits in CapacityBond escrow keyed by slashId; grantAppeal refunds it in full, upholdAppeal distributes 50/50 — neither reads a tunable cap. ADR 028 § Negative consequences calls this scenario "structurally impossible."
I checked the surviving SlashAppeal setters (setAppealBond, setChallengerIncentivePool) for an analogous strand-on-lower bug — neither feeds appeal resolution, so the class doesn't transfer. No code change is warranted against the current surface.
Activity
github-actions commentedon May 29, 2026
🎯 Triage report
SafetyReserve.ratifyAppealhas a state-inconsistency bug: it permanently reverts for any appeal that was fast-tracked (escrowed) at a cap higher than the cap at ratify-time, because it compares the snapshot escrow amount against the currentmaxAppealRestitutionand reverts instead of clamping. The only escape iscleanupExpiredAppeal, which refunds the bond but pays zero restitution — denying recourse that governance already approved and holding atotalEscrowLienagainst available reserve until the window expires. Making the cap TWAP-driven (#687) would make this strictly more likely.📊 Assessment
bug,security,technical,medium(already applied)🔗 Similar issues
MAX_APPEAL_RESTITUTION; reporter notes this would make the present bug more likely to occur in practice💡 Notes and suggestions
Root cause:
ratifyAppealchecksa.escrowAmount > maxAppealRestitutionand hard-reverts rather than clamping. The escrow was already solvency-checked and lien-reserved at fast-track time, so honoring the snapshot is both logically consistent and gas-safe.Preferred fix (binding snapshot):
The lien already covers this amount, so no additional solvency check is needed.
Alternative fix (clamp at ratify):
This is simpler but silently reduces an appellant's payout after governance lowers the cap — arguably a policy choice that should be explicit.
Recommended test to add in
test/SafetyReserve.t.sol:setMaxAppealRestitutionhardening (optional follow-up): Consider adding a floor that prevents the cap from being set below the maximum currently-escrowed appeal amount (totalEscrowLienis insufficient — it aggregates; you need per-appeal tracking or a simpler "no in-flight appeals" guard).CLAUDE.md note: This is a Solidity contract fix; run
(cd contracts && FOUNDRY_PROFILE=ci forge build --sizes --deny warnings && forge test)and both slither/aderyn checks before pushing. Watch for W5740 unreachable-code warnings if therevert RestitutionExceedsCapblock is removed.Add this agentic workflows to your repo
To install this agentic workflow, run
alpergundogdu commentedon May 29, 2026
Recommend closing as not-planned — the vulnerability is structurally eliminated by the SafetyReserve removal (#708, ADR 033 retired).
The bug was specific to
SafetyReserve.ratifyAppeal: a governance-loweredmaxAppealRestitutionUSDC cap could strand a fast-tracked appeal escrowed at the old cap. That contract is gone, and the newSlashAppealhas none of the moving parts:ratifyAppeal, nomaxAppealRestitution, noescrowAmount-vs-cap check —SlashAppealnever moves USDC (ADR 028: "NoMAX_APPEAL_RESTITUTIONcap exists").CapacityBondescrow keyed byslashId;grantAppealrefunds it in full,upholdAppealdistributes 50/50 — neither reads a tunable cap. ADR 028 § Negative consequences calls this scenario "structurally impossible."I checked the surviving
SlashAppealsetters (setAppealBond,setChallengerIncentivePool) for an analogous strand-on-lower bug — neither feeds appeal resolution, so the class doesn't transfer. No code change is warranted against the current surface.