Open
Description
Component
Forge
Describe the feature you would like
To test certain EVM errors such as block gas limit overflows, we have to expect an empty revert like this:
vm.expectRevert(bytes(""));
This is also documented in the Foundry Book, so it's all clear from a user documentation perspective. But this is not cool from a user experience point of view.
Ideally, Foundry would catch such EVM errors and throw a more specific error message, so that:
- Users have better guarantees that their tests are passing for the right reason
- Debugging is easier
Additional context
I can see the following logs in the traces if I pass the -vvvv
flag:
Traces:
[2157781646] CreateWithDeltas__ProTest::testCannotCreateWithDeltas__LoopCalculationOverflowsBlockGasLimit()
├─ [0] VM::expectRevert(0x)
│ └─ ← ()
└─ ← "EvmError: OutOfGas
Therefore, it should be in principle possible to catch this error and relay it to end users, so that tests could be written like this:
vm.expectRevert(bytes("EvmError: OutOfGas"));
Metadata
Metadata
Assignees
Type
Projects
Status
Todo