foundry
foundry copied to clipboard
Obscure error messaging when running script with --verify
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 (359dd77 2022-09-15T00:04:51.833948Z)
What command(s) is the bug in?
forge script
Operating System
macOS (Apple Silicon)
Describe the bug
I was getting this weird error message.
It took me a while to pin it down to using forge script --verify
while broadcasting, but not generating any transactions. Removing the --verify
allowed me to see the message: "no transactions generated"
looks like the linking step is the root cause for this, are you using only libraries that are in the project or something at a specific address?
I'm not using any libraries with public functions. I'm working with already deployed contracts in my script, forking from mumbai. The --verify
might have been misleading, because now, after running it again it gets stuck with or without.
do you have the libraries = []
key set in your config
https://book.getfoundry.sh/reference/config/solidity-compiler#libraries
That did the trick for me, thank you very much. It was previously just not present in the config.
I'll keep this open to improve the error message(s)
Interestingly it appeared again. I played around a bit again and removed the --verify
and it then worked (but without verifying the contracts of course).
hmm, will try to reproduce this,
is this public by any chance?
Yes, here: https://github.com/0xPhaze/gang-war/tree/198462993ade7cd4f578904da363454edb2a8e33 It seems to be reproducible on anvil
forge script deploy --rpc-url "http://127.0.0.1:8545" --private-key 0x83631fd2da5250fa4f9dd8c1057f6e53126de6dd9274b9aefbcc3eae3ada6a5f -vvv --ffi --broadcast
Though because of the setup scripts, it will think it has successfully deployed and you'll have to run rm -rf deployments/31337
to delete the stored deployments and "reset" it.
Edit: can just prepend US_RESET=true forge script...
to not have to delete it every time. If I take out the --rpc-url
then I get the same message "Code should have been linked before."
Following up here. This seems to occur when I add more functions (or any code). If I delete some code, I can deploy without an error (and I'm pretty sure it does not have anything to do with "linking", unless I misunderstand that word). Could this then simply be when the max code size is reached? Did the error messages get messed up?
Edit: Perhaps ignore what I just wrote there (noticed that I was on an older version that didn't display the message). Just want to mention that this is still very much a real issue and currently is entirely hindering me from deploying in a specific repository. Got a friend to reproduce and he is able to run the scripts without any issues. For me the problem persists, even after re-installing foundry, cleaning, changing the config...
Fixed in gakonst/ethers-rs#1743