besu
besu copied to clipboard
Besu returns logs with incorrect `logIndex` (different behaviour than go-ethereum)
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.
does it sound like : https://github.com/hyperledger/besu/issues/3921 ?
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.
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.
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.
This is not a dupe of #3921 @jflo . It is a separate and different issue.
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.
This a blocker for us to use Chainlink with Besu.
@samsondav - this change has been merged in and will be in the next release 22.10.0-RC1 - planned for tomorrow