Skip to content

Align eth_getStorageAt parameter validation with Ethereum's OpenRPC specification #3839

@mwb-al

Description

@mwb-al

Problem

The eth_getStorageAt method in packages/relay/src/lib/eth.ts currently allows the third parameter blockNumberOrTagOrHash to be null:

blockNumberOrTagOrHash: string | null

Additionally, the parameter validation rule is configured with required: false:

@rpcParamValidationRules({
  0: { type: ParamType.ADDRESS, required: true },
  1: { type: ParamType.HEX64, required: true },
  2: { type: ParamType.BLOCK_NUMBER_OR_HASH, required: false },
})

This does not align with the Ethereum OpenRPC specification, where the Block parameter is required and must conform to the BlockNumberOrTagOrHash schema. The current behavior is instead aligned with the Hedera-specific schema, which marks the parameter as optional.

To ensure compatibility with Ethereum tooling and clients, we must treat this parameter as required.

Solution

  • Update the parameter validation rule to mark the third parameter as required: true:

    2: { type: ParamType.BLOCK_NUMBER_OR_HASH, required: true },
  • Change the method signature to disallow null:

    blockNumberOrTagOrHash: string
  • Ensure internal logic does not assume the parameter can be missing or null.

  • Add or adjust tests to confirm that omitting the parameter results in a validation error, per the Ethereum spec.

Alternatives

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions