-
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
feat(cheatcodes): expectRevert with specific reverter address #8770
Conversation
8479102
to
068b91b
Compare
232aa0f
to
619bdd3
Compare
Continuing from #4762:
Personally I am not a fan of this behavior, and I think Additionally, I think "the next call to reverterAddress" is not always obvious, because calls to a different top level address may end up making subcalls to reverterAddress |
Agree, consistency makes sense. However not clear how the bubbling revert described in #5299 (comment) could be achieved if we expect the revert on the next call, I could be missing something |
I think this is probably the simplest solution, just ignore whether or not it bubbled up at all, and as long as |
👍 will do so then |
a4833cc
to
c672bda
Compare
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.
lgtm, pending @klkvr
is this basically |
yeah, pls check #5299 for identical selectors but in different contracts |
@klkvr ptal and lmk if any things you'd like to be changed before merging. Thank you! |
the approach LGTM, though I don't think we're actually resolving #5299 usecase here? eg there's no way to assert B reverting without calling it directly. IMO having a way to assert revert of the given contract at any subcall of the next call might be useful. such reverts might not even end up bubbled up, and this should still be fine — try-catch blocks are not used that much, and it's arguably useful to have a way to test them being entered as well. I also think that this would be consistent, because |
@mds1 would you concur with @klkvr comment? Imo makes sense but needs to be able to check subcalls of next call. So kind of a mix of how was implemented initially but only for the next call |
Oh, I thought this was: |
37c3bf8
to
6e3b7ff
Compare
6e3b7ff
to
a27cfdf
Compare
@klkvr please recheck. thank you! |
dismissing as several other changes were done since this review
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.
LGTM
…y-rs#8770) * feat(cheatcodes): expectRevert with specific reverter address * Support assert revert of the given contract at any subcall of the next call
Motivation
Closes #5299
Closes foundry-rs/book#945
#5299 (comment)
Solution
expectRevert
cheatcodes with reverter (expects an error on next call from the given address)Reason: Reverter != expected reverter
reason.ExpectedRevert
directly tohandle_expect_revert