feat(core/txpool): respect nolocals-setting #28435#2128
feat(core/txpool): respect nolocals-setting #28435#2128gzliudan wants to merge 2 commits intoXinFinOrg:dev-upgradefrom
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 Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
31467c0 to
fa69725
Compare
There was a problem hiding this comment.
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
NoLocalsin legacy pool add-path by masking thelocalflag when locals are disabled. - Remove the
txpool.Transactionwrapper and update txpool/subpool interfaces plus call sites to use*types.Transaction. - Add a regression test validating min-tip enforcement behavior when
NoLocalsis 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) |
There was a problem hiding this comment.
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.
| return pool.Add(txs, !pool.config.NoLocals, true) | |
| return pool.Add(txs, true, true) |
fa69725 to
81ce051
Compare
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.
81ce051 to
565e4e1
Compare
|
@gzliudan conflict |
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 applyImpacted Components
Which parts of the codebase does this PR touch?
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