@ -2,25 +2,32 @@
methods {
proposalSnapshot(uint256) returns uint256 envfree // matches proposalVoteStart
hashProposal(address[],uint256[],bytes[],bytes32) returns uint256 envfree
isExecuted(uint256) returns bool envfree
isCanceled(uint256) returns bool envfree
// internal functions made public in harness:
_quorumReached(uint256) returns bool envfree
_voteSucceeded(uint256) returns bool envfree
}
/*
ghost proposalVoteStart(uint256) returns uint64 {
init_state axiom forall uint256 pId. proposalVoteStart(pId) == 0;
}
ghost proposalVoteEnd(uint256) returns uint64 {
init_state axiom forall uint256 pId. proposalVoteEnd(pId) == 0;
}
*/
/*
ghost proposalExecuted(uint256) returns bool {
init_state axiom forall uint256 pId. !proposalExecuted(pId);
}
ghost proposalCanceled(uint256) returns bool {
init_state axiom forall uint256 pId. !proposalCanceled(pId);
}
*/
/*
hook Sstore _proposals[KEY uint256 pId].voteStart._deadline uint64 newValue STORAGE {
havoc proposalVoteStart assuming (
proposalVoteStart@new(pId) == newValue
@ -42,21 +49,22 @@ hook Sstore _proposals[KEY uint256 pId].voteEnd._deadline uint64 newValue STORAG
hook Sload uint64 value _proposals[KEY uint256 pId].voteEnd._deadline STORAGE {
require proposalVoteEnd(pId) == value;
}
*/
//////////////////////////////////////////////////////////////////////////////
//////////////////////////// SANITY CHECKS ///////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//
/*
rule sanityCheckVoteStart(method f, uint256 pId) {
uint64 preGhost = proposalVoteStart(pId) ;
uint64 preGhost = _ proposals(pId).voteStart._deadline ;
uint256 pre = proposalSnapshot(pId);
env e;
calldataarg arg;
f(e, arg);
uint64 postGhost = proposalVoteStart(pId) ;
uint64 postGhost = _ proposals(pId).voteStart._deadline ;
uint256 post = proposalSnapshot(pId);
assert preGhost == postGhost <=> pre == post, " g h o s t c h a n g e s a r e c o r r e l a t e d w i t h g e t t e r c h a n g e s " ;
@ -77,7 +85,7 @@ rule sanityCheckVoteEnd(method f, uint256 pId) {
assert preGhost == postGhost <=> pre == post, " g h o s t c h a n g e s a r e c o r r e l a t e d w i t h g e t t e r c h a n g e s " ;
assert pre == preGhost => post == postGhost, " i f c o r r e l a t e d a t t h e b e g i n n i n g s h o u l d b e c o r r e l a t e d a t t h e e n d " ;
}
*/
//////////////////////////////////////////////////////////////////////////////
////////////////////////////// INVARIANTS ////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
@ -91,12 +99,12 @@ invariant voteStartBeforeVoteEnd(uint256 pId) proposalVoteStart(pId) < proposalV
/**
* A proposal cannot be both executed and canceled.
*/
invariant noBothExecutedAndCanceled(uint256 pId) !proposal Executed(pId) || !proposal Canceled(pId)
invariant noBothExecutedAndCanceled(uint256 pId) !is Executed(pId) || !is Canceled(pId)
/**
* A proposal cannot be executed nor canceled before it starts
*/
invariant noExecuteOrCancelBeforeStarting(env e, uint256 pId) e.block.timestamp < proposalVoteStart(pId) => !proposal Executed(pId) && !proposal Canceled(pId)
invariant noExecuteOrCancelBeforeStarting(env e, uint256 pId) e.block.timestamp < proposalVoteStart(pId) => !is Executed(pId) && !is Canceled(pId)
/**
* The voting must start not before the proposal’ s creation time