From dca63b47c3a1d8e179869529c5567de5fa504aca Mon Sep 17 00:00:00 2001 From: Felipe Madero Date: Thu, 5 Sep 2024 07:42:33 -0300 Subject: [PATCH 1/8] bump to avago 1.11.11 --- go.mod | 4 ++-- go.sum | 8 ++++---- local/blockchain.go | 11 ++++++----- local/default/flags.json | 4 ++-- utils/genesis.go | 2 +- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/go.mod b/go.mod index b565fb3c..6a1c87c7 100644 --- a/go.mod +++ b/go.mod @@ -5,8 +5,8 @@ go 1.21.12 toolchain go1.22.3 require ( - github.com/ava-labs/avalanchego v1.11.11-0.20240814014627-2eef64141457 - github.com/ava-labs/coreth v0.13.8-fixed-genesis-upgrade.0.20240813194342-7635a96aa180 + github.com/ava-labs/avalanchego v1.11.11 + github.com/ava-labs/coreth v0.13.8-fixed-genesis-upgrade.0.20240815193440-a96bc921e732 github.com/ethereum/go-ethereum v1.13.8 github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 github.com/onsi/ginkgo/v2 v2.13.1 diff --git a/go.sum b/go.sum index 5c3ac47c..7e17bad6 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.20240814014627-2eef64141457 h1:yT27Bn/2+SnJR1YPIscqznSlvpnR3TEGfbS7wdB1Gmg= -github.com/ava-labs/avalanchego v1.11.11-0.20240814014627-2eef64141457/go.mod h1:UkyrRDXK2E15Lq2abyae2Pt+JsWvgsg1pe0/AtoMyAM= -github.com/ava-labs/coreth v0.13.8-fixed-genesis-upgrade.0.20240813194342-7635a96aa180 h1:6aIHp7wbyGVYdhHVQUbG7BEcbCMEQ5SYopPPJyipyvk= -github.com/ava-labs/coreth v0.13.8-fixed-genesis-upgrade.0.20240813194342-7635a96aa180/go.mod h1:/wNBVq7J7wlC2Kbov7kk6LV5xZvau7VF9zwTVOeyAjY= +github.com/ava-labs/avalanchego v1.11.11 h1:MIQq8xRavRj4ZXHA4G+aMiymig7SOScGOG1SApmMvBc= +github.com/ava-labs/avalanchego v1.11.11/go.mod h1:yFx3V31Jy9NFa8GZlgGnwiVf8KGjeF2+Uc99l9Scd/8= +github.com/ava-labs/coreth v0.13.8-fixed-genesis-upgrade.0.20240815193440-a96bc921e732 h1:wlhGJbmb7s3bU2QWtxKjscGjfHknQiq+cVhhUjONsB8= +github.com/ava-labs/coreth v0.13.8-fixed-genesis-upgrade.0.20240815193440-a96bc921e732/go.mod h1:RkQLaQ961Xe/sUb3ycn4Qi18vPPuEetTqDf2eDcquAs= 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/local/blockchain.go b/local/blockchain.go index f10facfa..008e6e63 100644 --- a/local/blockchain.go +++ b/local/blockchain.go @@ -43,6 +43,7 @@ import ( "github.com/ava-labs/avalanchego/wallet/chain/p" pbuilder "github.com/ava-labs/avalanchego/wallet/chain/p/builder" psigner "github.com/ava-labs/avalanchego/wallet/chain/p/signer" + pwallet "github.com/ava-labs/avalanchego/wallet/chain/p/wallet" "github.com/ava-labs/avalanchego/wallet/subnet/primary" "github.com/ava-labs/avalanchego/wallet/subnet/primary/common" "go.uber.org/zap" @@ -826,8 +827,8 @@ func (ln *localNetwork) restartNodes( type wallet struct { addr ids.ShortID pCTX *pbuilder.Context - pWallet p.Wallet - pBackend p.Backend + pWallet pwallet.Wallet + pBackend pwallet.Backend pBuilder pbuilder.Builder pSigner psigner.Signer xCTX *xbuilder.Context @@ -879,10 +880,10 @@ func newWallet( var w wallet w.addr = privateKey.PublicKey().Address() w.pCTX = pCTX - w.pBackend = p.NewBackend(pCTX, pUTXOs, subnetOwners) + w.pBackend = pwallet.NewBackend(pCTX, pUTXOs, subnetOwners) w.pBuilder = pbuilder.New(kc.Addresses(), pCTX, w.pBackend) w.pSigner = psigner.New(kc, w.pBackend) - w.pWallet = p.NewWallet(w.pBuilder, w.pSigner, pClient, w.pBackend) + w.pWallet = pwallet.New(p.NewClient(pClient, w.pBackend), w.pBuilder, w.pSigner) xBackend := x.NewBackend(xCTX, xUTXOs) xBuilder := xbuilder.New(kc.Addresses(), xCTX, xBackend) @@ -895,7 +896,7 @@ func newWallet( func (w *wallet) reload(uri string) { pClient := platformvm.NewClient(uri) - w.pWallet = p.NewWallet(w.pBuilder, w.pSigner, pClient, w.pBackend) + w.pWallet = pwallet.New(p.NewClient(pClient, w.pBackend), w.pBuilder, w.pSigner) } // add all nodes as validators of the primary network, in case they are not diff --git a/local/default/flags.json b/local/default/flags.json index 7a1d3276..afa0dd10 100644 --- a/local/default/flags.json +++ b/local/default/flags.json @@ -4,6 +4,6 @@ "health-check-frequency":"2s", "api-admin-enabled":true, "index-enabled":true, - "log-display-level":"ERROR", - "log-level": "ERROR" + "log-display-level":"INFO", + "log-level": "INFO" } diff --git a/utils/genesis.go b/utils/genesis.go index 73ad4500..7112ef0d 100644 --- a/utils/genesis.go +++ b/utils/genesis.go @@ -26,7 +26,7 @@ const ( func generateCchainGenesis() ([]byte, error) { cChainGenesisMap := map[string]interface{}{} - cChainGenesisMap["config"] = coreth_params.AvalancheLocalChainConfig + cChainGenesisMap["config"] = coreth_params.TestChainConfig cChainGenesisMap["nonce"] = hexa0Str cChainGenesisMap["timestamp"] = hexa0Str cChainGenesisMap["extraData"] = "0x00" From 0ec47aa1f223fef1e84bd55309cd2b72983cee6c Mon Sep 17 00:00:00 2001 From: Felipe Madero Date: Thu, 5 Sep 2024 09:38:50 -0300 Subject: [PATCH 2/8] fix c-chain block 0 timestamp --- utils/genesis.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/utils/genesis.go b/utils/genesis.go index 7112ef0d..4db28943 100644 --- a/utils/genesis.go +++ b/utils/genesis.go @@ -7,6 +7,7 @@ import ( "fmt" "time" + "github.com/ava-labs/avalanchego/upgrade" "github.com/ava-labs/avalanchego/utils/crypto/bls" "github.com/ava-labs/avalanchego/utils/formatting" "github.com/ava-labs/avalanchego/vms/platformvm/signer" @@ -26,9 +27,11 @@ const ( func generateCchainGenesis() ([]byte, error) { cChainGenesisMap := map[string]interface{}{} - cChainGenesisMap["config"] = coreth_params.TestChainConfig + chainConfig := coreth_params.TestChainConfig + chainConfig.ChainID = coreth_params.AvalancheLocalChainID + cChainGenesisMap["config"] = chainConfig + cChainGenesisMap["timestamp"] = upgrade.InitiallyActiveTime.Unix() cChainGenesisMap["nonce"] = hexa0Str - cChainGenesisMap["timestamp"] = hexa0Str cChainGenesisMap["extraData"] = "0x00" cChainGenesisMap["gasLimit"] = "0x5f5e100" cChainGenesisMap["difficulty"] = hexa0Str From 131bcbf251505b899afb31384010008d9307ba8c Mon Sep 17 00:00:00 2001 From: Felipe Madero Date: Thu, 5 Sep 2024 09:50:42 -0300 Subject: [PATCH 3/8] lint --- local/node_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/local/node_test.go b/local/node_test.go index 5ee93342..64e4a28d 100644 --- a/local/node_test.go +++ b/local/node_test.go @@ -112,6 +112,7 @@ func verifyProtocol( []uint32{}, knownPeersFilter, knownPeersSalt, + false, ) if err != nil { errCh <- err From a1dc77f2cc1099ae433b24d1e80bbeee6034411b Mon Sep 17 00:00:00 2001 From: Felipe Madero Date: Thu, 5 Sep 2024 18:27:16 -0300 Subject: [PATCH 4/8] fix unit tests --- utils/genesis.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/genesis.go b/utils/genesis.go index 4db28943..6c0c82d3 100644 --- a/utils/genesis.go +++ b/utils/genesis.go @@ -27,7 +27,7 @@ const ( func generateCchainGenesis() ([]byte, error) { cChainGenesisMap := map[string]interface{}{} - chainConfig := coreth_params.TestChainConfig + chainConfig := *coreth_params.TestChainConfig chainConfig.ChainID = coreth_params.AvalancheLocalChainID cChainGenesisMap["config"] = chainConfig cChainGenesisMap["timestamp"] = upgrade.InitiallyActiveTime.Unix() From 3448a55ad211e063161a537f6b2d2922851d12a7 Mon Sep 17 00:00:00 2001 From: Felipe Madero Date: Thu, 5 Sep 2024 18:32:57 -0300 Subject: [PATCH 5/8] fix e2e --- scripts/tests.e2e.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/tests.e2e.sh b/scripts/tests.e2e.sh index 7bc1665e..87cbd7d2 100755 --- a/scripts/tests.e2e.sh +++ b/scripts/tests.e2e.sh @@ -13,11 +13,11 @@ fi ANR_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) # this avago and subnet-evm versions must have compatibility at rpc protocol level -DEFAULT_VERSION_1=v1.11.5 -DEFAULT_SUBNET_EVM_VERSION=v0.6.4 +DEFAULT_VERSION_1=v1.11.11 +DEFAULT_SUBNET_EVM_VERSION=v0.6.9 # used standalone, without interaction with subnet-evm, no compatibility needed -DEFAULT_VERSION_2=v1.11.4 +DEFAULT_VERSION_2=v1.11.11 if [ $# == 0 ]; then VERSION_1=$DEFAULT_VERSION_1 From 6bb17a0799f3be952f2d1a5cac88717454267d50 Mon Sep 17 00:00:00 2001 From: Felipe Madero Date: Thu, 5 Sep 2024 18:35:12 -0300 Subject: [PATCH 6/8] empty commit From 24b7ee13f5416612cb6a5736338c5c97a8756d89 Mon Sep 17 00:00:00 2001 From: Felipe Madero Date: Thu, 5 Sep 2024 19:04:01 -0300 Subject: [PATCH 7/8] e2e fix try 2 --- tests/e2e/e2e_test.go | 105 +----------------------------------------- 1 file changed, 2 insertions(+), 103 deletions(-) diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index 1041ac0b..f52eca7f 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -927,107 +927,6 @@ var _ = ginkgo.Describe("[Start/Remove/Restart/Add/Stop]", func() { }) }) - ginkgo.It("transform subnet to elastic subnets", func() { - var elasticSubnetID string - ginkgo.By("add 1 subnet", func() { - ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute) - resp, err := cli.CreateSubnets(ctx, []*rpcpb.SubnetSpec{{}}) - cancel() - gomega.Ω(err).Should(gomega.BeNil()) - gomega.Ω(len(resp.SubnetIds)).Should(gomega.Equal(1)) - gomega.Ω(len(resp.ClusterInfo.Subnets)).Should(gomega.Equal(5)) - createdSubnetID = resp.SubnetIds[0] - }) - ginkgo.By("check expected non elastic status", func() { - ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) - status, err := cli.Status(ctx) - cancel() - gomega.Ω(err).Should(gomega.BeNil()) - subnetInfo := status.ClusterInfo.Subnets[createdSubnetID] - gomega.Ω(subnetInfo.IsElastic).Should(gomega.Equal(false)) - gomega.Ω(subnetInfo.ElasticSubnetId).Should(gomega.Equal(ids.Empty.String())) - }) - ginkgo.By("transform 1 subnet to elastic subnet", func() { - ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute) - defer cancel() - testElasticSubnetConfig.SubnetId = createdSubnetID - response, err := cli.TransformElasticSubnets(ctx, []*rpcpb.ElasticSubnetSpec{&testElasticSubnetConfig}) - gomega.Ω(err).Should(gomega.BeNil()) - gomega.Ω(len(response.TxIds)).Should(gomega.Equal(1)) - gomega.Ω(len(response.AssetIds)).Should(gomega.Equal(1)) - elasticAssetID = response.AssetIds[0] - }) - ginkgo.By("check expected elastic status", func() { - ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) - status, err := cli.Status(ctx) - cancel() - gomega.Ω(err).Should(gomega.BeNil()) - subnetInfo := status.ClusterInfo.Subnets[createdSubnetID] - gomega.Ω(subnetInfo.IsElastic).Should(gomega.Equal(true)) - gomega.Ω(subnetInfo.ElasticSubnetId).ShouldNot(gomega.Equal(ids.Empty.String())) - elasticSubnetID = subnetInfo.ElasticSubnetId - }) - ginkgo.By("transforming a subnet with same subnetID to elastic subnet will fail", func() { - ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute) - defer cancel() - testElasticSubnetConfig.SubnetId = createdSubnetID - _, err := cli.TransformElasticSubnets(ctx, []*rpcpb.ElasticSubnetSpec{&testElasticSubnetConfig}) - gomega.Ω(err).Should(gomega.HaveOccurred()) - }) - ginkgo.By("save snapshot with elastic info", func() { - ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) - _, err := cli.SaveSnapshot(ctx, "elastic_snapshot", false) - cancel() - gomega.Ω(err).Should(gomega.BeNil()) - }) - ginkgo.By("load snapshot with elastic info", func() { - ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute) - _, err := cli.LoadSnapshot(ctx, "elastic_snapshot", false) - cancel() - gomega.Ω(err).Should(gomega.BeNil()) - }) - ginkgo.By("check expected elastic status", func() { - ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) - status, err := cli.Status(ctx) - cancel() - gomega.Ω(err).Should(gomega.BeNil()) - subnetInfo := status.ClusterInfo.Subnets[createdSubnetID] - gomega.Ω(subnetInfo.IsElastic).Should(gomega.Equal(true)) - gomega.Ω(subnetInfo.ElasticSubnetId).Should(gomega.Equal(elasticSubnetID)) - }) - ginkgo.By("remove snapshot with elastic info", func() { - ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) - _, err := cli.RemoveSnapshot(ctx, "elastic_snapshot") - cancel() - gomega.Ω(err).Should(gomega.BeNil()) - }) - }) - - ginkgo.It("add permissionless validator to elastic subnets", func() { - ginkgo.By("adding a permissionless validator to elastic subnet", func() { - ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute) - defer cancel() - testValidatorConfig.SubnetId = createdSubnetID - testValidatorConfig.AssetId = elasticAssetID - testValidatorConfig.NodeName = delegateeNode - _, err := cli.AddPermissionlessValidator(ctx, []*rpcpb.PermissionlessStakerSpec{&testValidatorConfig}) - gomega.Ω(err).Should(gomega.BeNil()) - }) - }) - - ginkgo.It("add permissionless delegator to elastic subnets", func() { - ginkgo.By("adding a permissionless delegator to permissionless validator", func() { - ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute) - defer cancel() - testValidatorConfig.SubnetId = createdSubnetID - testValidatorConfig.AssetId = elasticAssetID - testValidatorConfig.NodeName = delegateeNode - testValidatorConfig.StakedTokenAmount = 35 - _, err := cli.AddPermissionlessDelegator(ctx, []*rpcpb.PermissionlessStakerSpec{&testValidatorConfig}) - gomega.Ω(err).Should(gomega.BeNil()) - }) - }) - ginkgo.It("snapshots + blockchain creation", func() { var originalUris []string var originalSubnets []string @@ -1037,7 +936,7 @@ var _ = ginkgo.Describe("[Start/Remove/Restart/Add/Stop]", func() { originalUris, err = cli.URIs(ctx) cancel() gomega.Ω(err).Should(gomega.BeNil()) - gomega.Ω(len(originalUris)).Should(gomega.Equal(8)) + gomega.Ω(len(originalUris)).Should(gomega.Equal(7)) }) ginkgo.By("get original subnets", func() { ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) @@ -1045,7 +944,7 @@ var _ = ginkgo.Describe("[Start/Remove/Restart/Add/Stop]", func() { cancel() gomega.Ω(err).Should(gomega.BeNil()) numSubnets := len(status.ClusterInfo.Subnets) - gomega.Ω(numSubnets).Should(gomega.Equal(5)) + gomega.Ω(numSubnets).Should(gomega.Equal(4)) originalSubnets = maps.Keys(status.ClusterInfo.Subnets) }) ginkgo.By("check there are no snapshots", func() { From 34b19d1b7e75cd8f170c50d0f6d41337df9e09d9 Mon Sep 17 00:00:00 2001 From: Felipe Madero Date: Thu, 5 Sep 2024 19:19:38 -0300 Subject: [PATCH 8/8] lint --- tests/e2e/e2e_test.go | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index f52eca7f..f12bfea4 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -58,8 +58,6 @@ var ( newNode2NodeID = "" pausedNodeURI = "" pausedNodeName = "node1" - createdSubnetID = "" - elasticAssetID = "" newSubnetID = "" customNodeConfigs = map[string]string{ "node1": `{"api-admin-enabled":true}`, @@ -73,36 +71,12 @@ var ( numNodes = uint32(5) subnetParticipants = []string{"node1", "node2", "node3"} newParticipantNode = "new_participant_node" - delegateeNode = "permissionlessNode" subnetParticipants2 = []string{"node1", "node2", newParticipantNode} existingNodes = []string{"node1", "node2", "node3", "node4", "node5"} disjointNewSubnetParticipants = [][]string{ {"n0", "n1", "n2", "n3", "n4"}, {"n5", "n6", "n7", "n8", "n9"}, } - testElasticSubnetConfig = rpcpb.ElasticSubnetSpec{ - SubnetId: "", - AssetName: "BLIZZARD", - AssetSymbol: "BRRR", - InitialSupply: 240000000, - MaxSupply: 720000000, - MinConsumptionRate: 100000, - MaxConsumptionRate: 120000, - MinValidatorStake: 2000, - MaxValidatorStake: 3000000, - MinStakeDuration: 14 * 24, - MaxStakeDuration: 365 * 24, - MinDelegationFee: 20000, - MinDelegatorStake: 25, - MaxValidatorWeightFactor: 5, - UptimeRequirement: 0.8 * 1_000_000, - } - - testValidatorConfig = rpcpb.PermissionlessStakerSpec{ - StakedTokenAmount: 2000, - StartTime: time.Now().Add(1 * time.Hour).UTC().Format(server.TimeParseLayout), - StakeDuration: 336, - } ) func init() {