Skip to content

Log filters should correctly omit missing address filter when calling eth_getLogs #33369

@0xpranay

Description

@0xpranay

System information

Geth version: v1.16.7
CL client & version: e.g. N/A (Hedera JSON RPC)
OS & Version: OSX

Expected behaviour

When the Addresses parameter in ethereum.FilterQuery is not specified, the underlying mapping function toFilterArg should respect that and not assign a nil value. If the user does not specify any address or list of addresses, the function still assigns address: nil in the RPC call that goes out.

This doesn't have any issues with major chains like eth and base. This issue pops up on Hedera chain. According to the Ethereum JSON RPC, the address is OPTIONAL. So we should omit it instead of passing nil to the call.

func toFilterArg(q ethereum.FilterQuery) (interface{}, error) {

"address": q.Addresses,

Actual behaviour

The toFilterArg function should check if query.Addresses is not nil and then assign, if nil then skip the key itself.

Steps to reproduce the behaviour

Call the FilterLogs method against a Hedera RPC. The RPC payload will contain address: nil and the response will be a 400 with bad address parameter

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions