Skip to content
RED SAGSkills
medium10 pts · first answer countstesting-and-fuzzingfoundry

expectRevert in the wrong place

This Foundry test fails with "next call did not revert as expected" even though withdraw reverts for non-owners. Why?

function test_RevertWhen_NotOwner() public {
    vm.prank(attacker);
    vault.withdraw(1 ether);
    vm.expectRevert(Vault.NotOwner.selector);
}
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions