Fix multiple bugs in FakeEVMChain simulator#21254
Conversation
|
I see you updated files related to
|
…d) to FilterLogs response
|
✅ No conflicts with other open PRs targeting |
There was a problem hiding this comment.
Pull request overview
This PR fixes multiple critical bugs in the FakeEVMChain simulator related to nil pointer dereferences and incorrect data handling. The fixes ensure proper conversion between protobuf and go-ethereum types, handle edge cases like contract creation transactions, and add defensive nil checks following the established pattern in the codebase.
Changes:
- Fixed nil pointer dereference in FilterLogs when converting log topics to protobuf
- Fixed FilterLogs ignoring topics filter and sign information in FromBlock/ToBlock
- Fixed nil pointer crash in GetTransactionByHash for contract creation transactions (nil To address)
- Fixed missing Data and Topics fields in GetTransactionReceipt log conversion
- Added nil input validation to FilterLogs, EstimateGas, GetTransactionByHash, and GetTransactionReceipt
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if filterQueryPb == nil { | ||
| return nil, caperrors.NewPublicSystemError(errors.New("FilterQuery is nil"), caperrors.Unknown) | ||
| } |
There was a problem hiding this comment.
Is this an error, do I need to filter?
There was a problem hiding this comment.
Verify against the real capability.
There was a problem hiding this comment.
In the real capability >
nil input: ConvertFilterFromProto returns ErrEmptyFilter
nil filterQuery: Same — returns ErrEmptyFilter
in new fake
nil input: Returns error "FilterLogsRequest is nil"
nil FilterQuery: Returns error "FilterQuery is nil"
- Add validateBlockNumber helper matching real capability behavior - Validate fromBlock/toBlock in FilterLogs (reject 0, bad negatives, non-int64) - Reject reversed block ranges (toBlock < fromBlock) - Populate EventSig field in FilterLogs log conversion - Populate EventSig field in GetTransactionReceipt log conversion - Add missing log fields in GetTransactionReceipt (BlockNumber, BlockHash, TxHash, Index, Removed)
ec5a7fd
|




Summary
Test plan