Skip to content

Commit 5fec099

Browse files
Set gas price oracle DefaultMinPrice to acp176.MinGasPrice (#1766)
1 parent 5eab822 commit 5fec099

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

eth/gasprice/gasprice.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333
"sync"
3434

3535
"github.com/ava-labs/avalanchego/utils/timer/mockable"
36+
"github.com/ava-labs/avalanchego/vms/evm/acp176"
3637
"github.com/ava-labs/libevm/common"
3738
"github.com/ava-labs/libevm/common/lru"
3839
"github.com/ava-labs/libevm/core/types"
@@ -66,7 +67,7 @@ const (
6667

6768
var (
6869
DefaultMaxPrice = big.NewInt(150 * params.GWei)
69-
DefaultMinPrice = big.NewInt(0 * params.GWei)
70+
DefaultMinPrice = big.NewInt(acp176.MinGasPrice)
7071
DefaultMinBaseFee = big.NewInt(legacy.BaseFee)
7172
DefaultMinGasUsed = big.NewInt(6_000_000) // block gas limit is 8,000,000
7273
DefaultMaxLookbackSeconds = uint64(80)

eth/gasprice/gasprice_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ func TestSuggestTipCapMinGas(t *testing.T) {
330330
chainConfig: params.TestChainConfig,
331331
numBlocks: 3,
332332
genBlock: testGenBlock(t, 500, 50),
333-
expectedTip: big.NewInt(0),
333+
expectedTip: DefaultMinPrice,
334334
}, defaultOracleConfig())
335335
}
336336

@@ -390,7 +390,7 @@ func TestSuggestTipCapMaxBlocksSecondsLookback(t *testing.T) {
390390

391391
// Regression test to ensure the last estimation of base fee is not used
392392
// for the block immediately following a fee configuration update.
393-
func TestSuggestGasPriceAfterFeeConfigUpdate(t *testing.T) {
393+
func TestEstimateBaseFeeAfterFeeConfigUpdate(t *testing.T) {
394394
require := require.New(t)
395395
config := Config{
396396
Blocks: 20,
@@ -417,7 +417,7 @@ func TestSuggestGasPriceAfterFeeConfigUpdate(t *testing.T) {
417417
defer backend.teardown()
418418
oracle, err := NewOracle(backend, config)
419419
require.NoError(err)
420-
got, err := oracle.SuggestPrice(context.Background())
420+
got, err := oracle.EstimateBaseFee(context.Background())
421421
require.NoError(err)
422422
require.Equal(chainConfigExtra.FeeConfig.MinBaseFee, got)
423423

@@ -447,8 +447,8 @@ func TestSuggestGasPriceAfterFeeConfigUpdate(t *testing.T) {
447447
_, err = backend.chain.InsertChain(blocks)
448448
require.NoError(err)
449449

450-
// verify the suggested price follows the new fee config.
451-
got, err = oracle.SuggestPrice(context.Background())
450+
// verify the base fee estimation follows the new fee config.
451+
got, err = oracle.EstimateBaseFee(context.Background())
452452
require.NoError(err)
453453
require.Equal(highFeeConfig.MinBaseFee, got)
454454
}

0 commit comments

Comments
 (0)