mirror of
https://github.com/logos-co/staking.git
synced 2025-01-10 18:56:00 +00:00
chore(StakeManager.spec): add two more MP related invariants
This adds two more invariants about multiplier points: 1. Initial multiplier points can never be less than an account's balance 2. Current multiplier points can never be less than initial MP
This commit is contained in:
parent
decd8a281d
commit
f1c1de7993
@ -113,14 +113,26 @@ invariant highEpochsAreNull(uint256 epochNumber)
|
|||||||
m -> !requiresPreviousManager(m) && !requiresNextManager(m)
|
m -> !requiresPreviousManager(m) && !requiresNextManager(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
invariant InitialMPIsNeverSmallerThanBalance(address addr)
|
||||||
|
to_mathint(getAccountInitialMultiplierPoints(addr)) >= to_mathint(getAccountBalance(addr))
|
||||||
|
filtered {
|
||||||
|
f -> f.selector != sig:migrateFrom(address,bool,StakeManager.Account).selector
|
||||||
|
}
|
||||||
|
|
||||||
|
invariant CurrentMPIsNeverSmallerThanInitialMP(address addr)
|
||||||
|
to_mathint(getAccountCurrentMultiplierPoints(addr)) >= to_mathint(getAccountInitialMultiplierPoints(addr))
|
||||||
|
filtered {
|
||||||
|
f -> f.selector != sig:migrateFrom(address,bool,StakeManager.Account).selector
|
||||||
|
}
|
||||||
|
|
||||||
invariant MPcantBeGreaterThanMaxMP(address addr)
|
invariant MPcantBeGreaterThanMaxMP(address addr)
|
||||||
to_mathint(getAccountCurrentMultiplierPoints(addr)) <= (getAccountBalance(addr) * 8) + getAccountInitialMultiplierPoints(addr)
|
to_mathint(getAccountCurrentMultiplierPoints(addr)) <= (getAccountBalance(addr) * 8) + getAccountInitialMultiplierPoints(addr)
|
||||||
filtered {
|
filtered {
|
||||||
f -> f.selector != sig:migrateFrom(address,bool,StakeManager.Account).selector
|
f -> f.selector != sig:migrateFrom(address,bool,StakeManager.Account).selector
|
||||||
}
|
}
|
||||||
{ preserved {
|
{ preserved {
|
||||||
require getAccountInitialMultiplierPoints(addr) >= getAccountBalance(addr);
|
requireInvariant InitialMPIsNeverSmallerThanBalance(addr);
|
||||||
require getAccountCurrentMultiplierPoints(addr) >= getAccountInitialMultiplierPoints(addr);
|
requireInvariant CurrentMPIsNeverSmallerThanInitialMP(addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user