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 incorrect records when filtering by block number #439

Closed
kilkka opened this issue Aug 15, 2024 · 3 comments · Fixed by #445
Closed

eth_getLogs returns incorrect records when filtering by block number #439

kilkka opened this issue Aug 15, 2024 · 3 comments · Fixed by #445
Assignees
Labels
Bug Something isn't working Feedback

Comments

@kilkka
Copy link

kilkka commented Aug 15, 2024

Problem

For some of the earliest blocks on the EVM testnet (below block ~100), filtering logs by block number can result in logs from blocks outside that range getting returned.

Steps to Reproduce

For example, this request to https://testnet.evm.nodes.onflow.org for block 9:

{
    "jsonrpc": "2.0",
    "method": "eth_getLogs",
    "id": "1",
    "params": [
        {
            "topics": [
                [
                    "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0"
                ]
            ],
            "fromBlock": "0x9",
            "toBlock": "0x9"
        }
    ]
}

Results in logs coming back from blocks 2519, 2532, and 2546:

{
    "jsonrpc": "2.0",
    "id": "1",
    "result": [
        {
            "address": "0xf8146b4aef631853f0eb98dbe28706d029e52c52",
            "topics": [
                "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0",
                "0x0000000000000000000000000000000000000000000000000000000000000000",
                "0x0000000000000000000000000000000000000000000000023f946ffbc8829bfd"
            ],
            "data": "0x",
            "blockNumber": "0x9d7",
            "transactionHash": "0x56e8d9586ed4422136ab0e79c9c537b33f09b7a3b870ca569e230a15b925c3b2",
            "transactionIndex": "0x0",
            "blockHash": "0xcad79e3019da8014f623f351f01c88d1bcb4613352d4801548c6b07992fd1393",
            "logIndex": "0x0",
            "removed": false
        },
        {
            "address": "0x4eb7be1347727d2ebc8fbf85cc82fd23c59d669a",
            "topics": [
                "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0",
                "0x0000000000000000000000000000000000000000000000000000000000000000",
                "0x0000000000000000000000000000000000000000000000023f946ffbc8829bfd"
            ],
            "data": "0x",
            "blockNumber": "0x9e4",
            "transactionHash": "0x23de904c89530a9225fa41733d5651f26cf587be51eed84a08bfc039beb9e3ca",
            "transactionIndex": "0x0",
            "blockHash": "0xf64d8bd7a1c0795c445fdf8829e7cdf2a572797b75daa8f208ad1a85d2b93a56",
            "logIndex": "0x0",
            "removed": false
        },
        {
            "address": "0x91adb5cba277f53a44d4cfc7a5c6b744ab4e7477",
            "topics": [
                "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0",
                "0x0000000000000000000000000000000000000000000000000000000000000000",
                "0x0000000000000000000000000000000000000000000000023f946ffbc8829bfd"
            ],
            "data": "0x",
            "blockNumber": "0x9f2",
            "transactionHash": "0x24488eccbd33523548b7d12835eb442dd7c4d9d01ec5ea9b0e54eba2ac965737",
            "transactionIndex": "0x0",
            "blockHash": "0x6b2844981b110526dea03bfb5e68456d03b936f2e649850f8616841b1c0a2af9",
            "logIndex": "0x0",
            "removed": false
        }
    ]
}

Will note that all four of those block numbers start with 0x9.

Similar issue when filtering for block number 10, 11, and others in the early block range on testnet.

Acceptance Criteria

Return only the logs from the specified range in the results.

Context

We are indexing data for SimpleHash, the multi-chain token API.

@m-Peter m-Peter self-assigned this Aug 15, 2024
@m-Peter m-Peter added the Bug Something isn't working label Aug 15, 2024
@sideninja
Copy link
Contributor

We will investigate this issue asap! thank you for reporting.

@sideninja sideninja self-assigned this Aug 15, 2024
@m-Peter
Copy link
Collaborator

m-Peter commented Aug 15, 2024

Will note that all four of those block numbers start with 0x9.

@kilkka That hint was pure 🥇 in helping find the issue 🙇

@sideninja sideninja mentioned this issue Aug 16, 2024
6 tasks
@sideninja
Copy link
Contributor

@kilkka the fix was made, we will update the deployment soon. Thank you for your report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Feedback
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants