Skip to content

rpc error: batch requests are disabled #50

@bap2pecs

Description

@bap2pecs

Problem

I was testing the quickstart and saw L2 tx went through in my Metamask. However, it doesn't show up in the explorer

Root cause analysis

I checked that my node config has:

[RPC]
...
MaxRequestsPerIPAndSecond = 5000
...

however, I still get this error:

zkevm-explorer-l2  | Retrying.
zkevm-explorer-l2  | 2024-01-16T07:04:06.434 application=indexer fetcher=block_catchup first_block_number=2 last_block_number=0 missing_block_count=3 shrunk=false [info] Index had to catch up.
zkevm-explorer-l2  | 2024-01-16T07:04:06.434 application=indexer fetcher=block_catchup [info] Checking if index needs to catch up in 2500ms.
zkevm-explorer-l2  | 2024-01-16T07:04:08.947 application=indexer fetcher=block_catchup first_block_number=2 last_block_number=0 [error] ** (EthereumJSONRPC.DecodeError) Failed to decode Ethereum JSONRPC response:
zkevm-explorer-l2  | 
zkevm-explorer-l2  |   request:
zkevm-explorer-l2  | 
zkevm-explorer-l2  |     url: http://zkevm-explorer-json-rpc:8124
zkevm-explorer-l2  | 
zkevm-explorer-l2  |     body: [{"id":0,"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x2",true]},{"id":1,"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x1",true]},{"id":2,"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x0",true]}]
zkevm-explorer-l2  | 
zkevm-explorer-l2  |   response:
zkevm-explorer-l2  | 
zkevm-explorer-l2  |     status code: 400
zkevm-explorer-l2  | 
zkevm-explorer-l2  |     body: batch requests are disabled
...

I can also curl to reproduce it and get "batch requests are disabled" response with:

curl -X POST -H "Content-Type: application/json" --data '[
  {
    "id": 0,
    "jsonrpc": "2.0",
    "method": "eth_getBlockByNumber",
    "params": ["0x2", true]
  },
  {
    "id": 1,
    "jsonrpc": "2.0",
    "method": "eth_getBlockByNumber",
    "params": ["0x1", true]
  },
  {
    "id": 2,
    "jsonrpc": "2.0",
    "method": "eth_getBlockByNumber",
    "params": ["0x0", true]
  }
]' http://localhost:8124

the RPC service is defined in the compose file as:

  zkevm-explorer-json-rpc:
    container_name: zkevm-explorer-json-rpc
    image: hermeznetwork/cdk-validium-node:v0.0.3-RC2
    ports:
      - 8124:8124
      - 8134:8134 # needed if WebSockets enabled
    environment:
      - ZKEVM_NODE_STATE_DB_HOST=zkevm-state-db
      - ZKEVM_NODE_POOL_DB_HOST=zkevm-pool-db
      - ZKEVM_NODE_RPC_PORT=8124
      - ZKEVM_NODE_RPC_WEBSOCKETS_PORT=8134
    volumes:
      - ./config/node/config.toml:/app/config.toml
      - ./config/node/genesis.config.json:/app/genesis.json
    command:
      - "/bin/sh"
      - "-c"
      - "/app/zkevm-node run --network custom --custom-network-file /app/genesis.json --cfg /app/config.toml --components rpc --http.api eth,net,debug,zkevm,txpool,web3"

which seems alright. so I don't know why I got this error. any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions