Skip to content

test(e2e): unskip eth_getBlockByNumber and eth_getBlockByHash RPC tests #225

@sadiq1971

Description

@sadiq1971

Background

Two E2E tests in tests/e2e/tests/api/rpc_test.go are currently hard-skipped:

  • TestRPC_GetBlockByNumber
  • TestRPC_GetBlockByHash

Both are skipped with the same reason:

t.Skip("api-server /eth facade returns blocks without uncle metadata; ethclient uncle-list validation fails")

Root Cause

The api-server's /eth JSON-RPC facade returns synthetic blocks assembled from Canton ledger state. The block struct (ethrpc.RPCBlock) populates:

  • Sha3Uncles: common.Hash{} — the zero hash
  • Uncles: []common.Hash{} — empty slice

The go-ethereum ethclient deserialises the raw JSON response and validates that sha3Uncles matches the actual SHA3 of the uncle list. The zero hash (0x000...) does not match the SHA3 of an empty uncle list (0x1dcc4de8dec75d7aab85b567b6ccd41a... — the well-known empty uncle hash). This causes ethclient.BlockByNumber / ethclient.BlockByHash to return an error, failing the test.

The fix is in pkg/ethrpc/service/service.go GetBlockByNumber: set Sha3Uncles to the correct empty-uncle SHA3 constant rather than the zero hash:

// types.EmptyUncleHash is keccak256(rlp([]))
Sha3Uncles: types.EmptyUncleHash,

Once that change is made, the two test t.Skip calls can be removed and the tests should pass against the live devstack.

Acceptance Criteria

  • pkg/ethrpc/service/service.go: Sha3Uncles set to types.EmptyUncleHash (not common.Hash{})
  • TestRPC_GetBlockByNumber unskipped and passing in CI
  • TestRPC_GetBlockByHash unskipped and passing in CI
  • Existing unit test in pkg/ethrpc/service/eth_api_test.go updated to assert the correct Sha3Uncles value

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No 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