Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion eth/gasprice/gasprice.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
"sync"

"github.com/ava-labs/avalanchego/utils/timer/mockable"
"github.com/ava-labs/avalanchego/vms/evm/acp176"
"github.com/ava-labs/libevm/common"
"github.com/ava-labs/libevm/common/lru"
"github.com/ava-labs/libevm/core/types"
Expand Down Expand Up @@ -66,7 +67,7 @@ const (

var (
DefaultMaxPrice = big.NewInt(150 * params.GWei)
DefaultMinPrice = big.NewInt(0 * params.GWei)
DefaultMinPrice = big.NewInt(acp176.MinGasPrice)
DefaultMinBaseFee = big.NewInt(legacy.BaseFee)
DefaultMinGasUsed = big.NewInt(6_000_000) // block gas limit is 8,000,000
DefaultMaxLookbackSeconds = uint64(80)
Expand Down
10 changes: 5 additions & 5 deletions eth/gasprice/gasprice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ func TestSuggestTipCapMinGas(t *testing.T) {
chainConfig: params.TestChainConfig,
numBlocks: 3,
genBlock: testGenBlock(t, 500, 50),
expectedTip: big.NewInt(0),
expectedTip: DefaultMinPrice,
}, defaultOracleConfig())
}

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

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

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

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