-
Notifications
You must be signed in to change notification settings - Fork 69
internal/ethapi: fix recover sender of pending transaction #23765 #1898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
internal/ethapi: fix recover sender of pending transaction #23765 #1898
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ce1bdf9 to
b845a9b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a bug where the sender address of pending transactions could not be correctly recovered due to using an incorrect block number when creating the transaction signer. The fix ensures that the current block number is used instead of hardcoded 0, allowing the appropriate signer to be selected based on active protocol forks (EIP-155, EIP-1559, Prague, etc.).
Key changes:
- Extracts the current block number from the header when available for pending transactions
- Passes the current block number to the signer creation logic instead of always using
0 - Minor code style improvement using
new(big.Int)instead ofbig.NewInt(0)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| func newRPCPendingTransaction(tx *types.Transaction, current *types.Header, config *params.ChainConfig) *RPCTransaction { | ||
| var baseFee *big.Int | ||
| var ( | ||
| baseFee *big.Int | ||
| blockNumber = uint64(0) | ||
| ) | ||
| if current != nil { | ||
| baseFee = eip1559.CalcBaseFee(config, current) | ||
| blockNumber = current.Number.Uint64() | ||
| } | ||
| return newRPCTransaction(tx, common.Hash{}, 0, 0, baseFee, config) | ||
| return newRPCTransaction(tx, common.Hash{}, blockNumber, 0, baseFee, config) | ||
| } |
Copilot
AI
Jan 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding test coverage for this bug fix to ensure that pending transactions correctly recover the sender address at different block heights, especially around fork boundaries (EIP-155, EIP-1559, Prague, etc.). This would help prevent regression of this issue in the future.
Proposed changes
Ref: ethereum#23765
Types of changes
What types of changes does your code introduce to XDC network?
Put an
✅in the boxes that applyImpacted Components
Which part of the codebase this PR will touch base on,
Put an
✅in the boxes that applyChecklist
Put an
✅in the boxes once you have confirmed below actions (or provide reasons on not doing so) that