Skip to content

getDeployedCode failed to find the code #7045

@zhiqiangxu

Description

@zhiqiangxu

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 (a5efe4f 2024-02-08T00:15:08.598684835Z)

What command(s) is the bug in?

forge script

Operating System

Linux

Describe the bug

When executing VM::getDeployedCode("DeployConfig.s.sol:DeployConfig"), foundry is looking for forge-artifacts/DeployConfig.s.sol/DeployConfig.json, but there's no such file:

ll forge-artifacts/DeployConfig.s.sol/
total 680
drwxr-xr-x   2 root root   4096 Jan 26 04:23 ./
drwxr-xr-x 343 root root  20480 Feb  8 02:34 ../
-rw-r--r--   1 root root 359118 Feb  8 02:34 DeployConfig.0.8.15.json
-rw-r--r--   1 root root 308925 Jan 26 04:23 DeployConfig.0.8.19.json

Here's the complete tree for forge-artifacts:

# tree forge-artifacts/
forge-artifacts/
...
├── DeployConfig.s.sol
│   ├── DeployConfig.0.8.15.json
│   └── DeployConfig.0.8.19.json
...

343 directories, 712 files

It seems the naming convension is not consistent, some are like xxx.json, some are like xxx.version.json?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Completed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions