Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary gasprice updater logic and tests #514

Merged
merged 5 commits into from
Feb 17, 2023
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
4 changes: 0 additions & 4 deletions core/tx_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -1441,10 +1441,6 @@ func (pool *TxPool) reset(oldHead, newHead *types.Header) {

// when we reset txPool we should explicitly check if fee struct for min base fee has changed
// so that we can correctly drop txs with < minBaseFee from tx pool.
// TODO: this should be checking IsSubnetEVM since we also support minimumFee for SubnetEVM
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now require SubnetEVMTimestamp at genesis: https://github.com/ava-labs/subnet-evm/pull/419/files

// without requiring FeeConfigManager is enabled.
// This is already being set by SetMinFee when gas price updater starts.
// However tests are currently failing if we change this check to IsSubnetEVM.
if pool.chainconfig.IsFeeConfigManager(new(big.Int).SetUint64(newHead.Time)) {
feeConfig, _, err := pool.chain.GetFeeConfigAt(newHead)
if err != nil {
Expand Down
18 changes: 18 additions & 0 deletions plugin/evm/block_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,24 @@ import (
"github.com/ava-labs/avalanchego/snow"
)

func attemptAwait(t *testing.T, wg *sync.WaitGroup, delay time.Duration) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

migrate from deleted test file

ticker := make(chan struct{})

// Wait for [wg] and then close [ticket] to indicate that
// the wait group has finished.
go func() {
wg.Wait()
close(ticker)
}()

select {
case <-time.After(delay):
t.Fatal("Timed out waiting for wait group to complete")
case <-ticker:
// The wait group completed without issue
}
}

func TestBlockBuilderShutsDown(t *testing.T) {
shutdownChan := make(chan struct{})
wg := &sync.WaitGroup{}
Expand Down
81 changes: 0 additions & 81 deletions plugin/evm/gasprice_update.go

This file was deleted.

129 changes: 0 additions & 129 deletions plugin/evm/gasprice_update_test.go

This file was deleted.

18 changes: 4 additions & 14 deletions plugin/evm/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"encoding/json"
"errors"
"fmt"
"math/big"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -218,17 +219,6 @@ type VM struct {
warpBackend warp.WarpBackend
}

/*
******************************************************************************
********************************* Snowman API ********************************
******************************************************************************
*/

// implements SnowmanPlusPlusVM interface
func (vm *VM) GetActivationTime() time.Time {
return time.Unix(vm.chainConfig.SubnetEVMTimestamp.Int64(), 0)
}

// Initialize implements the snowman.ChainVM interface
func (vm *VM) Initialize(
_ context.Context,
Expand Down Expand Up @@ -390,6 +380,7 @@ func (vm *VM) Initialize(
vm.chainConfig = g.Config
vm.networkID = vm.ethConfig.NetworkId

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

// start goroutines to update the tx pool gas minimum gas price when upgrades go into effect
vm.handleGasPriceUpdates()

vm.eth.Start()
return vm.initChainState(vm.blockChain.LastAcceptedBlock())
}
Expand Down