Skip to content

Commit d74a3f0

Browse files
Remove unnecessary gasprice updater logic and tests (#514)
* Remove unnecessary gasprice updater logic and tests * Remove comment referencing gas price updater * Revert default price limit change * Move set min fee back to vm.go * Update to retain previous tx pool gas price setting behavior
1 parent 93c60bb commit d74a3f0

File tree

5 files changed

+22
-228
lines changed

5 files changed

+22
-228
lines changed

core/tx_pool.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,10 +1441,6 @@ func (pool *TxPool) reset(oldHead, newHead *types.Header) {
14411441

14421442
// when we reset txPool we should explicitly check if fee struct for min base fee has changed
14431443
// so that we can correctly drop txs with < minBaseFee from tx pool.
1444-
// TODO: this should be checking IsSubnetEVM since we also support minimumFee for SubnetEVM
1445-
// without requiring FeeConfigManager is enabled.
1446-
// This is already being set by SetMinFee when gas price updater starts.
1447-
// However tests are currently failing if we change this check to IsSubnetEVM.
14481444
if pool.chainconfig.IsFeeConfigManager(new(big.Int).SetUint64(newHead.Time)) {
14491445
feeConfig, _, err := pool.chain.GetFeeConfigAt(newHead)
14501446
if err != nil {

plugin/evm/block_builder_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,24 @@ import (
1414
"github.com/ava-labs/avalanchego/snow"
1515
)
1616

17+
func attemptAwait(t *testing.T, wg *sync.WaitGroup, delay time.Duration) {
18+
ticker := make(chan struct{})
19+
20+
// Wait for [wg] and then close [ticket] to indicate that
21+
// the wait group has finished.
22+
go func() {
23+
wg.Wait()
24+
close(ticker)
25+
}()
26+
27+
select {
28+
case <-time.After(delay):
29+
t.Fatal("Timed out waiting for wait group to complete")
30+
case <-ticker:
31+
// The wait group completed without issue
32+
}
33+
}
34+
1735
func TestBlockBuilderShutsDown(t *testing.T) {
1836
shutdownChan := make(chan struct{})
1937
wg := &sync.WaitGroup{}

plugin/evm/gasprice_update.go

Lines changed: 0 additions & 81 deletions
This file was deleted.

plugin/evm/gasprice_update_test.go

Lines changed: 0 additions & 129 deletions
This file was deleted.

plugin/evm/vm.go

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"encoding/json"
99
"errors"
1010
"fmt"
11+
"math/big"
1112
"os"
1213
"path/filepath"
1314
"strings"
@@ -218,17 +219,6 @@ type VM struct {
218219
warpBackend warp.WarpBackend
219220
}
220221

221-
/*
222-
******************************************************************************
223-
********************************* Snowman API ********************************
224-
******************************************************************************
225-
*/
226-
227-
// implements SnowmanPlusPlusVM interface
228-
func (vm *VM) GetActivationTime() time.Time {
229-
return time.Unix(vm.chainConfig.SubnetEVMTimestamp.Int64(), 0)
230-
}
231-
232222
// Initialize implements the snowman.ChainVM interface
233223
func (vm *VM) Initialize(
234224
_ context.Context,
@@ -390,6 +380,7 @@ func (vm *VM) Initialize(
390380
vm.chainConfig = g.Config
391381
vm.networkID = vm.ethConfig.NetworkId
392382

383+
// TODO: remove SkipSubnetEVMUpgradeCheck after next network upgrade
393384
if !vm.config.SkipSubnetEVMUpgradeCheck {
394385
// check that subnetEVM upgrade is enabled from genesis before upgradeBytes
395386
if !vm.chainConfig.IsSubnetEVM(common.Big0) {
@@ -479,12 +470,11 @@ func (vm *VM) initializeChain(lastAcceptedHash common.Hash, ethConfig ethconfig.
479470
}
480471
vm.eth.SetEtherbase(ethConfig.Miner.Etherbase)
481472
vm.txPool = vm.eth.TxPool()
473+
vm.txPool.SetMinFee(vm.chainConfig.FeeConfig.MinBaseFee)
474+
vm.txPool.SetGasPrice(big.NewInt(0))
482475
vm.blockChain = vm.eth.BlockChain()
483476
vm.miner = vm.eth.Miner()
484477

485-
// start goroutines to update the tx pool gas minimum gas price when upgrades go into effect
486-
vm.handleGasPriceUpdates()
487-
488478
vm.eth.Start()
489479
return vm.initChainState(vm.blockChain.LastAcceptedBlock())
490480
}

0 commit comments

Comments
 (0)