-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
vm.getCode doesn't find artifacts by name #7569
Comments
@martinvol we've inroduced smarter compilation for Because of that, we can't anymore guarantee that all artifacts would be fresh when running tests and we've also inroduced additional vaildation of Can you confirm that this issue occurs on running a If you have import of that file somewhere in tests then this is a bug, and would be great if you could provide some kind of repro |
After a second thought I think a better UX would be to always recompile all files under |
Oh, ftr this happens even if I run `forge build` first. Is that expected?
As a follow up, the artifact is indeed in the out folder (see the code that does work), but the script somehow can't find it at least the full path is provided.
This is triggered by `forge script` and can guarantee the contract that's failing is not imported anywhere. I think I hit an edge case there, because I can't import the file because my script is in 0.8 but I'm working with a legacy contract that is in 0.5, so getCode is the only way I know how to deploy it.
…On Fri, Apr 5, 2024, 19:40 Arsenii Kulikov ***@***.***> wrote:
After a second thought I think a better UX would be to always recompile
all files under src when running tests, will create a PR for that soon
—
Reply to this email directly, view it on GitHub
<#7569 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFKNK5Z7JFZAVM33PXZ3VLY33O2LAVCNFSM6AAAAABFZNAMTKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBQGMZDAMBYGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
ah, I see, yeah in that case you can't have it imported anywhere because your contracts wouldn't compile otherwise. if this contract is in otherwise, you can either move it to |
Wow Tha was fast |
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (1281421 2024-04-05T00:21:15.963758000Z)
What command(s) is the bug in?
forge script
Operating System
macOS (Apple Silicon)
Describe the bug
In a project I have a contract called
ProxyFactory
. It gets compiled and its artifacts written toout/ProxyFactory.sol/ProxyFactory.json
.However
vm.getCode("ProxyFactory")
fails withBut the following call does work:
vm.getCode("./out/ProxyFactory.sol/ProxyFactory.json")
I've started noticing this issue since upgrading from version
forge 0.2.0 (7b45265 2023-11-21T00:18:30.267248000Z)
toforge 0.2.0 (1281421 2024-04-05T00:21:15.963758000Z)
.I think this issue is highly related to #6572, but as the the error messages don't match I though it was worth opening a different one.
The text was updated successfully, but these errors were encountered: