-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Certora] Handle overflows #105
base: main
Are you sure you want to change the base?
Conversation
I think it's even possible to actually require the invariants themselves. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, but it seems like there are more of the same to do in MintBurn
specification. For example:
toVotingPowerBefore + amount > max_uint256; |
Actually it isn't because the invriants require the munging setup which introduce new possible owerflows related to the zero virtual voting power.
Fixed in 6ab5bad. |
A couple more to fix :
|
@QGarchery, I haven't managed to get these ones do not go through because of the same reason as :
In particular, when votes are delegated to zero, |
Good point, but I think we can still frame it in terms of a "safe require". Here the invariant that we would want is that the balance of the sender is less that |
Just requiring the |
[Certora] Safe require mint&burn
certora/specs/Delegation.spec
Outdated
|
||
// Check that the delegated voting power of a delegatee after an update is lesser than or equal to the total supply of tokens. | ||
rule updatedDelegatedVPLTEqTotalSupply(env e, address to, uint256 amount) { | ||
// Safe require as implementation woud revert. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which implementation ? This is not as other rules, this one is to be used as an invariant. This means that you can require what you want, it will just have to be added in the premisses. For example, if you have the following rule:
require A;
require B;
assert C;
then later on you will be able to have the following "safe require":
require A => B => C;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right indeed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the require in fdbcc97.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commit linked does not change this part of the code right ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new code still mentions "safe require because XXX implementation would revert", but this rule is not tied to any particular function called. Indeed this will be used as an invariant.
Those require statements are "safe" because then you would add them as premises when you use use that property. This is the same as in my message above, by doing require A => B => C
. This would be similar as doing requireInvariant inv()
if inv
is the invariant A => B => C
. You wouldn't say that, in such an invariant, A
or B
is a safe premise because a particular implementation would revert
Replace absurd revert conditions with safe requirements that have been proven.
Fixes a very small typo in the
certora/README.md
.Closes #97.
Fixes #107.