Skip to content

Commit c521f91

Browse files
author
colinlyguo
committed
fix(GPO): increase min suggested tip to 100 wei
1 parent d2fe42b commit c521f91

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

eth/gasprice/gasprice.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,14 @@ func (oracle *Oracle) SuggestTipCap(ctx context.Context) (*big.Int, error) {
195195
// high-priced txs are causing the suggested tip cap to be high.
196196
pendingTxCount, _ := oracle.backend.StatsWithMinBaseFee(head.BaseFee)
197197
if pendingTxCount < oracle.congestedThreshold {
198-
// Before Curie (EIP-1559), we need to return the total suggested gas price. After Curie we return 2 wei as the tip cap,
199-
// as the base fee is set separately or added manually for legacy transactions.
200-
// 1. Set price to at least 1 as otherwise tx with a 0 tip might be filtered out by the default mempool config.
201-
// 2. Since oracle.ignoreprice was set to 2 (DefaultIgnorePrice) before by default, we need to set the price
202-
// to 2 to avoid filtering in oracle.getBlockValues() by nodes that did not yet update to this version.
203-
// In the future we can set the price to 1 wei.
204-
price := big.NewInt(2)
198+
// Before Curie (EIP-1559), we need to return the total suggested gas price (base fee + tip cap).
199+
// After Curie, a minimum tip cap of 100 wei is used to avoid issues with extremely low values like 1 wei:
200+
// 1. txpool protections:
201+
// - txpool commonly prevents replacing transactions with the same tip cap.
202+
// - A 1 wei tip may fail to increase (e.g., 1.1x rounds down to 1 wei) due to integer arithmetic.
203+
// 2. Negligible cost:
204+
// - Both 100 wei and 1 wei are almost zero in cost, so this change has no noticeable impact on users.
205+
price := big.NewInt(100)
205206
if !oracle.backend.ChainConfig().IsCurie(head.Number) {
206207
price = oracle.defaultBasePrice
207208
}

eth/gasprice/gasprice_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ func TestSuggestTipCap(t *testing.T) {
213213

214214
func TestSuggestTipCapCongestedThreshold(t *testing.T) {
215215
expectedDefaultBasePricePreCurie := big.NewInt(2000)
216-
expectedDefaultBasePricePostCurie := big.NewInt(1)
216+
expectedDefaultBasePricePostCurie := big.NewInt(100)
217217

218218
config := Config{
219219
Blocks: 3,

0 commit comments

Comments
 (0)