foundry-rs / foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
https://getfoundry.sh
Apache License 2.0
8.17k stars 1.7k forks source link

Add support for combination of `vm.expectRevert` and (failing) `deployCode` #4589

Open fubhy opened 1 year ago

fubhy commented 1 year ago

Component

Forge

Describe the feature you would like

It's currently not possible to pair a deployCode with vm.expectRevert. It also doesn't work to use testFail in this case.

We are forced to use deployCode to get around version constraints (our tests are solc 0.8.17 and some of our code is 0.6.12). We'd like to test some validation constraints in the constructor of one of our (old) contracts.

Additional context

One workaround would be to create a mock factory contract and use deployCode on that one and then deploy the tested contract through that mock factory ... but that seems a bit unwieldy.

elshan-eth commented 6 months ago

We have problems with this too