OpenZeppelin / openzeppelin-foundry-upgrades

Foundry library for deploying and managing upgradeable contracts
MIT License
182 stars 28 forks source link

Failed to run upgrade safety validation #59

Closed therealharpaljadeja closed 4 months ago

therealharpaljadeja commented 4 months ago

I am using openzeppelin-foundry-upgrades, openzeppelin contracts v5 and using the following code snippet in my setUp() function in foundry test.

 proxy = Upgrades.deployTransparentProxy(
      'Token.sol',
      tokenOwner,
      abi.encodeCall(Token.initialize, tokenOwner)
 );

foundry.toml

[profile.default]
src = "src"
out = "out"
libs = ["lib"]
ffi = true
ast = true
build_info = true
extra_output = ["storageLayout"]

OS: macOS Sonoma

I get the following error when running forge test. Compilation works, tests fail.

image
ericglau commented 4 months ago

This looks like an installation issue with the npm package @openzeppelin/upgrades-core or its dependency solidity-ast.

You can try manually installing that package for your project by running the following command from your project root:

npm install @openzeppelin/upgrades-core@latest
ericglau commented 4 months ago

Closing this as it looks like an installation issue. Feel free to reopen if you are still encountering the problem.

spaceh3ad commented 2 months ago

forge update worked for me and resolved this issue. This effectively updated the libaries.

also needed to update foundry.toml

evm_version="cancun"

but this probably depends on what compiler version you are using