foundry icon indicating copy to clipboard operation
foundry copied to clipboard

Anvil `eth_getBlockByNumber` returns incorrect block number for Arbitrum chain ID with no forking

Open michprev opened this issue 4 months ago • 0 comments

Component

Anvil

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

  • [X] Foundry
  • [X] Foundryup

What version of Foundry are you on?

anvil 0.2.0 (a8c3e9c 2024-10-19T00:20:41.820222000Z)

What command(s) is the bug in?

anvil --prune-history 100 --transaction-block-keeper 10 --steps-tracing --silent --port 63758 --chain-id 42161

Operating System

None

Describe the bug

Anvil configured with chainId 42161 with NO forking returns incorrect block number in eth_getBlockByNumber.

Relevant part of JSON-RPC communication:

INFO     2024-10-19 10:48:56,222 wake.development.json_rpc.communicator: Sending request: communicator.py:64
         {'jsonrpc': '2.0', 'method': 'eth_getBlockByNumber', 'params': ['0x1', False],                     
         'id': 17}                                                                                          
INFO     2024-10-19 10:48:56,223 wake.development.json_rpc.communicator: Received         communicator.py:68
         response:                                                                                          
         {"jsonrpc": "2.0", "id": 17, "result": {"hash":                                                    
         "0xf41355690f975fe48b4996040c8fa511e6e97bbd94c7a43f9604f0b9301e6c96",                              
         "parentHash":                                                                                      
         "0x865c37f9bd9edce7d295625b224ec50ba1275a625b32578d8bc84cc8be8cbc6a",                              
         "sha3Uncles":                                                                                      
         "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", "miner":                     
         "0x0000000000000000000000000000000000000000", "stateRoot":                                         
         "0xcd6d4d980ed05ff9fa6576d712e54b34dd430b2491f00211c8aac7c32bf973e3",                              
         "transactionsRoot":                                                                                
         "0xa734c92b0cbaa73dbe7aa9f6e3fab29eb3f8cf00367b7ae99b0dcda0fd938cdb",                              
         "receiptsRoot":                                                                                    
         "0xf78dfb743fbd92ade140711c8bbc542b5e307f0ab7984eff35d751969fe57efa",                              
         "logsBloom":                                                                                       
         "0x00000000000000000000000000000000000000000000000000000000000000000000000000000                   
         00000000000000000000000000000000000000000000000000000000000000000000000000000000                   
         00000000000000000000000000000000000000000000000000000000000000000000000000000000                   
         00000000000000000000000000000000000000000000000000000000000000000000000000000000                   
         00000000000000000000000000000000000000000000000000000000000000000000000000000000                   
         00000000000000000000000000000000000000000000000000000000000000000000000000000000                   
         00000000000000000000000000000000000", "difficulty": "0x0", "number": "0x2",                        
         "gasLimit": "0x1c9c380", "gasUsed": "0x5208", "timestamp": "0x67137279",                           
         "totalDifficulty": "0x0", "extraData": "0x", "mixHash":                                            
         "0x0000000000000000000000000000000000000000000000000000000000000000", "nonce":                     
         "0x0000000000000000", "baseFeePerGas": "0x0", "blobGasUsed": "0x0",                                
         "excessBlobGas": "0x0", "uncles": [], "transactions":                                              
         ["0xb04fa65c8d74145856ac847a19bcbb6fa15441dfaa7f32cff0592c2881ec9308"], "size":                    
         "0x22c", "l1BlockNumber": 1}}

Note that block with number 1 is requested, correct data are returned, except for "number": "0x2".

Most likely introduced in https://github.com/foundry-rs/foundry/pull/8542.

michprev avatar Oct 19 '24 08:10 michprev