Skip to content

Conversation

@gzliudan
Copy link
Collaborator

@gzliudan gzliudan commented Jan 7, 2026

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 apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)
  • Regular KTLO or any of the maintaince work. e.g code style
  • CICD Improvement

Impacted Components

Which part of the codebase this PR will touch base on,

Put an in the boxes that apply

  • Consensus
  • Account
  • Network
  • Geth
  • Smart Contract
  • External components
  • Not sure (Please specify below)

Checklist

Put an in the boxes once you have confirmed below actions (or provide reasons on not doing so) that

  • This PR has sufficient test coverage (unit/integration test) OR I have provided reason in the PR description for not having test coverage
  • Provide an end-to-end test plan in the PR description on how to manually test it on the devnet/testnet.
  • Tested the backwards compatibility.
  • Tested with XDC nodes running this version co-exist with those running the previous version.
  • Relevant documentation has been updated as part of this PR
  • N/A

@coderabbitai
Copy link

coderabbitai bot commented Jan 7, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Copilot AI left a 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/types package to miner package with support for LazyTransaction wrapper
  • 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.

Comment on lines 133 to 137
if tx := lazyTx.Resolve(); tx.Tx.IsSpecialTransaction() {
specialTxs = append(specialTxs, tx.Tx)
} else {
normalTxs = append(normalTxs, lazyTx)
}
Copy link

Copilot AI Jan 7, 2026

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.

Copilot uses AI. Check for mistakes.
@gzliudan gzliudan force-pushed the reject-gapped-tx branch 2 times, most recently from febabe2 to d3cc5fa Compare January 21, 2026 06:33
@AnilChinchawale AnilChinchawale merged commit 48b6063 into XinFinOrg:dev-upgrade Jan 21, 2026
13 checks passed
@gzliudan gzliudan deleted the reject-gapped-tx branch January 21, 2026 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants