Skip to content

fix(txpool): restore cumulative overdraft check for fee delegation txs#87

Closed
colinkim wants to merge 1 commit into
devfrom
fix/tx-pool
Closed

fix(txpool): restore cumulative overdraft check for fee delegation txs#87
colinkim wants to merge 1 commit into
devfrom
fix/tx-pool

Conversation

@colinkim

@colinkim colinkim commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Fee delegation tx (type 0x16) splits cost between sender (value) and feePayer (gas fee). The upstream cumulative overdraft check(introduced in ethereum/go-ethereum#27429) assumed a single payer via totalcost, causing false positives for valid fee delegation txs. As a workaround the check was globally disabled, leaving the pool exposed to two DoS vectors:

  1. A single sender submitting sequential txs whose aggregate value exceeds balance — each passes per-tx validation individually but reverts on execution, polluting the mempool.
  2. Multiple senders designating the same feePayer, collectively exceeding the feePayer's balance with no pool-level rejection.

Changes

  • list.go: add totalvalue, totalgas, pendingGas (pool-wide shared map); implement addCost/subCost. pendingGas aggregates gas obligations across all sender lists sharing the same feePayer, enabling cross-sender tracking.
  • legacypool.go: inject pendingGas by reference into each pending list (pending-only). ExistingExpenditure returns total obligation across three roles: sender (totalvalue), own gas payer (totalgas), fee payer for others (pendingGas). ExistingTx added for correct replacement accounting.
  • validation.go: replace disabled block with unified cumulative check via need(). Normal txs: combined balance check. Fee delegation txs: sender/feePayer checked independently.
  • blobpool_test.go: restore upstream core.ErrInsufficientFunds expectations.
  • legacypool_test.go: add TestFeeDelegationCumulativeGas.

Test

  • go test ./core/txpool/legacypool/ -run TestFeeDelegationCumulativeGas -v
  • go test ./core/txpool/legacypool/ ./core/txpool/blobpool/
  • go test -race ./core/txpool/legacypool/

@colinkim colinkim self-assigned this Jun 8, 2026
@colinkim colinkim added the enhancement New feature or request label Jun 8, 2026
@colinkim colinkim requested review from 0xmhha, egonspace, eomti-wm and hominlee-wemade and removed request for egonspace June 8, 2026 07:19
@hominlee-wemade

hominlee-wemade commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

To avoid diverging fixes between stableNet and WBFT, I propose closing this PR and continuing with the steps below.

During the PR review, we identified several additional issues that need further review and fixes.

This is not intended to drop the fix, but to avoid maintaining two diverging implementations while the shared txpool behavior is still being finalized.

The proposed plan is as follows:

  1. First, finalize the smaller and commonly applicable txpool fix in go-wbft.
  2. Port the stabilized common changes back to stableNet.
  3. Create a new stableNet PR that includes the Anzeon-specific fee calculation logic and related tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants