Skip to content

Commit

Permalink
feat: remove usage of lastCountedEpoch
Browse files Browse the repository at this point in the history
  • Loading branch information
GalloDaSballo committed Oct 15, 2024
1 parent 8b3670e commit 9109d98
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions test/GovernanceAttacks.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,12 @@ contract GovernanceTest is Test {

(Governance.VoteSnapshot memory v, Governance.InitiativeVoteSnapshot memory initData) = governance.snapshotVotesForInitiative(address(maliciousInitiative2));
uint256 currentEpoch = governance.epoch();
assertEq(initData.lastCountedEpoch, currentEpoch - 1, "Epoch Matches");


// Inactive for 4 epochs
// Add another proposal

vm.warp(block.timestamp + governance.EPOCH_DURATION() * 5); /// @audit needs 5?
(v, initData) = governance.snapshotVotesForInitiative(address(maliciousInitiative2));
assertEq(initData.lastCountedEpoch, currentEpoch - 1, "Epoch Matches"); /// @audit This fails if you have 0 votes, see QA

uint256 unregisterSnapshot = vm.snapshot();

maliciousInitiative2.setRevertBehaviour(MaliciousInitiative.FunctionType.UNREGISTER, MaliciousInitiative.RevertType.THROW);
Expand Down

0 comments on commit 9109d98

Please sign in to comment.