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
CapacityBond: per-slashId zero-out clearing on multi-outstanding-slash operators #709
Surfaced in Copilot review of #708 (escrow-on-slash refactor). Pre-existing latent issue, not introduced by #708 — the behavior is byte-identical to the old SafetyReserve.reverseAppeal → CapacityBond.clearSlashedAtEpoch path, which also cleared unconditionally.
Issue
CapacityBond._slashedAtEpoch[operator] is a single per-operator watermark (the +1-offset epoch of the most recent slash), consumed by DecdnGovernor to zero an operator's served-bytes vote weight while inside the trailing window (ADR 036 § Slashing zero-out). settleAppealGranted(slashId) clears it unconditionally via _clearSlashedAtEpoch(operator).
If an operator has two outstanding slashes within the trailing window (e.g. slashId 0 at epoch 10, slashId 1 at epoch 12 — the watermark holds 12), and the operator successfully appeals the older slashId 0, settleAppealGranted clears the watermark to 0 — restoring vote/claim eligibility even though slashId 1 still stands.
claimVestedCredit's slash gate reads the same watermark, so it is affected identically.
Pre-existing (identical to the retired clearSlashedAtEpoch), not a regression.
A correct fix is a semantics change to a governance-critical field and an amendment to ADR 036's single-watermark model — out of scope for a SafetyReserve-removal refactor.
Possible fixes
On a granted appeal, recompute the watermark as the max epoch among the operator's still-standing (Escrowed/AppealOpen/Upheld) slashes, clearing to 0 only if none remain. Requires an operator→slashIds index or iteration.
Track an outstanding-slash count / max-standing-epoch per operator updated on slash and on each terminal escrow transition; clear the watermark only when the count hits zero.
Option 2 is O(1) and avoids iteration; it needs one extra mapping and updates in _mintSlashRecord / _distributeUpheld / settleAppealGranted.
Should be paired with an ADR 036 note on the multi-slash watermark semantics.
CapacityBond.settleAppealGranted unconditionally clears the _slashedAtEpoch watermark, which incorrectly restores vote weight and claimVestedCredit eligibility for an operator who still has other outstanding slashes within the trailing window. This is a governance-correctness bug affecting DecdnGovernor voting and vested-credit claims — a bad-faith operator could exploit partial appeals to recover influence while still penalized. Fix requires amending ADR 036's single-watermark model and touching _mintSlashRecord / _distributeUpheld / settleAppealGranted.
📊 Assessment
Dimension
Value
Reasoning
Type
Bug
Incorrect state transition in governance-critical contract logic
Labels
bug, security, technical, adr-review, high
Exploitable governance/claim bypass; requires ADR 036 amendment; high priority due to on-chain impact
Coding agent
Needs more info
Fix approach is well-scoped (Option 2 preferred) but requires an ADR 036 amendment decision before implementation can be locked — the semantics change to the watermark model is a design choice maintainers must ratify
💡 Notes and suggestions
Root cause:_slashedAtEpoch[operator] is a single scalar "most-recent slash epoch + 1". It is decremented/cleared on any granted appeal, with no awareness of other concurrent slash records.
Recommended fix (Option 2 — O(1)):
Add a new mapping: mapping(address => uint256) private _outstandingSlashCount (or _maxStandingEpoch if you want to preserve the epoch semantics).
Increment in _mintSlashRecord.
Decrement (and recompute max epoch if needed) in _distributeUpheld and settleAppealGranted; only call _clearSlashedAtEpoch when the counter reaches zero.
Add _outstandingSlashCount mapping and update _mintSlashRecord
Update settleAppealGranted to decrement count, clear watermark only at zero
Update _distributeUpheld symmetrically
Add Foundry tests: two slashes, appeal older → watermark still set; appeal both → watermark cleared
Verify claimVestedCredit gate behaves correctly in both cases
Security note: Until fixed, an operator with two overlapping slashes who successfully appeals the older one will have _slashedAtEpoch cleared — bypassing both the governance vote-weight zero-out and the claimVestedCredit slash gate for the duration of the trailing window on the second slash. This is exploitable on-chain once the contract is live.
Partially addressed by a312cdd on #708 (review finding #2): settleAppealGranted now clears slashedAtEpoch only when the current stamp matches the reversed slash, so the cross-epoch front-run described here no longer wrongly restores vote weight. Two-slash regression test added. Remaining (kept open): the single-watermark model still cannot fully handle granting the most-recent slash while an earlier one in a different epoch still stands — that needs the max-standing-epoch re-derive (option 2 above).
Activity
github-actions commentedon May 29, 2026
🎯 Triage report
CapacityBond.settleAppealGrantedunconditionally clears the_slashedAtEpochwatermark, which incorrectly restores vote weight andclaimVestedCrediteligibility for an operator who still has other outstanding slashes within the trailing window. This is a governance-correctness bug affectingDecdnGovernorvoting and vested-credit claims — a bad-faith operator could exploit partial appeals to recover influence while still penalized. Fix requires amending ADR 036's single-watermark model and touching_mintSlashRecord/_distributeUpheld/settleAppealGranted.📊 Assessment
bug,security,technical,adr-review,high💡 Notes and suggestions
Root cause:
_slashedAtEpoch[operator]is a single scalar "most-recent slash epoch + 1". It is decremented/cleared on any granted appeal, with no awareness of other concurrent slash records.Recommended fix (Option 2 — O(1)):
mapping(address => uint256) private _outstandingSlashCount(or_maxStandingEpochif you want to preserve the epoch semantics)._mintSlashRecord._distributeUpheldandsettleAppealGranted; only call_clearSlashedAtEpochwhen the counter reaches zero.Suggested sub-tasks:
_outstandingSlashCountmapping and update_mintSlashRecordsettleAppealGrantedto decrement count, clear watermark only at zero_distributeUpheldsymmetricallyclaimVestedCreditgate behaves correctly in both casesSecurity note: Until fixed, an operator with two overlapping slashes who successfully appeals the older one will have
_slashedAtEpochcleared — bypassing both the governance vote-weight zero-out and theclaimVestedCreditslash gate for the duration of the trailing window on the second slash. This is exploitable on-chain once the contract is live.Add this agentic workflows to your repo
To install this agentic workflow, run
fix(contracts): address @alpergundogdu review — appeal-slot griefing …
thiras commentedon May 29, 2026
Partially addressed by a312cdd on #708 (review finding #2):
settleAppealGrantednow clearsslashedAtEpochonly when the current stamp matches the reversed slash, so the cross-epoch front-run described here no longer wrongly restores vote weight. Two-slash regression test added. Remaining (kept open): the single-watermark model still cannot fully handle granting the most-recent slash while an earlier one in a different epoch still stands — that needs the max-standing-epoch re-derive (option 2 above).refactor(contracts): remove SafetyReserve; escrow-on-slash + 5% bucke…
fix(contracts): recompute slashedAtEpoch over standing slashes on gra…