-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Misleading Error Message: Could not find target contract #7244
Comments
Will be addressed by #7247 |
I ran into this same error a few days ago. Unsure specifically why, but may also be related to internal/external library usage as I use a few in my contracts as well. I reverted to a commit that I had deployed previously ~2 weeks ago, and I get the error on that commit now as well, so does seems like a forge issue. I had just ran foundryup before this, which installed |
* [wip] script refactoring * execution refactor * refactor simulation * wip * wip * address #7244 * wip: enum for multi/single sequences * refactor execution + resume * wip: refactor verification * wip: cleaning up * naming * wip: clean up * cleanup ScriptSequence * fmt * better rpc tracking * fix rpc logic + extract states to separate file * fmt * some docs * remove --multi flag mentions * docs * checkpoint saves for multichain sequences * docs + broadcasted renamed into dry_run * fmt * Update crates/forge/bin/cmd/script/resume.rs Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de> * fmt * review fixes * fmt * wip: start extracting to separate crate * Use CoreBuildArgs + skip * fmt * review fixes * review fixes * remove redundant methods --------- Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (ac80261 2024-02-24T00:17:06.154246094Z)
What command(s) is the bug in?
forge script
Operating System
Linux
Describe the bug
Running
forge script MyDeployment.sol
fails with the messageError: Could not find target contract MyDeployment
even though the file is clearly present and the script contract name is correct.In my case, the real bug was calling an external library method which had been accidentally marked public/external instead of internal, causing a dynamic linkage failure, and the message "Error: Could not find target contract"
You should be able to reproduce using a
library Foo { function foo() public {} }
along with a contract which callsFoo.foo()
and finally a deployment script which constructs the contract that uses the external lib. If you change the visibility tointernal
, the static binding / inlining causes the "Could not find target contract" message to go away.This is the same error message as reported in #3076 but presumably with a different cause/solution.
The text was updated successfully, but these errors were encountered: