Skip to content

RPC call getBlockByNumber behaves different than Ganache #1868

@rhlsthrm

Description

@rhlsthrm

Component

Anvil

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

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (e6f2bc6 2022-06-07T00:05:25.119456Z)

What command(s) is the bug in?

anvil

Operating System

Linux

Describe the bug

I'm trying to run a Graph node against a local Anvil instance in a docker compose setup. The Graph node errors with the following errors:

Jun 07 19:10:06.455 WARN Trying again after eth_getBlockByNumber(0, false) RPC call failed (attempt #10) with result Err(Decoder error: Error("invalid length 1, expected a (both 0x-prefixed or not) hex string with length of 16", line: 0, column: 0)), provider: mainnet-rpc-0

I investigated and I get an error if I call the JSON-RPC request against Anvil:

curl --request POST \
  --url http://localhost:8545/ \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":[0,  false],"id":1}'

However, this works when the param "0" is a string.

In ganache-cli I can query with that same cURL and get a proper response. I'd like this functionality to be able to run full E2E tests using Anvil.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions