Skip to content

Commit

Permalink
fix: syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
colin-morpho committed Jan 15, 2025
1 parent a73bda1 commit f6f5b89
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions certora/specs/Delegation.spec
Original file line number Diff line number Diff line change
Expand Up @@ -227,21 +227,24 @@ rule updatedDelegatedVPLTEqTotalSupply(env e, address to, uint256 amount) {
require delegatee(to) != delegatee(e.msg.sender);

delegate@withrevert(e, e.msg.sender);
bool reverted = lastReverted;

assert delegatee(e.msg.sender) == e.msg.sender && delegatee(e.msg.sender) != 0;

// Safe require that follows from delegatedLTEqDelegateeVP.
require amount <= delegatedVotingPower(e.msg.sender) ;

requireInvariant delegatedVotingPowerLTEqTotalVotingPower();
requireInvariant sumOfVotesStartsAtZero();
requireInvariant sumOfVotesGrowsCorrectly();
requireInvariant sumOfVotesMonotone();
requireInvariant totalSupplyIsSumOfVirtualVotingPower();
requireInvariant sumOfTwoDelegatedVPLTEqTotalVP();

assert isTotalSupplyGTEqSumOfVotingPower();

assert !reverted => delegatedVotingPower(to) + amount <= totalSupply();
if (!lastReverted) {
assert delegatee(e.msg.sender) == e.msg.sender && delegatee(e.msg.sender) != 0;

// Safe require that follows from delegatedLTEqDelegateeVP.
require amount <= delegatedVotingPower(e.msg.sender) ;

requireInvariant delegatedVotingPowerLTEqTotalVotingPower();
requireInvariant sumOfVotesStartsAtZero();
requireInvariant sumOfVotesGrowsCorrectly();
requireInvariant sumOfVotesMonotone();
requireInvariant totalSupplyIsSumOfVirtualVotingPower();
requireInvariant sumOfTwoDelegatedVPLTEqTotalVP();

assert isTotalSupplyGTEqSumOfVotingPower();

assert delegatedVotingPower(to) + amount <= totalSupply();
} else {
// Do not check anything
assert true;
}
}

0 comments on commit f6f5b89

Please sign in to comment.