go-ethereum/core/txpool/legacypool
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
..
journal.go refactor(core/txpool): no need to log loud rotate if no local txs #29083 (#2164) 2026-03-17 11:17:08 +05:30
legacypool.go fix(core/txpool/legacypool): prevent uint256 overflow panic in executable tx filtering, fix #2134 (#2168) 2026-03-17 11:18:22 +05:30
legacypool2_test.go refactor(core/txpool/legacypool): use uint256.Int instead of big.Int #28606 (#2134) 2026-03-10 18:50:40 +05:30
legacypool_test.go fix(core/txpool/legacypool): prevent uint256 overflow panic in executable tx filtering, fix #2134 (#2168) 2026-03-17 11:18:22 +05:30
lending_pool.go refactor(all): remove term whitelist and blacklist (#1994) 2026-02-10 17:09:21 +05:30
lending_pool_test.go refactor(crypto): vendor in golang.org/x/crypto/sha3 #33323 (#2046) 2026-02-28 17:23:57 +04:00
lending_tx_journal.go all: move main transaction pool into a subpool #27463 (#1890) 2026-01-05 15:43:50 +05:30
lending_tx_list.go docs(core/txpool/legacypool): fix typos #28258 (#2126) 2026-03-10 18:45:06 +05:30
list.go fix(core/txpool/legacypool): prevent uint256 overflow panic in executable tx filtering, fix #2134 (#2168) 2026-03-17 11:18:22 +05:30
list_test.go fix(core/txpool/legacypool): prevent uint256 overflow panic in executable tx filtering, fix #2134 (#2168) 2026-03-17 11:18:22 +05:30
noncer.go all: move main transaction pool into a subpool #27463 (#1890) 2026-01-05 15:43:50 +05:30
order_pool.go refactor(all): remove term whitelist and blacklist (#1994) 2026-02-10 17:09:21 +05:30
order_tx_journal.go all: move main transaction pool into a subpool #27463 (#1890) 2026-01-05 15:43:50 +05:30
order_tx_list.go docs(core/txpool/legacypool): fix typos #28258 (#2126) 2026-03-10 18:45:06 +05:30