-
Notifications
You must be signed in to change notification settings - Fork 69
core/txpool/legacypool: reject gapped tx from delegated account #31430 #1928
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
core/txpool/legacypool: reject gapped tx from delegated account #31430 #1928
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 Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 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 |
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 implements EIP-7702 delegation support by adding restrictions on transactions from delegated accounts and introducing a lazy transaction loading mechanism. The main purpose is to prevent transaction churn attacks on delegated accounts by limiting them to one in-flight transaction at a time.
Key changes include:
- Refactored transaction ordering logic from
core/typespackage tominerpackage with support forLazyTransactionwrapper - Added address reservation mechanism in transaction pool to ensure subpool exclusivity
- Implemented delegation and authorization tracking to enforce single-transaction limits on delegated accounts
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| miner/ordering.go | New file containing transaction ordering logic moved from core/types, now using LazyTransaction |
| miner/ordering_test.go | New test file with comprehensive tests for transaction ordering, including special transaction separation |
| miner/worker.go | Updated to use new ordering logic with LazyTransaction wrapper and baseFee parameter |
| core/types/transaction.go | Removed TransactionsByPriceAndNonce and related heap structures; added SetCodeAuthorities() and Time() methods |
| core/types/transaction_test.go | Removed ordering tests that were moved to miner package |
| core/types/tx_setcode.go | Fixed SignSetCode parameter order (prv, auth instead of auth, prv) |
| core/txpool/txpool.go | Added address reservation mechanism and LazyTransaction support in Pending() |
| core/txpool/subpool.go | Added LazyTransaction wrapper type and AddressReserver callback; updated SubPool interface |
| core/txpool/validation.go | Enhanced validation with SetCode transaction checks and UsedAndLeftSlots callback |
| core/txpool/errors.go | Moved ErrFutureReplacePending to legacypool; added ErrAccountLimitExceeded |
| core/txpool/legacypool/legacypool.go | Major changes: added delegation limit checking, authority validation, address reservation, and Clear() method |
| core/txpool/legacypool/legacypool_test.go | Added comprehensive tests for SetCode transactions and delegation scenarios; updated all Init() calls |
| core/txpool/legacypool/legacypool2_test.go | Updated Init() calls to include makeAddressReserver() |
| eth/protocol.go | Updated Pending() interface to return LazyTransaction |
| eth/sync.go | Updated to resolve LazyTransaction when syncing |
| eth/api_backend.go | Updated to resolve LazyTransaction when retrieving pool transactions |
| eth/helper_test.go | Updated test helper to return LazyTransaction from Pending() |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if tx := lazyTx.Resolve(); tx.Tx.IsSpecialTransaction() { | ||
| specialTxs = append(specialTxs, tx.Tx) | ||
| } else { | ||
| normalTxs = append(normalTxs, lazyTx) | ||
| } |
Copilot
AI
Jan 7, 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.
There's a missing nil check after calling lazyTx.Resolve() on line 133. If Resolve() returns nil, or if tx.Tx is nil, this will cause a nil pointer dereference when calling tx.Tx.IsSpecialTransaction(). Consider adding a nil check before accessing the transaction.
febabe2 to
d3cc5fa
Compare
d3cc5fa to
69d762e
Compare
Proposed changes
Ref: ethereum#31430
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