From 1295a9aedd688c85c70824c893246cf6b50872ec Mon Sep 17 00:00:00 2001 From: Juan Franco <91078895+m1lestones@users.noreply.github.com> Date: Fri, 26 Jun 2026 00:18:28 -0400 Subject: [PATCH 1/3] schemas: allow null as a valid FilterTopic entry A null at a topic position in a filter means "match any topic at this position", which is valid per the Ethereum JSON-RPC spec. The FilterTopic schema only allowed bytes32 or an array of bytes32, causing validators to reject filters like: {"topics": ["0xABC...", null, ["0xDEF...", "0x123..."]]} Closes #118 --- src/schemas/filter.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/schemas/filter.yaml b/src/schemas/filter.yaml index 5da814a7a..cd19dba08 100644 --- a/src/schemas/filter.yaml +++ b/src/schemas/filter.yaml @@ -71,6 +71,8 @@ FilterTopics: FilterTopic: title: Filter Topic List Entry oneOf: + - title: Any Topic Match + type: 'null' - title: Single Topic Match $ref: '#/components/schemas/bytes32' - title: Multiple Topic Match From 2d5981fd2f5ef5f40ede91112439b0d1bd70f6dd Mon Sep 17 00:00:00 2001 From: Juan Franco <91078895+m1lestones@users.noreply.github.com> Date: Mon, 29 Jun 2026 12:27:48 -0400 Subject: [PATCH 2/3] tests: add eth_getLogs test for null topic wildcard --- tests/eth_getLogs/topic-null-wildcard.io | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 tests/eth_getLogs/topic-null-wildcard.io diff --git a/tests/eth_getLogs/topic-null-wildcard.io b/tests/eth_getLogs/topic-null-wildcard.io new file mode 100644 index 000000000..5d1df4024 --- /dev/null +++ b/tests/eth_getLogs/topic-null-wildcard.io @@ -0,0 +1,3 @@ +// queries for logs with a null topic in position zero, acting as a wildcard for that position +>> {"jsonrpc":"2.0","id":1,"method":"eth_getLogs","params":[{"fromBlock":"0x3","toBlock":"0x6","topics":[null,["0x4238ace0bf7e66fd40fea01bdf43f4f30423f48432efd0da3af5fcb17a977fd4"]]}]} +<< {"jsonrpc":"2.0","id":1,"result":[{"address":"0x7dcd17433742f4c0ca53122ab541d0ba67fc27df","topics":["0x00000000000000000000000000000000000000000000000000000000656d6974","0x4238ace0bf7e66fd40fea01bdf43f4f30423f48432efd0da3af5fcb17a977fd4"],"data":"0x0000000000000000000000000000000000000000000000000000000000000001","blockNumber":"0x4","transactionHash":"0xf047c5133c96c405a79d01038b4ccf8208c03e296dd9f6bea083727c9513f805","transactionIndex":"0x0","blockHash":"0x29cc6f97784c864cbe29b3502934ad874f48ddc89580018f5a32e01652c88f0a","blockTimestamp":"0x28","logIndex":"0x0","removed":false}]} From b175cb7c9d092e9a02feca4d2664f6cd51d50832 Mon Sep 17 00:00:00 2001 From: Juan Franco <91078895+m1lestones@users.noreply.github.com> Date: Tue, 30 Jun 2026 21:34:22 -0400 Subject: [PATCH 3/3] tests: generate topic-null-wildcard fixture from testgen Add the missing rpctestgen entry for the null-topic-wildcard case so the eth_getLogs/topic-null-wildcard.io fixture is produced by `make fill` instead of being hand-written, per review feedback. --- tools/testgen/generators.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tools/testgen/generators.go b/tools/testgen/generators.go index 71007a764..c26f07d8c 100644 --- a/tools/testgen/generators.go +++ b/tools/testgen/generators.go @@ -2168,6 +2168,34 @@ var EthGetLogs = MethodTests{ return nil }, }, + { + Name: "topic-null-wildcard", + About: "queries for logs with a null topic in position zero, acting as a wildcard for that position", + Run: func(ctx context.Context, t *T) error { + // Find a topic. + i := slices.IndexFunc(t.chain.txinfo.LegacyEmit, func(tx TxInfo) bool { + return tx.Block > 2 + }) + if i == -1 { + return fmt.Errorf("no suitable tx found") + } + info := t.chain.txinfo.LegacyEmit[i] + startBlock := uint64(info.Block - 1) + endBlock := uint64(info.Block + 2) + result, err := t.eth.FilterLogs(ctx, ethereum.FilterQuery{ + FromBlock: new(big.Int).SetUint64(startBlock), + ToBlock: new(big.Int).SetUint64(endBlock), + Topics: [][]common.Hash{nil, {*info.LogTopic1}}, + }) + if err != nil { + return err + } + if len(result) != 1 { + return fmt.Errorf("result contains %d logs, want 1", len(result)) + } + return nil + }, + }, { Name: "filter-with-blockHash", About: "queries for all logs of a block, identified by blockHash",