Skip to content

Commit

Permalink
chore(specs): add invariant that account balance == 0 => accountMP == 0
Browse files Browse the repository at this point in the history
  • Loading branch information
0x-r4bbit committed Sep 27, 2024
1 parent 44b4476 commit ff243e7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions certora/specs/StakeManager.spec
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ invariant highEpochsAreNull(uint256 epochNumber)
m -> !requiresPreviousManager(m) && !requiresNextManager(m)
}

invariant accountMPIsZeroIfBalanceIsZero(address addr)
to_mathint(getAccountBalance(addr)) == 0 => to_mathint(getAccountCurrentMultiplierPoints(addr)) == 0
filtered {
f -> f.selector != sig:migrateFrom(address,bool,StakeManager.Account).selector
}

invariant InitialMPIsNeverSmallerThanBalance(address addr)
to_mathint(getAccountBonusMultiplierPoints(addr)) >= to_mathint(getAccountBalance(addr))
filtered {
Expand Down Expand Up @@ -126,6 +132,7 @@ rule stakingMintsMultiplierPoints1To1Ratio {

requireInvariant InitialMPIsNeverSmallerThanBalance(e.msg.sender);
requireInvariant CurrentMPIsNeverSmallerThanInitialMP(e.msg.sender);
requireInvariant accountMPIsZeroIfBalanceIsZero(e.msg.sender);

require getAccountLockUntil(e.msg.sender) <= e.block.timestamp;

Expand Down

0 comments on commit ff243e7

Please sign in to comment.