Skip to content

Commit

Permalink
feat: snapshot asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
GalloDaSballo committed Oct 11, 2024
1 parent 7f66112 commit 9e8fd9e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions INTEGRATION.MD
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ Votes not meeting the threshold may result in 0 rewards

Claiming more than once will return 0

## INVARIANT: You can only claim for previous epoch

assert(votesSnapshot_.forEpoch == epoch() - 1); /// @audit INVARIANT: You can only claim for previous epoch
/// All unclaimed rewards are always recycled
2 changes: 2 additions & 0 deletions src/Governance.sol
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,8 @@ contract Governance is Multicall, UserProxyFactory, ReentrancyGuard, IGovernance
return 0;
}

assert(votesSnapshot_.forEpoch == epoch() - 1); /// @audit INVARIANT: You can only claim for previous epoch
/// All unclaimed rewards are always recycled

initiativeStates[_initiative].lastEpochClaim = epoch() - 1;
votesForInitiativeSnapshot[_initiative] = votesForInitiativeSnapshot_; // implicitly prevents double claiming
Expand Down

0 comments on commit 9e8fd9e

Please sign in to comment.