Skip to content

vm.getCode doesn't find artifacts by name #7569

@martinvol

Description

@martinvol

Component

Forge

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

  • Foundry
  • Foundryup

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 to out/ProxyFactory.sol/ProxyFactory.json.

However vm.getCode("ProxyFactory") fails with

    ├─ [0] VM::getCode("ProxyFactory.sol") [staticcall]
    │   └─ ← [Revert] No matching artifact found
    └─ ← [Revert] No matching artifact found

But 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) to forge 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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions