Repository: hyperledger/besu

Issue #3921: Besu failing to index event log
Created: 2022-05-30T22:29:32Z
Description
On one of the EF teku-besu kiln nodes, the besu instance is failing to return one of the deposit event logs. Since the CL requires all deposit events in order Teku is complaining about this quite a lot.
This is on box 164.92.203.174
JSON RPC request is:
{"jsonrpc":"2.0","method":"eth_getLogs","params":[{"topics":["0x649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c5"],"fromBlock":"0x8547d","toBlock":"0x8547d","address":["0x4242424242424242424242424242424242424242"]}],"id":0}

The broken besu instance returns:
{
  "jsonrpc" : "2.0",
  "id" : 0,
  "result" : [ ]
}

But another teku-besu instance on kiln returns the deposit event correctly:
{
  "jsonrpc" : "2.0",
  "id" : 0,
  "result" : [ {
    "logIndex" : "0x0",
    "removed" : false,
    "blockNumber" : "0x8547d",
    "blockHash" : "0xa62e2b2f55447ecbf5b603fa032746222da6039f27851175a3214812029ebc70",
    "transactionHash" : "0x589c0803aef2b3d0ecd48888bd0f9d799fd2421860c46bf91e2e21f0eb82414d",
    "transactionIndex" : "0x3c",
    "address" : "0x4242424242424242424242424242424242424242",
    "data" : "0x00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000030933f02fc10608e5b41513035b9f8f08306a0c54fcb2b04a673881987e6eb089b983481f5d888d4f6e08ebffbb41fcc4f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020005db87e87315c6545e51a5daff02eab6df948cc8c9a49d6d7d03b80d1f18096000000000000000000000000000000000000000000000000000000000000000800405973070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060aa19ef95787fe491388337f47fdb67936ae0aeb437766b5cc44402c8ecd08d51fe7cca7643d85fca8ec0a1c16f5102210e4b41bb6ef2f84964bdfeb733121d046e0d5cd7eb85ce8e399d0d4e61cc0cb979f58717e925e0c06a734f0311a772a00000000000000000000000000000000000000000000000000000000000000008442d000000000000000000000000000000000000000000000000000000000000",
    "topics" : [ "0x649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c5" ]
  } ]
}

Somehow besu has failed to index this deposit event.

Duplicate issue #4114: Besu returns logs with incorrect `logIndex` (different behaviour than go-ethereum)
Created: 2022-07-15T18:34:47Z
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.

Closing comment (2022-07-22T14:33:22Z): 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.