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
7.97k stars 1.62k forks source link

Multichain Error on Single Chain Deployment #8410

Closed ElliotFriedman closed 2 weeks ago

ElliotFriedman commented 3 weeks ago

Component

Forge

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

What version of Foundry are you on?

forge 0.2.0 (82ff8ee 2024-07-10T00:22:26.618652000Z)

What command(s) is the bug in?

forge script

Operating System

macOS (Intel)

Describe the bug

Currently on this pull request at the latest commit, running this command:

DO_DEPLOY=true DO_VALIDATE=true DO_PRINT=true DO_BUILD=true DO_RUN=true forge script src/proposals/mips/mip-x01/mip-x01.sol:mipx01 -vvvvv

gives this error:

"Multi chain deployment does not support library linking at the moment."

However, the same deployment tooling works across all other deployment scripts so it's unclear why this deploy function is different. See MIP-00 which can be run with command:

DO_DEPLOY=true DO_AFTER_DEPLOY=true DO_PRE_BUILD_MOCK=true DO_BUILD=true \
DO_RUN=true DO_VALIDATE=true forge script \
src/proposals/mips/mip00.sol:mip00 -vvv

It has no issues doing a multichain deployment for MIP-00 so it is unclear why this particular command is causing problems.

Update: another deployment script has this same issue even though it only deploys the contracts to a single chain.

https://github.com/moonwell-fi/moonwell-contracts-v2/pull/271

command:

PRIMARY_FORK_ID=2 DO_DEPLOY=true DO_VALIDATE=true forge script src/proposals/mips/mip-xwell/xwellDeploy.sol:xwellDeploy -vvv

fails with:

[⠆] Compiling...
No files changed, compilation skipped
Enter keystore password:
Multi chain deployment is still under development. Use with caution.
Error: 
Multi chain deployment does not support library linking at the moment.
klkvr commented 3 weeks ago

You should provide --rpc-url argument matching the RPC/alias of the fork which is being selected during the script execution.

Forge does not support dynamic library linking, so it predeploys all libraries before executing the script -> before knowing which exact fork is being selected via forking cheatcodes. Because of that, library deployment transactions don't have an RPC url and this causes script to be treated as multi-chain one

ElliotFriedman commented 3 weeks ago

Ok, I guess this would make sense why this works for some scripts and not others then. If the script deploys a library and then needs to link it with our current setup it will fail, but if the script does not deploy a library, then it will succeed.

klkvr commented 3 weeks ago

Ok, I guess this would make sense why this works for some scripts and not others then. If the script deploys a library and then needs to link it with our current setup it will fail, but if the script does not deploy a library, then it will succeed.

It is only happening if script needs to deploy libraries. If it does not pre-deploy any libraries, then there's no need to know fork url before forking cheatcode is being called

zerosnacks commented 2 weeks ago

Marking as resolved