From d3fb7094fd456c9a73b1502c62eedf9c1cb2031b Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Mon, 12 Aug 2024 08:59:42 -0700 Subject: [PATCH] Bump avalanchego to master (#1268) * 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 --- accounts/abi/bind/bind_test.go | 2 +- .../precompilebind/precompile_bind_test.go | 2 +- commontype/test_fee_config.go | 2 -- core/state/test_statedb.go | 2 -- core/test_blockchain.go | 2 -- go.mod | 4 +-- go.sum | 8 ++--- internal/blocktest/test_hash.go | 2 -- internal/cmdtest/test_cmd.go | 2 -- params/config.go | 6 ++-- params/network_upgrades.go | 7 ++-- peer/network_test.go | 3 +- plugin/evm/syncervm_test.go | 5 +-- plugin/evm/tx_gossip_test.go | 16 +++++---- plugin/evm/vm_test.go | 17 ++++++---- plugin/evm/vm_upgrade_bytes_test.go | 9 ++--- plugin/evm/vm_warp_test.go | 5 +-- precompile/allowlist/test_allowlist.go | 2 -- precompile/allowlist/test_allowlist_config.go | 2 -- precompile/contract/test_utils.go | 2 -- precompile/contracts/warp/predicate_test.go | 7 ++-- precompile/testutils/test_config.go | 2 -- precompile/testutils/test_precompile.go | 2 -- precompile/testutils/test_predicate.go | 2 -- rpc/testservice_test.go | 2 -- scripts/build_test.sh | 2 +- scripts/run_ginkgo_load.sh | 2 +- scripts/run_ginkgo_precompile.sh | 2 +- scripts/run_ginkgo_warp.sh | 2 +- scripts/versions.sh | 2 +- sync/handlers/test_providers.go | 2 -- sync/statesync/test_sync.go | 2 -- sync/syncutils/test_trie.go | 2 -- tests/load/load_test.go | 2 ++ tests/rlp_test_util.go | 2 -- tests/state_test_util.go | 2 -- tests/warp/warp_test.go | 33 ++++++++++++------- utils/snow.go | 4 +-- warp/warptest/block_client.go | 2 -- 39 files changed, 82 insertions(+), 94 deletions(-) diff --git a/accounts/abi/bind/bind_test.go b/accounts/abi/bind/bind_test.go index 266448f6d9..4ccb21ba91 100644 --- a/accounts/abi/bind/bind_test.go +++ b/accounts/abi/bind/bind_test.go @@ -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) diff --git a/accounts/abi/bind/precompilebind/precompile_bind_test.go b/accounts/abi/bind/precompilebind/precompile_bind_test.go index de59e3bd0a..a1633388dc 100644 --- a/accounts/abi/bind/precompilebind/precompile_bind_test.go +++ b/accounts/abi/bind/precompilebind/precompile_bind_test.go @@ -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) diff --git a/commontype/test_fee_config.go b/commontype/test_fee_config.go index 466a8638d4..646f21d1cb 100644 --- a/commontype/test_fee_config.go +++ b/commontype/test_fee_config.go @@ -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" diff --git a/core/state/test_statedb.go b/core/state/test_statedb.go index cd587bd38e..c18bdd2c65 100644 --- a/core/state/test_statedb.go +++ b/core/state/test_statedb.go @@ -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 ( diff --git a/core/test_blockchain.go b/core/test_blockchain.go index 41663353bb..0a109c6551 100644 --- a/core/test_blockchain.go +++ b/core/test_blockchain.go @@ -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 ( diff --git a/go.mod b/go.mod index 7956a35752..7a5de639cd 100644 --- a/go.mod +++ b/go.mod @@ -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 @@ -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 diff --git a/go.sum b/go.sum index a33e68a2f1..549db74bb0 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/internal/blocktest/test_hash.go b/internal/blocktest/test_hash.go index 03abe694cb..014e9ff4b0 100644 --- a/internal/blocktest/test_hash.go +++ b/internal/blocktest/test_hash.go @@ -30,8 +30,6 @@ // standalone go program. It provides an API that mirrors the standard library // testing API. -//go:build test - package blocktest import ( diff --git a/internal/cmdtest/test_cmd.go b/internal/cmdtest/test_cmd.go index 38415638b0..cf209889d2 100644 --- a/internal/cmdtest/test_cmd.go +++ b/internal/cmdtest/test_cmd.go @@ -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 . -//go:build test - package cmdtest import ( diff --git a/params/config.go b/params/config.go index 59ae91a869..904896ad32 100644 --- a/params/config.go +++ b/params/config.go @@ -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" @@ -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), @@ -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{}, diff --git a/params/network_upgrades.go b/params/network_upgrades.go index 7dcf15e911..013367c947 100644 --- a/params/network_upgrades.go +++ b/params/network_upgrades.go @@ -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" ) @@ -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), } } diff --git a/peer/network_test.go b/peer/network_test.go index 89419314cc..2ebcf6775a 100644 --- a/peer/network_test.go +++ b/peer/network_test.go @@ -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" @@ -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 }, diff --git a/plugin/evm/syncervm_test.go b/plugin/evm/syncervm_test.go index a81474c072..533740666b 100644 --- a/plugin/evm/syncervm_test.go +++ b/plugin/evm/syncervm_test.go @@ -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" @@ -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() @@ -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 diff --git a/plugin/evm/tx_gossip_test.go b/plugin/evm/tx_gossip_test.go index 1f04e223ce..36c47ffde5 100644 --- a/plugin/evm/tx_gossip_test.go +++ b/plugin/evm/tx_gossip_test.go @@ -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" @@ -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{ @@ -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)) @@ -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), } @@ -153,7 +155,7 @@ 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 }, @@ -161,7 +163,7 @@ func TestEthTxPushGossipOutbound(t *testing.T) { return nil, nil }, } - sender := &common.FakeSender{ + sender := &enginetest.SenderStub{ SentAppGossip: make(chan []byte, 1), } @@ -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{}, } diff --git a/plugin/evm/vm_test.go b/plugin/evm/vm_test.go index 2a0e5849c2..758fbbfd1d 100644 --- a/plugin/evm/vm_test.go +++ b/plugin/evm/vm_test.go @@ -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" @@ -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, @@ -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( @@ -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( diff --git a/plugin/evm/vm_upgrade_bytes_test.go b/plugin/evm/vm_upgrade_bytes_test.go index 6b0d4ad7a4..85d8d84885 100644 --- a/plugin/evm/vm_upgrade_bytes_test.go +++ b/plugin/evm/vm_upgrade_bytes_test.go @@ -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" @@ -32,7 +33,7 @@ import ( ) var ( - DefaultEUpgradeTime = uint64(version.GetEUpgradeTime(testNetworkID).Unix()) + DefaultEUpgradeTime = uint64(upgrade.GetConfig(testNetworkID).EtnaTime.Unix()) ) func TestVMUpgradeBytesPrecompile(t *testing.T) { @@ -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( @@ -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)) } diff --git a/plugin/evm/vm_warp_test.go b/plugin/evm/vm_warp_test.go index d90826a158..d5c46e540c 100644 --- a/plugin/evm/vm_warp_test.go +++ b/plugin/evm/vm_warp_test.go @@ -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" @@ -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 @@ -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 }, diff --git a/precompile/allowlist/test_allowlist.go b/precompile/allowlist/test_allowlist.go index fe92f0ba5d..48e81f18fd 100644 --- a/precompile/allowlist/test_allowlist.go +++ b/precompile/allowlist/test_allowlist.go @@ -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 ( diff --git a/precompile/allowlist/test_allowlist_config.go b/precompile/allowlist/test_allowlist_config.go index 2362ae14dc..27c649f520 100644 --- a/precompile/allowlist/test_allowlist_config.go +++ b/precompile/allowlist/test_allowlist_config.go @@ -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 ( diff --git a/precompile/contract/test_utils.go b/precompile/contract/test_utils.go index 137ea654d9..cf38b5db77 100644 --- a/precompile/contract/test_utils.go +++ b/precompile/contract/test_utils.go @@ -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 ( diff --git a/precompile/contracts/warp/predicate_test.go b/precompile/contracts/warp/predicate_test.go index 2b293b97a9..113db6fc43 100644 --- a/precompile/contracts/warp/predicate_test.go +++ b/precompile/contracts/warp/predicate_test.go @@ -13,6 +13,7 @@ import ( "github.com/ava-labs/avalanchego/snow" "github.com/ava-labs/avalanchego/snow/engine/snowman/block" "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/constants" "github.com/ava-labs/avalanchego/utils/crypto/bls" @@ -197,7 +198,7 @@ func createSnowCtx(validatorRanges []validatorRange) *snow.Context { } snowCtx := utils.TestSnowContext() - state := &validators.TestState{ + state := &validatorstest.State{ GetSubnetIDF: func(ctx context.Context, chainID ids.ID) (ids.ID, error) { return sourceSubnetID, nil }, @@ -266,7 +267,7 @@ func TestWarpMessageFromPrimaryNetwork(t *testing.T) { snowCtx.ChainID = ids.GenerateTestID() snowCtx.CChainID = cChainID snowCtx.NetworkID = networkID - snowCtx.ValidatorState = &validators.TestState{ + snowCtx.ValidatorState = &validatorstest.State{ GetSubnetIDF: func(ctx context.Context, chainID ids.ID) (ids.ID, error) { require.Equal(chainID, cChainID) return constants.PrimaryNetworkID, nil // Return Primary Network SubnetID @@ -666,7 +667,7 @@ func initWarpPredicateTests() { snowCtx := utils.TestSnowContext() snowCtx.NetworkID = networkID - state := &validators.TestState{ + state := &validatorstest.State{ GetSubnetIDF: func(ctx context.Context, chainID ids.ID) (ids.ID, error) { return sourceSubnetID, nil }, diff --git a/precompile/testutils/test_config.go b/precompile/testutils/test_config.go index 818f8f093a..101d15113d 100644 --- a/precompile/testutils/test_config.go +++ b/precompile/testutils/test_config.go @@ -1,8 +1,6 @@ // (c) 2023, Ava Labs, Inc. All rights reserved. // See the file LICENSE for licensing terms. -//go:build test - package testutils import ( diff --git a/precompile/testutils/test_precompile.go b/precompile/testutils/test_precompile.go index b684b5e9b6..c1a1eac813 100644 --- a/precompile/testutils/test_precompile.go +++ b/precompile/testutils/test_precompile.go @@ -1,8 +1,6 @@ // (c) 2023, Ava Labs, Inc. All rights reserved. // See the file LICENSE for licensing terms. -//go:build test - package testutils import ( diff --git a/precompile/testutils/test_predicate.go b/precompile/testutils/test_predicate.go index 4357ba9de4..2bba11611c 100644 --- a/precompile/testutils/test_predicate.go +++ b/precompile/testutils/test_predicate.go @@ -1,8 +1,6 @@ // (c) 2023, Ava Labs, Inc. All rights reserved. // See the file LICENSE for licensing terms. -//go:build test - package testutils import ( diff --git a/rpc/testservice_test.go b/rpc/testservice_test.go index 489ae207d8..1216fd5dcc 100644 --- a/rpc/testservice_test.go +++ b/rpc/testservice_test.go @@ -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 . -//go:build test - package rpc import ( diff --git a/scripts/build_test.sh b/scripts/build_test.sh index 556a5f6d92..6f588887e0 100755 --- a/scripts/build_test.sh +++ b/scripts/build_test.sh @@ -21,4 +21,4 @@ source "$SUBNET_EVM_PATH"/scripts/constants.sh # parallelism, and test coverage. # DO NOT RUN tests from the top level "tests" directory since they are run by ginkgo # shellcheck disable=SC2046 -go test -tags test -shuffle=on -race -timeout="${TIMEOUT:-600s}" -coverprofile=coverage.out -covermode=atomic "$@" $(go list ./... | grep -v github.com/ava-labs/subnet-evm/tests) +go test -shuffle=on -race -timeout="${TIMEOUT:-600s}" -coverprofile=coverage.out -covermode=atomic "$@" $(go list ./... | grep -v github.com/ava-labs/subnet-evm/tests) diff --git a/scripts/run_ginkgo_load.sh b/scripts/run_ginkgo_load.sh index 605265586c..6dd6c58757 100755 --- a/scripts/run_ginkgo_load.sh +++ b/scripts/run_ginkgo_load.sh @@ -26,4 +26,4 @@ if [[ -n "${AVALANCHEGO_BUILD_PATH}" ]]; then echo "Running with extra args:" "${EXTRA_ARGS[@]}" fi -ginkgo -tags=test -vv --label-filter="${GINKGO_LABEL_FILTER:-}" ./tests/load -- "${EXTRA_ARGS[@]}" +ginkgo -vv --label-filter="${GINKGO_LABEL_FILTER:-}" ./tests/load -- "${EXTRA_ARGS[@]}" diff --git a/scripts/run_ginkgo_precompile.sh b/scripts/run_ginkgo_precompile.sh index cd05c9d24d..9e626445c3 100755 --- a/scripts/run_ginkgo_precompile.sh +++ b/scripts/run_ginkgo_precompile.sh @@ -24,6 +24,6 @@ TEST_SOURCE_ROOT=$(pwd) # By default, it runs all e2e test cases! # Use "--ginkgo.skip" to skip tests. # Use "--ginkgo.focus" to select tests. -TEST_SOURCE_ROOT="$TEST_SOURCE_ROOT" ginkgo -tags=test run -procs=5 tests/precompile \ +TEST_SOURCE_ROOT="$TEST_SOURCE_ROOT" ginkgo run -procs=5 tests/precompile \ --ginkgo.vv \ --ginkgo.label-filter="${GINKGO_LABEL_FILTER:-""}" diff --git a/scripts/run_ginkgo_warp.sh b/scripts/run_ginkgo_warp.sh index b8b51741f9..0d7c3abd3a 100755 --- a/scripts/run_ginkgo_warp.sh +++ b/scripts/run_ginkgo_warp.sh @@ -27,4 +27,4 @@ if [[ -n "${AVALANCHEGO_BUILD_PATH}" ]]; then echo "Running with extra args:" "${EXTRA_ARGS[@]}" fi -ginkgo -tags=test -vv --label-filter="${GINKGO_LABEL_FILTER:-}" ./tests/warp -- "${EXTRA_ARGS[@]}" +ginkgo -vv --label-filter="${GINKGO_LABEL_FILTER:-}" ./tests/warp -- "${EXTRA_ARGS[@]}" diff --git a/scripts/versions.sh b/scripts/versions.sh index 4bb7ec71b9..a1bcaf654f 100644 --- a/scripts/versions.sh +++ b/scripts/versions.sh @@ -4,7 +4,7 @@ # shellcheck disable=SC2034 # Don't export them as they're used in the context of other calls -AVALANCHE_VERSION=${AVALANCHE_VERSION:-'v1.11.10'} +AVALANCHE_VERSION=${AVALANCHE_VERSION:-'479145a6602dfc6263c3d7842d26d7c7be7d5991'} GINKGO_VERSION=${GINKGO_VERSION:-'v2.2.0'} # This won't be used, but it's here to make code syncs easier diff --git a/sync/handlers/test_providers.go b/sync/handlers/test_providers.go index ab3a5f984a..9fb8945a4b 100644 --- a/sync/handlers/test_providers.go +++ b/sync/handlers/test_providers.go @@ -1,8 +1,6 @@ // (c) 2021-2022, Ava Labs, Inc. All rights reserved. // See the file LICENSE for licensing terms. -//go:build test - package handlers import ( diff --git a/sync/statesync/test_sync.go b/sync/statesync/test_sync.go index 1eb6aa9bca..a319e34c08 100644 --- a/sync/statesync/test_sync.go +++ b/sync/statesync/test_sync.go @@ -1,8 +1,6 @@ // (c) 2021-2022, Ava Labs, Inc. All rights reserved. // See the file LICENSE for licensing terms. -//go:build test - package statesync import ( diff --git a/sync/syncutils/test_trie.go b/sync/syncutils/test_trie.go index 6875167f67..23b603ce73 100644 --- a/sync/syncutils/test_trie.go +++ b/sync/syncutils/test_trie.go @@ -1,8 +1,6 @@ // (c) 2021-2022, Ava Labs, Inc. All rights reserved. // See the file LICENSE for licensing terms. -//go:build test - package syncutils import ( diff --git a/tests/load/load_test.go b/tests/load/load_test.go index c8f80915c4..aa5a14783b 100644 --- a/tests/load/load_test.go +++ b/tests/load/load_test.go @@ -53,10 +53,12 @@ var _ = ginkgo.Describe("[Load Simulator]", ginkgo.Ordered, func() { var env *e2e.TestEnvironment ginkgo.BeforeAll(func() { + tc := e2e.NewTestContext() genesisPath := filepath.Join(repoRootPath, "tests/load/genesis/genesis.json") nodes := utils.NewTmpnetNodes(nodeCount) env = e2e.NewTestEnvironment( + tc, flagVars, utils.NewTmpnetNetwork( "subnet-evm-small-load", diff --git a/tests/rlp_test_util.go b/tests/rlp_test_util.go index 0b229610c6..5af235bc5a 100644 --- a/tests/rlp_test_util.go +++ b/tests/rlp_test_util.go @@ -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 . -//go:build test - package tests import ( diff --git a/tests/state_test_util.go b/tests/state_test_util.go index 23acaadabe..a31ea88a95 100644 --- a/tests/state_test_util.go +++ b/tests/state_test_util.go @@ -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 . -//go:build test - package tests import ( diff --git a/tests/warp/warp_test.go b/tests/warp/warp_test.go index 54f27a47fc..57567ae451 100644 --- a/tests/warp/warp_test.go +++ b/tests/warp/warp_test.go @@ -91,9 +91,11 @@ func TestE2E(t *testing.T) { var _ = ginkgo.SynchronizedBeforeSuite(func() []byte { // Run only once in the first ginkgo process + tc := e2e.NewTestContext() nodes := utils.NewTmpnetNodes(tmpnet.DefaultNodeCount) env := e2e.NewTestEnvironment( + tc, flagVars, utils.NewTmpnetNetwork( "subnet-evm-warp-e2e", @@ -109,13 +111,14 @@ var _ = ginkgo.SynchronizedBeforeSuite(func() []byte { // Run in every ginkgo process require := require.New(ginkgo.GinkgoT()) + tc := e2e.NewTestContext() // Initialize the local test environment from the global state if len(envBytes) > 0 { - e2e.InitSharedTestEnvironment(envBytes) + e2e.InitSharedTestEnvironment(ginkgo.GinkgoT(), envBytes) } - network := e2e.Env.GetNetwork() + network := e2e.GetEnv(tc).GetNetwork() // By default all nodes are validating all subnets validatorURIs := make([]string, len(network.Nodes)) @@ -142,7 +145,7 @@ var _ = ginkgo.SynchronizedBeforeSuite(func() []byte { } infoClient := info.NewClient(network.Nodes[0].URI) - cChainBlockchainID, err := infoClient.GetBlockchainID(e2e.DefaultContext(), "C") + cChainBlockchainID, err := infoClient.GetBlockchainID(tc.DefaultContext(), "C") require.NoError(err) cChainSubnetDetails = &Subnet{ @@ -155,7 +158,8 @@ var _ = ginkgo.SynchronizedBeforeSuite(func() []byte { var _ = ginkgo.Describe("[Warp]", func() { testFunc := func(sendingSubnet *Subnet, receivingSubnet *Subnet) { - w := newWarpTest(e2e.DefaultContext(), sendingSubnet, receivingSubnet) + tc := e2e.NewTestContext() + w := newWarpTest(tc.DefaultContext(), sendingSubnet, receivingSubnet) log.Info("Sending message from A to B") w.sendMessageFromSendingSubnet() @@ -294,7 +298,8 @@ func (w *warpTest) getBlockHashAndNumberFromTxReceipt(ctx context.Context, clien } func (w *warpTest) sendMessageFromSendingSubnet() { - ctx := e2e.DefaultContext() + tc := e2e.NewTestContext() + ctx := tc.DefaultContext() require := require.New(ginkgo.GinkgoT()) client := w.sendingSubnetClients[0] @@ -375,7 +380,8 @@ func (w *warpTest) sendMessageFromSendingSubnet() { func (w *warpTest) aggregateSignaturesViaAPI() { require := require.New(ginkgo.GinkgoT()) - ctx := e2e.DefaultContext() + tc := e2e.NewTestContext() + ctx := tc.DefaultContext() warpAPIs := make(map[ids.NodeID]warpBackend.Client, len(w.sendingSubnetURIs)) for _, uri := range w.sendingSubnetURIs { @@ -434,7 +440,8 @@ func (w *warpTest) aggregateSignaturesViaAPI() { func (w *warpTest) aggregateSignatures() { require := require.New(ginkgo.GinkgoT()) - ctx := e2e.DefaultContext() + tc := e2e.NewTestContext() + ctx := tc.DefaultContext() // Verify that the signature aggregation matches the results of manually constructing the warp message client, err := warpBackend.NewClient(w.sendingSubnetURIs[0], w.sendingSubnet.BlockchainID.String()) @@ -457,7 +464,8 @@ func (w *warpTest) aggregateSignatures() { func (w *warpTest) deliverAddressedCallToReceivingSubnet() { require := require.New(ginkgo.GinkgoT()) - ctx := e2e.DefaultContext() + tc := e2e.NewTestContext() + ctx := tc.DefaultContext() client := w.receivingSubnetClients[0] log.Info("Subscribing to new heads") @@ -511,7 +519,8 @@ func (w *warpTest) deliverAddressedCallToReceivingSubnet() { func (w *warpTest) deliverBlockHashPayload() { require := require.New(ginkgo.GinkgoT()) - ctx := e2e.DefaultContext() + tc := e2e.NewTestContext() + ctx := tc.DefaultContext() client := w.receivingSubnetClients[0] log.Info("Subscribing to new heads") @@ -565,7 +574,8 @@ func (w *warpTest) deliverBlockHashPayload() { func (w *warpTest) executeHardHatTest() { require := require.New(ginkgo.GinkgoT()) - ctx := e2e.DefaultContext() + tc := e2e.NewTestContext() + ctx := tc.DefaultContext() client := w.sendingSubnetClients[0] log.Info("Subscribing to new heads") @@ -593,7 +603,8 @@ func (w *warpTest) executeHardHatTest() { func (w *warpTest) warpLoad() { require := require.New(ginkgo.GinkgoT()) - ctx := e2e.DefaultContext() + tc := e2e.NewTestContext() + ctx := tc.DefaultContext() var ( numWorkers = len(w.sendingSubnetClients) diff --git a/utils/snow.go b/utils/snow.go index 96c13708d3..92a1d236c1 100644 --- a/utils/snow.go +++ b/utils/snow.go @@ -7,7 +7,7 @@ import ( "github.com/ava-labs/avalanchego/api/metrics" "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/snow" - "github.com/ava-labs/avalanchego/snow/validators" + "github.com/ava-labs/avalanchego/snow/validators/validatorstest" "github.com/ava-labs/avalanchego/utils/crypto/bls" "github.com/ava-labs/avalanchego/utils/logging" ) @@ -28,6 +28,6 @@ func TestSnowContext() *snow.Context { BCLookup: ids.NewAliaser(), Metrics: metrics.NewMultiGatherer(), ChainDataDir: "", - ValidatorState: &validators.TestState{}, + ValidatorState: &validatorstest.State{}, } } diff --git a/warp/warptest/block_client.go b/warp/warptest/block_client.go index c21dd702d6..6b7354d7fb 100644 --- a/warp/warptest/block_client.go +++ b/warp/warptest/block_client.go @@ -1,8 +1,6 @@ // (c) 2024, Ava Labs, Inc. All rights reserved. // See the file LICENSE for licensing terms. -//go:build test - // warptest exposes common functionality for testing the warp package. package warptest