-
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
Native assertions are not skipped for expectRevert #8049
Comments
I was able to reproduce this on the latest foundry, cc @klkvr |
This is happening because the revert is being catched on the level of the test contract itself.
this means that when |
Hmm, ideally the test would fail here though, this feels like a footgun. Would this be solved by the proposed v1 changes for expectRevert? I'm not sure what the latest on those is |
Hi @mds1 and @klkvr. Thank you for looking into this issue. Can I check if there is any update on this? Thank you. Anyway, I am Jin Xing, part of the Kontrol team, where Kontrol combines KEVM and Foundry to grant developers the ability to perform formal verification without learning a new language or tool. So we want to make sure that the behaviour of this issue (expecting revert for assertions) in Foundry is done similarly in Kontrol. |
hi @jinxinglim what exactly is your usecase for this?
|
Hi @klkvr. We are fine with either direction you guys will be taking as we just want Kontrol to behave similarly when it comes to
But the issue is that when we run the following test, it does catch the revert from function test_assertTrue_string() public {
string memory err = "throw test";
vm.expectRevert(bytes(err));
assertTrue(false, err);
} Thus, we would like to clarify if |
I see how this is confusing though, and this indeed will be fixed by v1 |
Oh. Thank you for the explanation!
If that is the case, we will continue to make |
Issue
According to the foundry book, after calling expectRevert, calls to other cheatcodes before the reverting call are ignored.
However, when running a test like
the
vm.assertTrue
call is executed and the test passed.Question
Are the native assertions such as
assertTrue
,assertFalse
,assertEq
, etc not skipped forexpectRevert
? Are there any other exceptions as well? Thank you.The text was updated successfully, but these errors were encountered: