Skip to content

eth_getCode returns empty #13247

@wjmelements

Description

@wjmelements

Checklist

  • This is not a security-related bug/issue. If it is, please follow please follow the security policy.
  • I have searched on the issue tracker and the lotus forum, and there is no existing related issue or discussion.
  • I am running the Latest release, the most recent RC(release canadiate) for the upcoming release or the dev branch(master), or have an issue updating to any of these.
  • I did not make any code changes to lotus.

Lotus component

  • lotus daemon - chain sync
  • lotus fvm/fevm - Lotus FVM and FEVM interactions
  • lotus miner/worker - sealing
  • lotus miner - proving(WindowPoSt/WinningPoSt)
  • lotus JSON-RPC API
  • lotus message management (mpool)
  • Other

Lotus Version

Daemon:  1.33.0+debug+git.7bdccad+api1.5.0
Local: lotus version 1.33.0+debug+git.7bdccad

Repro Steps

First, deploy a contract with eth_sendRawTransaction. This about 17kb so I don't paste it here, but for my own work I am using Payments.sol.

getcode.json:

    {
        "method": "eth_getCode",
        "params": [
            "0xf6990c51dc94b36c5d5184bf60107efe99dde592",
            "latest"
        ],
        "id": 14,
        "jsonrpc": "2.0"
    }
curl --data @getcode.json -H "Content-Type:application/json" http://localhost:8080/rpc/v1
{"id":14,"jsonrpc":"2.0","result":"0x"}

But the contract is there:

call.json:

    {
        "method": "eth_call",
        "params": [
            {
                "to": "0xf6990c51dc94b36c5d5184bf60107efe99dde592",
                "data": "0x9be5c024"
            },
            "latest"
        ],
        "id": 14,
        "jsonrpc": "2.0"
    }
curl --data @call.json -H "Content-Type:application/json" http://localhost:8080/rpc/v1
{"id":14,"jsonrpc":"2.0","result":"0x00000000000000000000000000000000000000000000000000049e57d6354000"}

Describe the Bug

The contract is deployed with eth_sendRawTransaction. I can interact with it with eth_call, but the code is missing from eth_getCode.

The impact of this is that forge script --fork-url <> can't load existing smart contracts:

    ├─ [0] 0x7392F5951F84C9A8ee8CDC7E2AC9f0445e7A17fb::NETWORK_FEE() [staticcall]
    │   └─ ← [Stop]
    └─ ← [Revert] EvmError: Revert

Logging Information

Not seeing anything noteworthy in the lotus daemon logs. Here are the network logs:


    Host: localhost:1234
    User-Agent: curl/8.7.1
    Accept: */*
    Content-Type: application/json
    Content-Length: 189

    {
        "method": "eth_getCode",
        "params": [
            "0xf6990c51dc94b36c5d5184bf60107efe99dde592",
            "latest"
        ],
        "id": 14,
        "jsonrpc": "2.0"
    }

 << 200 OK 40b
    Date: Thu, 07 Aug 2025 02:00:44 GMT
    Content-Length: 40
    Content-Type: text/plain; charset=utf-8

    {"id":14,"jsonrpc":"2.0","result":"0x"}


[::1]:56810: POST http://localhost:1234/rpc/v1
    Host: localhost:1234
    User-Agent: curl/8.7.1
    Accept: */*
    Content-Type: application/json
    Content-Length: 259

    {
        "method": "eth_call",
        "params": [
            {
                "to": "0xf6990c51dc94b36c5d5184bf60107efe99dde592",
                "data": "0x9be5c024"
            },
            "latest"
        ],
        "id": 14,
        "jsonrpc": "2.0"
    }

 << 200 OK 104b
    Date: Thu, 07 Aug 2025 02:01:11 GMT
    Content-Length: 104
    Content-Type: text/plain; charset=utf-8

    {"id":14,"jsonrpc":"2.0","result":"0x00000000000000000000000000000000000000000000000000049e57d6354000"}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

📌 Triage

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions