Skip to content

eth_getBalance - Missing block parameter silently defaults to latest #11764

@manusw7

Description

@manusw7

Description

When eth_getBalance is called with only the address (block parameter omitted), Nethermind silently defaults to the latest block and returns a balance (Reth does the same); while Geth, Erigon, and Besu all reject with -32602 "missing value for required argument 1".

Per the execution-apis spec, the block parameter is marked as required.

This behavior is currently codified as intentional by the Nethermind unit test Eth_get_balance_default_block in src/Nethermind/Nethermind.JsonRpc.Test/Modules/Eth/EthRpcModuleTests.cs:101.
That test must be deleted in the fix PR.

Steps to Reproduce

{
  "jsonrpc": "2.0",
  "method": "eth_getBalance",
  "params": ["0xcf1dc766fc2c62bef0b67a8de666c8e67acf35f6"],
  "id": 1
}

Expected (Geth / Erigon / Reth)

{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32602,
    "message": "missing value for required argument 1"
  }
}

Actual (Nethermind v1.38.0-rc)

{ "jsonrpc": "2.0", "result": "0x46f5e69c5c82ad00", "id": 1 }

Fix Location

JSON-RPC argument-count check at the module-dispatch layer in Nethermind.JsonRpc. The current BlockParameter? blockParameter = null default-to-latest behavior on the handler signature (see Nethermind.JsonRpc/Modules/Eth/IEthRpcModule.cs:95 and EthRpcModule.cs:175-191) needs to become a missing-required-argument rejection at parameter binding.

Notes

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions