Skip to content

bug(anvil): inconsistent rpc method result returned by anvil in between cast block finalized and cast block $(cast block finalized --field number) #12645

@yiweichi

Description

@yiweichi

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.4.4-stable
Commit SHA: 0579449
Build Timestamp: 2025-11-03T23:46:57.847015000Z (1762213617)
Build Profile: maxperf

What version of Foundryup are you on?

foundryup: 1.4.0

What command(s) is the bug in?

No response

Operating System

macOS (Apple Silicon)

Describe the bug

This issue is that anvil returns inconsistent value of cast block finalized and cast block $(cast block finalized --field number), which logically should return the same result.

To reproduce:

  1. launch anvil and dump the state: anvil --dump-state state.json
  2. launch the anvil with the state.json: anvil --chain-id 22222222 --accounts 10 --balance 10000 --load-state ./state.json
  3. request the finalized block from anvil:
$ cast block finalized -r http:localhost:8544


baseFeePerGas        1000000000
difficulty           0
extraData            0x
gasLimit             30000000
gasUsed              0
hash                 0x5a776a60c285063c7e064301bd8c6890ea74e6e07d1d3a7719d71d28d019ae57
logsBloom            0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
miner                0x0000000000000000000000000000000000000000
mixHash              0x0000000000000000000000000000000000000000000000000000000000000000
nonce                0x0000000000000000
number               0
parentHash           0x0000000000000000000000000000000000000000000000000000000000000000
parentBeaconRoot     0x0000000000000000000000000000000000000000000000000000000000000000
transactionsRoot     0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421
receiptsRoot         0x0000000000000000000000000000000000000000000000000000000000000000
sha3Uncles           0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347
size                 615
stateRoot            0x0000000000000000000000000000000000000000000000000000000000000000
timestamp            1763968283 (Mon, 24 Nov 2025 07:11:23 +0000)
withdrawalsRoot      0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421
totalDifficulty      0
blobGasUsed          0
excessBlobGas        0
requestsHash         0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
transactions:        []
  1. request the block 0(which is the finalized block number) from anvil.
cast block $(cast block finalized -r http://localhost:8544 --field number) -r http://localhost:8544



baseFeePerGas        1000000000
difficulty           0
extraData            0x
gasLimit             30000000
gasUsed              0
hash                 0xa96a5f9cf080483d4ec9ee0e425805d232cdc0b77e8c07f8336838afff199cb6
logsBloom            0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
miner                0x0000000000000000000000000000000000000000
mixHash              0x0000000000000000000000000000000000000000000000000000000000000000
nonce                0x0000000000000000
number               0
parentHash           0x0000000000000000000000000000000000000000000000000000000000000000
parentBeaconRoot     0x0000000000000000000000000000000000000000000000000000000000000000
transactionsRoot     0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421
receiptsRoot         0x0000000000000000000000000000000000000000000000000000000000000000
sha3Uncles           0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347
size                 615
stateRoot            0x0000000000000000000000000000000000000000000000000000000000000000
timestamp            1763658366 (Thu, 20 Nov 2025 17:06:06 +0000)
withdrawalsRoot      0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421
totalDifficulty      0
blobGasUsed          0
excessBlobGas        0
requestsHash         0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
transactions:        []
  1. the hash field of two results if weirdly different.

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions