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 respect blockhash filter #369

Closed
rafaelkallis opened this issue Jul 22, 2022 · 1 comment
Closed

eth_getLogs does not respect blockhash filter #369

rafaelkallis opened this issue Jul 22, 2022 · 1 comment
Assignees
Labels
bug Something isn't working limechain P1
Projects
Milestone

Comments

@rafaelkallis
Copy link
Contributor

rafaelkallis commented Jul 22, 2022

Description

One can query the logs of a specific block using eth_getLogs with the blockhash filter.

The results of this query on the relay node unexpectedly also contain logs from other blocks.

Steps to reproduce

set BASE_URL "http://localhost:7546"
set BLOCK_HASH 0xc28a3f6447377809b1ecf7cf5ea252bfd3d0da593ef4d75539907f0e46b20193
set ADDRESS 0x0000000000000000000000000000000002bcc93e
curl -X POST $BASE_URL \
                                       -H 'Content-Type: application/json' \
                                       -d "{\"id\":\"2\",\"jsonrpc\":\"2.0\",\"method\":\"eth_getLogs\",\"params\":[{\"blockhash\":\"$BLOCK_HASH\", \"address\":\"$ADDRESS\"}]}"

NOTE: you might need to retry the request in case of a 500 :)

Additional context

Response of the above curl, notice that it contains logs from block 0x01b75faf6be6e191dc6251cd7ab7f88e6a038f6767e1da9b06db245a615d2729 which violates the filter

{
  "address": "0x0000000000000000000000000000000002bcc93e",
  "blockHash": "0xc28a3f6447377809b1ecf7cf5ea252bfd3d0da593ef4d75539907f0e46b20193",
  "blockNumber": "0x14c3300",
  "data": "0x",
  "logIndex": "0x0",
  "removed": false,
  "topics": [
    "0x5cece29c095139a9ac6cdc37054dc769541db4a33484b164ee9edb27babce82a",
    "0x0000000000000000000000000000000000000000000000000000000002bcc93e",
    "0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b",
    "0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b"
  ],
  "transactionHash": "0x9040d4244cfeb7c5fc96ac378308d9df8a6616c550e9d02162b3ef3fe889df86",
  "transactionIndex": "0x2"
}
{
  "address": "0x0000000000000000000000000000000002bcc93e",
  "blockHash": "0xc28a3f6447377809b1ecf7cf5ea252bfd3d0da593ef4d75539907f0e46b20193",
  "blockNumber": "0x14c3300",
  "data": "0x",
  "logIndex": "0x1",
  "removed": false,
  "topics": [
    "0x5cece29c095139a9ac6cdc37054dc769541db4a33484b164ee9edb27babce82a",
    "0x0000000000000000000000000000000000000000000000000000000002bcc93e",
    "0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b",
    "0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b"
  ],
  "transactionHash": "0x9040d4244cfeb7c5fc96ac378308d9df8a6616c550e9d02162b3ef3fe889df86",
  "transactionIndex": "0x2"
}
{
  "address": "0x0000000000000000000000000000000002bcc93e",
  "blockHash": "0xc28a3f6447377809b1ecf7cf5ea252bfd3d0da593ef4d75539907f0e46b20193",
  "blockNumber": "0x14c3300",
  "data": "0x",
  "logIndex": "0x2",
  "removed": false,
  "topics": [
    "0x5cece29c095139a9ac6cdc37054dc769541db4a33484b164ee9edb27babce82a",
    "0x0000000000000000000000000000000000000000000000000000000002bcc93e",
    "0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b",
    "0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b"
  ],
  "transactionHash": "0x9040d4244cfeb7c5fc96ac378308d9df8a6616c550e9d02162b3ef3fe889df86",
  "transactionIndex": "0x2"
}
{
  "address": "0x0000000000000000000000000000000002bcc93e",
  "blockHash": "0x01b75faf6be6e191dc6251cd7ab7f88e6a038f6767e1da9b06db245a615d2729", // <---------- OOPS
  "blockNumber": "0x14c32ff",
  "data": "0x",
  "logIndex": "0x3",
  "removed": false,
  "topics": [
    "0x5cece29c095139a9ac6cdc37054dc769541db4a33484b164ee9edb27babce82a",
    "0x0000000000000000000000000000000000000000000000000000000002bcc93e",
    "0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b",
    "0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b"
  ],
  "transactionHash": "0x3c52b41907459c7c47aab138c3a26c08b048dae822b00f55dd2de3c87232b509",
  "transactionIndex": "0x2"
}
{
  "address": "0x0000000000000000000000000000000002bcc93e",
  "blockHash": "0x01b75faf6be6e191dc6251cd7ab7f88e6a038f6767e1da9b06db245a615d2729",
  "blockNumber": "0x14c32ff",
  "data": "0x",
  "logIndex": "0x4",
  "removed": false,
  "topics": [
    "0x5cece29c095139a9ac6cdc37054dc769541db4a33484b164ee9edb27babce82a",
    "0x0000000000000000000000000000000000000000000000000000000002bcc93e",
    "0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b",
    "0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b"
  ],
  "transactionHash": "0x3c52b41907459c7c47aab138c3a26c08b048dae822b00f55dd2de3c87232b509",
  "transactionIndex": "0x2"
}
{
  "address": "0x0000000000000000000000000000000002bcc93e",
  "blockHash": "0x01b75faf6be6e191dc6251cd7ab7f88e6a038f6767e1da9b06db245a615d2729",
  "blockNumber": "0x14c32ff",
  "data": "0x",
  "logIndex": "0x5",
  "removed": false,
  "topics": [
    "0x5cece29c095139a9ac6cdc37054dc769541db4a33484b164ee9edb27babce82a",
    "0x0000000000000000000000000000000000000000000000000000000002bcc93e",
    "0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b",
    "0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b"
  ],
  "transactionHash": "0x3c52b41907459c7c47aab138c3a26c08b048dae822b00f55dd2de3c87232b509",
  "transactionIndex": "0x2"
}
{
  "address": "0x0000000000000000000000000000000002bcc93e",
  "blockHash": "0x01b75faf6be6e191dc6251cd7ab7f88e6a038f6767e1da9b06db245a615d2729",
  "blockNumber": "0x14c32ff",
  "data": "0x",
  "logIndex": "0x6",
  "removed": false,
  "topics": [
    "0x5cece29c095139a9ac6cdc37054dc769541db4a33484b164ee9edb27babce82a",
    "0x0000000000000000000000000000000000000000000000000000000002bcc93e",
    "0x00000000000000000000000000000000000000000000000000000000002ba05c",
    "0x00000000000000000000000000000000000000000000000000000000002ba05c"
  ],
  "transactionHash": "0x4bd72731f52f20cb6f4a6ea733f57748b6ee5e72b1af9e664b53d05969b63f12",
  "transactionIndex": "0x0"
}
{
  "address": "0x0000000000000000000000000000000002bcc93e",
  "blockHash": "0x01b75faf6be6e191dc6251cd7ab7f88e6a038f6767e1da9b06db245a615d2729",
  "blockNumber": "0x14c32ff",
  "data": "0x",
  "logIndex": "0x7",
  "removed": false,
  "topics": [
    "0x5cece29c095139a9ac6cdc37054dc769541db4a33484b164ee9edb27babce82a",
    "0x0000000000000000000000000000000000000000000000000000000002bcc93e",
    "0x00000000000000000000000000000000000000000000000000000000002ba05c",
    "0x00000000000000000000000000000000000000000000000000000000002ba05c"
  ],
  "transactionHash": "0x4bd72731f52f20cb6f4a6ea733f57748b6ee5e72b1af9e664b53d05969b63f12",
  "transactionIndex": "0x0"
}
{
  "address": "0x0000000000000000000000000000000002bcc93e",
  "blockHash": "0x01b75faf6be6e191dc6251cd7ab7f88e6a038f6767e1da9b06db245a615d2729",
  "blockNumber": "0x14c32ff",
  "data": "0x",
  "logIndex": "0x8",
  "removed": false,
  "topics": [
    "0x5cece29c095139a9ac6cdc37054dc769541db4a33484b164ee9edb27babce82a",
    "0x0000000000000000000000000000000000000000000000000000000002bcc93e",
    "0x00000000000000000000000000000000000000000000000000000000002ba05c",
    "0x00000000000000000000000000000000000000000000000000000000002ba05c"
  ],
  "transactionHash": "0x4bd72731f52f20cb6f4a6ea733f57748b6ee5e72b1af9e664b53d05969b63f12",
  "transactionIndex": "0x0"
}

