Skip to content

fix eth_getLogs panic when block hash lookup returns no block#655

Open
mooncitydev wants to merge 1 commit into
mezo-org:mainfrom
mooncitydev:fix-eth-getlogs-nil-block-hash
Open

fix eth_getLogs panic when block hash lookup returns no block#655
mooncitydev wants to merge 1 commit into
mezo-org:mainfrom
mooncitydev:fix-eth-getlogs-nil-block-hash

Conversation

@mooncitydev

@mooncitydev mooncitydev commented Apr 16, 2026

Copy link
Copy Markdown

what changed

TendermintBlockByHash can return (nil, nil) when the block is not in the local store (see
pc/backend/blocks.go). \Filter.Logs\ only checked the error value and then used
esBlock.Block.Height, which caused the nil pointer panic reported in #595.

This adds a nil guard and a regression test that reproduces the backend behavior.

testing

  • added \TestFilterLogs_blockHashMissingDoesNotPanic\
  • \go\ was not available in this environment to run the test locally; please run \go test ./rpc/namespaces/ethereum/eth/filters/...\ before merge

made by mooncitydev

TendermintBlockByHash can return (nil, nil) without error when the block
is missing from the local store. Avoid dereferencing resBlock before use.

Closes the crash reported in mezo-org#595.

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant