From 309bd0762a99f6d87220b352c7a9bf5331dab9e7 Mon Sep 17 00:00:00 2001 From: Felipe Madero Date: Tue, 30 Jul 2024 13:18:32 -0300 Subject: [PATCH 1/3] bump to avago that uses getSubnet API calls in wallet --- go.mod | 8 ++++---- go.sum | 12 ++++++------ local/blockchain.go | 33 +++++++++++++++++---------------- 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/go.mod b/go.mod index 74cf6903..b489bbeb 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,12 @@ module github.com/ava-labs/avalanche-network-runner -go 1.21.11 +go 1.21.12 toolchain go1.22.3 require ( - github.com/ava-labs/avalanchego v1.11.8 - github.com/ava-labs/coreth v0.13.5-rc.0 + github.com/ava-labs/avalanchego v1.11.11-0.20240730161032-ba377e9c75d9 + github.com/ava-labs/coreth v0.13.7 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 @@ -23,7 +23,7 @@ require ( golang.org/x/sync v0.6.0 google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 google.golang.org/grpc v1.64.0 - google.golang.org/protobuf v1.33.0 + google.golang.org/protobuf v1.34.2 ) require ( diff --git a/go.sum b/go.sum index a4b4825e..d30e14eb 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.8 h1:Q/der5bC/q3BQbIqxT7nNC0F30c+6X1G/eQzzMQ2CLk= -github.com/ava-labs/avalanchego v1.11.8/go.mod h1:aPYTETkM0KjtC7vFwPO6S8z2L0QTKaXjVUi98pTdNO4= -github.com/ava-labs/coreth v0.13.5-rc.0 h1:PJQbR9o2RrW3j9ba4r1glXnmM2PNAP3xR569+gMcBd0= -github.com/ava-labs/coreth v0.13.5-rc.0/go.mod h1:cm5c12xo5NiTgtbmeduv8i2nYdzgkczz9Wm3yiwwTRU= +github.com/ava-labs/avalanchego v1.11.11-0.20240730161032-ba377e9c75d9 h1:Lr04/CLN79xUrgpjuiBZ3gzZZbTvR7YwbLUiiVC7R08= +github.com/ava-labs/avalanchego v1.11.11-0.20240730161032-ba377e9c75d9/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/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= @@ -997,8 +997,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/local/blockchain.go b/local/blockchain.go index cc806fab..373e7d82 100644 --- a/local/blockchain.go +++ b/local/blockchain.go @@ -35,6 +35,7 @@ import ( "github.com/ava-labs/avalanchego/utils/logging" "github.com/ava-labs/avalanchego/utils/set" "github.com/ava-labs/avalanchego/vms/platformvm" + "github.com/ava-labs/avalanchego/vms/platformvm/fx" "github.com/ava-labs/avalanchego/vms/platformvm/signer" "github.com/ava-labs/avalanchego/vms/platformvm/txs" "github.com/ava-labs/avalanchego/vms/secp256k1fx" @@ -267,7 +268,7 @@ func (ln *localNetwork) installCustomChains( platformCli := platformvm.NewClient(clientURI) // wallet needs txs for all previously created subnets - var preloadTXs []ids.ID + var alreadyCreatedSubnetIDs []ids.ID for _, chainSpec := range chainSpecs { // if subnet id for the blockchain is specified, we need to add the subnet id // tx info to the wallet so blockchain creation does not fail @@ -278,11 +279,11 @@ func (ln *localNetwork) installCustomChains( if err != nil { return nil, err } - preloadTXs = append(preloadTXs, subnetID) + alreadyCreatedSubnetIDs = append(alreadyCreatedSubnetIDs, subnetID) } } - w, err := newWallet(ctx, clientURI, preloadTXs) + w, err := newWallet(ctx, clientURI, alreadyCreatedSubnetIDs) if err != nil { return nil, err } @@ -826,7 +827,7 @@ type wallet struct { func newWallet( ctx context.Context, uri string, - preloadTXs []ids.ID, + subnetIDs []ids.ID, ) (*wallet, error) { kc := secp256k1fx.NewKeychain(genesis.EWOQKey) primaryAVAXState, err := primary.FetchState(ctx, uri, kc.Addresses()) @@ -835,24 +836,24 @@ func newWallet( } pCTX, xCTX, utxos := primaryAVAXState.PCTX, primaryAVAXState.XCTX, primaryAVAXState.UTXOs pClient := platformvm.NewClient(uri) - pTXs := make(map[ids.ID]*txs.Tx) - for _, id := range preloadTXs { - txBytes, err := pClient.GetTx(ctx, id) - if err != nil { - return nil, err - } - tx, err := txs.Parse(txs.Codec, txBytes) + subnetOwners := map[ids.ID]fx.Owner{} + for _, subnetID := range subnetIDs { + subnetInfo, err := pClient.GetSubnet(ctx, subnetID) if err != nil { return nil, err } - pTXs[id] = tx + owner := secp256k1fx.OutputOwners{} + owner.Locktime = subnetInfo.Locktime + owner.Threshold = subnetInfo.Threshold + owner.Addrs = subnetInfo.ControlKeys + subnetOwners[subnetID] = &owner } pUTXOs := common.NewChainUTXOs(constants.PlatformChainID, utxos) xUTXOs := common.NewChainUTXOs(xCTX.BlockchainID, utxos) var w wallet w.addr = genesis.EWOQKey.PublicKey().Address() w.pCTX = pCTX - w.pBackend = p.NewBackend(pCTX, pUTXOs, pTXs) + w.pBackend = p.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) @@ -1020,15 +1021,15 @@ func (ln *localNetwork) removeSubnetValidators( } platformCli := platformvm.NewClient(clientURI) // wallet needs txs for all previously created subnets - preloadTXs := make([]ids.ID, len(removeSubnetSpecs)) + subnetIDs := make([]ids.ID, len(removeSubnetSpecs)) for i, removeSubnetSpec := range removeSubnetSpecs { subnetID, err := ids.FromString(removeSubnetSpec.SubnetID) if err != nil { return err } - preloadTXs[i] = subnetID + subnetIDs[i] = subnetID } - w, err := newWallet(ctx, clientURI, preloadTXs) + w, err := newWallet(ctx, clientURI, subnetIDs) if err != nil { return err } From 90421d314622af4447bef112d9305a110ef42478 Mon Sep 17 00:00:00 2001 From: Felipe Madero Date: Fri, 9 Aug 2024 12:57:47 -0300 Subject: [PATCH 2/3] avago bump to latest --- .golangci.yml | 1 - go.mod | 4 ++-- go.sum | 8 ++++---- local/node.go | 3 ++- local/node_test.go | 3 ++- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 4da34fb1..8433e423 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -95,7 +95,6 @@ linters-settings: - name: useless-break disabled: false staticcheck: - go: '~1.21.7' # https://staticcheck.io/docs/options#checks checks: - "all" diff --git a/go.mod b/go.mod index b489bbeb..b5ec2c83 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.20240730161032-ba377e9c75d9 - github.com/ava-labs/coreth v0.13.7 + github.com/ava-labs/avalanchego v1.11.11-0.20240809151225-4e5bb870c134 + github.com/ava-labs/coreth v0.13.8-0.20240802110637-b3e5088d062d 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 d30e14eb..3eb2675e 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.20240730161032-ba377e9c75d9 h1:Lr04/CLN79xUrgpjuiBZ3gzZZbTvR7YwbLUiiVC7R08= -github.com/ava-labs/avalanchego v1.11.11-0.20240730161032-ba377e9c75d9/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.20240809151225-4e5bb870c134 h1:FKy6/N7FjgEqiVK9GiviPG29ug2Ic2LH/uB5ug7MzJY= +github.com/ava-labs/avalanchego v1.11.11-0.20240809151225-4e5bb870c134/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/local/node.go b/local/node.go index de8485b4..5502ea2d 100644 --- a/local/node.go +++ b/local/node.go @@ -21,6 +21,7 @@ import ( "github.com/ava-labs/avalanchego/snow/uptime" "github.com/ava-labs/avalanchego/snow/validators" "github.com/ava-labs/avalanchego/staking" + "github.com/ava-labs/avalanchego/upgrade" "github.com/ava-labs/avalanchego/utils" "github.com/ava-labs/avalanchego/utils/constants" "github.com/ava-labs/avalanchego/utils/crypto/bls" @@ -148,7 +149,7 @@ func (node *localNode) AttachPeer(ctx context.Context, router router.InboundHand InboundMsgThrottler: throttling.NewNoInboundThrottler(), Network: peer.TestNetwork, Router: router, - VersionCompatibility: version.GetCompatibility(node.networkID), + VersionCompatibility: version.GetCompatibility(upgrade.InitiallyActiveTime), MySubnets: set.Set[ids.ID]{}, Beacons: validators.NewManager(), NetworkID: node.networkID, diff --git a/local/node_test.go b/local/node_test.go index 7a66ec4e..5ee93342 100644 --- a/local/node_test.go +++ b/local/node_test.go @@ -17,6 +17,7 @@ import ( "github.com/ava-labs/avalanchego/message" "github.com/ava-labs/avalanchego/network/peer" "github.com/ava-labs/avalanchego/staking" + "github.com/ava-labs/avalanchego/upgrade" "github.com/ava-labs/avalanchego/utils/constants" "github.com/ava-labs/avalanchego/utils/crypto/bls" "github.com/ava-labs/avalanchego/utils/ips" @@ -93,7 +94,7 @@ func verifyProtocol( knownPeersFilter, knownPeersSalt := peer.TestNetwork.KnownPeers() - myVersion := version.GetCompatibility(constants.MainnetID).Version() + myVersion := version.GetCompatibility(upgrade.InitiallyActiveTime).Version() verMsg, err := mc.Handshake( constants.MainnetID, From 03d6cb76b53f4c6b526edac4760e51b77c98a0b6 Mon Sep 17 00:00:00 2001 From: Felipe Madero Date: Wed, 14 Aug 2024 07:21:25 -0300 Subject: [PATCH 3/3] use avalanchego master --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index b5ec2c83..b565fb3c 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.20240809151225-4e5bb870c134 - github.com/ava-labs/coreth v0.13.8-0.20240802110637-b3e5088d062d + 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/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 3eb2675e..5c3ac47c 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.20240809151225-4e5bb870c134 h1:FKy6/N7FjgEqiVK9GiviPG29ug2Ic2LH/uB5ug7MzJY= -github.com/ava-labs/avalanchego v1.11.11-0.20240809151225-4e5bb870c134/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/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/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=