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
eth_getFilterChanges returns a string containing serialized JSON array (not the JSON array)
Description
If you install a block filter, using eth_newBlockFilter, or a log filter, using eth_newFilter, then call eth_getFilterChanges you get a result such as:
Hey @peterbroadhurst, thank you for opening this issue
I see that you've opened draft PR, if you need any help with it or you want us to take over the task please ask :)
eth_getFilterChanges returns a string containing serialized JSON array (not the JSON array)
Description
If you install a block filter, using
eth_newBlockFilter
, or a log filter, usingeth_newFilter
, then calleth_getFilterChanges
you get a result such as:You can see
Your environment
Steps to reproduce
For blocks
Request 1:
eth_newBlockFilter
Response 1:
eth_newBlockFilter
Request 2:
eth_getFilterChanges
Response 2:
eth_getFilterChanges
For Logs
Request 1:
eth_newFilter
Response 1:
Request 2:
eth_getFilterLogs
- note this is GOODResponse 2: - note this is GOOD
Request 3:
eth_getFilterChanges
Response 3: - see here it is a string (not an array)
Expected behaviour
The result should not be an array, not a string containing a serialized JSON array.
Actual behaviour
It's an array directly in the JSON/RPC
result
.Logs
Easy to recreate.
Note: The unit test does not catch this, as the Go JSON/RPC wrapper used in the test masks this issue, by unmarshalling the array:
https://github.com/umbracle/ethgo/blob/8326bf607acf2ae4893128cacf205c67261cc411/jsonrpc/eth.go#L74-L86
Proposed solution
The problem appears to be specific to this area of code, because it's trying to handle either type of filter there could be two types of result.
polygon-edge/jsonrpc/filter_manager.go
Lines 481 to 503 in d34f557
So I propose this code returns ajson.RawMessage
rather thanstring
.I will work to provide that proposal in code via a PR, as a follow-up to this issue.
The text was updated successfully, but these errors were encountered: