go-ethereum/core/txpool
Daniel Liu d78d79add0
core/txpool: allow zero tip transactions with minimum gas price enforcement (#1879)
This commit simplifies the transaction pool's gas price validation logic while
maintaining network security through the existing minimum gas price requirement.

Changes:
- Set default PriceLimit to 0 (was 1), allowing transactions with zero tip
- Remove PriceLimit >= 1 validation in config sanitization
- Simplify Pending() method by using EffectiveGasTipIntCmp consistently
- Unify validateTxBasics() logic to use GasTipCapIntCmp for all transactions

Key Points:
1. Economic Protection: All transactions still require gasPrice >= 12.5 Gwei
   (enforced by GetMinGasPrice check in validateTx), providing sufficient
   protection against DoS attacks even with zero tip.

2. Miner Incentives: Since XDPoSChain includes baseFee in miner rewards
   (unlike standard EIP-1559), miners still earn the full gasPrice even when
   tip is 0. This maintains miner revenue while allowing greater flexibility.

3. Special Transactions: BlockSigner and Randomize contract transactions
   remain exempt from gas price checks, as they are critical for consensus.

4. Code Quality: Reduces complexity by 11 lines and unifies validation logic,
   making the codebase more maintainable.

Security Analysis:
- No nil pointer risks: EffectiveGasTipIntCmp has built-in nil handling
- No DoS vulnerability: 12.5 Gwei minimum ensures economic cost per transaction
- EIP-1559 compatible: Existing minGasPrice check covers all validation needs
- Backward compatible: Only relaxes restrictions, doesn't break existing behavior

This change benefits system transactions and special use cases while maintaining
all existing security guarantees through the network's minimum gas price floor.
2025-12-22 12:51:48 +05:30
..
journal.go all: fix typos, close XFN-23 (#1725) 2025-11-14 20:02:34 +05:30
lending_pool.go all: change chain head markers from block to header #26777 (#1846) 2025-12-16 07:36:51 +04:00
lending_pool_test.go all: fix whitespace error of golangci-lint, remove extra empty lines (#1676) 2025-11-17 11:16:09 +05:30
lending_tx_journal.go all: fix typos, close XFN-23 (#1725) 2025-11-14 20:02:34 +05:30
lending_tx_list.go core/txpool: remove a redundant heap.Init #28910 (#1706) 2025-12-07 15:47:20 +05:30
list.go core/txpool: disallow future churn by remote txs #26907 (#1860) 2025-12-16 11:05:39 +04:00
list_test.go core/txpool: remove a redundant heap.Init #28910 (#1706) 2025-12-07 15:47:20 +05:30
noncer.go all: refactor txpool into it's own package in prep for 4844 (#26038) 2024-11-01 11:36:53 +08:00
order_pool.go all: change chain head markers from block to header #26777 (#1846) 2025-12-16 07:36:51 +04:00
order_tx_journal.go all: fix typos, close XFN-23 (#1725) 2025-11-14 20:02:34 +05:30
order_tx_list.go core/txpool: remove a redundant heap.Init #28910 (#1706) 2025-12-07 15:47:20 +05:30
txpool.go core/txpool: allow zero tip transactions with minimum gas price enforcement (#1879) 2025-12-22 12:51:48 +05:30
txpool2_test.go core/txpool: disallow future churn by remote txs #26907 (#1860) 2025-12-16 11:05:39 +04:00
txpool_test.go core/txpool: fix global MinGasPrice override and single test failure, fix #1881 (#1880) 2025-12-22 12:01:21 +05:30