Relay logs:

[2022-07-22 08:34:21.937 +0000] DEBUG (rpc-server/50 on f128ee9cc506): eth_getLogs
[2022-07-22 08:34:22.475 +0000] DEBUG (mirror-node/50 on f128ee9cc506): [GET] contracts/0x0000000000000000000000000000000002bcc93e/results/logs 200 538 ms
[2022-07-22 08:34:23.069 +0000] DEBUG (mirror-node/50 on f128ee9cc506): [GET] contracts/0.0.45926718/results/1654724385.319072000 200 589 ms
[2022-07-22 08:34:23.117 +0000] DEBUG (mirror-node/50 on f128ee9cc506): [GET] contracts/0.0.45926718/results/1654724384.047576427 200 633 ms
[2022-07-22 08:34:23.181 +0000] DEBUG (mirror-node/50 on f128ee9cc506): [GET] contracts/0.0.45926718/results/1654724387.540522275 200 705 ms
[2022-07-22 08:34:23.182 +0000] INFO (rpc-server/50 on f128ee9cc506): [POST] eth_getLogs: 200 1245 ms 

Hedera network

testnet

Version

main branch

Operating system

Linux

@rafaelkallis rafaelkallis added the bug Something isn't working label Jul 22, 2022
@Nana-EC Nana-EC added this to the 0.5.0 milestone Jul 22, 2022
@Nana-EC Nana-EC added this to Sprint Commitment in Development Jul 22, 2022
@Ivo-Yankov Ivo-Yankov self-assigned this Jul 25, 2022
@Ivo-Yankov
Copy link
Collaborator

The relay expects the filter to be passed in camel case notation: blockHash. I opened a ticket to update the rpc specification, since this filter is not documented.

@Kalina-Todorova Kalina-Todorova moved this from Sprint Commitment to In progress in Development Jul 25, 2022
Development automation moved this from In progress to Done Jul 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working limechain P1
Projects
Development

No branches or pull requests

3 participants