This commit is contained in:
Hadrien Croubois
2023-03-16 09:28:48 +01:00
parent 06baea7fa8
commit a355bf0de2
3 changed files with 7 additions and 4 deletions

View File

@ -142,7 +142,9 @@ invariant quorumRatioLessThanOne(uint256 blockNumber)
quorumNumerator(blockNumber) <= quorumDenominator() quorumNumerator(blockNumber) <= quorumDenominator()
filtered { f -> !skip(f) } filtered { f -> !skip(f) }
{ {
require quorumNumeratorLength() < max_uint256; preserved {
require quorumNumeratorLength() < max_uint256;
}
} }
/* /*

View File

@ -23,12 +23,13 @@ use invariant votesImplySnapshotPassed
rule deadlineChangeToPreventLateQuorum(uint256 pId, env e, method f, calldataarg args) rule deadlineChangeToPreventLateQuorum(uint256 pId, env e, method f, calldataarg args)
filtered { f -> !skip(f) } filtered { f -> !skip(f) }
{ {
require clockSanity(e);
requireInvariant proposalStateConsistency(pId); requireInvariant proposalStateConsistency(pId);
requireInvariant votesImplySnapshotPassed(e, pId); requireInvariant votesImplySnapshotPassed(e, pId);
// This is not (easily) provable as an invariant because the prover think `_totalSupplyCheckpoints` // This is not (easily) provable as an invariant because the prover think `_totalSupplyCheckpoints`
// can arbitrarily change, which causes the quorum() to change. Not sure how to fix that. // can arbitrarily change, which causes the quorum() to change. Not sure how to fix that.
require !quorumReached(pId) <=> getExtendedDeadline(pId) == 0; require quorumReached(pId) <=> getExtendedDeadline(pId) > 0;
uint256 deadlineBefore = proposalDeadline(pId); uint256 deadlineBefore = proposalDeadline(pId);
bool deadlineExtendedBefore = getExtendedDeadline(pId) > 0; bool deadlineExtendedBefore = getExtendedDeadline(pId) > 0;
@ -52,7 +53,7 @@ rule deadlineChangeToPreventLateQuorum(uint256 pId, env e, method f, calldataarg
) || ( ) || (
!deadlineExtendedBefore && !deadlineExtendedBefore &&
deadlineExtendedAfter && deadlineExtendedAfter &&
!quorumReachedBefore && // Not sure how to prove that !quorumReachedBefore &&
quorumReachedAfter && quorumReachedAfter &&
deadlineAfter == clock(e) + lateQuorumVoteExtension() && deadlineAfter == clock(e) + lateQuorumVoteExtension() &&
votingAll(f) votingAll(f)

View File

@ -149,7 +149,7 @@ rule onlyVoteCanChangeQuorumReached(uint256 pId, env e, method f, calldataarg ar
f(e, args); f(e, args);
// Needed because the prover doesn't understand the checkpoint properties of the voting token. // Needed because the prover doesn't understand the checkpoint properties of the voting token.
require clock(e) > snapshot => token_getPastTotalSupply(snapshot) == cache; require clock(e) > snapshot => token_getPastTotalSupply(snapshot) == totalSupply;
assert quorumReached(pId) != quorumReachedBefore => ( assert quorumReached(pId) != quorumReachedBefore => (
!quorumReachedBefore && !quorumReachedBefore &&