-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
invariant shrink #6683: check if test failed instead revert #7257
Conversation
…est failure instead 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.
I believe this makes sense,
one q re clone
- lint issue
if error_call_result.reverted { | ||
let is_success = executor.is_raw_call_success( | ||
self.addr, | ||
call_result.state_changeset.clone().unwrap(), |
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.
do we need the clone here?
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 next param is &call_result
which borrows the value so if not cloning fails with
225 | &call_result,
| ^^^^^^^^^^^^ value borrowed here after partial move
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.
hmm, the pub fn is_raw_call_success(
fn is not very good, I see why we need the state as a separate arg
but this means for this call, we can use mut call_result.state_changeset.take().unwrap()
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.
thank you, this makes sense, I made following change in 9d2b073 + made test more robust as they can change in less steps
Motivation
see #6683 (comment)
Atm shrinking doesn't apply for invariants using asserts but only for invariants that reverts (require)
Solution