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 returns empty array in v2.34.0 #6598

Closed
sjlee1125 opened this issue Jan 17, 2023 · 21 comments
Closed

eth_getLogs returns empty array in v2.34.0 #6598

sjlee1125 opened this issue Jan 17, 2023 · 21 comments
Assignees

Comments

@sjlee1125
Copy link

System information

Erigon version: v2.34.0

OS & Version: Linux

body:

{
    "jsonrpc": "2.0",
    "method": "eth_getLogs",
    "id": 1000,
    "params": [{"fromBlock":"0x2282842","toBlock":"0x2282842", "topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}]
}

In 2.33.1, the result is normal, but in 2.34.0, an empty array is returned.

@Denis-score
Copy link

Same issue on my side.

Rollback to 2.33.1 resolved the issue

@boxhock
Copy link

boxhock commented Jan 17, 2023

Have experienced this as well. What's weird is that it sometimes works - but most of the time it does not work and just returns an empty array. Tested and experienced this on Ethereum.

Before anyone asks, you get the same result regardless if you wrap your topics or not ([A] and [[A]]).

@AlexeyAkhunov
Copy link
Contributor

Thanks for reporting. Reproduced

@AlexeyAkhunov
Copy link
Contributor

Oh, I did not realise it is for polygon, so I cannot reproduce for now, will need to try to reproduce on Ethereum

@boxhock
Copy link

boxhock commented Jan 18, 2023

@AlexeyAkhunov this seems to be a problem regardless of chain (both Ethereum and Polygon) - will reproducing on both chains need to be necessary?

Another detail: it seems like the few times eth_getLogs actually does return data, it varies how many logs it actually manages to return for the same block across multiple requests.

@AlexeyAkhunov
Copy link
Contributor

@AlexeyAkhunov this seems to be a problem regardless of chain (both Ethereum and Polygon) - will reproducing on both chains need to be necessary?

I don't have a working Polygon node, therefore I cannot reproduce in Polygon, but I think I might be able to reproduce on Ethereum Mainnet, but I am not sure yet

@AlexeyAkhunov
Copy link
Contributor

I think I have reproduced, will investigate further tomorrow

@AlexeyAkhunov
Copy link
Contributor

Ok, I found what caused this

@AlexeyAkhunov
Copy link
Contributor

I have made a tag for the patch release, v2.35.1, could you please try. Will publish tomorrow after some more testing

@boxhock
Copy link

boxhock commented Jan 19, 2023

@AlexeyAkhunov unfortunately it does not appear to have fully resolved it for us.

We're doing a repeating curl, and this is the number of bytes in each response (we'd expect this to be constant since we're querying a specific block number):

Wed Jan 18 22:12:42 EST 2023: 42
Wed Jan 18 22:13:02 EST 2023: 1920
Wed Jan 18 22:13:15 EST 2023: 42
Wed Jan 18 22:14:50 EST 2023: 2046
Wed Jan 18 22:15:05 EST 2023: 1664
Wed Jan 18 22:15:15 EST 2023: 4247
Wed Jan 18 22:15:27 EST 2023: 4055

(42 bytes means that it returned an empty array)

Edit: It does potentially seem like it's returning data more often than returning empty compared to before, but it still seems flakey as I'd expect it to return data, and the same amount of data, on each query.

@AlexeyAkhunov
Copy link
Contributor

@boxhock thank you. I only fixed what I could reproduce.

So which query are you using? I still don't have Polygon node, so I cannot reproduce that one. Also, is the version 2.33.1 definitely free from this defect?

@drcliche
Copy link

@AlexeyAkhunov, I work with @boxhock

We cannot confirm it specifically didn't occur on eth with 2.33.1 as our nodes never ran that version. We observed it first on 2.34.0.

Example against our Ethereum archive node running Erigon 2.35.1:
First request in recent run:
$ curl -q --location --request POST 'http://eth-archive:8545' --header 'Content-Type: application/json' --data-raw '{ "id": "test", "jsonrpc": "2.0", "method": "eth_getLogs", "params": [{ "blockFrom": "0xf9428f", "blockTo": "0xf9428f", "topics": ["0xf6a97944f31ea060dfde0566e4167c1a1082551e64b60ecb14d599a9d023d451"] }] }' {"jsonrpc":"2.0","id":"test","result":[{"address":"0x0ebdc65e7e9132cb41ac5cbd0101b799d7adb475","topics":["0xf6a97944f31ea060dfde0566e4167c1a1082551e64b60ecb14d599a9d023d451","0x0000000000000000000000000000000000000000000000000000000000000f36"],"data":"0x000000000000000000000000000000000000000000000000000000000124af1d000000000000000000000000dbfea8d5822141c13f92caa06eb94d0f3d67c24300000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000065a2e0d0e729de6c2b36859dd076ccac000050c4040000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000124948700000000000000000000000000000000000000000000000000000000012496b200000000000000000000000000000000000000000000000000000000012496b200000000000000000000000000000000000000000000000000000000012496b2000000000000000000000000000000000000000000000000000000000124adc8000000000000000000000000000000000000000000000000000000000124af1d000000000000000000000000000000000000000000000000000000000124af1d000000000000000000000000000000000000000000000000000000000124af1d000000000000000000000000000000000000000000000000000000000124af1d000000000000000000000000000000000000000000000000000000000124af1d000000000000000000000000000000000000000000000000000000000124afd5000000000000000000000000000000000000000000000000000000000124b200000000000000000000000000000000000000000000000000000000000124b372000000000000000000000000000000000000000000000000000000000124c114000000000000000000000000000000000000000000000000000000000124cebd000000000000000000000000000000000000000000000000000000000124cebd00000000000000000000000000000000000000000000000000000000000000100a040207080503010c0f0b00060e090d00000000000000000000000000000000","blockNumber":"0xfafe20","transactionHash":"0xf0ec4f9657a1ad2907f30becdaf718a4ca8e9f29df2152888f53ebc7c47afc2f","transactionIndex":"0x53","blockHash":"0x715a7c617f33a543ad5cd0d0498b9278c6e0204c923c08ce17e80b3891a53b54","logIndex":"0x9b","removed":false}]}

Immediately running the same curl again:
$ curl -q --location --request POST 'http://eth-archive:8545' --header 'Content-Type: application/json' --data-raw '{ "id": "test", "jsonrpc": "2.0", "method": "eth_getLogs", "params": [{ "blockFrom": "0xf9428f", "blockTo": "0xf9428f", "topics": ["0xf6a97944f31ea060dfde0566e4167c1a1082551e64b60ecb14d599a9d023d451"] }] }' {"jsonrpc":"2.0","id":"test","result":[]}

This is noticeable across all chains, including ethereum.

@AlexeyAkhunov
Copy link
Contributor

@drcliche thank you! Can you try this on v2.36.0 ? I had to downgrade MDBX version, maybe new version had something to do with it

@drcliche
Copy link

@AlexeyAkhunov Apologies for the lag and thank you for looking into this. Now running erigon[1162456]: [INFO] [01-22|17:40:34.258] Build info git_branch=HEAD git_tag=v2.36.0-dirty git_commit=3ec0ed769fc9ee11c5a23b213309a82fb0921a but seeing the same behavior:

$ curl -q --location --request POST 'http://eth-archive:8545' --header 'Content-Type: application/json' --data-raw '{ "id": "test", "jsonrpc": "2.0", "method": "eth_getLogs", "params": [{ "blockFrom": "0xf9428f", "blockTo": "0xf9428f", "topics": ["0xf6a97944f31ea060dfde0566e4167c1a1082551e64b60ecb14d599a9d023d451"] }] }' {"jsonrpc":"2.0","id":"test","result":[]} $ curl -q --location --request POST 'http://eth-archive:8545' --header 'Content-Type: application/json' --data-raw '{ "id": "test", "jsonrpc": "2.0", "method": "eth_getLogs", "params": [{ "blockFrom": "0xf9428f", "blockTo": "0xf9428f", "topics": ["0xf6a97944f31ea060dfde0566e4167c1a1082551e64b60ecb14d599a9d023d451"] }] }' {"jsonrpc":"2.0","id":"test","result":[]} $ curl -q --location --request POST 'http://eth-archive:8545' --header 'Content-Type: application/json' --data-raw '{ "id": "test", "jsonrpc": "2.0", "method": "eth_getLogs", "params": [{ "blockFrom": "0xf9428f", "blockTo": "0xf9428f", "topics": ["0xf6a97944f31ea060dfde0566e4167c1a1082551e64b60ecb14d599a9d023d451"] }] }' {"jsonrpc":"2.0","id":"test","result":[]} $ curl -q --location --request POST 'http://eth-archive:8545' --header 'Content-Type: application/json' --data-raw '{ "id": "test", "jsonrpc": "2.0", "method": "eth_getLogs", "params": [{ "blockFrom": "0xf9428f", "blockTo": "0xf9428f", "topics": ["0xf6a97944f31ea060dfde0566e4167c1a1082551e64b60ecb14d599a9d023d451"] }] }' {"jsonrpc":"2.0","id":"test","result":[{"address":"0x6a1ef9bf93048533c49a1eed984c080608f7db6a","topics":["0xf6a97944f31ea060dfde0566e4167c1a1082551e64b60ecb14d599a9d023d451","0x000000000000000000000000000000000000000000000000000000000000288d"],"data":"0x0000000000000000000000000000000000000000000000000000000001ffc7a0000000000000000000000000dbfea8d5822141c13f92caa06eb94d0f3d67c24300000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000065df9cacd604d3542bdfe242042d9106000054b003000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000016ec8730000000000000000000000000000000000000000000000000000000001d4730b0000000000000000000000000000000000000000000000000000000001d4730b0000000000000000000000000000000000000000000000000000000001d4730b0000000000000000000000000000000000000000000000000000000001d4730b0000000000000000000000000000000000000000000000000000000001ffc7a00000000000000000000000000000000000000000000000000000000001ffc7a00000000000000000000000000000000000000000000000000000000001ffc7a00000000000000000000000000000000000000000000000000000000001ffc7a00000000000000000000000000000000000000000000000000000000001ffc7a00000000000000000000000000000000000000000000000000000000001ffc7a0000000000000000000000000000000000000000000000000000000000202d4e0000000000000000000000000000000000000000000000000000000000202d4e0000000000000000000000000000000000000000000000000000000000202d4e00000000000000000000000000000000000000000000000000000000002078fc80000000000000000000000000000000000000000000000000000000002078fc8000000000000000000000000000000000000000000000000000000000000001001080b0a090403020c0d0f060705000e00000000000000000000000000000000","blockNumber":"0xfb3823","transactionHash":"0x55f985a0eb5f129dcd9cc61f4dc0569ee58a1a9bc84b0e501fec0a8fd180a690","transactionIndex":"0x2e","blockHash":"0xf326d76fdcd0612b8c3c74d62831a33e80c3912a27ebd67fa3ef5fb1173f444c","logIndex":"0x78","removed":false}]} $ curl -q --location --request POST 'http://eth-archive:8545' --header 'Content-Type: application/json' --data-raw '{ "id": "test", "jsonrpc": "2.0", "method": "eth_getLogs", "params": [{ "blockFrom": "0xf9428f", "blockTo": "0xf9428f", "topics": ["0xf6a97944f31ea060dfde0566e4167c1a1082551e64b60ecb14d599a9d023d451"] }] }' {"jsonrpc":"2.0","id":"test","result":[{"address":"0x6a1ef9bf93048533c49a1eed984c080608f7db6a","topics":["0xf6a97944f31ea060dfde0566e4167c1a1082551e64b60ecb14d599a9d023d451","0x000000000000000000000000000000000000000000000000000000000000288d"],"data":"0x0000000000000000000000000000000000000000000000000000000001ffc7a0000000000000000000000000dbfea8d5822141c13f92caa06eb94d0f3d67c24300000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000065df9cacd604d3542bdfe242042d9106000054b003000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000016ec8730000000000000000000000000000000000000000000000000000000001d4730b0000000000000000000000000000000000000000000000000000000001d4730b0000000000000000000000000000000000000000000000000000000001d4730b0000000000000000000000000000000000000000000000000000000001d4730b0000000000000000000000000000000000000000000000000000000001ffc7a00000000000000000000000000000000000000000000000000000000001ffc7a00000000000000000000000000000000000000000000000000000000001ffc7a00000000000000000000000000000000000000000000000000000000001ffc7a00000000000000000000000000000000000000000000000000000000001ffc7a00000000000000000000000000000000000000000000000000000000001ffc7a0000000000000000000000000000000000000000000000000000000000202d4e0000000000000000000000000000000000000000000000000000000000202d4e0000000000000000000000000000000000000000000000000000000000202d4e00000000000000000000000000000000000000000000000000000000002078fc80000000000000000000000000000000000000000000000000000000002078fc8000000000000000000000000000000000000000000000000000000000000001001080b0a090403020c0d0f060705000e00000000000000000000000000000000","blockNumber":"0xfb3823","transactionHash":"0x55f985a0eb5f129dcd9cc61f4dc0569ee58a1a9bc84b0e501fec0a8fd180a690","transactionIndex":"0x2e","blockHash":"0xf326d76fdcd0612b8c3c74d62831a33e80c3912a27ebd67fa3ef5fb1173f444c","logIndex":"0x78","removed":false}]} $ curl -q --location --request POST 'http://eth-archive:8545' --header 'Content-Type: application/json' --data-raw '{ "id": "test", "jsonrpc": "2.0", "method": "eth_getLogs", "params": [{ "blockFrom": "0xf9428f", "blockTo": "0xf9428f", "topics": ["0xf6a97944f31ea060dfde0566e4167c1a1082551e64b60ecb14d599a9d023d451"] }] }' {"jsonrpc":"2.0","id":"test","result":[{"address":"0x6a1ef9bf93048533c49a1eed984c080608f7db6a","topics":["0xf6a97944f31ea060dfde0566e4167c1a1082551e64b60ecb14d599a9d023d451","0x000000000000000000000000000000000000000000000000000000000000288d"],"data":"0x0000000000000000000000000000000000000000000000000000000001ffc7a0000000000000000000000000dbfea8d5822141c13f92caa06eb94d0f3d67c24300000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000065df9cacd604d3542bdfe242042d9106000054b003000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000016ec8730000000000000000000000000000000000000000000000000000000001d4730b0000000000000000000000000000000000000000000000000000000001d4730b0000000000000000000000000000000000000000000000000000000001d4730b0000000000000000000000000000000000000000000000000000000001d4730b0000000000000000000000000000000000000000000000000000000001ffc7a00000000000000000000000000000000000000000000000000000000001ffc7a00000000000000000000000000000000000000000000000000000000001ffc7a00000000000000000000000000000000000000000000000000000000001ffc7a00000000000000000000000000000000000000000000000000000000001ffc7a00000000000000000000000000000000000000000000000000000000001ffc7a0000000000000000000000000000000000000000000000000000000000202d4e0000000000000000000000000000000000000000000000000000000000202d4e0000000000000000000000000000000000000000000000000000000000202d4e00000000000000000000000000000000000000000000000000000000002078fc80000000000000000000000000000000000000000000000000000000002078fc8000000000000000000000000000000000000000000000000000000000000001001080b0a090403020c0d0f060705000e00000000000000000000000000000000","blockNumber":"0xfb3823","transactionHash":"0x55f985a0eb5f129dcd9cc61f4dc0569ee58a1a9bc84b0e501fec0a8fd180a690","transactionIndex":"0x2e","blockHash":"0xf326d76fdcd0612b8c3c74d62831a33e80c3912a27ebd67fa3ef5fb1173f444c","logIndex":"0x78","removed":false}]} $ curl -q --location --request POST 'http://eth-archive:8545' --header 'Content-Type: application/json' --data-raw '{ "id": "test", "jsonrpc": "2.0", "method": "eth_getLogs", "params": [{ "blockFrom": "0xf9428f", "blockTo": "0xf9428f", "topics": ["0xf6a97944f31ea060dfde0566e4167c1a1082551e64b60ecb14d599a9d023d451"] }] }' {"jsonrpc":"2.0","id":"test","result":[]} $ curl -q --location --request POST 'http://eth-archive:8545' --header 'Content-Type: application/json' --data-raw '{ "id": "test", "jsonrpc": "2.0", "method": "eth_getLogs", "params": [{ "blockFrom": "0xf9428f", "blockTo": "0xf9428f", "topics": ["0xf6a97944f31ea060dfde0566e4167c1a1082551e64b60ecb14d599a9d023d451"] }] }' {"jsonrpc":"2.0","id":"test","result":[]} $ curl -q --location --request POST 'http://eth-archive:8545' --header 'Content-Type: application/json' --data-raw '{ "id": "test", "jsonrpc": "2.0", "method": "eth_getLogs", "params": [{ "blockFrom": "0xf9428f", "blockTo": "0xf9428f", "topics": ["0xf6a97944f31ea060dfde0566e4167c1a1082551e64b60ecb14d599a9d023d451"] }] }' {"jsonrpc":"2.0","id":"test","result":[]} $ curl -q --location --request POST 'http://eth-archive:8545' --header 'Content-Type: application/json' --data-raw '{ "id": "test", "jsonrpc": "2.0", "method": "eth_getLogs", "params": [{ "blockFrom": "0xf9428f", "blockTo": "0xf9428f", "topics": ["0xf6a97944f31ea060dfde0566e4167c1a1082551e64b60ecb14d599a9d023d451"] }] }' {"jsonrpc":"2.0","id":"test","result":[]} $ curl -q --location --request POST 'http://eth-archive:8545' --header 'Content-Type: application/json' --data-raw '{ "id": "test", "jsonrpc": "2.0", "method": "eth_getLogs", "params": [{ "blockFrom": "0xf9428f", "blockTo": "0xf9428f", "topics": ["0xf6a97944f31ea060dfde0566e4167c1a1082551e64b60ecb14d599a9d023d451"] }] }' {"jsonrpc":"2.0","id":"test","result":[]} $ curl -q --location --request POST 'http://eth-archive:8545' --header 'Content-Type: application/json' --data-raw '{ "id": "test", "jsonrpc": "2.0", "method": "eth_getLogs", "params": [{ "blockFrom": "0xf9428f", "blockTo": "0xf9428f", "topics": ["0xf6a97944f31ea060dfde0566e4167c1a1082551e64b60ecb14d599a9d023d451"] }] }' {"jsonrpc":"2.0","id":"test","result":[]} $ curl -q --location --request POST 'http://eth-archive:8545' --header 'Content-Type: application/json' --data-raw '{ "id": "test", "jsonrpc": "2.0", "method": "eth_getLogs", "params": [{ "blockFrom": "0xf9428f", "blockTo": "0xf9428f", "topics": ["0xf6a97944f31ea060dfde0566e4167c1a1082551e64b60ecb14d599a9d023d451"] }] }' {"jsonrpc":"2.0","id":"test","result":[]} $ curl -q --location --request POST 'http://eth-archive:8545' --header 'Content-Type: application/json' --data-raw '{ "id": "test", "jsonrpc": "2.0", "method": "eth_getLogs", "params": [{ "blockFrom": "0xf9428f", "blockTo": "0xf9428f", "topics": ["0xf6a97944f31ea060dfde0566e4167c1a1082551e64b60ecb14d599a9d023d451"] }] }' {"jsonrpc":"2.0","id":"test","result":[]} $ curl -q --location --request POST 'http://eth-archive:8545' --header 'Content-Type: application/json' --data-raw '{ "id": "test", "jsonrpc": "2.0", "method": "eth_getLogs", "params": [{ "blockFrom": "0xf9428f", "blockTo": "0xf9428f", "topics": ["0xf6a97944f31ea060dfde0566e4167c1a1082551e64b60ecb14d599a9d023d451"] }] }' {"jsonrpc":"2.0","id":"test","result":[]}

@hexoscott
Copy link
Collaborator

hexoscott commented Feb 21, 2023

@drcliche, @boxhock - I've just run that curl and got nothing back, my node is behind the tip by a long way and syncing though but has that block.... it looks like you're using bad params in your request. blockFrom should be fromBlock and likewise blockTo should be toBlock.

When these are passed incorrectly the logs are read from the most recently executed block which is possibly why you're seeing an issue here.

Could you try curl -q --location --request POST 'http://localhost:8545' --header 'Content-Type: application/json' --data-raw '{ "id": "test", "jsonrpc": "2.0", "method": "eth_getLogs", "params": [{ "fromBlock": "0xf9428f", "toBlock": "0xf9428f", "topics": ["0xf6a97944f31ea060dfde0566e4167c1a1082551e64b60ecb14d599a9d023d451"] }] }' and see if that makes a difference for you.

@drcliche
Copy link

@hexoscott That does appear to work a lot more reliably on our synced nodes... I'll get with the team and see if that was just something that got kicked around backwards in testing or if that was actually the issue all along.

@hexoscott
Copy link
Collaborator

@drcliche - great thanks, let me know either way if you could :) hopefully it was just a simple typo

@hexoscott
Copy link
Collaborator

Going to close this down, if the issue is still there feel free to re-open and we'll pick the thread back up.

@drcliche
Copy link

Thanks @hexoscott ! We have verified things are good now. It looks like the reversion at 2.34.0 was the issue, then a bad test case was used from there.

@hexoscott
Copy link
Collaborator

Great! Thank you for confirming!

@AgentDarren
Copy link

@hexoscott Can you please look at this same issue with bsc-erigon?
node-real#174

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

No branches or pull requests

7 participants