You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.
I've spent a lot of the last two days hunting for this bug, I'm not sure I understand it, but I think I've isolated it.
The RPC API specifies that a topic filter object can specify a topic array that is order-dependent, and can include null values to represent wildcards.
While it is true that submitting all null topics to Parity returns all logs, and returning a null after a valid topic returns valid logs, it seems that adding any topics after a null topic (wildcard value) will always return an empty array of logs.
To see for yourself, here are a series of experiments (I'm pointing at a hosted Parity node in archive mode, you can point it at your own local node if you'd like):
An empty topic query of the DAO contract at a specific block returns two results:
curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","id":12345,"method":"eth_getLogs","params":[{"topics":[null, "0x000000000000000000000000684cc7b2c5e666fdf0bd677b5ecd195eeb949353"],"address":"0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413","fromBlock":"0x247379","toBlock":"0x247379"}]}' https://mainnet.infura.io
Notice the returned items have these two topic arrays:
First let's do a simple query for just the first one, so just that first topic, which is unique to it, 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925.
curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","id":12345,"method":"eth_getLogs","params":[{"topics":[ "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925"],"address":"0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413","fromBlock":"0x247379","toBlock":"0x247379"}]}' https://mainnet.infura.io
No problem, we got our owe log back. Now, since they both share their second item, let's try querying for it, by constructing a filter object with a null first argument, followed by the shared filter, 0x000000000000000000000000684cc7b2c5e666fdf0bd677b5ecd195eeb949353.
curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","id":12345,"method":"eth_getLogs","params":[{"topics":[null, "0x000000000000000000000000684cc7b2c5e666fdf0bd677b5ecd195eeb949353"],"address":"0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413","fromBlock":"0x247379","toBlock":"0x247379"}]}' https://mainnet.infura.io
Now we get no results back.
Maybe we can't use null values at all, you say?
Let's now try two null values, just to check if nulls are respected at all:
curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","id":12345,"method":"eth_getLogs","params":[{"topics":[null, null],"address":"0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413","fromBlock":"0x247379","toBlock":"0x247379"}]}' https://mainnet.infura.io
I won't bore you with more examples. A few things I'll tell you:
A null can follow a valid filter.
A valid filter cannot follow a null.
Anyways, I hope this is enough to debug the issue, thanks!
The text was updated successfully, but these errors were encountered:
I've spent a lot of the last two days hunting for this bug, I'm not sure I understand it, but I think I've isolated it.
The RPC API specifies that a topic filter object can specify a
topic
array that is order-dependent, and can includenull
values to represent wildcards.While it is true that submitting all
null
topics to Parity returns all logs, and returning anull
after a valid topic returns valid logs, it seems that adding any topics after anull
topic (wildcard value) will always return an empty array of logs.To see for yourself, here are a series of experiments (I'm pointing at a hosted Parity node in
archive
mode, you can point it at your own local node if you'd like):Notice the returned items have these two topic arrays:
["0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925","0x000000000000000000000000684cc7b2c5e666fdf0bd677b5ecd195eeb949353","0x000000000000000000000000bf4ed7b27f1d666546e30d74d50d173d20bca754"]
["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x000000000000000000000000684cc7b2c5e666fdf0bd677b5ecd195eeb949353","0x000000000000000000000000bf4ed7b27f1d666546e30d74d50d173d20bca754"]
First let's do a simple query for just the first one, so just that first topic, which is unique to it,
0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925
.No problem, we got our owe log back. Now, since they both share their second item, let's try querying for it, by constructing a filter object with a null first argument, followed by the shared filter,
0x000000000000000000000000684cc7b2c5e666fdf0bd677b5ecd195eeb949353
.Now we get no results back.
Maybe we can't use null values at all, you say?
Let's now try two null values, just to check if nulls are respected at all:
I won't bore you with more examples. A few things I'll tell you:
Anyways, I hope this is enough to debug the issue, thanks!
The text was updated successfully, but these errors were encountered: