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

Many event logs repeated twice in rpc response #1649

Open
leo-xinwang opened this issue Jan 7, 2025 · 1 comment
Open

Many event logs repeated twice in rpc response #1649

leo-xinwang opened this issue Jan 7, 2025 · 1 comment

Comments

@leo-xinwang
Copy link

For example the first 2 logs below:
Request:
{"jsonrpc":"2.0","method":"eth_getLogs","params":[{"topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"],"fromBlock":"0x4d7ffe","toBlock":"0x4d7ffe"}],"id":1}
Response:
{
"jsonrpc": "2.0",
"result": [
{
"address": "0x46275d29113f065c2aac262f34c7a3d8a8b7377d",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x000000000000000000000000efb73e47099485c72b7678cb59fb0da7dacf173f",
"0x000000000000000000000000a4ffac7a5da311d724ed47393848f694baee7930",
"0x00000000000000000000000000000000000000000000000000000000000007ab"
],
"data": "0x",
"blockHash": "0x7f6fc143909105b45f8c2ae11ac554f8f1c4dd03d30ac66161fca000dd60ff01",
"blockNumber": "0x4d7ffe",
"transactionHash": "0xb9d05f6af4f709ddf719186c3f4b735de1468c8698c00291b667c92804d238fc",
"transactionIndex": "0x0",
"logIndex": "0x0",
"transactionLogIndex": "0x0",
"removed": false
},
{
"address": "0x46275d29113f065c2aac262f34c7a3d8a8b7377d",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x000000000000000000000000efb73e47099485c72b7678cb59fb0da7dacf173f",
"0x000000000000000000000000a4ffac7a5da311d724ed47393848f694baee7930",
"0x00000000000000000000000000000000000000000000000000000000000007ab"
],
"data": "0x",
"blockHash": "0xfb94d9057ba08fe9dadb15470fa91d7d7d61dcf0c010a94ce6cd4cc4c43e2c9f",
"blockNumber": "0x4d7ffe",
"transactionHash": "0xb9d05f6af4f709ddf719186c3f4b735de1468c8698c00291b667c92804d238fc",
"transactionIndex": "0x0",
"logIndex": "0x0",
"transactionLogIndex": "0x0",
"removed": false
},

@boundless-forest
Copy link
Member

boundless-forest commented Jan 7, 2025

image

Nice catch! I think there is a bug in the code that the removed field is not being checked. As you can tell from the screenshot I pasted, the duplicated log's only difference is the blockHash field because of reorged block. According to the https://www.quicknode.com/docs/ethereum/eth_getLogs, the removed field is a boolean value indicating if the log was removed from the blockchain due to a chain reorganization. So, I think we should check the removed field to avoid duplicated logs, but now all the logs' removed field is false. I'll try to find a way to fix this.

A temporary solution is to add the blockhash to the filter and ensure the blockhash is always the conical one.

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

2 participants