go-ethereum/core
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
..
asm all: pre-allocate memory for slices and maps, close XFN-148 (#1714) 2025-11-14 20:13:36 +05:30
bloombits all: use WaigGroup.Go() to simplify code (#1699) 2025-11-29 17:17:08 +05:30
rawdb contracts, core/rawdb: refactor read and write randomizeKey (#1806) 2025-12-09 11:01:37 +05:30
state core/state, trie: port changes from PBSS #26763 (#1137) 2025-12-22 12:03:56 +05:30
tracing eth/tracers: various fixes #30540 (#1491) 2025-09-17 09:04:38 +08:00
txpool core/txpool: allow zero tip transactions with minimum gas price enforcement (#1879) 2025-12-22 12:51:48 +05:30
types core/types: updates for EIP-7702 API functions #30933 (#1827) 2025-12-20 11:13:04 +05:30
vm all: implement eip-7702 set code tx #30078 (#1759) 2025-12-19 14:09:45 +04:00
.gitignore Renamed chain => core 2014-12-04 10:28:02 +01:00
bench_test.go all: implement eip-7702 set code tx #30078 (#1759) 2025-12-19 14:09:45 +04:00
block_validator.go all: remove mongodb support in XDCx (#1679) 2025-11-15 16:50:02 +05:30
block_validator_test.go core: remove outdated tests #27662 (#1496) 2025-09-17 08:16:07 +08:00
blockchain.go all: change chain head markers from block to header #26777 (#1846) 2025-12-16 07:36:51 +04:00
blockchain_insert.go all: simplify timestamps to uint64 #19372 (#1318) 2025-08-08 10:33:37 +08:00
blockchain_reader.go all: change chain head markers from block to header #26777 (#1846) 2025-12-16 07:36:51 +04:00
blockchain_test.go all: change chain head markers from block to header #26777 (#1846) 2025-12-16 07:36:51 +04:00
blocks.go new EVM Upgrade 2021-09-21 16:53:46 +05:30
chain_indexer.go core: refactor read and write valid sections (#1808) 2025-12-08 15:07:33 +05:30
chain_indexer_test.go light: CHT and bloom trie indexers working in light mode (#16534) 2025-03-06 15:30:48 +08:00
chain_makers.go all: rework trc21 (#1777) 2025-11-18 11:24:56 +05:30
chain_makers_test.go all: change chain head markers from block to header #26777 (#1846) 2025-12-16 07:36:51 +04:00
dao_test.go all: change chain head markers from block to header #26777 (#1846) 2025-12-16 07:36:51 +04:00
error.go all: implement eip-7702 set code tx #30078 (#1759) 2025-12-19 14:09:45 +04:00
events.go eth/filters: remove use of event.TypeMux for pending logs (#20312) 2024-08-03 10:03:22 +08:00
evm.go core/state: move state log mechanism to a separate layer #30569 #30732 (#1775) 2025-12-16 07:33:19 +04:00
gaspool.go miner: avoid unnecessary work (#15883) 2018-01-15 12:57:06 +02:00
gen_genesis.go all: format golang files (#1548) 2025-09-21 19:41:54 +08:00
genesis.go core :use batch to write chain config (#1760) 2025-11-14 19:59:10 +05:30
genesis_alloc_devnet.go all: format golang files (#1548) 2025-09-21 19:41:54 +08:00
genesis_alloc_mainnet.go core: tidy up genesis alloc 2025-02-19 14:15:09 +08:00
genesis_alloc_testnet.go core: tidy up genesis alloc 2025-02-19 14:15:09 +08:00
genesis_test.go core, light, params: clean genesis hash 2025-03-05 14:30:39 +08:00
headerchain.go all: simplify timestamps to uint64 #19372 (#1318) 2025-08-08 10:33:37 +08:00
mkalloc.go core: use slices package for sorting #27489 #27909 (#1701) 2025-12-07 15:43:24 +05:30
sender_cacher.go all: refactor txpool into it's own package in prep for 4844 (#26038) 2024-11-01 11:36:53 +08:00
state_prefetcher.go core/types: remove message #25977 (#1322) 2025-09-09 11:23:47 +08:00
state_processor.go core, eth/tracers: support debug_traceCall for special tx, fix #1870 (#1872) 2025-12-22 12:02:05 +05:30
state_processor_test.go core/types: updates for EIP-7702 API functions #30933 (#1827) 2025-12-20 11:13:04 +05:30
state_transition.go core/types: updates for EIP-7702 API functions #30933 (#1827) 2025-12-20 11:13:04 +05:30
token_validator.go all: rework trc21 (#1777) 2025-11-18 11:24:56 +05:30
types.go core: use atomic type #27011 2025-04-28 16:57:56 +08:00