fixing certora/specs/GovernorCountingSimple.spec

This commit is contained in:
Hadrien Croubois
2023-02-28 16:09:35 +01:00
parent 2e7bca424a
commit f21f86c3c1

View File

@ -135,12 +135,12 @@ rule noVoteForSomeoneElse(uint256 pId, uint8 sup, method f) {
address voter = e.msg.sender; address voter = e.msg.sender;
address user; address user;
bool hasVotedBefore_User = hasVoted(e, pId, user); bool hasVotedBefore_User = hasVoted(pId, user);
castVote@withrevert(e, pId, sup); castVote@withrevert(e, pId, sup);
require(!lastReverted); require(!lastReverted);
bool hasVotedAfter_User = hasVoted(e, pId, user); bool hasVotedAfter_User = hasVoted(pId, user);
assert user != voter => hasVotedBefore_User == hasVotedAfter_User; assert user != voter => hasVotedBefore_User == hasVotedAfter_User;
} }
@ -172,7 +172,7 @@ rule hasVotedCorrelation(uint256 pId, method f, env e, uint256 bn) {
uint256 forBefore = votesFor(); uint256 forBefore = votesFor();
uint256 abstainBefore = votesAbstain(); uint256 abstainBefore = votesAbstain();
bool hasVotedBefore = hasVoted(e, pId, acc); bool hasVotedBefore = hasVoted(pId, acc);
helperFunctionsWithRevert(pId, f, e); helperFunctionsWithRevert(pId, f, e);
require(!lastReverted); require(!lastReverted);
@ -181,7 +181,7 @@ rule hasVotedCorrelation(uint256 pId, method f, env e, uint256 bn) {
uint256 forAfter = votesFor(); uint256 forAfter = votesFor();
uint256 abstainAfter = votesAbstain(); uint256 abstainAfter = votesAbstain();
bool hasVotedAfter = hasVoted(e, pId, acc); bool hasVotedAfter = hasVoted(pId, acc);
// want all vote categories to not decrease and at least one category to increase // want all vote categories to not decrease and at least one category to increase
assert (!hasVotedBefore && hasVotedAfter) => (againstBefore <= againstAfter && forBefore <= forAfter && abstainBefore <= abstainAfter), "no correlation: some category decreased"; assert (!hasVotedBefore && hasVotedAfter) => (againstBefore <= againstAfter && forBefore <= forAfter && abstainBefore <= abstainAfter), "no correlation: some category decreased";