Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bylingo opened this issue Jun 5, 2024 · 0 comments · May be fixed by #3762
Open

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

bylingo opened this issue Jun 5, 2024 · 0 comments · May be fixed by #3762

Comments

@bylingo
Copy link

bylingo commented Jun 5, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant