-
Notifications
You must be signed in to change notification settings - Fork 2
Feat: add Certora specs #7
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
Conversation
Co-authored-by: amusingaxl <112016538+amusingaxl@users.noreply.github.com> Signed-off-by: oddaf <106770775+oddaf@users.noreply.github.com>
Co-authored-by: amusingaxl <112016538+amusingaxl@users.noreply.github.com> Signed-off-by: oddaf <106770775+oddaf@users.noreply.github.com>
Co-authored-by: amusingaxl <112016538+amusingaxl@users.noreply.github.com> Signed-off-by: oddaf <106770775+oddaf@users.noreply.github.com>
Co-authored-by: amusingaxl <112016538+amusingaxl@users.noreply.github.com> Signed-off-by: oddaf <106770775+oddaf@users.noreply.github.com>
Co-authored-by: amusingaxl <112016538+amusingaxl@users.noreply.github.com> Signed-off-by: oddaf <106770775+oddaf@users.noreply.github.com>
Co-authored-by: amusingaxl <112016538+amusingaxl@users.noreply.github.com> Signed-off-by: oddaf <106770775+oddaf@users.noreply.github.com>
Co-authored-by: amusingaxl <112016538+amusingaxl@users.noreply.github.com> Signed-off-by: oddaf <106770775+oddaf@users.noreply.github.com>
Co-authored-by: amusingaxl <112016538+amusingaxl@users.noreply.github.com> Signed-off-by: oddaf <106770775+oddaf@users.noreply.github.com>
Co-authored-by: amusingaxl <112016538+amusingaxl@users.noreply.github.com> Signed-off-by: oddaf <106770775+oddaf@users.noreply.github.com>
Co-authored-by: amusingaxl <112016538+amusingaxl@users.noreply.github.com> Signed-off-by: oddaf <106770775+oddaf@users.noreply.github.com>
Co-authored-by: amusingaxl <112016538+amusingaxl@users.noreply.github.com> Signed-off-by: oddaf <106770775+oddaf@users.noreply.github.com>
Co-authored-by: amusingaxl <112016538+amusingaxl@users.noreply.github.com> Signed-off-by: oddaf <106770775+oddaf@users.noreply.github.com>
Co-authored-by: amusingaxl <112016538+amusingaxl@users.noreply.github.com> Signed-off-by: oddaf <106770775+oddaf@users.noreply.github.com>
Co-authored-by: amusingaxl <112016538+amusingaxl@users.noreply.github.com> Signed-off-by: oddaf <106770775+oddaf@users.noreply.github.com>
Co-authored-by: amusingaxl <112016538+amusingaxl@users.noreply.github.com> Signed-off-by: oddaf <106770775+oddaf@users.noreply.github.com>
pedrobergamini
left a comment
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 good to me! Just commented an idea on Certora's GH actions workflow
certora/SPBEAM.spec
Outdated
| revert7 || revert8 || revert9 || | ||
| revert10, | ||
| "set revert rules failed"; | ||
| revert7 || revert8, |
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.
Nice work on this change
|
Maybe an interesting rule/invariant to do, if you end up having some extra time, would be to prove that after any call to |
This was added in 67d5fbc.
Not entirely sure if I get what you're suggesting here. |
The base branch was changed.
pedrobergamini
left a comment
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.
Added a few questions about the mocks, also, after reviewing the updated rules I thought it could be useful if we added the following one to ensure the config is always consistent:
rule config_min_less_than_max(bytes32 id) {
uint16 min; uint16 max; uint16 step;
min, max, step = cfgs(id);
assert min <= max, "Configuration min should always be <= max";
}
| // NOTE: using mocked `drip` function because this method is not a subject of the formal verification | ||
| // NOTE: this line is needed to prevent `file` above from reverting | ||
| rho = uint64(block.timestamp); | ||
| // (uint256 chi_, uint256 rho_) = (chi, rho); |
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.
Shouldn't we return chi here? As right now nChi is always == 0?
nChi = uint256(chi)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.
As discussed, the return value is irrelevant to the main subject of the formal verification.
We just need to ensure that the calls to drip() and file() in the underlying contracts don't fail for reasons that are not relevant.
| // NOTE: this line is needed to prevent `file` above from reverting | ||
| ilks[ilk].rho = now; | ||
| // require(now >= ilks[ilk].rho, "Jug/invalid-now"); | ||
| // (, uint prev) = vat.ilks(ilk); |
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.
Would it be better if we returned the current duty instead of 0 here?
function drip(bytes32 ilk) external note returns (uint256 rate) {
ilks[ilk].rho = now;
rate = ilks[ilk].duty; // Return current duty instead of 0
}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.
Same as above.
| // uint chi_ = sub(tmp, chi); | ||
| // chi = tmp; | ||
| rho = now; | ||
| // rho = now; |
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.
Same question as Jug::drip, would it be better if we returned the dsr value here?
function drip() external note returns (uint256 tmp) {
rho = now;
tmp = dsr; // Return current dsr instead of 0
}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.
Same as above.
pedrobergamini
left a comment
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 good to me!
No description provided.