fix(rpc): Missing boundary check in GetTransactionReceipt#861
Merged
thomas-nguy merged 4 commits intocrypto-org-chain:developfrom Mar 16, 2026
Merged
fix(rpc): Missing boundary check in GetTransactionReceipt#861thomas-nguy merged 4 commits intocrypto-org-chain:developfrom
thomas-nguy merged 4 commits intocrypto-org-chain:developfrom
Conversation
This comment has been minimized.
This comment has been minimized.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #861 +/- ##
===========================================
- Coverage 40.69% 40.66% -0.04%
===========================================
Files 190 190
Lines 15452 15471 +19
===========================================
+ Hits 6288 6291 +3
- Misses 8491 8499 +8
- Partials 673 681 +8
🚀 New features to boost your workflow:
|
songgaoye
reviewed
Mar 4, 2026
|
I think we should also check other code in |
thomas-nguy
reviewed
Mar 4, 2026
Author
check added. |
thomas-nguy
approved these changes
Mar 16, 2026
JayT106
added a commit
that referenced
this pull request
Mar 19, 2026
* missing boundary check * update changelog * apply checks to other functions * unity the error log format
This was referenced Mar 19, 2026
thomas-nguy
pushed a commit
that referenced
this pull request
Mar 27, 2026
* fix(rpc): Missing boundary check in GetTransactionReceipt (#861) * missing boundary check * update changelog * apply checks to other functions * unity the error log format * fix(rpc): scope block receipts when eth tx hash index is overwritten - Rebuild TxResult from block data when resBlock is set and indexer points to a different height (same hash re-included later). - Prefer indexer when height matches target block for unchanged paths. - Add unit test proving KV overwrite + eth_getBlockReceipts still returns correct blockNumber for the requested block. Made-with: Cursor * perf(rpc): eliminate N redundant BlockResults RPC calls in GetBlockReceipts Pass the already-fetched blockRes from GetBlockReceipts into GetTransactionReceipt so it is not re-fetched for every transaction in the block. For a block with N txs this removes N uncached CometBFT BlockResults RPCs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(lint): break long GetTransactionReceipt signature to satisfy lll Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor(rpc): extract ethMsgAtTxResult helper, split GetTransactionReceipt Address PR #870 review feedback: - Extract ethMsgAtTxResult helper to deduplicate decode+bounds-check logic across GetTransactionByHash, GetTransactionByBlockAndIndex, and GetTransactionReceipt. - Split GetTransactionReceipt into prepareTransactionReceipt and transactionReceiptToJSON for better readability. - Add txIndex >= len(txResults) bounds check in txResultFromBlockHash. - Update CHANGELOG to reference PR #870. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * update changelog * return empty receipt when index height is different to request height * lint * revert(rpc): undo ethMsgAtTxResult helper and receipt function split Revert the structural refactoring from d3cf0a1: - Remove ethMsgAtTxResult helper; inline decode+bounds-check logic back into GetTransactionByHash, GetTransactionByBlockAndIndex, and GetTransactionReceipt. - Merge prepareTransactionReceipt and transactionReceiptToJSON back into a single GetTransactionReceipt function. Functional changes from subsequent commits are preserved: - txResultFromBlockHash bounds check (txIndex >= len(txResults)). - Return nil receipt when tx indexer points to a different block height. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * update changelog * remove txreceipt reconstruct logic when indexer is missing receipt * cleanup --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
thomas-nguy
pushed a commit
that referenced
this pull request
Apr 8, 2026
* fix(rpc): Missing boundary check in GetTransactionReceipt (#861) * missing boundary check * update changelog * apply checks to other functions * unity the error log format * fix(rpc): scope block receipts when eth tx hash index is overwritten - Rebuild TxResult from block data when resBlock is set and indexer points to a different height (same hash re-included later). - Prefer indexer when height matches target block for unchanged paths. - Add unit test proving KV overwrite + eth_getBlockReceipts still returns correct blockNumber for the requested block. Made-with: Cursor * perf(rpc): eliminate N redundant BlockResults RPC calls in GetBlockReceipts Pass the already-fetched blockRes from GetBlockReceipts into GetTransactionReceipt so it is not re-fetched for every transaction in the block. For a block with N txs this removes N uncached CometBFT BlockResults RPCs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(lint): break long GetTransactionReceipt signature to satisfy lll Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor(rpc): extract ethMsgAtTxResult helper, split GetTransactionReceipt Address PR #870 review feedback: - Extract ethMsgAtTxResult helper to deduplicate decode+bounds-check logic across GetTransactionByHash, GetTransactionByBlockAndIndex, and GetTransactionReceipt. - Split GetTransactionReceipt into prepareTransactionReceipt and transactionReceiptToJSON for better readability. - Add txIndex >= len(txResults) bounds check in txResultFromBlockHash. - Update CHANGELOG to reference PR #870. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * update changelog * return empty receipt when index height is different to request height * lint * revert(rpc): undo ethMsgAtTxResult helper and receipt function split Revert the structural refactoring from d3cf0a1: - Remove ethMsgAtTxResult helper; inline decode+bounds-check logic back into GetTransactionByHash, GetTransactionByBlockAndIndex, and GetTransactionReceipt. - Merge prepareTransactionReceipt and transactionReceiptToJSON back into a single GetTransactionReceipt function. Functional changes from subsequent commits are preserved: - txResultFromBlockHash bounds check (txIndex >= len(txResults)). - Return nil receipt when tx indexer points to a different block height. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * update changelog * remove txreceipt reconstruct logic when indexer is missing receipt * cleanup --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.
Closes: #XXX
Description
For contributor use:
docs/) or specification (x/<module>/spec/)godoccomments.Unreleasedsection inCHANGELOG.mdFiles changedin the Github PR explorerFor admin use:
WIP,R4R,docs, etc)