Skip to content

feat(core/txpool): respect nolocals-setting #28435#2128

Open
gzliudan wants to merge 2 commits intoXinFinOrg:dev-upgradefrom
gzliudan:respect-nolocals
Open

feat(core/txpool): respect nolocals-setting #28435#2128
gzliudan wants to merge 2 commits intoXinFinOrg:dev-upgradefrom
gzliudan:respect-nolocals

Conversation

@gzliudan
Copy link
Collaborator

@gzliudan gzliudan commented Mar 3, 2026

Proposed changes

added a check for pool.config.NoLocals when setting up txpool validation

Ref: ethereum#28435

Types of changes

What types of changes does your code introduce to XDC network?
Put an in the boxes that apply

  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Changes that don't change source code or tests
  • docs: Documentation only changes
  • feat: A new feature
  • fix: A bug fix
  • perf: A code change that improves performance
  • refactor: A code change that neither fixes a bug nor adds a feature
  • revert: Revert something
  • style: Changes that do not affect the meaning of the code
  • test: Adding missing tests or correcting existing tests

Impacted Components

Which parts of the codebase does this PR touch?
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
  • Tested on a private network from the genesis block and monitored the chain operating correctly for multiple epochs.
  • 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 March 3, 2026 06:35
@coderabbitai
Copy link

coderabbitai bot commented Mar 3, 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.

Use the checkbox below for a quick retry:

  • 🔍 Trigger 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.

@gzliudan gzliudan changed the title feat(core/txpool/legacypool): respect nolocals-setting #28435 feat(core/txpool): respect nolocals-setting #28435 Mar 3, 2026
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 updates transaction pool handling to ensure the NoLocals configuration is respected during tx validation (i.e., “local” submissions no longer bypass pricing/min-tip checks when locals are disabled), and refactors txpool plumbing to use *types.Transaction directly instead of a txpool.Transaction wrapper.

Changes:

  • Enforce NoLocals in legacy pool add-path by masking the local flag when locals are disabled.
  • Remove the txpool.Transaction wrapper and update txpool/subpool interfaces plus call sites to use *types.Transaction.
  • Add a regression test validating min-tip enforcement behavior when NoLocals is enabled.

Reviewed changes

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

Show a summary per file
File Description
miner/worker.go Adjusts lazy-tx wrapping/resolution to use *types.Transaction directly.
miner/ordering.go Updates special-tx and payer-swap checks to operate on *types.Transaction.
miner/ordering_test.go Updates tests for new lazy-tx/tx extraction types.
eth/sync.go Sends resolved pending txs as *types.Transaction without wrapper.
eth/protocol.go Updates internal txPool interface to accept *types.Transaction.
eth/protocol_test.go Updates protocol tests to populate/send *types.Transaction directly.
eth/helper_test.go Updates mock txpool to match new Add/Get types and pending representation.
eth/handler.go Removes wrapper conversion before adding received txs to the pool.
eth/api_backend.go Updates RPC backend tx submission/pool retrieval to new Add/Get signatures.
core/txpool/txpool.go Changes TxPool.Add/Get to use *types.Transaction and updates subpool filter call.
core/txpool/subpool.go Removes txpool.Transaction wrapper; makes lazy resolution and subpool APIs use *types.Transaction.
core/txpool/legacypool/legacypool.go Implements NoLocals masking inside LegacyPool.Add; updates Pending/Get to return *types.Transaction.
core/txpool/legacypool/legacypool_test.go Adds test ensuring min-tip enforcement when NoLocals=true and bypass when enabled.
contracts/utils.go Updates contract tx submission to use []*types.Transaction for pool.Add.

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

// reorganization and event propagation.
func (pool *LegacyPool) addLocals(txs []*types.Transaction) []error {
return pool.addTxs(txs, !pool.config.NoLocals, true)
return pool.Add(txs, !pool.config.NoLocals, true)
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addLocals passes !pool.config.NoLocals as the local flag, but LegacyPool.Add already masks local with !pool.config.NoLocals. This duplicates the policy in two places and makes it easier to drift; consider always passing local=true from addLocals and letting Add enforce the NoLocals setting centrally.

Suggested change
return pool.Add(txs, !pool.config.NoLocals, true)
return pool.Add(txs, true, true)

Copilot uses AI. Check for mistakes.
gzliudan added 2 commits March 3, 2026 18:19
Partial backport of ethereum/go-ethereum PR ethereum#27841, limited to txpool wrapper removal.

- Migrate txpool interfaces/call sites from `*txpool.Transaction` to `*types.Transaction`
- Update eth/miner/contracts paths and related tests accordingly
- No intended behavior change

Blob sidecar validation/handling changes from upstream are not included here.
@AnilChinchawale
Copy link
Member

@gzliudan conflict

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.

6 participants