Skip to content

Conversation

@gzliudan
Copy link
Collaborator

Proposed changes

Ref: ethereum#27463

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

Copilot AI review requested due to automatic review settings December 23, 2025 11:17
@coderabbitai
Copy link

coderabbitai bot commented Dec 23, 2025

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.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 pull request implements a major architectural refactoring to move the main transaction pool into a subpool system, supporting specialization and modularity in transaction handling.

Summary: The PR restructures the transaction pool to use a coordinator pattern where a main TxPool manages multiple specialized SubPool implementations. The legacy transaction pool logic is moved to core/txpool/legacypool/, and a new wrapper type txpool.Transaction is introduced for better encapsulation.

Key Changes:

  • Introduced subpool architecture with SubPool interface and main TxPool coordinator
  • Moved legacy pool implementation to dedicated legacypool package
  • Added transaction wrapper type (txpool.Transaction) for better type safety
  • Updated API signatures across the codebase (e.g., AddLocalAdd, Stop()Close())

Reviewed changes

Copilot reviewed 37 out of 37 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
core/txpool/txpool.go New main transaction pool coordinator implementing subpool aggregation
core/txpool/subpool.go Defines SubPool interface for specialized transaction pools
core/txpool/legacypool/legacypool.go Refactored legacy pool as a SubPool implementation
core/txpool/errors.go Centralized error definitions for transaction pool
event/multisub.go New utility for joining multiple event subscriptions
eth/backend.go Updated to use new pool initialization pattern
miner/worker.go Type signature updates for transaction maps
internal/ethapi/backend.go Interface signature updates for consistency
eth/protocol.go Updated txPool interface with new method signatures
Multiple test files Updated tests to use new API (e.g., addLocal, addRemote, Close)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Copilot reviewed 37 out of 37 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Copilot reviewed 37 out of 37 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gzliudan gzliudan force-pushed the 4844-txpool-subpool branch 10 times, most recently from 083953d to 1869827 Compare December 25, 2025 05:07
…inFinOrg#1850

Previously, vote verification would log errors and fail when the referenced block header was not yet available locally, especially when nodes in the same round processed votes before receiving the block header. This commit changes the logic to defer verification and log at debug level if the header is missing, preventing unnecessary error logs and aligning with upstream geth behavior for out-of-order message arrival during consensus voting.
- Refactor NewTransactionsByPriceAndNonce to properly filter and separate special transactions (IsSpecialTransaction)
- Remove account from txs map if it has no normal transactions left
- Update comments for clarity
Previously, the code used binary.BigEndian.Uint64(data[8:40]), which incorrectly read the index and only extracted the highest 8 bytes of the 32-byte left-padded block number, resulting in wrong values (often zero).
Now, the code uses new(big.Int).SetBytes(data[4:36]).Uint64() to correctly extract the block number from the proper 32-byte field.
This change fixes both the incorrect index and the parsing logic, ensuring accurate block number extraction and correct validation for special transactions.
@gzliudan gzliudan force-pushed the 4844-txpool-subpool branch 7 times, most recently from 7c7e85e to 4553c0c Compare December 25, 2025 09:09
This commit updates the Txs field in NewTxsEvent to use []*types.Transaction instead of types.Transactions. This ensures type consistency for event broadcasting and handling, improving reliability of transaction propagation across the network. The change also removes unnecessary goroutine usage for txFeed.Send, making event delivery synchronous and safer for downstream consumers.
@gzliudan gzliudan force-pushed the 4844-txpool-subpool branch from 4553c0c to 66167c3 Compare December 25, 2025 09:35
@gzliudan gzliudan force-pushed the 4844-txpool-subpool branch from 66167c3 to 614bab0 Compare December 25, 2025 09:56
@gzliudan gzliudan requested a review from anunay-xin December 27, 2025 08:45
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.

2 participants