Skip to content

reopen: eth_getAccountInfo returns zero balance/nonce for current state in fork mode (incomplete fix from #11634) #11714

@winnsterx

Description

@winnsterx

Component

Anvil

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

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge Version: 1.3.6-dev Commit SHA: 5dbd958 Build Timestamp: 2025-09-17T19:01:24.288351000Z (1758135684) Build Profile: release

What version of Foundryup are you on?

1.3.0

What command(s) is the bug in?

anvil

Operating System

Linux

Describe the bug

Following up on this recently closed issue here. While this fix works correctly for blocks that predate the fork, the bug still exists when querying the current state (blocks at or after the fork point). Reproduction:

anvil --fork-url <RPC_URL> --fork-block-number 61629270

# Historical query (predates fork) - WORKS
cast rpc eth_getAccountInfo 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c "0x3ac6355" --rpc-url http://127.0.0.1:8545
# Returns: {"balance":"0x1196b741251f34f3ff8cb","nonce":"0x1",...}

# Current state query - BROKEN  
cast rpc eth_getAccountInfo 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c "latest" --rpc-url http://127.0.0.1:8545  
# Returns: {"balance":"0x0","nonce":"0x0",...}

# But individual queries work fine:
cast balance 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c --rpc-url http://127.0.0.1:8545
# Returns: 1328967138206161849999779 (correct balance)

The fix here only triggers when fork.predates_fork(number) is true. For current state queries, it falls back to the regular get_account() path which has the original bug. Could you apply the same individual fetch logic to all fork mode queries, not just historical ones? Otherwise, the underlying get_account() method needs to be fixed for fork mod

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-bugType: bugT-needs-triageType: this issue needs to be labelled

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions