Fix eth_getLogs returning wrong blockHash (issue #1)#4
Open
naninu123 wants to merge 1 commit into
Open
Conversation
eth_getLogs previously returned receipt's blockHash which is incorrect on XDPoS. Apply GetCanonicalHash like GetFilterChanges already does.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1 —
eth_getLogsreturns the wrongblockHashfor logs on XDPoS.Root cause
GetLogsandGetFilterLogsineth/filters/api.goreturn logs straight fromfilter.Logs(), which carries the receipt'sblockHash. On XDPoS that receipt hash is incorrect. The polling pathGetFilterChangesalready corrects this withcore.GetCanonicalHash(the "XinFinOrg#208" fix), butGetLogs/GetFilterLogswere missed — soeth_getLogskeeps returning the wrong value whileeth_getFilterChangesreturns the right one.Fix
Apply the same canonical-hash correction in
GetLogsandGetFilterLogs:Verified the package compiles (
go build ./eth/filters/).Example
For block
0x22b2277,eth_getLogsnow returns0xe8ec0bfc021f839fd0a69ae89689e309632af2cc434e8a096732068f0736864b(matches explorer) instead of the previously wrong0x194a513ea40c94fccaca470cccb24c2ff3bd6398dec9a04e3eb3a4bfef8a330e.🤖 Generated with Claude Code