rpc: fix otterscan API stability and correctness issues#19679
Merged
Conversation
- Replace panic(err) with proper error handling in GetContractCreator and GetTransactionBySenderAndNonce - Fix uint256 zero check using IsZero() instead of Uint64() != 0 in OperationsTracer - Add missing defer it.Close() to prevent iterator resource leak Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Fix nil dereference in GetContractCreator: add tracer.Found() check before accessing tracer.Tx.Hash() to prevent panic when the contract creator is not found by the tracer - Fix genericTracer returning nil error silently when header or txn is not found; now returns an explicit error to prevent callers from proceeding with uninitialized tracer state - Remove dead code: prunedBlock was computed but never assigned to the response in GetBlockTransactions (present since PR #5945) - Fix OOB panic in GetBlockTransactions: add bounds check on receipts slice before slicing with page offsets derived from transaction count - Fix gas price truncation in delegateBlockFees: replace Uint64() intermediate with ToBig() to preserve full uint256 precision - Fix SELFDESTRUCT handler in TransactionTracer: guard against empty Results slice to prevent index out of range panic - Fix OnTxEnd call inconsistency: use tracer.Hooks.OnTxEnd consistently instead of mixing promoted field access with explicit field access Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
canepat
approved these changes
Mar 9, 2026
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.
This PR contains the following fixes