foundry icon indicating copy to clipboard operation
foundry copied to clipboard

StdCheats deployCode(string): Deployment failed

Open shortdoom opened this issue 2 years ago • 1 comments

Component

Forge

Have you ensured that all of these are up to date?

  • [X] Foundry
  • [X] Foundryup

What version of Foundry are you on?

forge 0.2.0 (5c2db0b 2023-01-31T00:08:04.867779198Z)

What command(s) is the bug in?

No response

Operating System

Linux

Describe the bug

I noticed that for certain contracts deployment deployCode fails. Here's an example with deploying using artifact bytecode (generated in hardhat) of UniswapV3Pool

address pool_ = deployCode("src/build/UniswapV3Pool.json");
IUniswapV3Pool pool = IUniswapV3Pool(pool_);

which will complain with: [FAIL. Reason: Setup failed: StdCheats deployCode(string): Deployment failed.]

I think the reason is external contracts being called at the runtime in UniswapV3Pool, here: https://github.com/Uniswap/v3-core/blob/05c10bf6d547d6121622ac51c457f93775e1df09/contracts/UniswapV3Pool.sol#L119

Notice that deployCode works fine for UniswapV3Factory, which doesn't perform any external call during runtime, here's the constructor for reference: https://github.com/Uniswap/v3-core/blob/05c10bf6d547d6121622ac51c457f93775e1df09/contracts/UniswapV3Factory.sol#L22

shortdoom avatar Feb 01 '23 14:02 shortdoom