You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The values returned by eth_subscribe for logIndex are inconsistent with the values returned by eth_getLogs for the same log events.
Geth conforms to the rpc spec, which states that logIndex should be the index of the log into the block. Besu has its own non-compliant logIndex field, which is an index into the transaction rather than the block. There is currently an open PR for bringing Besu into compliance with the spec, which looks likely to be merged sometime soon (hyperledger/besu#4355).
I have to say, I really appreciate the behavior of Nethermind's eth_getLogs, which is the best of both worlds: it returns the canonical geth style logIndex as logIndex, and the pathological besu-style logIndex as transactionLogIndex. Excellent!
Unfortunately,eth_subscribe does not do this, and instead returns only the besu-style logindex as logIndex. Because the same transaction has two different values for logIndex depending on whether it was returned by eth_subscribe or eth_getLogs, that makes it very easy for a client connecting to Nethermind's rpc server to become confused and malfunction.
We built our client around geth originally. Then had to build special behavior in for besu's bug, so now it can handle either. But it isn't working well with Nethermind, where the field is inconsistent and depends on how you receive the logs.
To Reproduce
Steps to reproduce the behavior:
Create a subscription to log events for an active contract using eth_subscribe call over ws.
Save a handful of log events to a file.
Re-request the same logs using eth_getLogs
Notice that the logIndex values returned from eth_subscribe do not match the logIndex values returned from eth_getLogs. Instead of being an index into the block, it's an index into the transaction, which is returned separately as transactionLogIndex by eth_getLogs.
Expected behavior
I expect logIndex for a specific log to return the same index regardless of whether it's coming back from eth_subscribe or eth_getLogs, ideally in compliance with the Ethereum JSON RPC.
Example
From eth_subscribe, I received this log event among others:
Describe the bug
The values returned by
eth_subscribe
forlogIndex
are inconsistent with the values returned byeth_getLogs
for the same log events.Geth conforms to the rpc spec, which states that
logIndex
should be the index of the log into the block. Besu has its own non-compliantlogIndex
field, which is an index into the transaction rather than the block. There is currently an open PR for bringing Besu into compliance with the spec, which looks likely to be merged sometime soon (hyperledger/besu#4355).I have to say, I really appreciate the behavior of Nethermind's
eth_getLogs
, which is the best of both worlds: it returns the canonical geth stylelogIndex
as logIndex, and the pathological besu-style logIndex astransactionLogIndex
. Excellent!Unfortunately,
eth_subscribe
does not do this, and instead returns only the besu-style logindex aslogIndex
. Because the same transaction has two different values forlogIndex
depending on whether it was returned byeth_subscribe
oreth_getLogs
, that makes it very easy for a client connecting to Nethermind's rpc server to become confused and malfunction.We built our client around geth originally. Then had to build special behavior in for besu's bug, so now it can handle either. But it isn't working well with Nethermind, where the field is inconsistent and depends on how you receive the logs.
To Reproduce
Steps to reproduce the behavior:
eth_subscribe
call over ws.eth_getLogs
logIndex
values returned frometh_subscribe
do not match thelogIndex
values returned frometh_getLogs
. Instead of being an index into the block, it's an index into the transaction, which is returned separately astransactionLogIndex
byeth_getLogs
.Expected behavior
I expect
logIndex
for a specific log to return the same index regardless of whether it's coming back frometh_subscribe
oreth_getLogs
, ideally in compliance with the Ethereum JSON RPC.Example
From
eth_subscribe
, I received this log event among others:Using
eth_getLogs
to fetch it after the fact gives me the correct logIndex (0x61):These results came from a getblock rpc server running:
The text was updated successfully, but these errors were encountered: