go-ethereum/core/txpool
Daniel Liu bd355d7b3f
fix(core/txpool/legacypool): prevent uint256 overflow panic in executable tx filtering, fix #2134 (#2168)
A runtime panic was triggered in promoteExecutables/demoteUnexecutables when
account balance was converted with uint256.MustFromBig(...):

panic: overflow
... legacypool.go:1637

Root cause:
- pool.currentState.GetBalance(addr) can exceed uint256 range in this code path.
- uint256.MustFromBig(balance) panics on overflow, crashing the reorg loop.

What this commit changes:
- remove uint256.MustFromBig(balance) from executable/non-executable filtering paths
- change list.Filter costLimit from *uint256.Int to *big.Int, and compare costs using big.Int directly
- keep overflow-safe totalcost accounting for replacements (subtract old cost first, then add new)
- return txpool.ErrSpecialTxCostOverflow for special-tx cost/totalcost overflow instead of returning (false, nil)
- avoid partial pending-state mutation by attaching a new pending list only after overflow-safe totalcost calculation succeeds

Tests:
- add regression coverage for special-tx overflow rejection returning non-nil error
- verify no pending/lookup/nonce mutation on overflow rejection
- cover replacement paths to ensure no intermediate-overflow regressions in list.Add/promoteSpecialTx
2026-03-17 11:18:22 +05:30
..
legacypool fix(core/txpool/legacypool): prevent uint256 overflow panic in executable tx filtering, fix #2134 (#2168) 2026-03-17 11:18:22 +05:30
errors.go fix(core/txpool/legacypool): prevent uint256 overflow panic in executable tx filtering, fix #2134 (#2168) 2026-03-17 11:18:22 +05:30
reserver.go core/txpool: add 7702 protection to blobpool #31526 (#1930) 2026-01-26 11:20:02 +05:30
subpool.go refactor(txpool,eth,miner): use pending filter struct #29026 (#2160) 2026-03-11 08:58:07 +05:30
txpool.go fix(core/txpool): coordinate reset lifecycle and shutdown signaling #28837 (#2132) 2026-03-17 11:13:47 +05:30
validation.go feat(core/txpool): improve error responses #30715 (#2170) 2026-03-17 11:18:01 +05:30