Skip to content

Commit

Permalink
Bump avalanchego to master (#1268)
Browse files Browse the repository at this point in the history
* Bump avalanchego to master

* Update avalanchego x (#1275)

* remove test tags

* use avago default

* revert ws diffs

* remove ginkgo test tags

---------

Co-authored-by: Ceyhun Onur <[email protected]>
  • Loading branch information
darioush and ceyonur authored Aug 12, 2024
1 parent e3266a3 commit d3fb709
Show file tree
Hide file tree
Showing 39 changed files with 82 additions and 94 deletions.
2 changes: 1 addition & 1 deletion accounts/abi/bind/bind_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2180,7 +2180,7 @@ func golangBindings(t *testing.T, overload bool) {
t.Fatalf("failed to tidy Go module file: %v\n%s", err, out)
}
// Test the entire package and report any failures
cmd := exec.Command(gocmd, "test", "-tags", "test", "-v", "-count", "1")
cmd := exec.Command(gocmd, "test", "-v", "-count", "1")
cmd.Dir = pkg
if out, err := cmd.CombinedOutput(); err != nil {
t.Fatalf("failed to run binding test: %v\n%s", err, out)
Expand Down
2 changes: 1 addition & 1 deletion accounts/abi/bind/precompilebind/precompile_bind_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ func TestPrecompileBind(t *testing.T) {
t.Fatalf("failed to tidy Go module file: %v\n%s", err, out)
}
// Test the entire package and report any failures
cmd := exec.Command(gocmd, "test", "-tags", "test", "./...", "-v", "-count", "1")
cmd := exec.Command(gocmd, "test", "./...", "-v", "-count", "1")
cmd.Dir = pkg
if out, err := cmd.CombinedOutput(); err != nil {
t.Fatalf("failed to run binding test: %v\n%s", err, out)
Expand Down
2 changes: 0 additions & 2 deletions commontype/test_fee_config.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// (c) 2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

//go:build test

package commontype

import "math/big"
Expand Down
2 changes: 0 additions & 2 deletions core/state/test_statedb.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// (c) 2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

//go:build test

package state

import (
Expand Down
2 changes: 0 additions & 2 deletions core/test_blockchain.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// (c) 2020-2021, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

//go:build test

package core

import (
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.21.12

require (
github.com/VictoriaMetrics/fastcache v1.12.1
github.com/ava-labs/avalanchego v1.11.11-0.20240729205337-a0f7e422bb84
github.com/ava-labs/avalanchego v1.11.11-0.20240805202431-479145a6602d
github.com/cespare/cp v0.1.0
github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233
github.com/davecgh/go-spew v1.1.1
Expand Down Expand Up @@ -54,7 +54,7 @@ require (
require (
github.com/DataDog/zstd v1.5.2 // indirect
github.com/NYTimes/gziphandler v1.1.1 // indirect
github.com/ava-labs/coreth v0.13.7 // indirect
github.com/ava-labs/coreth v0.13.8-0.20240802110637-b3e5088d062d // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8=
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/ava-labs/avalanchego v1.11.11-0.20240729205337-a0f7e422bb84 h1:AmPZLlnVREbJ/viK/hDTIVn1bqX8QTB2CFtrBxHwnsw=
github.com/ava-labs/avalanchego v1.11.11-0.20240729205337-a0f7e422bb84/go.mod h1:POgZPryqe80OeHCDNrXrPOKoFre736iFuMgmUBeKaLc=
github.com/ava-labs/coreth v0.13.7 h1:k8T9u/ROifl8f7oXjHRc1KvSISRl9txvy7gGVmHEz6g=
github.com/ava-labs/coreth v0.13.7/go.mod h1:tXDujonxXFOF6oK5HS2EmgtSXJK3Gy6RpZxb5WzR9rM=
github.com/ava-labs/avalanchego v1.11.11-0.20240805202431-479145a6602d h1:T8sDX5uo7zSEjwDtVccS1WtzuC3pRXs9NXYbmGGagJ4=
github.com/ava-labs/avalanchego v1.11.11-0.20240805202431-479145a6602d/go.mod h1:9e0UPXJboybmgFjeTj+SFbK4ugbrdG4t68VdiUW5oQ8=
github.com/ava-labs/coreth v0.13.8-0.20240802110637-b3e5088d062d h1:klPTcKVvqfA2KSKaRvQAO56Pd4XAqGhwgMTQ6/W+w7w=
github.com/ava-labs/coreth v0.13.8-0.20240802110637-b3e5088d062d/go.mod h1:tXDujonxXFOF6oK5HS2EmgtSXJK3Gy6RpZxb5WzR9rM=
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
Expand Down
2 changes: 0 additions & 2 deletions internal/blocktest/test_hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
// standalone go program. It provides an API that mirrors the standard library
// testing API.

//go:build test

package blocktest

import (
Expand Down
2 changes: 0 additions & 2 deletions internal/cmdtest/test_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

//go:build test

package cmdtest

import (
Expand Down
6 changes: 3 additions & 3 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import (
"math/big"
"time"

"github.com/ava-labs/avalanchego/upgrade"
"github.com/ava-labs/avalanchego/utils/constants"
"github.com/ava-labs/avalanchego/version"
"github.com/ava-labs/subnet-evm/commontype"
"github.com/ava-labs/subnet-evm/precompile/modules"
"github.com/ava-labs/subnet-evm/precompile/precompileconfig"
Expand All @@ -57,7 +57,7 @@ var (
DynamicFeeExtraDataSize = 80
RollupWindow uint64 = 10

DefaultGenesisTime = version.DefaultUpgradeTime
DefaultGenesisTime = upgrade.InitiallyActiveTime

DefaultFeeConfig = commontype.FeeConfig{
GasLimit: big.NewInt(8_000_000),
Expand Down Expand Up @@ -110,7 +110,7 @@ var (
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
CancunTime: utils.TimeToNewUint64(version.GetEUpgradeTime(constants.UnitTestID)),
CancunTime: utils.TimeToNewUint64(upgrade.GetConfig(constants.UnitTestID).EtnaTime),
NetworkUpgrades: getDefaultNetworkUpgrades(constants.UnitTestID),
GenesisPrecompiles: Precompiles{},
UpgradeConfig: UpgradeConfig{},
Expand Down
7 changes: 4 additions & 3 deletions params/network_upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"fmt"
"reflect"

"github.com/ava-labs/avalanchego/version"
"github.com/ava-labs/avalanchego/upgrade"
"github.com/ava-labs/subnet-evm/utils"
)

Expand Down Expand Up @@ -143,10 +143,11 @@ func (n *NetworkUpgrades) GetAvalancheRules(time uint64) AvalancheRules {
// getDefaultNetworkUpgrades returns the network upgrades for the specified network ID.
// These should not return nil values.
func getDefaultNetworkUpgrades(networkID uint32) NetworkUpgrades {
agoUpgrade := upgrade.GetConfig(networkID)
return NetworkUpgrades{
SubnetEVMTimestamp: utils.NewUint64(0),
DurangoTimestamp: utils.TimeToNewUint64(version.GetDurangoTime(networkID)),
EUpgradeTimestamp: utils.TimeToNewUint64(version.GetEUpgradeTime(networkID)),
DurangoTimestamp: utils.TimeToNewUint64(agoUpgrade.DurangoTime),
EUpgradeTimestamp: utils.TimeToNewUint64(agoUpgrade.EtnaTime),
}
}

Expand Down
3 changes: 2 additions & 1 deletion peer/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

"github.com/ava-labs/avalanchego/network/p2p"
"github.com/ava-labs/avalanchego/snow/engine/common"
"github.com/ava-labs/avalanchego/snow/engine/enginetest"
"github.com/ava-labs/avalanchego/utils/logging"
"github.com/ava-labs/avalanchego/utils/set"
ethcommon "github.com/ethereum/go-ethereum/common"
Expand Down Expand Up @@ -510,7 +511,7 @@ func TestHandleInvalidMessages(t *testing.T) {

nodeID := ids.GenerateTestNodeID()
requestID := uint32(1)
sender := &common.SenderTest{
sender := &enginetest.Sender{
SendAppErrorF: func(context.Context, ids.NodeID, uint32, int32, string) error {
return nil
},
Expand Down
5 changes: 3 additions & 2 deletions plugin/evm/syncervm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/snow"
commonEng "github.com/ava-labs/avalanchego/snow/engine/common"
"github.com/ava-labs/avalanchego/snow/engine/enginetest"
"github.com/ava-labs/avalanchego/snow/engine/snowman/block"
"github.com/ava-labs/avalanchego/utils/set"

Expand Down Expand Up @@ -124,7 +125,7 @@ func TestStateSyncToggleEnabledToDisabled(t *testing.T) {
test.expectedErr = nil

syncDisabledVM := &VM{}
appSender := &commonEng.SenderTest{T: t}
appSender := &enginetest.Sender{T: t}
appSender.SendAppGossipF = func(context.Context, commonEng.SendConfig, []byte) error { return nil }
appSender.SendAppRequestF = func(ctx context.Context, nodeSet set.Set[ids.NodeID], requestID uint32, request []byte) error {
nodeID, hasItem := nodeSet.Pop()
Expand Down Expand Up @@ -368,7 +369,7 @@ func createSyncServerAndClientVMs(t *testing.T, test syncTest, numBlocks int) *s
// off of a server VM.
type syncVMSetup struct {
serverVM *VM
serverAppSender *commonEng.SenderTest
serverAppSender *enginetest.Sender

fundedAccounts map[*keystore.Key]*types.StateAccount

Expand Down
16 changes: 9 additions & 7 deletions plugin/evm/tx_gossip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ import (
"github.com/ava-labs/avalanchego/proto/pb/sdk"
"github.com/ava-labs/avalanchego/snow"
"github.com/ava-labs/avalanchego/snow/engine/common"
"github.com/ava-labs/avalanchego/snow/engine/enginetest"
"github.com/ava-labs/avalanchego/snow/validators"
"github.com/ava-labs/avalanchego/snow/validators/validatorstest"
agoUtils "github.com/ava-labs/avalanchego/utils"
"github.com/ava-labs/avalanchego/utils/logging"
"github.com/ava-labs/avalanchego/utils/set"
Expand All @@ -35,10 +37,10 @@ func TestEthTxGossip(t *testing.T) {
require := require.New(t)
ctx := context.Background()
snowCtx := utils.TestSnowContext()
validatorState := &validators.TestState{}
validatorState := &validatorstest.State{}
snowCtx.ValidatorState = validatorState

responseSender := &common.FakeSender{
responseSender := &enginetest.SenderStub{
SentAppResponse: make(chan []byte, 1),
}
vm := &VM{
Expand All @@ -54,7 +56,7 @@ func TestEthTxGossip(t *testing.T) {
nil,
make(chan common.Message),
nil,
&common.SenderTest{},
&enginetest.Sender{},
))
require.NoError(vm.SetState(ctx, snow.NormalOp))

Expand All @@ -63,7 +65,7 @@ func TestEthTxGossip(t *testing.T) {
}()

// sender for the peer requesting gossip from [vm]
peerSender := &common.FakeSender{
peerSender := &enginetest.SenderStub{
SentAppRequest: make(chan []byte, 1),
}

Expand Down Expand Up @@ -153,15 +155,15 @@ func TestEthTxPushGossipOutbound(t *testing.T) {
require := require.New(t)
ctx := context.Background()
snowCtx := utils.TestSnowContext()
snowCtx.ValidatorState = &validators.TestState{
snowCtx.ValidatorState = &validatorstest.State{
GetCurrentHeightF: func(context.Context) (uint64, error) {
return 0, nil
},
GetValidatorSetF: func(context.Context, uint64, ids.ID) (map[ids.NodeID]*validators.GetValidatorOutput, error) {
return nil, nil
},
}
sender := &common.FakeSender{
sender := &enginetest.SenderStub{
SentAppGossip: make(chan []byte, 1),
}

Expand Down Expand Up @@ -217,7 +219,7 @@ func TestEthTxPushGossipInbound(t *testing.T) {
ctx := context.Background()
snowCtx := utils.TestSnowContext()

sender := &common.SenderTest{}
sender := &enginetest.Sender{}
vm := &VM{
ethTxPullGossiper: gossip.NoOpGossiper{},
}
Expand Down
17 changes: 10 additions & 7 deletions plugin/evm/vm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ import (
"github.com/ava-labs/avalanchego/snow"
"github.com/ava-labs/avalanchego/snow/consensus/snowman"
commonEng "github.com/ava-labs/avalanchego/snow/engine/common"
"github.com/ava-labs/avalanchego/snow/validators"
"github.com/ava-labs/avalanchego/snow/engine/enginetest"
"github.com/ava-labs/avalanchego/snow/validators/validatorstest"
avalancheConstants "github.com/ava-labs/avalanchego/utils/constants"
"github.com/ava-labs/avalanchego/utils/crypto/bls"
"github.com/ava-labs/avalanchego/utils/formatting"
Expand Down Expand Up @@ -152,7 +153,7 @@ func NewContext() *snow.Context {
_ = aliaser.Alias(testCChainID, testCChainID.String())
_ = aliaser.Alias(testXChainID, "X")
_ = aliaser.Alias(testXChainID, testXChainID.String())
ctx.ValidatorState = &validators.TestState{
ctx.ValidatorState = &validatorstest.State{
GetSubnetIDF: func(_ context.Context, chainID ids.ID) (ids.ID, error) {
subnetID, ok := map[ids.ID]ids.ID{
avalancheConstants.PlatformChainID: avalancheConstants.PrimaryNetworkID,
Expand Down Expand Up @@ -221,13 +222,15 @@ func GenesisVM(t *testing.T,
genesisJSON string,
configJSON string,
upgradeJSON string,
) (chan commonEng.Message,
*VM, database.Database,
*commonEng.SenderTest,
) (
chan commonEng.Message,
*VM,
database.Database,
*enginetest.Sender,
) {
vm := &VM{}
ctx, dbManager, genesisBytes, issuer, _ := setupGenesis(t, genesisJSON)
appSender := &commonEng.SenderTest{T: t}
appSender := &enginetest.Sender{T: t}
appSender.CantSendAppGossip = true
appSender.SendAppGossipF = func(context.Context, commonEng.SendConfig, []byte) error { return nil }
err := vm.Initialize(
Expand Down Expand Up @@ -1934,7 +1937,7 @@ func TestConfigureLogLevel(t *testing.T) {
t.Run(test.name, func(t *testing.T) {
vm := &VM{}
ctx, dbManager, genesisBytes, issuer, _ := setupGenesis(t, test.genesisJSON)
appSender := &commonEng.SenderTest{T: t}
appSender := &enginetest.Sender{T: t}
appSender.CantSendAppGossip = true
appSender.SendAppGossipF = func(context.Context, commonEng.SendConfig, []byte) error { return nil }
err := vm.Initialize(
Expand Down
9 changes: 5 additions & 4 deletions plugin/evm/vm_upgrade_bytes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import (

"github.com/ava-labs/avalanchego/snow"
commonEng "github.com/ava-labs/avalanchego/snow/engine/common"
"github.com/ava-labs/avalanchego/version"
"github.com/ava-labs/avalanchego/snow/engine/enginetest"
"github.com/ava-labs/avalanchego/upgrade"
"github.com/ava-labs/avalanchego/vms/components/chain"
"github.com/ava-labs/subnet-evm/core"
"github.com/ava-labs/subnet-evm/core/types"
Expand All @@ -32,7 +33,7 @@ import (
)

var (
DefaultEUpgradeTime = uint64(version.GetEUpgradeTime(testNetworkID).Unix())
DefaultEUpgradeTime = uint64(upgrade.GetConfig(testNetworkID).EtnaTime.Unix())
)

func TestVMUpgradeBytesPrecompile(t *testing.T) {
Expand Down Expand Up @@ -183,7 +184,7 @@ func TestNetworkUpgradesOverriden(t *testing.T) {

vm := &VM{}
ctx, dbManager, genesisBytes, issuer, _ := setupGenesis(t, string(genesisBytes))
appSender := &commonEng.SenderTest{T: t}
appSender := &enginetest.Sender{T: t}
appSender.CantSendAppGossip = true
appSender.SendAppGossipF = func(context.Context, commonEng.SendConfig, []byte) error { return nil }
err = vm.Initialize(
Expand Down Expand Up @@ -212,7 +213,7 @@ func TestNetworkUpgradesOverriden(t *testing.T) {
require.False(t, vm.chainConfig.IsSubnetEVM(0))
require.True(t, vm.chainConfig.IsSubnetEVM(2))
require.False(t, vm.chainConfig.IsDurango(0))
require.False(t, vm.chainConfig.IsDurango(uint64(version.DefaultUpgradeTime.Unix())))
require.False(t, vm.chainConfig.IsDurango(uint64(params.DefaultGenesisTime.Unix())))
require.True(t, vm.chainConfig.IsDurango(1607144402))
}

Expand Down
5 changes: 3 additions & 2 deletions plugin/evm/vm_warp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/snow/engine/snowman/block"
"github.com/ava-labs/avalanchego/snow/validators"
"github.com/ava-labs/avalanchego/snow/validators/validatorstest"
avagoUtils "github.com/ava-labs/avalanchego/utils"
"github.com/ava-labs/avalanchego/utils/crypto/bls"
"github.com/ava-labs/avalanchego/utils/set"
Expand Down Expand Up @@ -278,7 +279,7 @@ func testWarpVMTransaction(t *testing.T, unsignedMessage *avalancheWarp.Unsigned
minimumValidPChainHeight := uint64(10)
getValidatorSetTestErr := errors.New("can't get validator set test error")

vm.ctx.ValidatorState = &validators.TestState{
vm.ctx.ValidatorState = &validatorstest.State{
// TODO: test both Primary Network / C-Chain and non-Primary Network
GetSubnetIDF: func(ctx context.Context, chainID ids.ID) (ids.ID, error) {
return ids.Empty, nil
Expand Down Expand Up @@ -448,7 +449,7 @@ func TestReceiveWarpMessage(t *testing.T) {
minimumValidPChainHeight := uint64(10)
getValidatorSetTestErr := errors.New("can't get validator set test error")

vm.ctx.ValidatorState = &validators.TestState{
vm.ctx.ValidatorState = &validatorstest.State{
GetSubnetIDF: func(ctx context.Context, chainID ids.ID) (ids.ID, error) {
return ids.Empty, nil
},
Expand Down
2 changes: 0 additions & 2 deletions precompile/allowlist/test_allowlist.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// (c) 2019-2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

//go:build test

package allowlist

import (
Expand Down
2 changes: 0 additions & 2 deletions precompile/allowlist/test_allowlist_config.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// (c) 2019-2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

//go:build test

package allowlist

import (
Expand Down
2 changes: 0 additions & 2 deletions precompile/contract/test_utils.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// (c) 2019-2020, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

//go:build test

package contract

import (
Expand Down
Loading

0 comments on commit d3fb709

Please sign in to comment.