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_getLogs does not work with pending #24237

Closed
quickchase opened this issue Jan 13, 2022 · 3 comments · Fixed by #24949
Closed

eth_getLogs does not work with pending #24237

quickchase opened this issue Jan 13, 2022 · 3 comments · Fixed by #24949
Assignees
Labels

Comments

@quickchase
Copy link

quickchase commented Jan 13, 2022

System information

Geth version: v1.10.15
OS & Version: Linux

This is kind of a duplicate of #5359 however, that was automatically closed and was never addressed.

Expected behaviour

eth_getLogs should work with "pending" blocks - according to all available documentation "pending" is a valid string for both fromBlock and toBlock

Both Nethermind and OpenEthereum support "pending" here in accordance with the docs.

Actual behaviour

"pending" to "pending":

{"jsonrpc":"2.0","id":1,"error":{"code":-32000,"message":"failed to get block number from hash"}}

That ☝️ is just broken completely

"latest" to "pending":

{"jsonrpc":"2.0","id":1,"result":[]}

That ☝️ always returns an empty array, despite the fact there should be logs (test an OpenEthereum node, it'll return lots of stuff)

Steps to reproduce the behaviour

Take the the following eth_getLogs command and just modify the fromBlock and/or toBlock

curl -H "Content-Type: application/json" -d '{"method":"eth_getLogs","params":[{"fromBlock":"pending","toBlock":"pending","topics":[["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62"],["0x0000000000000000000000000000000000000000000000000000000000000000"]]}],"id":1,"jsonrpc":"2.0"}' localhost:8545
@holiman
Copy link
Contributor

holiman commented Jan 20, 2022

It looks like we don't properly handle input for pending, but the backend looks like it should handle this case.

@marvinkennis
Copy link

Logs are only emitted when a transaction is executed by the EVM. Pending transactions by definition aren't executed yet, so no logs have been emitted for them?

@quickchase
Copy link
Author

It works for Nethermind and it works for OpenEthereum, every JSON-RPC doc I can find states that pending is supported, and Martin/holiman already said "the backend looks like it should handle this case."

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

Successfully merging a pull request may close this issue.

5 participants