Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

eth_getFilterLogs returns empty may cause NullPointerException (NPE) in web3j #3686

@bylingo

Description

@bylingo

Rationale

From user's feedback, we have found that there is a difference between Erigon and zkevm-node when querying events with eth_getFilterLogs RPC method. When the RPC cannot find the filter ID from user in its own memory, Erigon will return a [] while the zkevm-node will return null. But null leads to a NullPointerException (NPE) in web3j and thus causes a crash on user's program. So maybe zkevm-node should change its return from null to an empty slice when nothing returns and no error occors, and the RPC query response will be like the following:

{
    "jsonrpc": "2.0",
    "id": 73,
    "result": []
}

Implementation

We modified jsonrpc/endpoints_eth.go Line 493 & 499 into return []types.Log{}, nil, and it works.

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