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

Besu returns logs with incorrect logIndex (different behaviour than go-ethereum) #4114

Closed
samsondav opened this issue Jul 15, 2022 · 8 comments · Fixed by #4355
Closed

Besu returns logs with incorrect logIndex (different behaviour than go-ethereum) #4114

samsondav opened this issue Jul 15, 2022 · 8 comments · Fixed by #4355
Assignees
Labels
RPC TeamRevenant GH issues worked on by Revenant Team

Comments

@samsondav
Copy link

samsondav commented Jul 15, 2022

Description

As a RPC client consumer, I expect Besu to return logs with the same logIndex as go-ethereum. It does not do this.

Acceptance Criteria

Besu should return logs with the same logIndex as go-ethereum.

Steps to Reproduce (Bug)

(examples are from Sepolia - chain ID 11155111)

go-ethereum

curl -v --data '{"method":"eth_getLogs","id":"1","params":[{"blockhash": "0xd34a6973e49210a7ae5e487459f625c7444f9ffca93b2430400677cdaa82c293"}],"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST <ethereum RPC URL> | jq

A sample of this response is below:

...
    {
      "address": "0xed6dd2313fb133e8d7a7697eda6f7e7640af0b85",
      "topics": [
        "0x0109fc6f55cf40689f02fbaad7af7fe7bbac8a3d2186600afc7d3e10cac60271",
        "0x000000000000000000000000000000000000000000000000000000000000000b",
        "0x0000000000000000000000000000000000000000000000000000000000000000"
      ],
      "data": "0x0000000000000000000000000000000000000000000000000000000062c4b107",
      "blockNumber": "0x160f2e",
      "transactionHash": "0x3b5feb43df1b020656385df5ff2e7603231e9b83b41165357f3c8d08f786d152",
      "transactionIndex": "0xa",
      "blockHash": "0xd34a6973e49210a7ae5e487459f625c7444f9ffca93b2430400677cdaa82c293",
      "logIndex": "0x18",
      "removed": false
    },
    {
      "address": "0xed6dd2313fb133e8d7a7697eda6f7e7640af0b85",
      "topics": [
        "0x0559884fd3a460db3073b7fc896cc77986f16e378210ded43186175bf646fc5f",
        "0x0000000000000000000000000000000000000000000000000000000000000005",
        "0x000000000000000000000000000000000000000000000000000000000000000b"
      ],
      "data": "0x0000000000000000000000000000000000000000000000000000000062c4b107",
      "blockNumber": "0x160f2e",
      "transactionHash": "0x3b5feb43df1b020656385df5ff2e7603231e9b83b41165357f3c8d08f786d152",
      "transactionIndex": "0xa",
      "blockHash": "0xd34a6973e49210a7ae5e487459f625c7444f9ffca93b2430400677cdaa82c293",
      "logIndex": "0x19",
      "removed": false
    }
    ...

besu

curl -v --data '{"method":"eth_getLogs","id":"1","params":[{"blockhash": "0xd34a6973e49210a7ae5e487459f625c7444f9ffca93b2430400677cdaa82c293"}],"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST <besu RPC URL> | jq

    {
      "logIndex": "0x1",
      "removed": false,
      "blockNumber": "0x160f2e",
      "blockHash": "0xd34a6973e49210a7ae5e487459f625c7444f9ffca93b2430400677cdaa82c293",
      "transactionHash": "0x3b5feb43df1b020656385df5ff2e7603231e9b83b41165357f3c8d08f786d152",
      "transactionIndex": "0xa",
      "address": "0xed6dd2313fb133e8d7a7697eda6f7e7640af0b85",
      "data": "0x0000000000000000000000000000000000000000000000000000000062c4b107",
      "topics": [
        "0x0109fc6f55cf40689f02fbaad7af7fe7bbac8a3d2186600afc7d3e10cac60271",
        "0x000000000000000000000000000000000000000000000000000000000000000b",
        "0x0000000000000000000000000000000000000000000000000000000000000000"
      ]
    },
    {
      "logIndex": "0x2",
      "removed": false,
      "blockNumber": "0x160f2e",
      "blockHash": "0xd34a6973e49210a7ae5e487459f625c7444f9ffca93b2430400677cdaa82c293",
      "transactionHash": "0x3b5feb43df1b020656385df5ff2e7603231e9b83b41165357f3c8d08f786d152",
      "transactionIndex": "0xa",
      "address": "0xed6dd2313fb133e8d7a7697eda6f7e7640af0b85",
      "data": "0x0000000000000000000000000000000000000000000000000000000062c4b107",
      "topics": [
        "0x0559884fd3a460db3073b7fc896cc77986f16e378210ded43186175bf646fc5f",
        "0x0000000000000000000000000000000000000000000000000000000000000005",
        "0x000000000000000000000000000000000000000000000000000000000000000b"
      ]
    }
    ...

Expected behavior: [What you expect to happen]

I expect logs to be uniquely indexed by (blockHash, logIndex).

Actual behavior: [What actually happens]

It appears that logIndex is only unique within (blockHash, transactionIndex, logIndex). This is different to how go-ethereum works.

Frequency: [What percentage of the time does it occur?]

100% of the time.

@jflo
Copy link
Contributor

jflo commented Jul 15, 2022

does it sound like : #3921 ?

@jflo
Copy link
Contributor

jflo commented Jul 15, 2022

in the short term, you can cleanly shut down besu, delete the logBloom-*.cache files in your data directory, and restart. They will be re-built.

@ajsutton
Copy link
Contributor

Sounds like a different issue to me, particularly given it happens all the time. My guess is that Besu has just implemented this incorrectly and is setting logIndex to the index of the event in terms of what the transaction emitted, rather than what the block emitted. That certainly looks like what LogWithMetaData.generate is doing.

@braddmiller
Copy link

Hey folks, any update on this? We're looking to add official support for the Besu client to the Chainlink node and this is the last remaining issue preventing that as far as we can tell.

@samsondav
Copy link
Author

This is not a dupe of #3921 @jflo . It is a separate and different issue.

@jflo
Copy link
Contributor

jflo commented Jul 22, 2022

Apologies for not reading well, you are correct this is not a duplicate of #3921. We will prioritize this, but be advised it is competing with merge preparation work.

@samsondav
Copy link
Author

This a blocker for us to use Chainlink with Besu.

@macfarla
Copy link
Contributor

macfarla commented Oct 5, 2022

@samsondav - this change has been merged in and will be in the next release 22.10.0-RC1 - planned for tomorrow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RPC TeamRevenant GH issues worked on by Revenant Team
Projects
None yet
8 participants