From 651ee9030da11d4e25f6983c12860101f622fc56 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Thu, 7 Nov 2024 14:04:41 -0600 Subject: [PATCH 01/34] basic teleporter test passing --- go.mod | 6 +- go.sum | 12 +- tests/network/network.go | 127 ++++++++++++----- .../teleporter/teleporter_suite_test.go | 134 +++++++++++++++++- tests/utils/validator_manager.go | 2 + 5 files changed, 233 insertions(+), 48 deletions(-) diff --git a/go.mod b/go.mod index 4bdcc240e..58eb982f6 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/ava-labs/teleporter go 1.22.8 require ( - github.com/ava-labs/avalanchego v1.12.0-initial-poc.5 + github.com/ava-labs/avalanchego v1.12.0-initial-poc.6 github.com/supranational/blst v0.3.11 // indirect ) @@ -104,7 +104,7 @@ require ( github.com/prometheus/common v0.55.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rivo/uniseg v0.2.0 // indirect - github.com/rogpeppe/go-internal v1.10.0 // indirect + github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/rs/cors v1.7.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect @@ -143,7 +143,7 @@ require ( golang.org/x/time v0.3.0 // indirect gonum.org/v1/gonum v0.11.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect google.golang.org/grpc v1.67.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect diff --git a/go.sum b/go.sum index 01e9f7052..f8f83a7bb 100644 --- a/go.sum +++ b/go.sum @@ -56,8 +56,8 @@ 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.12.0-initial-poc.5 h1:gW4xAqZNvkA4gP8M9yDyd7YUzuwfQbbCR+hgd1ztOto= -github.com/ava-labs/avalanchego v1.12.0-initial-poc.5/go.mod h1:qSHmog3wMVjo/ruIAQo0ppXAilyni07NIu5K88RyhWE= +github.com/ava-labs/avalanchego v1.12.0-initial-poc.6 h1:7Ijm0POq/NGX6jQG08BlOPfuHi9JYtDy4HylNAjel2A= +github.com/ava-labs/avalanchego v1.12.0-initial-poc.6/go.mod h1:gYlTU42Q4b29hzhUN22yclym5qwB3Si0jh4+LTn7DZM= github.com/ava-labs/awm-relayer v1.4.1-0.20241010161724-2db445c994d6 h1:WdFWoZ8clWfTPp3cKyWYTsveMKW/0SQzWk8U1aCcdnw= github.com/ava-labs/awm-relayer v1.4.1-0.20241010161724-2db445c994d6/go.mod h1:6eqh3V1Og40gXmZUOP6tCrlmMEcVuj9l737yYh1s8uw= github.com/ava-labs/coreth v0.13.8 h1:f14X3KgwHl9LwzfxlN6S4bbn5VA2rhEsNnHaRLSTo/8= @@ -498,8 +498,8 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= @@ -969,8 +969,8 @@ google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 h1:wKguEg1hsxI2/L3hUYrpo1RVi48K+uTyzKqprwLXsb8= google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= diff --git a/tests/network/network.go b/tests/network/network.go index 2580260f3..0a8851c6a 100644 --- a/tests/network/network.go +++ b/tests/network/network.go @@ -12,6 +12,7 @@ import ( "github.com/ava-labs/avalanchego/api/info" "github.com/ava-labs/avalanchego/config" + "github.com/ava-labs/avalanchego/genesis" "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/tests/fixture/tmpnet" "github.com/ava-labs/avalanchego/upgrade" @@ -37,8 +38,7 @@ type LocalNetwork struct { extraNodes []*tmpnet.Node // to add as more subnet validators in the tests primaryNetworkValidators []ids.NodeID - globalFundedKey *ecdsa.PrivateKey - pChainWallet pwallet.Wallet + globalFundedKey *secp256k1.PrivateKey } const ( @@ -69,8 +69,8 @@ func NewLocalNetwork( // Create extra nodes to be used to add more validators later extraNodes := subnetEvmTestUtils.NewTmpnetNodes(extraNodeCount) - var allNodes []*tmpnet.Node - allNodes = append(allNodes, extraNodes...) // to be appended w/ subnet validators + // var allNodes []*tmpnet.Node + // allNodes = append(allNodes, extraNodes...) // to be appended w/ subnet validators fundedKey, err := hex.DecodeString(fundedKeyStr) Expect(err).Should(BeNil()) @@ -81,9 +81,17 @@ func NewLocalNetwork( Expect(err).Should(BeNil()) var subnets []*tmpnet.Subnet + var bootstrapNodes []*tmpnet.Node for _, subnetSpec := range subnetSpecs { - nodes := subnetEvmTestUtils.NewTmpnetNodes(subnetSpec.NodeCount) - allNodes = append(allNodes, nodes...) + // Create a single bootstrap node. This will be removed from the subnet validator set after it is converted, but will remain a primary network validator + boostrapNodes := subnetEvmTestUtils.NewTmpnetNodes(1) // One bootstrap node per subnet + // allNodes = append(allNodes, boostrapNodes...) + bootstrapNodes = append(bootstrapNodes, boostrapNodes...) + + // Create validators to specify as the initial vdr set in the subnet conversion, and store them as extra nodes + initialVdrNodes := subnetEvmTestUtils.NewTmpnetNodes(subnetSpec.NodeCount) + // allNodes = append(allNodes, initialVdrNodes...) + extraNodes = append(extraNodes, initialVdrNodes...) subnet := subnetEvmTestUtils.NewTmpnetSubnet( subnetSpec.Name, @@ -95,7 +103,7 @@ func NewLocalNetwork( subnetSpec.TeleporterDeployerAddress, ), utils.WarpEnabledChainConfig, - nodes..., + bootstrapNodes..., ) subnet.OwningKey = globalFundedKey subnets = append(subnets, subnet) @@ -103,7 +111,7 @@ func NewLocalNetwork( network := subnetEvmTestUtils.NewTmpnetNetwork( name, - allNodes, + bootstrapNodes, utils.WarpEnabledChainConfig, subnets..., ) @@ -123,6 +131,18 @@ func NewLocalNetwork( avalancheGoBuildPath, ok := os.LookupEnv("AVALANCHEGO_BUILD_PATH") Expect(ok).Should(Equal(true)) + // Specify only a subset of the nodes to be bootstrapped + // TODO: clean this up + keysToFund := []*secp256k1.PrivateKey{ + genesis.VMRQKey, + genesis.EWOQKey, + tmpnet.HardhatKey, + } + keysToFund = append(keysToFund, network.PreFundedKeys...) + genesis, err := tmpnet.NewTestGenesis(88888, bootstrapNodes, keysToFund) + Expect(err).Should(BeNil()) + network.Genesis = genesis + ctx, cancelBootstrap := context.WithCancel(ctx) defer cancelBootstrap() err = tmpnet.BootstrapNewNetwork( @@ -149,29 +169,24 @@ func NewLocalNetwork( localNetwork := &LocalNetwork{ Network: *network, extraNodes: extraNodes, - globalFundedKey: globalFundedECDSAKey, + globalFundedKey: globalFundedKey, primaryNetworkValidators: primaryNetworkValidators, } - // Create the P-Chain wallet to issue transactions - kc := secp256k1fx.NewKeychain(globalFundedKey) - localNetwork.GetSubnetsInfo() - var subnetIDs []ids.ID - for _, subnet := range localNetwork.GetSubnetsInfo() { - subnetIDs = append(subnetIDs, subnet.SubnetID) - } - wallet, err := primary.MakeWallet(ctx, &primary.WalletConfig{ - URI: localNetwork.GetPrimaryNetworkInfo().NodeURIs[0], - AVAXKeychain: kc, - EthKeychain: kc, - SubnetIDs: subnetIDs, - }) - Expect(err).Should(BeNil()) - localNetwork.pChainWallet = wallet.P() - return localNetwork } +func (n *LocalNetwork) GetExtraNodes(count uint) []*tmpnet.Node { + Expect(count > 0).Should(BeTrue(), "can't add 0 validators") + Expect(uint(len(n.extraNodes)) >= count).Should( + BeTrue(), + "not enough extra nodes to use", + ) + nodes := n.extraNodes[0:count] + n.extraNodes = n.extraNodes[count:] + return nodes +} + func (n *LocalNetwork) GetPrimaryNetworkInfo() interfaces.SubnetTestInfo { var nodeURIs []string for _, nodeID := range n.primaryNetworkValidators { @@ -202,6 +217,37 @@ func (n *LocalNetwork) GetPrimaryNetworkInfo() interfaces.SubnetTestInfo { } } +func (n *LocalNetwork) GetSubnetInfo(subnetID ids.ID) interfaces.SubnetTestInfo { + for _, subnet := range n.Network.Subnets { + if subnet.SubnetID == subnetID { + var nodeURIs []string + for _, nodeID := range subnet.ValidatorIDs { + uri, err := n.Network.GetURIForNodeID(nodeID) + Expect(err).Should(BeNil()) + + nodeURIs = append(nodeURIs, uri) + } + blockchainID := subnet.Chains[0].ChainID + wsClient, err := ethclient.Dial(utils.HttpToWebsocketURI(nodeURIs[0], blockchainID.String())) + Expect(err).Should(BeNil()) + + rpcClient, err := ethclient.Dial(utils.HttpToRPCURI(nodeURIs[0], blockchainID.String())) + Expect(err).Should(BeNil()) + evmChainID, err := rpcClient.ChainID(context.Background()) + Expect(err).Should(BeNil()) + return interfaces.SubnetTestInfo{ + SubnetID: subnetID, + BlockchainID: blockchainID, + NodeURIs: nodeURIs, + WSClient: wsClient, + RPCClient: rpcClient, + EVMChainID: evmChainID, + } + } + } + return interfaces.SubnetTestInfo{} +} + // Returns all subnet info sorted in lexicographic order of SubnetName. func (n *LocalNetwork) GetSubnetsInfo() []interfaces.SubnetTestInfo { subnets := make([]interfaces.SubnetTestInfo, len(n.Network.Subnets)) @@ -240,8 +286,9 @@ func (n *LocalNetwork) GetAllSubnetsInfo() []interfaces.SubnetTestInfo { } func (n *LocalNetwork) GetFundedAccountInfo() (common.Address, *ecdsa.PrivateKey) { - fundedAddress := crypto.PubkeyToAddress(n.globalFundedKey.PublicKey) - return fundedAddress, n.globalFundedKey + ecdsaKey := n.globalFundedKey.ToECDSA() + fundedAddress := crypto.PubkeyToAddress(ecdsaKey.PublicKey) + return fundedAddress, ecdsaKey } func (n *LocalNetwork) TearDownNetwork() { @@ -252,21 +299,13 @@ func (n *LocalNetwork) TearDownNetwork() { } func (n *LocalNetwork) AddSubnetValidators(ctx context.Context, subnetID ids.ID, count uint) { - Expect(count > 0).Should(BeTrue(), "can't add 0 validators") - Expect(uint(len(n.extraNodes)) >= count).Should( - BeTrue(), - "not enough extra nodes to use", - ) - subnet := n.Network.Subnets[slices.IndexFunc( n.Network.Subnets, func(s *tmpnet.Subnet) bool { return s.SubnetID == subnetID }, )] // consume some of the extraNodes - var newValidatorNodes []*tmpnet.Node - newValidatorNodes = append(newValidatorNodes, n.extraNodes[0:count]...) - n.extraNodes = n.extraNodes[count:] + newValidatorNodes := n.GetExtraNodes(count) apiURI, err := n.Network.GetURIForNodeID(subnet.ValidatorIDs[0]) Expect(err).Should(BeNil()) @@ -379,7 +418,21 @@ func (n *LocalNetwork) Dir() string { } func (n *LocalNetwork) GetPChainWallet() pwallet.Wallet { - return n.pChainWallet + // Create the P-Chain wallet to issue transactions + kc := secp256k1fx.NewKeychain(n.globalFundedKey) + n.GetSubnetsInfo() + var subnetIDs []ids.ID + for _, subnet := range n.GetSubnetsInfo() { + subnetIDs = append(subnetIDs, subnet.SubnetID) + } + wallet, err := primary.MakeWallet(context.Background(), &primary.WalletConfig{ + URI: n.GetPrimaryNetworkInfo().NodeURIs[0], + AVAXKeychain: kc, + EthKeychain: kc, + SubnetIDs: subnetIDs, + }) + Expect(err).Should(BeNil()) + return wallet.P() } func (n *LocalNetwork) GetTwoSubnets() ( diff --git a/tests/suites/teleporter/teleporter_suite_test.go b/tests/suites/teleporter/teleporter_suite_test.go index 9c97c806e..069265493 100644 --- a/tests/suites/teleporter/teleporter_suite_test.go +++ b/tests/suites/teleporter/teleporter_suite_test.go @@ -5,10 +5,20 @@ package teleporter_test import ( "context" + goLog "log" "os" + "sort" "testing" "time" + "github.com/ava-labs/avalanchego/config" + "github.com/ava-labs/avalanchego/ids" + "github.com/ava-labs/avalanchego/utils/formatting/address" + "github.com/ava-labs/avalanchego/utils/units" + "github.com/ava-labs/avalanchego/vms/platformvm/txs" + warpMessage "github.com/ava-labs/avalanchego/vms/platformvm/warp/message" + "github.com/ava-labs/subnet-evm/accounts/abi/bind" + poavalidatormanager "github.com/ava-labs/teleporter/abi-bindings/go/validator-manager/PoAValidatorManager" teleporterFlows "github.com/ava-labs/teleporter/tests/flows/teleporter" registryFlows "github.com/ava-labs/teleporter/tests/flows/teleporter/registry" localnetwork "github.com/ava-labs/teleporter/tests/network" @@ -57,7 +67,7 @@ var _ = ginkgo.BeforeSuite(func() { Expect(err).Should(BeNil()) // Create the local network instance - ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), 120*2*time.Second) defer cancel() LocalNetworkInstance = localnetwork.NewLocalNetwork( @@ -88,7 +98,7 @@ var _ = ginkgo.BeforeSuite(func() { log.Info("Started local network") // Only need to deploy Teleporter on the C-Chain since it is included in the genesis of the subnet chains. - _, fundedKey := LocalNetworkInstance.GetFundedAccountInfo() + fundedAddress, fundedKey := LocalNetworkInstance.GetFundedAccountInfo() TeleporterInfo.DeployTeleporterMessenger( ctx, LocalNetworkInstance.GetPrimaryNetworkInfo(), @@ -104,6 +114,126 @@ var _ = ginkgo.BeforeSuite(func() { TeleporterInfo.DeployTeleporterRegistry(subnet, fundedKey) } + // Convert the subnets to be managed by a PoAValidatorManager + cChainInfo := LocalNetworkInstance.GetPrimaryNetworkInfo() + for _, subnet := range LocalNetworkInstance.GetSubnetsInfo() { + signatureAggregator := utils.NewSignatureAggregator( + cChainInfo.NodeURIs[0], + []ids.ID{ + subnet.SubnetID, + }, + ) + vdrManagerAddress, vdrManager := utils.DeployPoAValidatorManager( + ctx, + fundedKey, + subnet, + ) + opts, err := bind.NewKeyedTransactorWithChainID( + fundedKey, + subnet.EVMChainID, + ) + Expect(err).Should(BeNil()) + + tx, err := vdrManager.Initialize( + opts, + poavalidatormanager.ValidatorManagerSettings{ + SubnetID: subnet.SubnetID, + ChurnPeriodSeconds: uint64(0), + MaximumChurnPercentage: uint8(20), + }, + fundedAddress, + ) + Expect(err).Should(BeNil()) + utils.WaitForTransactionSuccess(context.Background(), subnet, tx.Hash()) + + tmpnetNodes := LocalNetworkInstance.GetExtraNodes(2) + sort.Slice(tmpnetNodes, func(i, j int) bool { + return string(tmpnetNodes[i].NodeID.Bytes()) < string(tmpnetNodes[j].NodeID.Bytes()) + }) + totalWeight := uint64(len(tmpnetNodes)-1) * units.Schmeckle + var nodes []utils.Node + // Construct the convert subnet info + destAddr, err := address.ParseToID(utils.DefaultPChainAddress) + Expect(err).Should(BeNil()) + vdrs := make([]*txs.ConvertSubnetValidator, len(tmpnetNodes)) + for i, node := range tmpnetNodes { + weight := units.Schmeckle + if i == len(tmpnetNodes)-1 { + weight = 4 * totalWeight + } + + signer, err := node.GetProofOfPossession() + Expect(err).Should(BeNil()) + nodes = append(nodes, utils.Node{ + NodeID: node.NodeID, + NodePoP: signer, + Weight: weight, + }) + vdrs[i] = &txs.ConvertSubnetValidator{ + NodeID: node.NodeID.Bytes(), + Weight: weight, + Balance: units.Avax * 100, + Signer: *signer, + RemainingBalanceOwner: warpMessage.PChainOwner{ + Threshold: 1, + Addresses: []ids.ShortID{destAddr}, + }, + DeactivationOwner: warpMessage.PChainOwner{ + Threshold: 1, + Addresses: []ids.ShortID{destAddr}, + }, + } + } + pChainWallet := LocalNetworkInstance.GetPChainWallet() + _, err = pChainWallet.IssueConvertSubnetTx( + subnet.SubnetID, + subnet.BlockchainID, + vdrManagerAddress[:], + vdrs, + ) + Expect(err).Should(BeNil()) + + // Modify the each node's config to track the subnet + for _, node := range tmpnetNodes { + existingTrackedSubnets, err := node.Flags.GetStringVal(config.TrackSubnetsKey) + Expect(err).Should(BeNil()) + if existingTrackedSubnets == subnet.SubnetID.String() { + goLog.Printf("Node %s @ %s already tracking subnet %s\n", node.NodeID, node.URI, subnet.SubnetID) + continue + } + node.Flags[config.TrackSubnetsKey] = subnet.SubnetID.String() + + // Add the node to the network + LocalNetworkInstance.Network.Nodes = append(LocalNetworkInstance.Network.Nodes, node) + } + LocalNetworkInstance.Network.StartNodes(context.Background(), os.Stdout, tmpnetNodes...) + + // Update the tmpnet Subnet struct + for _, tmpnetSubnet := range LocalNetworkInstance.Network.Subnets { + if tmpnetSubnet.SubnetID == subnet.SubnetID { + for _, tmpnetNode := range tmpnetNodes { + tmpnetSubnet.ValidatorIDs = append(tmpnetSubnet.ValidatorIDs, tmpnetNode.NodeID) + } + } + } + // Refresh the subnet info after restarting the nodes + subnet = LocalNetworkInstance.GetSubnetInfo(subnet.SubnetID) + + utils.PChainProposerVMWorkaround(pChainWallet) + utils.AdvanceProposerVM(ctx, subnet, fundedKey, 5) + + utils.InitializePoAValidatorSet( + ctx, + fundedKey, + subnet, + utils.GetPChainInfo(cChainInfo), + vdrManager, + vdrManagerAddress, + LocalNetworkInstance.GetNetworkID(), + signatureAggregator, + nodes, + ) + } log.Info("Set up ginkgo before suite") }) diff --git a/tests/utils/validator_manager.go b/tests/utils/validator_manager.go index 648488f8e..8f9789cab 100644 --- a/tests/utils/validator_manager.go +++ b/tests/utils/validator_manager.go @@ -437,6 +437,7 @@ func InitializePoAValidatorSet( signatureAggregator *aggregator.SignatureAggregator, nodes []Node, ) []ids.ID { + log.Println("Initializing PoA validator set") initialValidators := make([]warpMessage.SubnetConversionValidatorData, len(nodes)) initialValidatorsABI := make([]poavalidatormanager.InitialValidator, len(nodes)) for i, node := range nodes { @@ -2203,6 +2204,7 @@ func AdvanceProposerVM( fundedKey *ecdsa.PrivateKey, blocks int, ) { + log.Println("Advancing proposer VM") for i := 0; i < blocks; i++ { err := subnetEvmUtils.IssueTxsToActivateProposerVMFork( ctx, subnet.EVMChainID, fundedKey, subnet.WSClient, From 9a46f4f8711236662c1e4b7cfa84c503ee6060dd Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Thu, 7 Nov 2024 16:16:00 -0600 Subject: [PATCH 02/34] bind validator manager interfaces --- .../IPoSValidatorManager.go | 2190 +++++++++++++++++ .../IValidatorManager/IValidatorManager.go | 1228 +++++++++ scripts/abi_bindings.sh | 39 +- tests/flows/validator-manager/poa_to_pos.go | 1 - tests/network/network.go | 1 + .../teleporter/teleporter_suite_test.go | 4 +- tests/utils/validator_manager.go | 217 +- 7 files changed, 3458 insertions(+), 222 deletions(-) create mode 100644 abi-bindings/go/validator-manager/interfaces/IPoSValidatorManager/IPoSValidatorManager.go create mode 100644 abi-bindings/go/validator-manager/interfaces/IValidatorManager/IValidatorManager.go diff --git a/abi-bindings/go/validator-manager/interfaces/IPoSValidatorManager/IPoSValidatorManager.go b/abi-bindings/go/validator-manager/interfaces/IPoSValidatorManager/IPoSValidatorManager.go new file mode 100644 index 000000000..ee379a028 --- /dev/null +++ b/abi-bindings/go/validator-manager/interfaces/IPoSValidatorManager/IPoSValidatorManager.go @@ -0,0 +1,2190 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package iposvalidatormanager + +import ( + "errors" + "math/big" + "strings" + + "github.com/ava-labs/subnet-evm/accounts/abi" + "github.com/ava-labs/subnet-evm/accounts/abi/bind" + "github.com/ava-labs/subnet-evm/core/types" + "github.com/ava-labs/subnet-evm/interfaces" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = interfaces.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// ConversionData is an auto generated low-level Go binding around an user-defined struct. +type ConversionData struct { + SubnetID [32]byte + ValidatorManagerBlockchainID [32]byte + ValidatorManagerAddress common.Address + InitialValidators []InitialValidator +} + +// InitialValidator is an auto generated low-level Go binding around an user-defined struct. +type InitialValidator struct { + NodeID []byte + BlsPublicKey []byte + Weight uint64 +} + +// IPoSValidatorManagerMetaData contains all meta data concerning the IPoSValidatorManager contract. +var IPoSValidatorManagerMetaData = &bind.MetaData{ + ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rewards\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fees\",\"type\":\"uint256\"}],\"name\":\"DelegationEnded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegatorAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"nonce\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"validatorWeight\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"delegatorWeight\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"setWeightMessageID\",\"type\":\"bytes32\"}],\"name\":\"DelegatorAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startTime\",\"type\":\"uint256\"}],\"name\":\"DelegatorRegistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"}],\"name\":\"DelegatorRemovalInitialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes\",\"name\":\"nodeID\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"}],\"name\":\"InitialValidatorCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"uptime\",\"type\":\"uint64\"}],\"name\":\"UptimeUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes\",\"name\":\"nodeID\",\"type\":\"bytes\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"registerValidationMessageID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"registrationExpiry\",\"type\":\"uint64\"}],\"name\":\"ValidationPeriodCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"}],\"name\":\"ValidationPeriodEnded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"ValidationPeriodRegistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"setWeightMessageID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"endTime\",\"type\":\"uint256\"}],\"name\":\"ValidatorRemovalInitialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint64\",\"name\":\"nonce\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"validatorWeight\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"setWeightMessageID\",\"type\":\"bytes32\"}],\"name\":\"ValidatorWeightUpdate\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"}],\"name\":\"claimDelegationFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"completeDelegatorRegistration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"completeEndDelegation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"completeEndValidation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"completeValidatorRegistration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"includeUptimeProof\",\"type\":\"bool\"},{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"forceInitializeEndDelegation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"includeUptimeProof\",\"type\":\"bool\"},{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"forceInitializeEndValidation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"includeUptimeProof\",\"type\":\"bool\"},{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"initializeEndDelegation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"includeUptimeProof\",\"type\":\"bool\"},{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"initializeEndValidation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"subnetID\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"validatorManagerBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"validatorManagerAddress\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"bytes\",\"name\":\"nodeID\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"blsPublicKey\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"weight\",\"type\":\"uint64\"}],\"internalType\":\"structInitialValidator[]\",\"name\":\"initialValidators\",\"type\":\"tuple[]\"}],\"internalType\":\"structConversionData\",\"name\":\"conversionData\",\"type\":\"tuple\"},{\"internalType\":\"uint32\",\"name\":\"messsageIndex\",\"type\":\"uint32\"}],\"name\":\"initializeValidatorSet\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"}],\"name\":\"resendEndValidatorMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"}],\"name\":\"resendRegisterValidatorMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"}],\"name\":\"resendUpdateDelegation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"submitUptimeProof\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", +} + +// IPoSValidatorManagerABI is the input ABI used to generate the binding from. +// Deprecated: Use IPoSValidatorManagerMetaData.ABI instead. +var IPoSValidatorManagerABI = IPoSValidatorManagerMetaData.ABI + +// IPoSValidatorManager is an auto generated Go binding around an Ethereum contract. +type IPoSValidatorManager struct { + IPoSValidatorManagerCaller // Read-only binding to the contract + IPoSValidatorManagerTransactor // Write-only binding to the contract + IPoSValidatorManagerFilterer // Log filterer for contract events +} + +// IPoSValidatorManagerCaller is an auto generated read-only Go binding around an Ethereum contract. +type IPoSValidatorManagerCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IPoSValidatorManagerTransactor is an auto generated write-only Go binding around an Ethereum contract. +type IPoSValidatorManagerTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IPoSValidatorManagerFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type IPoSValidatorManagerFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IPoSValidatorManagerSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type IPoSValidatorManagerSession struct { + Contract *IPoSValidatorManager // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// IPoSValidatorManagerCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type IPoSValidatorManagerCallerSession struct { + Contract *IPoSValidatorManagerCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// IPoSValidatorManagerTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type IPoSValidatorManagerTransactorSession struct { + Contract *IPoSValidatorManagerTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// IPoSValidatorManagerRaw is an auto generated low-level Go binding around an Ethereum contract. +type IPoSValidatorManagerRaw struct { + Contract *IPoSValidatorManager // Generic contract binding to access the raw methods on +} + +// IPoSValidatorManagerCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type IPoSValidatorManagerCallerRaw struct { + Contract *IPoSValidatorManagerCaller // Generic read-only contract binding to access the raw methods on +} + +// IPoSValidatorManagerTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type IPoSValidatorManagerTransactorRaw struct { + Contract *IPoSValidatorManagerTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewIPoSValidatorManager creates a new instance of IPoSValidatorManager, bound to a specific deployed contract. +func NewIPoSValidatorManager(address common.Address, backend bind.ContractBackend) (*IPoSValidatorManager, error) { + contract, err := bindIPoSValidatorManager(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &IPoSValidatorManager{IPoSValidatorManagerCaller: IPoSValidatorManagerCaller{contract: contract}, IPoSValidatorManagerTransactor: IPoSValidatorManagerTransactor{contract: contract}, IPoSValidatorManagerFilterer: IPoSValidatorManagerFilterer{contract: contract}}, nil +} + +// NewIPoSValidatorManagerCaller creates a new read-only instance of IPoSValidatorManager, bound to a specific deployed contract. +func NewIPoSValidatorManagerCaller(address common.Address, caller bind.ContractCaller) (*IPoSValidatorManagerCaller, error) { + contract, err := bindIPoSValidatorManager(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &IPoSValidatorManagerCaller{contract: contract}, nil +} + +// NewIPoSValidatorManagerTransactor creates a new write-only instance of IPoSValidatorManager, bound to a specific deployed contract. +func NewIPoSValidatorManagerTransactor(address common.Address, transactor bind.ContractTransactor) (*IPoSValidatorManagerTransactor, error) { + contract, err := bindIPoSValidatorManager(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &IPoSValidatorManagerTransactor{contract: contract}, nil +} + +// NewIPoSValidatorManagerFilterer creates a new log filterer instance of IPoSValidatorManager, bound to a specific deployed contract. +func NewIPoSValidatorManagerFilterer(address common.Address, filterer bind.ContractFilterer) (*IPoSValidatorManagerFilterer, error) { + contract, err := bindIPoSValidatorManager(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &IPoSValidatorManagerFilterer{contract: contract}, nil +} + +// bindIPoSValidatorManager binds a generic wrapper to an already deployed contract. +func bindIPoSValidatorManager(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := IPoSValidatorManagerMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_IPoSValidatorManager *IPoSValidatorManagerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _IPoSValidatorManager.Contract.IPoSValidatorManagerCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_IPoSValidatorManager *IPoSValidatorManagerRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.IPoSValidatorManagerTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_IPoSValidatorManager *IPoSValidatorManagerRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.IPoSValidatorManagerTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_IPoSValidatorManager *IPoSValidatorManagerCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _IPoSValidatorManager.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_IPoSValidatorManager *IPoSValidatorManagerTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_IPoSValidatorManager *IPoSValidatorManagerTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.contract.Transact(opts, method, params...) +} + +// ClaimDelegationFees is a paid mutator transaction binding the contract method 0x93e24598. +// +// Solidity: function claimDelegationFees(bytes32 validationID) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerTransactor) ClaimDelegationFees(opts *bind.TransactOpts, validationID [32]byte) (*types.Transaction, error) { + return _IPoSValidatorManager.contract.Transact(opts, "claimDelegationFees", validationID) +} + +// ClaimDelegationFees is a paid mutator transaction binding the contract method 0x93e24598. +// +// Solidity: function claimDelegationFees(bytes32 validationID) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerSession) ClaimDelegationFees(validationID [32]byte) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.ClaimDelegationFees(&_IPoSValidatorManager.TransactOpts, validationID) +} + +// ClaimDelegationFees is a paid mutator transaction binding the contract method 0x93e24598. +// +// Solidity: function claimDelegationFees(bytes32 validationID) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerTransactorSession) ClaimDelegationFees(validationID [32]byte) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.ClaimDelegationFees(&_IPoSValidatorManager.TransactOpts, validationID) +} + +// CompleteDelegatorRegistration is a paid mutator transaction binding the contract method 0x60ad7784. +// +// Solidity: function completeDelegatorRegistration(bytes32 delegationID, uint32 messageIndex) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerTransactor) CompleteDelegatorRegistration(opts *bind.TransactOpts, delegationID [32]byte, messageIndex uint32) (*types.Transaction, error) { + return _IPoSValidatorManager.contract.Transact(opts, "completeDelegatorRegistration", delegationID, messageIndex) +} + +// CompleteDelegatorRegistration is a paid mutator transaction binding the contract method 0x60ad7784. +// +// Solidity: function completeDelegatorRegistration(bytes32 delegationID, uint32 messageIndex) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerSession) CompleteDelegatorRegistration(delegationID [32]byte, messageIndex uint32) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.CompleteDelegatorRegistration(&_IPoSValidatorManager.TransactOpts, delegationID, messageIndex) +} + +// CompleteDelegatorRegistration is a paid mutator transaction binding the contract method 0x60ad7784. +// +// Solidity: function completeDelegatorRegistration(bytes32 delegationID, uint32 messageIndex) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerTransactorSession) CompleteDelegatorRegistration(delegationID [32]byte, messageIndex uint32) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.CompleteDelegatorRegistration(&_IPoSValidatorManager.TransactOpts, delegationID, messageIndex) +} + +// CompleteEndDelegation is a paid mutator transaction binding the contract method 0x80dd672f. +// +// Solidity: function completeEndDelegation(bytes32 delegationID, uint32 messageIndex) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerTransactor) CompleteEndDelegation(opts *bind.TransactOpts, delegationID [32]byte, messageIndex uint32) (*types.Transaction, error) { + return _IPoSValidatorManager.contract.Transact(opts, "completeEndDelegation", delegationID, messageIndex) +} + +// CompleteEndDelegation is a paid mutator transaction binding the contract method 0x80dd672f. +// +// Solidity: function completeEndDelegation(bytes32 delegationID, uint32 messageIndex) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerSession) CompleteEndDelegation(delegationID [32]byte, messageIndex uint32) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.CompleteEndDelegation(&_IPoSValidatorManager.TransactOpts, delegationID, messageIndex) +} + +// CompleteEndDelegation is a paid mutator transaction binding the contract method 0x80dd672f. +// +// Solidity: function completeEndDelegation(bytes32 delegationID, uint32 messageIndex) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerTransactorSession) CompleteEndDelegation(delegationID [32]byte, messageIndex uint32) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.CompleteEndDelegation(&_IPoSValidatorManager.TransactOpts, delegationID, messageIndex) +} + +// CompleteEndValidation is a paid mutator transaction binding the contract method 0x467ef06f. +// +// Solidity: function completeEndValidation(uint32 messageIndex) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerTransactor) CompleteEndValidation(opts *bind.TransactOpts, messageIndex uint32) (*types.Transaction, error) { + return _IPoSValidatorManager.contract.Transact(opts, "completeEndValidation", messageIndex) +} + +// CompleteEndValidation is a paid mutator transaction binding the contract method 0x467ef06f. +// +// Solidity: function completeEndValidation(uint32 messageIndex) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerSession) CompleteEndValidation(messageIndex uint32) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.CompleteEndValidation(&_IPoSValidatorManager.TransactOpts, messageIndex) +} + +// CompleteEndValidation is a paid mutator transaction binding the contract method 0x467ef06f. +// +// Solidity: function completeEndValidation(uint32 messageIndex) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerTransactorSession) CompleteEndValidation(messageIndex uint32) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.CompleteEndValidation(&_IPoSValidatorManager.TransactOpts, messageIndex) +} + +// CompleteValidatorRegistration is a paid mutator transaction binding the contract method 0xa3a65e48. +// +// Solidity: function completeValidatorRegistration(uint32 messageIndex) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerTransactor) CompleteValidatorRegistration(opts *bind.TransactOpts, messageIndex uint32) (*types.Transaction, error) { + return _IPoSValidatorManager.contract.Transact(opts, "completeValidatorRegistration", messageIndex) +} + +// CompleteValidatorRegistration is a paid mutator transaction binding the contract method 0xa3a65e48. +// +// Solidity: function completeValidatorRegistration(uint32 messageIndex) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerSession) CompleteValidatorRegistration(messageIndex uint32) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.CompleteValidatorRegistration(&_IPoSValidatorManager.TransactOpts, messageIndex) +} + +// CompleteValidatorRegistration is a paid mutator transaction binding the contract method 0xa3a65e48. +// +// Solidity: function completeValidatorRegistration(uint32 messageIndex) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerTransactorSession) CompleteValidatorRegistration(messageIndex uint32) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.CompleteValidatorRegistration(&_IPoSValidatorManager.TransactOpts, messageIndex) +} + +// ForceInitializeEndDelegation is a paid mutator transaction binding the contract method 0x1ec44724. +// +// Solidity: function forceInitializeEndDelegation(bytes32 delegationID, bool includeUptimeProof, uint32 messageIndex) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerTransactor) ForceInitializeEndDelegation(opts *bind.TransactOpts, delegationID [32]byte, includeUptimeProof bool, messageIndex uint32) (*types.Transaction, error) { + return _IPoSValidatorManager.contract.Transact(opts, "forceInitializeEndDelegation", delegationID, includeUptimeProof, messageIndex) +} + +// ForceInitializeEndDelegation is a paid mutator transaction binding the contract method 0x1ec44724. +// +// Solidity: function forceInitializeEndDelegation(bytes32 delegationID, bool includeUptimeProof, uint32 messageIndex) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerSession) ForceInitializeEndDelegation(delegationID [32]byte, includeUptimeProof bool, messageIndex uint32) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.ForceInitializeEndDelegation(&_IPoSValidatorManager.TransactOpts, delegationID, includeUptimeProof, messageIndex) +} + +// ForceInitializeEndDelegation is a paid mutator transaction binding the contract method 0x1ec44724. +// +// Solidity: function forceInitializeEndDelegation(bytes32 delegationID, bool includeUptimeProof, uint32 messageIndex) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerTransactorSession) ForceInitializeEndDelegation(delegationID [32]byte, includeUptimeProof bool, messageIndex uint32) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.ForceInitializeEndDelegation(&_IPoSValidatorManager.TransactOpts, delegationID, includeUptimeProof, messageIndex) +} + +// ForceInitializeEndValidation is a paid mutator transaction binding the contract method 0x3a1cfff6. +// +// Solidity: function forceInitializeEndValidation(bytes32 validationID, bool includeUptimeProof, uint32 messageIndex) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerTransactor) ForceInitializeEndValidation(opts *bind.TransactOpts, validationID [32]byte, includeUptimeProof bool, messageIndex uint32) (*types.Transaction, error) { + return _IPoSValidatorManager.contract.Transact(opts, "forceInitializeEndValidation", validationID, includeUptimeProof, messageIndex) +} + +// ForceInitializeEndValidation is a paid mutator transaction binding the contract method 0x3a1cfff6. +// +// Solidity: function forceInitializeEndValidation(bytes32 validationID, bool includeUptimeProof, uint32 messageIndex) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerSession) ForceInitializeEndValidation(validationID [32]byte, includeUptimeProof bool, messageIndex uint32) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.ForceInitializeEndValidation(&_IPoSValidatorManager.TransactOpts, validationID, includeUptimeProof, messageIndex) +} + +// ForceInitializeEndValidation is a paid mutator transaction binding the contract method 0x3a1cfff6. +// +// Solidity: function forceInitializeEndValidation(bytes32 validationID, bool includeUptimeProof, uint32 messageIndex) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerTransactorSession) ForceInitializeEndValidation(validationID [32]byte, includeUptimeProof bool, messageIndex uint32) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.ForceInitializeEndValidation(&_IPoSValidatorManager.TransactOpts, validationID, includeUptimeProof, messageIndex) +} + +// InitializeEndDelegation is a paid mutator transaction binding the contract method 0x0118acc4. +// +// Solidity: function initializeEndDelegation(bytes32 delegationID, bool includeUptimeProof, uint32 messageIndex) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerTransactor) InitializeEndDelegation(opts *bind.TransactOpts, delegationID [32]byte, includeUptimeProof bool, messageIndex uint32) (*types.Transaction, error) { + return _IPoSValidatorManager.contract.Transact(opts, "initializeEndDelegation", delegationID, includeUptimeProof, messageIndex) +} + +// InitializeEndDelegation is a paid mutator transaction binding the contract method 0x0118acc4. +// +// Solidity: function initializeEndDelegation(bytes32 delegationID, bool includeUptimeProof, uint32 messageIndex) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerSession) InitializeEndDelegation(delegationID [32]byte, includeUptimeProof bool, messageIndex uint32) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.InitializeEndDelegation(&_IPoSValidatorManager.TransactOpts, delegationID, includeUptimeProof, messageIndex) +} + +// InitializeEndDelegation is a paid mutator transaction binding the contract method 0x0118acc4. +// +// Solidity: function initializeEndDelegation(bytes32 delegationID, bool includeUptimeProof, uint32 messageIndex) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerTransactorSession) InitializeEndDelegation(delegationID [32]byte, includeUptimeProof bool, messageIndex uint32) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.InitializeEndDelegation(&_IPoSValidatorManager.TransactOpts, delegationID, includeUptimeProof, messageIndex) +} + +// InitializeEndValidation is a paid mutator transaction binding the contract method 0x76f78621. +// +// Solidity: function initializeEndValidation(bytes32 validationID, bool includeUptimeProof, uint32 messageIndex) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerTransactor) InitializeEndValidation(opts *bind.TransactOpts, validationID [32]byte, includeUptimeProof bool, messageIndex uint32) (*types.Transaction, error) { + return _IPoSValidatorManager.contract.Transact(opts, "initializeEndValidation", validationID, includeUptimeProof, messageIndex) +} + +// InitializeEndValidation is a paid mutator transaction binding the contract method 0x76f78621. +// +// Solidity: function initializeEndValidation(bytes32 validationID, bool includeUptimeProof, uint32 messageIndex) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerSession) InitializeEndValidation(validationID [32]byte, includeUptimeProof bool, messageIndex uint32) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.InitializeEndValidation(&_IPoSValidatorManager.TransactOpts, validationID, includeUptimeProof, messageIndex) +} + +// InitializeEndValidation is a paid mutator transaction binding the contract method 0x76f78621. +// +// Solidity: function initializeEndValidation(bytes32 validationID, bool includeUptimeProof, uint32 messageIndex) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerTransactorSession) InitializeEndValidation(validationID [32]byte, includeUptimeProof bool, messageIndex uint32) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.InitializeEndValidation(&_IPoSValidatorManager.TransactOpts, validationID, includeUptimeProof, messageIndex) +} + +// InitializeValidatorSet is a paid mutator transaction binding the contract method 0x20d91b7a. +// +// Solidity: function initializeValidatorSet((bytes32,bytes32,address,(bytes,bytes,uint64)[]) conversionData, uint32 messsageIndex) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerTransactor) InitializeValidatorSet(opts *bind.TransactOpts, conversionData ConversionData, messsageIndex uint32) (*types.Transaction, error) { + return _IPoSValidatorManager.contract.Transact(opts, "initializeValidatorSet", conversionData, messsageIndex) +} + +// InitializeValidatorSet is a paid mutator transaction binding the contract method 0x20d91b7a. +// +// Solidity: function initializeValidatorSet((bytes32,bytes32,address,(bytes,bytes,uint64)[]) conversionData, uint32 messsageIndex) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerSession) InitializeValidatorSet(conversionData ConversionData, messsageIndex uint32) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.InitializeValidatorSet(&_IPoSValidatorManager.TransactOpts, conversionData, messsageIndex) +} + +// InitializeValidatorSet is a paid mutator transaction binding the contract method 0x20d91b7a. +// +// Solidity: function initializeValidatorSet((bytes32,bytes32,address,(bytes,bytes,uint64)[]) conversionData, uint32 messsageIndex) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerTransactorSession) InitializeValidatorSet(conversionData ConversionData, messsageIndex uint32) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.InitializeValidatorSet(&_IPoSValidatorManager.TransactOpts, conversionData, messsageIndex) +} + +// ResendEndValidatorMessage is a paid mutator transaction binding the contract method 0x0322ed98. +// +// Solidity: function resendEndValidatorMessage(bytes32 validationID) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerTransactor) ResendEndValidatorMessage(opts *bind.TransactOpts, validationID [32]byte) (*types.Transaction, error) { + return _IPoSValidatorManager.contract.Transact(opts, "resendEndValidatorMessage", validationID) +} + +// ResendEndValidatorMessage is a paid mutator transaction binding the contract method 0x0322ed98. +// +// Solidity: function resendEndValidatorMessage(bytes32 validationID) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerSession) ResendEndValidatorMessage(validationID [32]byte) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.ResendEndValidatorMessage(&_IPoSValidatorManager.TransactOpts, validationID) +} + +// ResendEndValidatorMessage is a paid mutator transaction binding the contract method 0x0322ed98. +// +// Solidity: function resendEndValidatorMessage(bytes32 validationID) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerTransactorSession) ResendEndValidatorMessage(validationID [32]byte) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.ResendEndValidatorMessage(&_IPoSValidatorManager.TransactOpts, validationID) +} + +// ResendRegisterValidatorMessage is a paid mutator transaction binding the contract method 0xbee0a03f. +// +// Solidity: function resendRegisterValidatorMessage(bytes32 validationID) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerTransactor) ResendRegisterValidatorMessage(opts *bind.TransactOpts, validationID [32]byte) (*types.Transaction, error) { + return _IPoSValidatorManager.contract.Transact(opts, "resendRegisterValidatorMessage", validationID) +} + +// ResendRegisterValidatorMessage is a paid mutator transaction binding the contract method 0xbee0a03f. +// +// Solidity: function resendRegisterValidatorMessage(bytes32 validationID) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerSession) ResendRegisterValidatorMessage(validationID [32]byte) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.ResendRegisterValidatorMessage(&_IPoSValidatorManager.TransactOpts, validationID) +} + +// ResendRegisterValidatorMessage is a paid mutator transaction binding the contract method 0xbee0a03f. +// +// Solidity: function resendRegisterValidatorMessage(bytes32 validationID) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerTransactorSession) ResendRegisterValidatorMessage(validationID [32]byte) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.ResendRegisterValidatorMessage(&_IPoSValidatorManager.TransactOpts, validationID) +} + +// ResendUpdateDelegation is a paid mutator transaction binding the contract method 0xba3a4b97. +// +// Solidity: function resendUpdateDelegation(bytes32 delegationID) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerTransactor) ResendUpdateDelegation(opts *bind.TransactOpts, delegationID [32]byte) (*types.Transaction, error) { + return _IPoSValidatorManager.contract.Transact(opts, "resendUpdateDelegation", delegationID) +} + +// ResendUpdateDelegation is a paid mutator transaction binding the contract method 0xba3a4b97. +// +// Solidity: function resendUpdateDelegation(bytes32 delegationID) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerSession) ResendUpdateDelegation(delegationID [32]byte) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.ResendUpdateDelegation(&_IPoSValidatorManager.TransactOpts, delegationID) +} + +// ResendUpdateDelegation is a paid mutator transaction binding the contract method 0xba3a4b97. +// +// Solidity: function resendUpdateDelegation(bytes32 delegationID) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerTransactorSession) ResendUpdateDelegation(delegationID [32]byte) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.ResendUpdateDelegation(&_IPoSValidatorManager.TransactOpts, delegationID) +} + +// SubmitUptimeProof is a paid mutator transaction binding the contract method 0x25e1c776. +// +// Solidity: function submitUptimeProof(bytes32 validationID, uint32 messageIndex) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerTransactor) SubmitUptimeProof(opts *bind.TransactOpts, validationID [32]byte, messageIndex uint32) (*types.Transaction, error) { + return _IPoSValidatorManager.contract.Transact(opts, "submitUptimeProof", validationID, messageIndex) +} + +// SubmitUptimeProof is a paid mutator transaction binding the contract method 0x25e1c776. +// +// Solidity: function submitUptimeProof(bytes32 validationID, uint32 messageIndex) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerSession) SubmitUptimeProof(validationID [32]byte, messageIndex uint32) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.SubmitUptimeProof(&_IPoSValidatorManager.TransactOpts, validationID, messageIndex) +} + +// SubmitUptimeProof is a paid mutator transaction binding the contract method 0x25e1c776. +// +// Solidity: function submitUptimeProof(bytes32 validationID, uint32 messageIndex) returns() +func (_IPoSValidatorManager *IPoSValidatorManagerTransactorSession) SubmitUptimeProof(validationID [32]byte, messageIndex uint32) (*types.Transaction, error) { + return _IPoSValidatorManager.Contract.SubmitUptimeProof(&_IPoSValidatorManager.TransactOpts, validationID, messageIndex) +} + +// IPoSValidatorManagerDelegationEndedIterator is returned from FilterDelegationEnded and is used to iterate over the raw logs and unpacked data for DelegationEnded events raised by the IPoSValidatorManager contract. +type IPoSValidatorManagerDelegationEndedIterator struct { + Event *IPoSValidatorManagerDelegationEnded // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *IPoSValidatorManagerDelegationEndedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(IPoSValidatorManagerDelegationEnded) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(IPoSValidatorManagerDelegationEnded) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *IPoSValidatorManagerDelegationEndedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IPoSValidatorManagerDelegationEndedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IPoSValidatorManagerDelegationEnded represents a DelegationEnded event raised by the IPoSValidatorManager contract. +type IPoSValidatorManagerDelegationEnded struct { + DelegationID [32]byte + ValidationID [32]byte + Rewards *big.Int + Fees *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterDelegationEnded is a free log retrieval operation binding the contract event 0x8ececf510070c320d9a55323ffabe350e294ae505fc0c509dc5736da6f5cc993. +// +// Solidity: event DelegationEnded(bytes32 indexed delegationID, bytes32 indexed validationID, uint256 rewards, uint256 fees) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) FilterDelegationEnded(opts *bind.FilterOpts, delegationID [][32]byte, validationID [][32]byte) (*IPoSValidatorManagerDelegationEndedIterator, error) { + + var delegationIDRule []interface{} + for _, delegationIDItem := range delegationID { + delegationIDRule = append(delegationIDRule, delegationIDItem) + } + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + + logs, sub, err := _IPoSValidatorManager.contract.FilterLogs(opts, "DelegationEnded", delegationIDRule, validationIDRule) + if err != nil { + return nil, err + } + return &IPoSValidatorManagerDelegationEndedIterator{contract: _IPoSValidatorManager.contract, event: "DelegationEnded", logs: logs, sub: sub}, nil +} + +// WatchDelegationEnded is a free log subscription operation binding the contract event 0x8ececf510070c320d9a55323ffabe350e294ae505fc0c509dc5736da6f5cc993. +// +// Solidity: event DelegationEnded(bytes32 indexed delegationID, bytes32 indexed validationID, uint256 rewards, uint256 fees) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) WatchDelegationEnded(opts *bind.WatchOpts, sink chan<- *IPoSValidatorManagerDelegationEnded, delegationID [][32]byte, validationID [][32]byte) (event.Subscription, error) { + + var delegationIDRule []interface{} + for _, delegationIDItem := range delegationID { + delegationIDRule = append(delegationIDRule, delegationIDItem) + } + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + + logs, sub, err := _IPoSValidatorManager.contract.WatchLogs(opts, "DelegationEnded", delegationIDRule, validationIDRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(IPoSValidatorManagerDelegationEnded) + if err := _IPoSValidatorManager.contract.UnpackLog(event, "DelegationEnded", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseDelegationEnded is a log parse operation binding the contract event 0x8ececf510070c320d9a55323ffabe350e294ae505fc0c509dc5736da6f5cc993. +// +// Solidity: event DelegationEnded(bytes32 indexed delegationID, bytes32 indexed validationID, uint256 rewards, uint256 fees) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) ParseDelegationEnded(log types.Log) (*IPoSValidatorManagerDelegationEnded, error) { + event := new(IPoSValidatorManagerDelegationEnded) + if err := _IPoSValidatorManager.contract.UnpackLog(event, "DelegationEnded", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IPoSValidatorManagerDelegatorAddedIterator is returned from FilterDelegatorAdded and is used to iterate over the raw logs and unpacked data for DelegatorAdded events raised by the IPoSValidatorManager contract. +type IPoSValidatorManagerDelegatorAddedIterator struct { + Event *IPoSValidatorManagerDelegatorAdded // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *IPoSValidatorManagerDelegatorAddedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(IPoSValidatorManagerDelegatorAdded) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(IPoSValidatorManagerDelegatorAdded) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *IPoSValidatorManagerDelegatorAddedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IPoSValidatorManagerDelegatorAddedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IPoSValidatorManagerDelegatorAdded represents a DelegatorAdded event raised by the IPoSValidatorManager contract. +type IPoSValidatorManagerDelegatorAdded struct { + DelegationID [32]byte + ValidationID [32]byte + DelegatorAddress common.Address + Nonce uint64 + ValidatorWeight uint64 + DelegatorWeight uint64 + SetWeightMessageID [32]byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterDelegatorAdded is a free log retrieval operation binding the contract event 0xb0024b263bc3a0b728a6edea50a69efa841189f8d32ee8af9d1c2b1a1a223426. +// +// Solidity: event DelegatorAdded(bytes32 indexed delegationID, bytes32 indexed validationID, address indexed delegatorAddress, uint64 nonce, uint64 validatorWeight, uint64 delegatorWeight, bytes32 setWeightMessageID) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) FilterDelegatorAdded(opts *bind.FilterOpts, delegationID [][32]byte, validationID [][32]byte, delegatorAddress []common.Address) (*IPoSValidatorManagerDelegatorAddedIterator, error) { + + var delegationIDRule []interface{} + for _, delegationIDItem := range delegationID { + delegationIDRule = append(delegationIDRule, delegationIDItem) + } + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + var delegatorAddressRule []interface{} + for _, delegatorAddressItem := range delegatorAddress { + delegatorAddressRule = append(delegatorAddressRule, delegatorAddressItem) + } + + logs, sub, err := _IPoSValidatorManager.contract.FilterLogs(opts, "DelegatorAdded", delegationIDRule, validationIDRule, delegatorAddressRule) + if err != nil { + return nil, err + } + return &IPoSValidatorManagerDelegatorAddedIterator{contract: _IPoSValidatorManager.contract, event: "DelegatorAdded", logs: logs, sub: sub}, nil +} + +// WatchDelegatorAdded is a free log subscription operation binding the contract event 0xb0024b263bc3a0b728a6edea50a69efa841189f8d32ee8af9d1c2b1a1a223426. +// +// Solidity: event DelegatorAdded(bytes32 indexed delegationID, bytes32 indexed validationID, address indexed delegatorAddress, uint64 nonce, uint64 validatorWeight, uint64 delegatorWeight, bytes32 setWeightMessageID) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) WatchDelegatorAdded(opts *bind.WatchOpts, sink chan<- *IPoSValidatorManagerDelegatorAdded, delegationID [][32]byte, validationID [][32]byte, delegatorAddress []common.Address) (event.Subscription, error) { + + var delegationIDRule []interface{} + for _, delegationIDItem := range delegationID { + delegationIDRule = append(delegationIDRule, delegationIDItem) + } + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + var delegatorAddressRule []interface{} + for _, delegatorAddressItem := range delegatorAddress { + delegatorAddressRule = append(delegatorAddressRule, delegatorAddressItem) + } + + logs, sub, err := _IPoSValidatorManager.contract.WatchLogs(opts, "DelegatorAdded", delegationIDRule, validationIDRule, delegatorAddressRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(IPoSValidatorManagerDelegatorAdded) + if err := _IPoSValidatorManager.contract.UnpackLog(event, "DelegatorAdded", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseDelegatorAdded is a log parse operation binding the contract event 0xb0024b263bc3a0b728a6edea50a69efa841189f8d32ee8af9d1c2b1a1a223426. +// +// Solidity: event DelegatorAdded(bytes32 indexed delegationID, bytes32 indexed validationID, address indexed delegatorAddress, uint64 nonce, uint64 validatorWeight, uint64 delegatorWeight, bytes32 setWeightMessageID) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) ParseDelegatorAdded(log types.Log) (*IPoSValidatorManagerDelegatorAdded, error) { + event := new(IPoSValidatorManagerDelegatorAdded) + if err := _IPoSValidatorManager.contract.UnpackLog(event, "DelegatorAdded", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IPoSValidatorManagerDelegatorRegisteredIterator is returned from FilterDelegatorRegistered and is used to iterate over the raw logs and unpacked data for DelegatorRegistered events raised by the IPoSValidatorManager contract. +type IPoSValidatorManagerDelegatorRegisteredIterator struct { + Event *IPoSValidatorManagerDelegatorRegistered // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *IPoSValidatorManagerDelegatorRegisteredIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(IPoSValidatorManagerDelegatorRegistered) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(IPoSValidatorManagerDelegatorRegistered) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *IPoSValidatorManagerDelegatorRegisteredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IPoSValidatorManagerDelegatorRegisteredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IPoSValidatorManagerDelegatorRegistered represents a DelegatorRegistered event raised by the IPoSValidatorManager contract. +type IPoSValidatorManagerDelegatorRegistered struct { + DelegationID [32]byte + ValidationID [32]byte + StartTime *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterDelegatorRegistered is a free log retrieval operation binding the contract event 0x047059b465069b8b751836b41f9f1d83daff583d2238cc7fbb461437ec23a4f6. +// +// Solidity: event DelegatorRegistered(bytes32 indexed delegationID, bytes32 indexed validationID, uint256 startTime) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) FilterDelegatorRegistered(opts *bind.FilterOpts, delegationID [][32]byte, validationID [][32]byte) (*IPoSValidatorManagerDelegatorRegisteredIterator, error) { + + var delegationIDRule []interface{} + for _, delegationIDItem := range delegationID { + delegationIDRule = append(delegationIDRule, delegationIDItem) + } + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + + logs, sub, err := _IPoSValidatorManager.contract.FilterLogs(opts, "DelegatorRegistered", delegationIDRule, validationIDRule) + if err != nil { + return nil, err + } + return &IPoSValidatorManagerDelegatorRegisteredIterator{contract: _IPoSValidatorManager.contract, event: "DelegatorRegistered", logs: logs, sub: sub}, nil +} + +// WatchDelegatorRegistered is a free log subscription operation binding the contract event 0x047059b465069b8b751836b41f9f1d83daff583d2238cc7fbb461437ec23a4f6. +// +// Solidity: event DelegatorRegistered(bytes32 indexed delegationID, bytes32 indexed validationID, uint256 startTime) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) WatchDelegatorRegistered(opts *bind.WatchOpts, sink chan<- *IPoSValidatorManagerDelegatorRegistered, delegationID [][32]byte, validationID [][32]byte) (event.Subscription, error) { + + var delegationIDRule []interface{} + for _, delegationIDItem := range delegationID { + delegationIDRule = append(delegationIDRule, delegationIDItem) + } + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + + logs, sub, err := _IPoSValidatorManager.contract.WatchLogs(opts, "DelegatorRegistered", delegationIDRule, validationIDRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(IPoSValidatorManagerDelegatorRegistered) + if err := _IPoSValidatorManager.contract.UnpackLog(event, "DelegatorRegistered", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseDelegatorRegistered is a log parse operation binding the contract event 0x047059b465069b8b751836b41f9f1d83daff583d2238cc7fbb461437ec23a4f6. +// +// Solidity: event DelegatorRegistered(bytes32 indexed delegationID, bytes32 indexed validationID, uint256 startTime) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) ParseDelegatorRegistered(log types.Log) (*IPoSValidatorManagerDelegatorRegistered, error) { + event := new(IPoSValidatorManagerDelegatorRegistered) + if err := _IPoSValidatorManager.contract.UnpackLog(event, "DelegatorRegistered", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IPoSValidatorManagerDelegatorRemovalInitializedIterator is returned from FilterDelegatorRemovalInitialized and is used to iterate over the raw logs and unpacked data for DelegatorRemovalInitialized events raised by the IPoSValidatorManager contract. +type IPoSValidatorManagerDelegatorRemovalInitializedIterator struct { + Event *IPoSValidatorManagerDelegatorRemovalInitialized // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *IPoSValidatorManagerDelegatorRemovalInitializedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(IPoSValidatorManagerDelegatorRemovalInitialized) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(IPoSValidatorManagerDelegatorRemovalInitialized) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *IPoSValidatorManagerDelegatorRemovalInitializedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IPoSValidatorManagerDelegatorRemovalInitializedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IPoSValidatorManagerDelegatorRemovalInitialized represents a DelegatorRemovalInitialized event raised by the IPoSValidatorManager contract. +type IPoSValidatorManagerDelegatorRemovalInitialized struct { + DelegationID [32]byte + ValidationID [32]byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterDelegatorRemovalInitialized is a free log retrieval operation binding the contract event 0x366d336c0ab380dc799f095a6f82a26326585c52909cc698b09ba4540709ed57. +// +// Solidity: event DelegatorRemovalInitialized(bytes32 indexed delegationID, bytes32 indexed validationID) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) FilterDelegatorRemovalInitialized(opts *bind.FilterOpts, delegationID [][32]byte, validationID [][32]byte) (*IPoSValidatorManagerDelegatorRemovalInitializedIterator, error) { + + var delegationIDRule []interface{} + for _, delegationIDItem := range delegationID { + delegationIDRule = append(delegationIDRule, delegationIDItem) + } + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + + logs, sub, err := _IPoSValidatorManager.contract.FilterLogs(opts, "DelegatorRemovalInitialized", delegationIDRule, validationIDRule) + if err != nil { + return nil, err + } + return &IPoSValidatorManagerDelegatorRemovalInitializedIterator{contract: _IPoSValidatorManager.contract, event: "DelegatorRemovalInitialized", logs: logs, sub: sub}, nil +} + +// WatchDelegatorRemovalInitialized is a free log subscription operation binding the contract event 0x366d336c0ab380dc799f095a6f82a26326585c52909cc698b09ba4540709ed57. +// +// Solidity: event DelegatorRemovalInitialized(bytes32 indexed delegationID, bytes32 indexed validationID) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) WatchDelegatorRemovalInitialized(opts *bind.WatchOpts, sink chan<- *IPoSValidatorManagerDelegatorRemovalInitialized, delegationID [][32]byte, validationID [][32]byte) (event.Subscription, error) { + + var delegationIDRule []interface{} + for _, delegationIDItem := range delegationID { + delegationIDRule = append(delegationIDRule, delegationIDItem) + } + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + + logs, sub, err := _IPoSValidatorManager.contract.WatchLogs(opts, "DelegatorRemovalInitialized", delegationIDRule, validationIDRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(IPoSValidatorManagerDelegatorRemovalInitialized) + if err := _IPoSValidatorManager.contract.UnpackLog(event, "DelegatorRemovalInitialized", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseDelegatorRemovalInitialized is a log parse operation binding the contract event 0x366d336c0ab380dc799f095a6f82a26326585c52909cc698b09ba4540709ed57. +// +// Solidity: event DelegatorRemovalInitialized(bytes32 indexed delegationID, bytes32 indexed validationID) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) ParseDelegatorRemovalInitialized(log types.Log) (*IPoSValidatorManagerDelegatorRemovalInitialized, error) { + event := new(IPoSValidatorManagerDelegatorRemovalInitialized) + if err := _IPoSValidatorManager.contract.UnpackLog(event, "DelegatorRemovalInitialized", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IPoSValidatorManagerInitialValidatorCreatedIterator is returned from FilterInitialValidatorCreated and is used to iterate over the raw logs and unpacked data for InitialValidatorCreated events raised by the IPoSValidatorManager contract. +type IPoSValidatorManagerInitialValidatorCreatedIterator struct { + Event *IPoSValidatorManagerInitialValidatorCreated // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *IPoSValidatorManagerInitialValidatorCreatedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(IPoSValidatorManagerInitialValidatorCreated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(IPoSValidatorManagerInitialValidatorCreated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *IPoSValidatorManagerInitialValidatorCreatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IPoSValidatorManagerInitialValidatorCreatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IPoSValidatorManagerInitialValidatorCreated represents a InitialValidatorCreated event raised by the IPoSValidatorManager contract. +type IPoSValidatorManagerInitialValidatorCreated struct { + ValidationID [32]byte + NodeID common.Hash + Weight *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterInitialValidatorCreated is a free log retrieval operation binding the contract event 0x9d47fef9da077661546e646d61830bfcbda90506c2e5eed38195e82c4eb1cbdf. +// +// Solidity: event InitialValidatorCreated(bytes32 indexed validationID, bytes indexed nodeID, uint256 weight) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) FilterInitialValidatorCreated(opts *bind.FilterOpts, validationID [][32]byte, nodeID [][]byte) (*IPoSValidatorManagerInitialValidatorCreatedIterator, error) { + + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + var nodeIDRule []interface{} + for _, nodeIDItem := range nodeID { + nodeIDRule = append(nodeIDRule, nodeIDItem) + } + + logs, sub, err := _IPoSValidatorManager.contract.FilterLogs(opts, "InitialValidatorCreated", validationIDRule, nodeIDRule) + if err != nil { + return nil, err + } + return &IPoSValidatorManagerInitialValidatorCreatedIterator{contract: _IPoSValidatorManager.contract, event: "InitialValidatorCreated", logs: logs, sub: sub}, nil +} + +// WatchInitialValidatorCreated is a free log subscription operation binding the contract event 0x9d47fef9da077661546e646d61830bfcbda90506c2e5eed38195e82c4eb1cbdf. +// +// Solidity: event InitialValidatorCreated(bytes32 indexed validationID, bytes indexed nodeID, uint256 weight) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) WatchInitialValidatorCreated(opts *bind.WatchOpts, sink chan<- *IPoSValidatorManagerInitialValidatorCreated, validationID [][32]byte, nodeID [][]byte) (event.Subscription, error) { + + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + var nodeIDRule []interface{} + for _, nodeIDItem := range nodeID { + nodeIDRule = append(nodeIDRule, nodeIDItem) + } + + logs, sub, err := _IPoSValidatorManager.contract.WatchLogs(opts, "InitialValidatorCreated", validationIDRule, nodeIDRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(IPoSValidatorManagerInitialValidatorCreated) + if err := _IPoSValidatorManager.contract.UnpackLog(event, "InitialValidatorCreated", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseInitialValidatorCreated is a log parse operation binding the contract event 0x9d47fef9da077661546e646d61830bfcbda90506c2e5eed38195e82c4eb1cbdf. +// +// Solidity: event InitialValidatorCreated(bytes32 indexed validationID, bytes indexed nodeID, uint256 weight) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) ParseInitialValidatorCreated(log types.Log) (*IPoSValidatorManagerInitialValidatorCreated, error) { + event := new(IPoSValidatorManagerInitialValidatorCreated) + if err := _IPoSValidatorManager.contract.UnpackLog(event, "InitialValidatorCreated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IPoSValidatorManagerUptimeUpdatedIterator is returned from FilterUptimeUpdated and is used to iterate over the raw logs and unpacked data for UptimeUpdated events raised by the IPoSValidatorManager contract. +type IPoSValidatorManagerUptimeUpdatedIterator struct { + Event *IPoSValidatorManagerUptimeUpdated // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *IPoSValidatorManagerUptimeUpdatedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(IPoSValidatorManagerUptimeUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(IPoSValidatorManagerUptimeUpdated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *IPoSValidatorManagerUptimeUpdatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IPoSValidatorManagerUptimeUpdatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IPoSValidatorManagerUptimeUpdated represents a UptimeUpdated event raised by the IPoSValidatorManager contract. +type IPoSValidatorManagerUptimeUpdated struct { + ValidationID [32]byte + Uptime uint64 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterUptimeUpdated is a free log retrieval operation binding the contract event 0xec44148e8ff271f2d0bacef1142154abacb0abb3a29eb3eb50e2ca97e86d0435. +// +// Solidity: event UptimeUpdated(bytes32 indexed validationID, uint64 uptime) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) FilterUptimeUpdated(opts *bind.FilterOpts, validationID [][32]byte) (*IPoSValidatorManagerUptimeUpdatedIterator, error) { + + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + + logs, sub, err := _IPoSValidatorManager.contract.FilterLogs(opts, "UptimeUpdated", validationIDRule) + if err != nil { + return nil, err + } + return &IPoSValidatorManagerUptimeUpdatedIterator{contract: _IPoSValidatorManager.contract, event: "UptimeUpdated", logs: logs, sub: sub}, nil +} + +// WatchUptimeUpdated is a free log subscription operation binding the contract event 0xec44148e8ff271f2d0bacef1142154abacb0abb3a29eb3eb50e2ca97e86d0435. +// +// Solidity: event UptimeUpdated(bytes32 indexed validationID, uint64 uptime) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) WatchUptimeUpdated(opts *bind.WatchOpts, sink chan<- *IPoSValidatorManagerUptimeUpdated, validationID [][32]byte) (event.Subscription, error) { + + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + + logs, sub, err := _IPoSValidatorManager.contract.WatchLogs(opts, "UptimeUpdated", validationIDRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(IPoSValidatorManagerUptimeUpdated) + if err := _IPoSValidatorManager.contract.UnpackLog(event, "UptimeUpdated", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseUptimeUpdated is a log parse operation binding the contract event 0xec44148e8ff271f2d0bacef1142154abacb0abb3a29eb3eb50e2ca97e86d0435. +// +// Solidity: event UptimeUpdated(bytes32 indexed validationID, uint64 uptime) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) ParseUptimeUpdated(log types.Log) (*IPoSValidatorManagerUptimeUpdated, error) { + event := new(IPoSValidatorManagerUptimeUpdated) + if err := _IPoSValidatorManager.contract.UnpackLog(event, "UptimeUpdated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IPoSValidatorManagerValidationPeriodCreatedIterator is returned from FilterValidationPeriodCreated and is used to iterate over the raw logs and unpacked data for ValidationPeriodCreated events raised by the IPoSValidatorManager contract. +type IPoSValidatorManagerValidationPeriodCreatedIterator struct { + Event *IPoSValidatorManagerValidationPeriodCreated // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *IPoSValidatorManagerValidationPeriodCreatedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(IPoSValidatorManagerValidationPeriodCreated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(IPoSValidatorManagerValidationPeriodCreated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *IPoSValidatorManagerValidationPeriodCreatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IPoSValidatorManagerValidationPeriodCreatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IPoSValidatorManagerValidationPeriodCreated represents a ValidationPeriodCreated event raised by the IPoSValidatorManager contract. +type IPoSValidatorManagerValidationPeriodCreated struct { + ValidationID [32]byte + NodeID common.Hash + RegisterValidationMessageID [32]byte + Weight *big.Int + RegistrationExpiry uint64 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterValidationPeriodCreated is a free log retrieval operation binding the contract event 0xb77297e3befc691bfc864a81e241f83e2ef722b6e7becaa2ecec250c6d52b430. +// +// Solidity: event ValidationPeriodCreated(bytes32 indexed validationID, bytes indexed nodeID, bytes32 indexed registerValidationMessageID, uint256 weight, uint64 registrationExpiry) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) FilterValidationPeriodCreated(opts *bind.FilterOpts, validationID [][32]byte, nodeID [][]byte, registerValidationMessageID [][32]byte) (*IPoSValidatorManagerValidationPeriodCreatedIterator, error) { + + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + var nodeIDRule []interface{} + for _, nodeIDItem := range nodeID { + nodeIDRule = append(nodeIDRule, nodeIDItem) + } + var registerValidationMessageIDRule []interface{} + for _, registerValidationMessageIDItem := range registerValidationMessageID { + registerValidationMessageIDRule = append(registerValidationMessageIDRule, registerValidationMessageIDItem) + } + + logs, sub, err := _IPoSValidatorManager.contract.FilterLogs(opts, "ValidationPeriodCreated", validationIDRule, nodeIDRule, registerValidationMessageIDRule) + if err != nil { + return nil, err + } + return &IPoSValidatorManagerValidationPeriodCreatedIterator{contract: _IPoSValidatorManager.contract, event: "ValidationPeriodCreated", logs: logs, sub: sub}, nil +} + +// WatchValidationPeriodCreated is a free log subscription operation binding the contract event 0xb77297e3befc691bfc864a81e241f83e2ef722b6e7becaa2ecec250c6d52b430. +// +// Solidity: event ValidationPeriodCreated(bytes32 indexed validationID, bytes indexed nodeID, bytes32 indexed registerValidationMessageID, uint256 weight, uint64 registrationExpiry) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) WatchValidationPeriodCreated(opts *bind.WatchOpts, sink chan<- *IPoSValidatorManagerValidationPeriodCreated, validationID [][32]byte, nodeID [][]byte, registerValidationMessageID [][32]byte) (event.Subscription, error) { + + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + var nodeIDRule []interface{} + for _, nodeIDItem := range nodeID { + nodeIDRule = append(nodeIDRule, nodeIDItem) + } + var registerValidationMessageIDRule []interface{} + for _, registerValidationMessageIDItem := range registerValidationMessageID { + registerValidationMessageIDRule = append(registerValidationMessageIDRule, registerValidationMessageIDItem) + } + + logs, sub, err := _IPoSValidatorManager.contract.WatchLogs(opts, "ValidationPeriodCreated", validationIDRule, nodeIDRule, registerValidationMessageIDRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(IPoSValidatorManagerValidationPeriodCreated) + if err := _IPoSValidatorManager.contract.UnpackLog(event, "ValidationPeriodCreated", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseValidationPeriodCreated is a log parse operation binding the contract event 0xb77297e3befc691bfc864a81e241f83e2ef722b6e7becaa2ecec250c6d52b430. +// +// Solidity: event ValidationPeriodCreated(bytes32 indexed validationID, bytes indexed nodeID, bytes32 indexed registerValidationMessageID, uint256 weight, uint64 registrationExpiry) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) ParseValidationPeriodCreated(log types.Log) (*IPoSValidatorManagerValidationPeriodCreated, error) { + event := new(IPoSValidatorManagerValidationPeriodCreated) + if err := _IPoSValidatorManager.contract.UnpackLog(event, "ValidationPeriodCreated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IPoSValidatorManagerValidationPeriodEndedIterator is returned from FilterValidationPeriodEnded and is used to iterate over the raw logs and unpacked data for ValidationPeriodEnded events raised by the IPoSValidatorManager contract. +type IPoSValidatorManagerValidationPeriodEndedIterator struct { + Event *IPoSValidatorManagerValidationPeriodEnded // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *IPoSValidatorManagerValidationPeriodEndedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(IPoSValidatorManagerValidationPeriodEnded) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(IPoSValidatorManagerValidationPeriodEnded) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *IPoSValidatorManagerValidationPeriodEndedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IPoSValidatorManagerValidationPeriodEndedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IPoSValidatorManagerValidationPeriodEnded represents a ValidationPeriodEnded event raised by the IPoSValidatorManager contract. +type IPoSValidatorManagerValidationPeriodEnded struct { + ValidationID [32]byte + Status uint8 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterValidationPeriodEnded is a free log retrieval operation binding the contract event 0x1c08e59656f1a18dc2da76826cdc52805c43e897a17c50faefb8ab3c1526cc16. +// +// Solidity: event ValidationPeriodEnded(bytes32 indexed validationID, uint8 indexed status) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) FilterValidationPeriodEnded(opts *bind.FilterOpts, validationID [][32]byte, status []uint8) (*IPoSValidatorManagerValidationPeriodEndedIterator, error) { + + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + var statusRule []interface{} + for _, statusItem := range status { + statusRule = append(statusRule, statusItem) + } + + logs, sub, err := _IPoSValidatorManager.contract.FilterLogs(opts, "ValidationPeriodEnded", validationIDRule, statusRule) + if err != nil { + return nil, err + } + return &IPoSValidatorManagerValidationPeriodEndedIterator{contract: _IPoSValidatorManager.contract, event: "ValidationPeriodEnded", logs: logs, sub: sub}, nil +} + +// WatchValidationPeriodEnded is a free log subscription operation binding the contract event 0x1c08e59656f1a18dc2da76826cdc52805c43e897a17c50faefb8ab3c1526cc16. +// +// Solidity: event ValidationPeriodEnded(bytes32 indexed validationID, uint8 indexed status) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) WatchValidationPeriodEnded(opts *bind.WatchOpts, sink chan<- *IPoSValidatorManagerValidationPeriodEnded, validationID [][32]byte, status []uint8) (event.Subscription, error) { + + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + var statusRule []interface{} + for _, statusItem := range status { + statusRule = append(statusRule, statusItem) + } + + logs, sub, err := _IPoSValidatorManager.contract.WatchLogs(opts, "ValidationPeriodEnded", validationIDRule, statusRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(IPoSValidatorManagerValidationPeriodEnded) + if err := _IPoSValidatorManager.contract.UnpackLog(event, "ValidationPeriodEnded", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseValidationPeriodEnded is a log parse operation binding the contract event 0x1c08e59656f1a18dc2da76826cdc52805c43e897a17c50faefb8ab3c1526cc16. +// +// Solidity: event ValidationPeriodEnded(bytes32 indexed validationID, uint8 indexed status) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) ParseValidationPeriodEnded(log types.Log) (*IPoSValidatorManagerValidationPeriodEnded, error) { + event := new(IPoSValidatorManagerValidationPeriodEnded) + if err := _IPoSValidatorManager.contract.UnpackLog(event, "ValidationPeriodEnded", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IPoSValidatorManagerValidationPeriodRegisteredIterator is returned from FilterValidationPeriodRegistered and is used to iterate over the raw logs and unpacked data for ValidationPeriodRegistered events raised by the IPoSValidatorManager contract. +type IPoSValidatorManagerValidationPeriodRegisteredIterator struct { + Event *IPoSValidatorManagerValidationPeriodRegistered // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *IPoSValidatorManagerValidationPeriodRegisteredIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(IPoSValidatorManagerValidationPeriodRegistered) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(IPoSValidatorManagerValidationPeriodRegistered) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *IPoSValidatorManagerValidationPeriodRegisteredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IPoSValidatorManagerValidationPeriodRegisteredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IPoSValidatorManagerValidationPeriodRegistered represents a ValidationPeriodRegistered event raised by the IPoSValidatorManager contract. +type IPoSValidatorManagerValidationPeriodRegistered struct { + ValidationID [32]byte + Weight *big.Int + Timestamp *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterValidationPeriodRegistered is a free log retrieval operation binding the contract event 0xf8fd1c90fb9cfa2ca2358fdf5806b086ad43315d92b221c929efc7f105ce7568. +// +// Solidity: event ValidationPeriodRegistered(bytes32 indexed validationID, uint256 weight, uint256 timestamp) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) FilterValidationPeriodRegistered(opts *bind.FilterOpts, validationID [][32]byte) (*IPoSValidatorManagerValidationPeriodRegisteredIterator, error) { + + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + + logs, sub, err := _IPoSValidatorManager.contract.FilterLogs(opts, "ValidationPeriodRegistered", validationIDRule) + if err != nil { + return nil, err + } + return &IPoSValidatorManagerValidationPeriodRegisteredIterator{contract: _IPoSValidatorManager.contract, event: "ValidationPeriodRegistered", logs: logs, sub: sub}, nil +} + +// WatchValidationPeriodRegistered is a free log subscription operation binding the contract event 0xf8fd1c90fb9cfa2ca2358fdf5806b086ad43315d92b221c929efc7f105ce7568. +// +// Solidity: event ValidationPeriodRegistered(bytes32 indexed validationID, uint256 weight, uint256 timestamp) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) WatchValidationPeriodRegistered(opts *bind.WatchOpts, sink chan<- *IPoSValidatorManagerValidationPeriodRegistered, validationID [][32]byte) (event.Subscription, error) { + + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + + logs, sub, err := _IPoSValidatorManager.contract.WatchLogs(opts, "ValidationPeriodRegistered", validationIDRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(IPoSValidatorManagerValidationPeriodRegistered) + if err := _IPoSValidatorManager.contract.UnpackLog(event, "ValidationPeriodRegistered", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseValidationPeriodRegistered is a log parse operation binding the contract event 0xf8fd1c90fb9cfa2ca2358fdf5806b086ad43315d92b221c929efc7f105ce7568. +// +// Solidity: event ValidationPeriodRegistered(bytes32 indexed validationID, uint256 weight, uint256 timestamp) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) ParseValidationPeriodRegistered(log types.Log) (*IPoSValidatorManagerValidationPeriodRegistered, error) { + event := new(IPoSValidatorManagerValidationPeriodRegistered) + if err := _IPoSValidatorManager.contract.UnpackLog(event, "ValidationPeriodRegistered", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IPoSValidatorManagerValidatorRemovalInitializedIterator is returned from FilterValidatorRemovalInitialized and is used to iterate over the raw logs and unpacked data for ValidatorRemovalInitialized events raised by the IPoSValidatorManager contract. +type IPoSValidatorManagerValidatorRemovalInitializedIterator struct { + Event *IPoSValidatorManagerValidatorRemovalInitialized // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *IPoSValidatorManagerValidatorRemovalInitializedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(IPoSValidatorManagerValidatorRemovalInitialized) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(IPoSValidatorManagerValidatorRemovalInitialized) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *IPoSValidatorManagerValidatorRemovalInitializedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IPoSValidatorManagerValidatorRemovalInitializedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IPoSValidatorManagerValidatorRemovalInitialized represents a ValidatorRemovalInitialized event raised by the IPoSValidatorManager contract. +type IPoSValidatorManagerValidatorRemovalInitialized struct { + ValidationID [32]byte + SetWeightMessageID [32]byte + Weight *big.Int + EndTime *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterValidatorRemovalInitialized is a free log retrieval operation binding the contract event 0x13d58394cf269d48bcf927959a29a5ffee7c9924dafff8927ecdf3c48ffa7c67. +// +// Solidity: event ValidatorRemovalInitialized(bytes32 indexed validationID, bytes32 indexed setWeightMessageID, uint256 weight, uint256 endTime) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) FilterValidatorRemovalInitialized(opts *bind.FilterOpts, validationID [][32]byte, setWeightMessageID [][32]byte) (*IPoSValidatorManagerValidatorRemovalInitializedIterator, error) { + + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + var setWeightMessageIDRule []interface{} + for _, setWeightMessageIDItem := range setWeightMessageID { + setWeightMessageIDRule = append(setWeightMessageIDRule, setWeightMessageIDItem) + } + + logs, sub, err := _IPoSValidatorManager.contract.FilterLogs(opts, "ValidatorRemovalInitialized", validationIDRule, setWeightMessageIDRule) + if err != nil { + return nil, err + } + return &IPoSValidatorManagerValidatorRemovalInitializedIterator{contract: _IPoSValidatorManager.contract, event: "ValidatorRemovalInitialized", logs: logs, sub: sub}, nil +} + +// WatchValidatorRemovalInitialized is a free log subscription operation binding the contract event 0x13d58394cf269d48bcf927959a29a5ffee7c9924dafff8927ecdf3c48ffa7c67. +// +// Solidity: event ValidatorRemovalInitialized(bytes32 indexed validationID, bytes32 indexed setWeightMessageID, uint256 weight, uint256 endTime) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) WatchValidatorRemovalInitialized(opts *bind.WatchOpts, sink chan<- *IPoSValidatorManagerValidatorRemovalInitialized, validationID [][32]byte, setWeightMessageID [][32]byte) (event.Subscription, error) { + + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + var setWeightMessageIDRule []interface{} + for _, setWeightMessageIDItem := range setWeightMessageID { + setWeightMessageIDRule = append(setWeightMessageIDRule, setWeightMessageIDItem) + } + + logs, sub, err := _IPoSValidatorManager.contract.WatchLogs(opts, "ValidatorRemovalInitialized", validationIDRule, setWeightMessageIDRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(IPoSValidatorManagerValidatorRemovalInitialized) + if err := _IPoSValidatorManager.contract.UnpackLog(event, "ValidatorRemovalInitialized", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseValidatorRemovalInitialized is a log parse operation binding the contract event 0x13d58394cf269d48bcf927959a29a5ffee7c9924dafff8927ecdf3c48ffa7c67. +// +// Solidity: event ValidatorRemovalInitialized(bytes32 indexed validationID, bytes32 indexed setWeightMessageID, uint256 weight, uint256 endTime) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) ParseValidatorRemovalInitialized(log types.Log) (*IPoSValidatorManagerValidatorRemovalInitialized, error) { + event := new(IPoSValidatorManagerValidatorRemovalInitialized) + if err := _IPoSValidatorManager.contract.UnpackLog(event, "ValidatorRemovalInitialized", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IPoSValidatorManagerValidatorWeightUpdateIterator is returned from FilterValidatorWeightUpdate and is used to iterate over the raw logs and unpacked data for ValidatorWeightUpdate events raised by the IPoSValidatorManager contract. +type IPoSValidatorManagerValidatorWeightUpdateIterator struct { + Event *IPoSValidatorManagerValidatorWeightUpdate // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *IPoSValidatorManagerValidatorWeightUpdateIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(IPoSValidatorManagerValidatorWeightUpdate) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(IPoSValidatorManagerValidatorWeightUpdate) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *IPoSValidatorManagerValidatorWeightUpdateIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IPoSValidatorManagerValidatorWeightUpdateIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IPoSValidatorManagerValidatorWeightUpdate represents a ValidatorWeightUpdate event raised by the IPoSValidatorManager contract. +type IPoSValidatorManagerValidatorWeightUpdate struct { + ValidationID [32]byte + Nonce uint64 + ValidatorWeight uint64 + SetWeightMessageID [32]byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterValidatorWeightUpdate is a free log retrieval operation binding the contract event 0x07de5ff35a674a8005e661f3333c907ca6333462808762d19dc7b3abb1a8c1df. +// +// Solidity: event ValidatorWeightUpdate(bytes32 indexed validationID, uint64 indexed nonce, uint64 validatorWeight, bytes32 setWeightMessageID) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) FilterValidatorWeightUpdate(opts *bind.FilterOpts, validationID [][32]byte, nonce []uint64) (*IPoSValidatorManagerValidatorWeightUpdateIterator, error) { + + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + var nonceRule []interface{} + for _, nonceItem := range nonce { + nonceRule = append(nonceRule, nonceItem) + } + + logs, sub, err := _IPoSValidatorManager.contract.FilterLogs(opts, "ValidatorWeightUpdate", validationIDRule, nonceRule) + if err != nil { + return nil, err + } + return &IPoSValidatorManagerValidatorWeightUpdateIterator{contract: _IPoSValidatorManager.contract, event: "ValidatorWeightUpdate", logs: logs, sub: sub}, nil +} + +// WatchValidatorWeightUpdate is a free log subscription operation binding the contract event 0x07de5ff35a674a8005e661f3333c907ca6333462808762d19dc7b3abb1a8c1df. +// +// Solidity: event ValidatorWeightUpdate(bytes32 indexed validationID, uint64 indexed nonce, uint64 validatorWeight, bytes32 setWeightMessageID) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) WatchValidatorWeightUpdate(opts *bind.WatchOpts, sink chan<- *IPoSValidatorManagerValidatorWeightUpdate, validationID [][32]byte, nonce []uint64) (event.Subscription, error) { + + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + var nonceRule []interface{} + for _, nonceItem := range nonce { + nonceRule = append(nonceRule, nonceItem) + } + + logs, sub, err := _IPoSValidatorManager.contract.WatchLogs(opts, "ValidatorWeightUpdate", validationIDRule, nonceRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(IPoSValidatorManagerValidatorWeightUpdate) + if err := _IPoSValidatorManager.contract.UnpackLog(event, "ValidatorWeightUpdate", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseValidatorWeightUpdate is a log parse operation binding the contract event 0x07de5ff35a674a8005e661f3333c907ca6333462808762d19dc7b3abb1a8c1df. +// +// Solidity: event ValidatorWeightUpdate(bytes32 indexed validationID, uint64 indexed nonce, uint64 validatorWeight, bytes32 setWeightMessageID) +func (_IPoSValidatorManager *IPoSValidatorManagerFilterer) ParseValidatorWeightUpdate(log types.Log) (*IPoSValidatorManagerValidatorWeightUpdate, error) { + event := new(IPoSValidatorManagerValidatorWeightUpdate) + if err := _IPoSValidatorManager.contract.UnpackLog(event, "ValidatorWeightUpdate", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/abi-bindings/go/validator-manager/interfaces/IValidatorManager/IValidatorManager.go b/abi-bindings/go/validator-manager/interfaces/IValidatorManager/IValidatorManager.go new file mode 100644 index 000000000..6825e6e3c --- /dev/null +++ b/abi-bindings/go/validator-manager/interfaces/IValidatorManager/IValidatorManager.go @@ -0,0 +1,1228 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package ivalidatormanager + +import ( + "errors" + "math/big" + "strings" + + "github.com/ava-labs/subnet-evm/accounts/abi" + "github.com/ava-labs/subnet-evm/accounts/abi/bind" + "github.com/ava-labs/subnet-evm/core/types" + "github.com/ava-labs/subnet-evm/interfaces" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = interfaces.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// ConversionData is an auto generated low-level Go binding around an user-defined struct. +type ConversionData struct { + SubnetID [32]byte + ValidatorManagerBlockchainID [32]byte + ValidatorManagerAddress common.Address + InitialValidators []InitialValidator +} + +// InitialValidator is an auto generated low-level Go binding around an user-defined struct. +type InitialValidator struct { + NodeID []byte + BlsPublicKey []byte + Weight uint64 +} + +// IValidatorManagerMetaData contains all meta data concerning the IValidatorManager contract. +var IValidatorManagerMetaData = &bind.MetaData{ + ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes\",\"name\":\"nodeID\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"}],\"name\":\"InitialValidatorCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes\",\"name\":\"nodeID\",\"type\":\"bytes\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"registerValidationMessageID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"registrationExpiry\",\"type\":\"uint64\"}],\"name\":\"ValidationPeriodCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"}],\"name\":\"ValidationPeriodEnded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"ValidationPeriodRegistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"setWeightMessageID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"endTime\",\"type\":\"uint256\"}],\"name\":\"ValidatorRemovalInitialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint64\",\"name\":\"nonce\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"validatorWeight\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"setWeightMessageID\",\"type\":\"bytes32\"}],\"name\":\"ValidatorWeightUpdate\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"completeEndValidation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"completeValidatorRegistration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"subnetID\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"validatorManagerBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"validatorManagerAddress\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"bytes\",\"name\":\"nodeID\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"blsPublicKey\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"weight\",\"type\":\"uint64\"}],\"internalType\":\"structInitialValidator[]\",\"name\":\"initialValidators\",\"type\":\"tuple[]\"}],\"internalType\":\"structConversionData\",\"name\":\"conversionData\",\"type\":\"tuple\"},{\"internalType\":\"uint32\",\"name\":\"messsageIndex\",\"type\":\"uint32\"}],\"name\":\"initializeValidatorSet\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"}],\"name\":\"resendEndValidatorMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"}],\"name\":\"resendRegisterValidatorMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", +} + +// IValidatorManagerABI is the input ABI used to generate the binding from. +// Deprecated: Use IValidatorManagerMetaData.ABI instead. +var IValidatorManagerABI = IValidatorManagerMetaData.ABI + +// IValidatorManager is an auto generated Go binding around an Ethereum contract. +type IValidatorManager struct { + IValidatorManagerCaller // Read-only binding to the contract + IValidatorManagerTransactor // Write-only binding to the contract + IValidatorManagerFilterer // Log filterer for contract events +} + +// IValidatorManagerCaller is an auto generated read-only Go binding around an Ethereum contract. +type IValidatorManagerCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IValidatorManagerTransactor is an auto generated write-only Go binding around an Ethereum contract. +type IValidatorManagerTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IValidatorManagerFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type IValidatorManagerFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IValidatorManagerSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type IValidatorManagerSession struct { + Contract *IValidatorManager // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// IValidatorManagerCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type IValidatorManagerCallerSession struct { + Contract *IValidatorManagerCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// IValidatorManagerTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type IValidatorManagerTransactorSession struct { + Contract *IValidatorManagerTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// IValidatorManagerRaw is an auto generated low-level Go binding around an Ethereum contract. +type IValidatorManagerRaw struct { + Contract *IValidatorManager // Generic contract binding to access the raw methods on +} + +// IValidatorManagerCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type IValidatorManagerCallerRaw struct { + Contract *IValidatorManagerCaller // Generic read-only contract binding to access the raw methods on +} + +// IValidatorManagerTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type IValidatorManagerTransactorRaw struct { + Contract *IValidatorManagerTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewIValidatorManager creates a new instance of IValidatorManager, bound to a specific deployed contract. +func NewIValidatorManager(address common.Address, backend bind.ContractBackend) (*IValidatorManager, error) { + contract, err := bindIValidatorManager(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &IValidatorManager{IValidatorManagerCaller: IValidatorManagerCaller{contract: contract}, IValidatorManagerTransactor: IValidatorManagerTransactor{contract: contract}, IValidatorManagerFilterer: IValidatorManagerFilterer{contract: contract}}, nil +} + +// NewIValidatorManagerCaller creates a new read-only instance of IValidatorManager, bound to a specific deployed contract. +func NewIValidatorManagerCaller(address common.Address, caller bind.ContractCaller) (*IValidatorManagerCaller, error) { + contract, err := bindIValidatorManager(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &IValidatorManagerCaller{contract: contract}, nil +} + +// NewIValidatorManagerTransactor creates a new write-only instance of IValidatorManager, bound to a specific deployed contract. +func NewIValidatorManagerTransactor(address common.Address, transactor bind.ContractTransactor) (*IValidatorManagerTransactor, error) { + contract, err := bindIValidatorManager(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &IValidatorManagerTransactor{contract: contract}, nil +} + +// NewIValidatorManagerFilterer creates a new log filterer instance of IValidatorManager, bound to a specific deployed contract. +func NewIValidatorManagerFilterer(address common.Address, filterer bind.ContractFilterer) (*IValidatorManagerFilterer, error) { + contract, err := bindIValidatorManager(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &IValidatorManagerFilterer{contract: contract}, nil +} + +// bindIValidatorManager binds a generic wrapper to an already deployed contract. +func bindIValidatorManager(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := IValidatorManagerMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_IValidatorManager *IValidatorManagerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _IValidatorManager.Contract.IValidatorManagerCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_IValidatorManager *IValidatorManagerRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _IValidatorManager.Contract.IValidatorManagerTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_IValidatorManager *IValidatorManagerRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _IValidatorManager.Contract.IValidatorManagerTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_IValidatorManager *IValidatorManagerCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _IValidatorManager.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_IValidatorManager *IValidatorManagerTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _IValidatorManager.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_IValidatorManager *IValidatorManagerTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _IValidatorManager.Contract.contract.Transact(opts, method, params...) +} + +// CompleteEndValidation is a paid mutator transaction binding the contract method 0x467ef06f. +// +// Solidity: function completeEndValidation(uint32 messageIndex) returns() +func (_IValidatorManager *IValidatorManagerTransactor) CompleteEndValidation(opts *bind.TransactOpts, messageIndex uint32) (*types.Transaction, error) { + return _IValidatorManager.contract.Transact(opts, "completeEndValidation", messageIndex) +} + +// CompleteEndValidation is a paid mutator transaction binding the contract method 0x467ef06f. +// +// Solidity: function completeEndValidation(uint32 messageIndex) returns() +func (_IValidatorManager *IValidatorManagerSession) CompleteEndValidation(messageIndex uint32) (*types.Transaction, error) { + return _IValidatorManager.Contract.CompleteEndValidation(&_IValidatorManager.TransactOpts, messageIndex) +} + +// CompleteEndValidation is a paid mutator transaction binding the contract method 0x467ef06f. +// +// Solidity: function completeEndValidation(uint32 messageIndex) returns() +func (_IValidatorManager *IValidatorManagerTransactorSession) CompleteEndValidation(messageIndex uint32) (*types.Transaction, error) { + return _IValidatorManager.Contract.CompleteEndValidation(&_IValidatorManager.TransactOpts, messageIndex) +} + +// CompleteValidatorRegistration is a paid mutator transaction binding the contract method 0xa3a65e48. +// +// Solidity: function completeValidatorRegistration(uint32 messageIndex) returns() +func (_IValidatorManager *IValidatorManagerTransactor) CompleteValidatorRegistration(opts *bind.TransactOpts, messageIndex uint32) (*types.Transaction, error) { + return _IValidatorManager.contract.Transact(opts, "completeValidatorRegistration", messageIndex) +} + +// CompleteValidatorRegistration is a paid mutator transaction binding the contract method 0xa3a65e48. +// +// Solidity: function completeValidatorRegistration(uint32 messageIndex) returns() +func (_IValidatorManager *IValidatorManagerSession) CompleteValidatorRegistration(messageIndex uint32) (*types.Transaction, error) { + return _IValidatorManager.Contract.CompleteValidatorRegistration(&_IValidatorManager.TransactOpts, messageIndex) +} + +// CompleteValidatorRegistration is a paid mutator transaction binding the contract method 0xa3a65e48. +// +// Solidity: function completeValidatorRegistration(uint32 messageIndex) returns() +func (_IValidatorManager *IValidatorManagerTransactorSession) CompleteValidatorRegistration(messageIndex uint32) (*types.Transaction, error) { + return _IValidatorManager.Contract.CompleteValidatorRegistration(&_IValidatorManager.TransactOpts, messageIndex) +} + +// InitializeValidatorSet is a paid mutator transaction binding the contract method 0x20d91b7a. +// +// Solidity: function initializeValidatorSet((bytes32,bytes32,address,(bytes,bytes,uint64)[]) conversionData, uint32 messsageIndex) returns() +func (_IValidatorManager *IValidatorManagerTransactor) InitializeValidatorSet(opts *bind.TransactOpts, conversionData ConversionData, messsageIndex uint32) (*types.Transaction, error) { + return _IValidatorManager.contract.Transact(opts, "initializeValidatorSet", conversionData, messsageIndex) +} + +// InitializeValidatorSet is a paid mutator transaction binding the contract method 0x20d91b7a. +// +// Solidity: function initializeValidatorSet((bytes32,bytes32,address,(bytes,bytes,uint64)[]) conversionData, uint32 messsageIndex) returns() +func (_IValidatorManager *IValidatorManagerSession) InitializeValidatorSet(conversionData ConversionData, messsageIndex uint32) (*types.Transaction, error) { + return _IValidatorManager.Contract.InitializeValidatorSet(&_IValidatorManager.TransactOpts, conversionData, messsageIndex) +} + +// InitializeValidatorSet is a paid mutator transaction binding the contract method 0x20d91b7a. +// +// Solidity: function initializeValidatorSet((bytes32,bytes32,address,(bytes,bytes,uint64)[]) conversionData, uint32 messsageIndex) returns() +func (_IValidatorManager *IValidatorManagerTransactorSession) InitializeValidatorSet(conversionData ConversionData, messsageIndex uint32) (*types.Transaction, error) { + return _IValidatorManager.Contract.InitializeValidatorSet(&_IValidatorManager.TransactOpts, conversionData, messsageIndex) +} + +// ResendEndValidatorMessage is a paid mutator transaction binding the contract method 0x0322ed98. +// +// Solidity: function resendEndValidatorMessage(bytes32 validationID) returns() +func (_IValidatorManager *IValidatorManagerTransactor) ResendEndValidatorMessage(opts *bind.TransactOpts, validationID [32]byte) (*types.Transaction, error) { + return _IValidatorManager.contract.Transact(opts, "resendEndValidatorMessage", validationID) +} + +// ResendEndValidatorMessage is a paid mutator transaction binding the contract method 0x0322ed98. +// +// Solidity: function resendEndValidatorMessage(bytes32 validationID) returns() +func (_IValidatorManager *IValidatorManagerSession) ResendEndValidatorMessage(validationID [32]byte) (*types.Transaction, error) { + return _IValidatorManager.Contract.ResendEndValidatorMessage(&_IValidatorManager.TransactOpts, validationID) +} + +// ResendEndValidatorMessage is a paid mutator transaction binding the contract method 0x0322ed98. +// +// Solidity: function resendEndValidatorMessage(bytes32 validationID) returns() +func (_IValidatorManager *IValidatorManagerTransactorSession) ResendEndValidatorMessage(validationID [32]byte) (*types.Transaction, error) { + return _IValidatorManager.Contract.ResendEndValidatorMessage(&_IValidatorManager.TransactOpts, validationID) +} + +// ResendRegisterValidatorMessage is a paid mutator transaction binding the contract method 0xbee0a03f. +// +// Solidity: function resendRegisterValidatorMessage(bytes32 validationID) returns() +func (_IValidatorManager *IValidatorManagerTransactor) ResendRegisterValidatorMessage(opts *bind.TransactOpts, validationID [32]byte) (*types.Transaction, error) { + return _IValidatorManager.contract.Transact(opts, "resendRegisterValidatorMessage", validationID) +} + +// ResendRegisterValidatorMessage is a paid mutator transaction binding the contract method 0xbee0a03f. +// +// Solidity: function resendRegisterValidatorMessage(bytes32 validationID) returns() +func (_IValidatorManager *IValidatorManagerSession) ResendRegisterValidatorMessage(validationID [32]byte) (*types.Transaction, error) { + return _IValidatorManager.Contract.ResendRegisterValidatorMessage(&_IValidatorManager.TransactOpts, validationID) +} + +// ResendRegisterValidatorMessage is a paid mutator transaction binding the contract method 0xbee0a03f. +// +// Solidity: function resendRegisterValidatorMessage(bytes32 validationID) returns() +func (_IValidatorManager *IValidatorManagerTransactorSession) ResendRegisterValidatorMessage(validationID [32]byte) (*types.Transaction, error) { + return _IValidatorManager.Contract.ResendRegisterValidatorMessage(&_IValidatorManager.TransactOpts, validationID) +} + +// IValidatorManagerInitialValidatorCreatedIterator is returned from FilterInitialValidatorCreated and is used to iterate over the raw logs and unpacked data for InitialValidatorCreated events raised by the IValidatorManager contract. +type IValidatorManagerInitialValidatorCreatedIterator struct { + Event *IValidatorManagerInitialValidatorCreated // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *IValidatorManagerInitialValidatorCreatedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(IValidatorManagerInitialValidatorCreated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(IValidatorManagerInitialValidatorCreated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *IValidatorManagerInitialValidatorCreatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IValidatorManagerInitialValidatorCreatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IValidatorManagerInitialValidatorCreated represents a InitialValidatorCreated event raised by the IValidatorManager contract. +type IValidatorManagerInitialValidatorCreated struct { + ValidationID [32]byte + NodeID common.Hash + Weight *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterInitialValidatorCreated is a free log retrieval operation binding the contract event 0x9d47fef9da077661546e646d61830bfcbda90506c2e5eed38195e82c4eb1cbdf. +// +// Solidity: event InitialValidatorCreated(bytes32 indexed validationID, bytes indexed nodeID, uint256 weight) +func (_IValidatorManager *IValidatorManagerFilterer) FilterInitialValidatorCreated(opts *bind.FilterOpts, validationID [][32]byte, nodeID [][]byte) (*IValidatorManagerInitialValidatorCreatedIterator, error) { + + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + var nodeIDRule []interface{} + for _, nodeIDItem := range nodeID { + nodeIDRule = append(nodeIDRule, nodeIDItem) + } + + logs, sub, err := _IValidatorManager.contract.FilterLogs(opts, "InitialValidatorCreated", validationIDRule, nodeIDRule) + if err != nil { + return nil, err + } + return &IValidatorManagerInitialValidatorCreatedIterator{contract: _IValidatorManager.contract, event: "InitialValidatorCreated", logs: logs, sub: sub}, nil +} + +// WatchInitialValidatorCreated is a free log subscription operation binding the contract event 0x9d47fef9da077661546e646d61830bfcbda90506c2e5eed38195e82c4eb1cbdf. +// +// Solidity: event InitialValidatorCreated(bytes32 indexed validationID, bytes indexed nodeID, uint256 weight) +func (_IValidatorManager *IValidatorManagerFilterer) WatchInitialValidatorCreated(opts *bind.WatchOpts, sink chan<- *IValidatorManagerInitialValidatorCreated, validationID [][32]byte, nodeID [][]byte) (event.Subscription, error) { + + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + var nodeIDRule []interface{} + for _, nodeIDItem := range nodeID { + nodeIDRule = append(nodeIDRule, nodeIDItem) + } + + logs, sub, err := _IValidatorManager.contract.WatchLogs(opts, "InitialValidatorCreated", validationIDRule, nodeIDRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(IValidatorManagerInitialValidatorCreated) + if err := _IValidatorManager.contract.UnpackLog(event, "InitialValidatorCreated", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseInitialValidatorCreated is a log parse operation binding the contract event 0x9d47fef9da077661546e646d61830bfcbda90506c2e5eed38195e82c4eb1cbdf. +// +// Solidity: event InitialValidatorCreated(bytes32 indexed validationID, bytes indexed nodeID, uint256 weight) +func (_IValidatorManager *IValidatorManagerFilterer) ParseInitialValidatorCreated(log types.Log) (*IValidatorManagerInitialValidatorCreated, error) { + event := new(IValidatorManagerInitialValidatorCreated) + if err := _IValidatorManager.contract.UnpackLog(event, "InitialValidatorCreated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IValidatorManagerValidationPeriodCreatedIterator is returned from FilterValidationPeriodCreated and is used to iterate over the raw logs and unpacked data for ValidationPeriodCreated events raised by the IValidatorManager contract. +type IValidatorManagerValidationPeriodCreatedIterator struct { + Event *IValidatorManagerValidationPeriodCreated // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *IValidatorManagerValidationPeriodCreatedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(IValidatorManagerValidationPeriodCreated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(IValidatorManagerValidationPeriodCreated) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *IValidatorManagerValidationPeriodCreatedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IValidatorManagerValidationPeriodCreatedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IValidatorManagerValidationPeriodCreated represents a ValidationPeriodCreated event raised by the IValidatorManager contract. +type IValidatorManagerValidationPeriodCreated struct { + ValidationID [32]byte + NodeID common.Hash + RegisterValidationMessageID [32]byte + Weight *big.Int + RegistrationExpiry uint64 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterValidationPeriodCreated is a free log retrieval operation binding the contract event 0xb77297e3befc691bfc864a81e241f83e2ef722b6e7becaa2ecec250c6d52b430. +// +// Solidity: event ValidationPeriodCreated(bytes32 indexed validationID, bytes indexed nodeID, bytes32 indexed registerValidationMessageID, uint256 weight, uint64 registrationExpiry) +func (_IValidatorManager *IValidatorManagerFilterer) FilterValidationPeriodCreated(opts *bind.FilterOpts, validationID [][32]byte, nodeID [][]byte, registerValidationMessageID [][32]byte) (*IValidatorManagerValidationPeriodCreatedIterator, error) { + + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + var nodeIDRule []interface{} + for _, nodeIDItem := range nodeID { + nodeIDRule = append(nodeIDRule, nodeIDItem) + } + var registerValidationMessageIDRule []interface{} + for _, registerValidationMessageIDItem := range registerValidationMessageID { + registerValidationMessageIDRule = append(registerValidationMessageIDRule, registerValidationMessageIDItem) + } + + logs, sub, err := _IValidatorManager.contract.FilterLogs(opts, "ValidationPeriodCreated", validationIDRule, nodeIDRule, registerValidationMessageIDRule) + if err != nil { + return nil, err + } + return &IValidatorManagerValidationPeriodCreatedIterator{contract: _IValidatorManager.contract, event: "ValidationPeriodCreated", logs: logs, sub: sub}, nil +} + +// WatchValidationPeriodCreated is a free log subscription operation binding the contract event 0xb77297e3befc691bfc864a81e241f83e2ef722b6e7becaa2ecec250c6d52b430. +// +// Solidity: event ValidationPeriodCreated(bytes32 indexed validationID, bytes indexed nodeID, bytes32 indexed registerValidationMessageID, uint256 weight, uint64 registrationExpiry) +func (_IValidatorManager *IValidatorManagerFilterer) WatchValidationPeriodCreated(opts *bind.WatchOpts, sink chan<- *IValidatorManagerValidationPeriodCreated, validationID [][32]byte, nodeID [][]byte, registerValidationMessageID [][32]byte) (event.Subscription, error) { + + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + var nodeIDRule []interface{} + for _, nodeIDItem := range nodeID { + nodeIDRule = append(nodeIDRule, nodeIDItem) + } + var registerValidationMessageIDRule []interface{} + for _, registerValidationMessageIDItem := range registerValidationMessageID { + registerValidationMessageIDRule = append(registerValidationMessageIDRule, registerValidationMessageIDItem) + } + + logs, sub, err := _IValidatorManager.contract.WatchLogs(opts, "ValidationPeriodCreated", validationIDRule, nodeIDRule, registerValidationMessageIDRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(IValidatorManagerValidationPeriodCreated) + if err := _IValidatorManager.contract.UnpackLog(event, "ValidationPeriodCreated", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseValidationPeriodCreated is a log parse operation binding the contract event 0xb77297e3befc691bfc864a81e241f83e2ef722b6e7becaa2ecec250c6d52b430. +// +// Solidity: event ValidationPeriodCreated(bytes32 indexed validationID, bytes indexed nodeID, bytes32 indexed registerValidationMessageID, uint256 weight, uint64 registrationExpiry) +func (_IValidatorManager *IValidatorManagerFilterer) ParseValidationPeriodCreated(log types.Log) (*IValidatorManagerValidationPeriodCreated, error) { + event := new(IValidatorManagerValidationPeriodCreated) + if err := _IValidatorManager.contract.UnpackLog(event, "ValidationPeriodCreated", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IValidatorManagerValidationPeriodEndedIterator is returned from FilterValidationPeriodEnded and is used to iterate over the raw logs and unpacked data for ValidationPeriodEnded events raised by the IValidatorManager contract. +type IValidatorManagerValidationPeriodEndedIterator struct { + Event *IValidatorManagerValidationPeriodEnded // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *IValidatorManagerValidationPeriodEndedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(IValidatorManagerValidationPeriodEnded) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(IValidatorManagerValidationPeriodEnded) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *IValidatorManagerValidationPeriodEndedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IValidatorManagerValidationPeriodEndedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IValidatorManagerValidationPeriodEnded represents a ValidationPeriodEnded event raised by the IValidatorManager contract. +type IValidatorManagerValidationPeriodEnded struct { + ValidationID [32]byte + Status uint8 + Raw types.Log // Blockchain specific contextual infos +} + +// FilterValidationPeriodEnded is a free log retrieval operation binding the contract event 0x1c08e59656f1a18dc2da76826cdc52805c43e897a17c50faefb8ab3c1526cc16. +// +// Solidity: event ValidationPeriodEnded(bytes32 indexed validationID, uint8 indexed status) +func (_IValidatorManager *IValidatorManagerFilterer) FilterValidationPeriodEnded(opts *bind.FilterOpts, validationID [][32]byte, status []uint8) (*IValidatorManagerValidationPeriodEndedIterator, error) { + + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + var statusRule []interface{} + for _, statusItem := range status { + statusRule = append(statusRule, statusItem) + } + + logs, sub, err := _IValidatorManager.contract.FilterLogs(opts, "ValidationPeriodEnded", validationIDRule, statusRule) + if err != nil { + return nil, err + } + return &IValidatorManagerValidationPeriodEndedIterator{contract: _IValidatorManager.contract, event: "ValidationPeriodEnded", logs: logs, sub: sub}, nil +} + +// WatchValidationPeriodEnded is a free log subscription operation binding the contract event 0x1c08e59656f1a18dc2da76826cdc52805c43e897a17c50faefb8ab3c1526cc16. +// +// Solidity: event ValidationPeriodEnded(bytes32 indexed validationID, uint8 indexed status) +func (_IValidatorManager *IValidatorManagerFilterer) WatchValidationPeriodEnded(opts *bind.WatchOpts, sink chan<- *IValidatorManagerValidationPeriodEnded, validationID [][32]byte, status []uint8) (event.Subscription, error) { + + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + var statusRule []interface{} + for _, statusItem := range status { + statusRule = append(statusRule, statusItem) + } + + logs, sub, err := _IValidatorManager.contract.WatchLogs(opts, "ValidationPeriodEnded", validationIDRule, statusRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(IValidatorManagerValidationPeriodEnded) + if err := _IValidatorManager.contract.UnpackLog(event, "ValidationPeriodEnded", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseValidationPeriodEnded is a log parse operation binding the contract event 0x1c08e59656f1a18dc2da76826cdc52805c43e897a17c50faefb8ab3c1526cc16. +// +// Solidity: event ValidationPeriodEnded(bytes32 indexed validationID, uint8 indexed status) +func (_IValidatorManager *IValidatorManagerFilterer) ParseValidationPeriodEnded(log types.Log) (*IValidatorManagerValidationPeriodEnded, error) { + event := new(IValidatorManagerValidationPeriodEnded) + if err := _IValidatorManager.contract.UnpackLog(event, "ValidationPeriodEnded", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IValidatorManagerValidationPeriodRegisteredIterator is returned from FilterValidationPeriodRegistered and is used to iterate over the raw logs and unpacked data for ValidationPeriodRegistered events raised by the IValidatorManager contract. +type IValidatorManagerValidationPeriodRegisteredIterator struct { + Event *IValidatorManagerValidationPeriodRegistered // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *IValidatorManagerValidationPeriodRegisteredIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(IValidatorManagerValidationPeriodRegistered) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(IValidatorManagerValidationPeriodRegistered) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *IValidatorManagerValidationPeriodRegisteredIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IValidatorManagerValidationPeriodRegisteredIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IValidatorManagerValidationPeriodRegistered represents a ValidationPeriodRegistered event raised by the IValidatorManager contract. +type IValidatorManagerValidationPeriodRegistered struct { + ValidationID [32]byte + Weight *big.Int + Timestamp *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterValidationPeriodRegistered is a free log retrieval operation binding the contract event 0xf8fd1c90fb9cfa2ca2358fdf5806b086ad43315d92b221c929efc7f105ce7568. +// +// Solidity: event ValidationPeriodRegistered(bytes32 indexed validationID, uint256 weight, uint256 timestamp) +func (_IValidatorManager *IValidatorManagerFilterer) FilterValidationPeriodRegistered(opts *bind.FilterOpts, validationID [][32]byte) (*IValidatorManagerValidationPeriodRegisteredIterator, error) { + + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + + logs, sub, err := _IValidatorManager.contract.FilterLogs(opts, "ValidationPeriodRegistered", validationIDRule) + if err != nil { + return nil, err + } + return &IValidatorManagerValidationPeriodRegisteredIterator{contract: _IValidatorManager.contract, event: "ValidationPeriodRegistered", logs: logs, sub: sub}, nil +} + +// WatchValidationPeriodRegistered is a free log subscription operation binding the contract event 0xf8fd1c90fb9cfa2ca2358fdf5806b086ad43315d92b221c929efc7f105ce7568. +// +// Solidity: event ValidationPeriodRegistered(bytes32 indexed validationID, uint256 weight, uint256 timestamp) +func (_IValidatorManager *IValidatorManagerFilterer) WatchValidationPeriodRegistered(opts *bind.WatchOpts, sink chan<- *IValidatorManagerValidationPeriodRegistered, validationID [][32]byte) (event.Subscription, error) { + + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + + logs, sub, err := _IValidatorManager.contract.WatchLogs(opts, "ValidationPeriodRegistered", validationIDRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(IValidatorManagerValidationPeriodRegistered) + if err := _IValidatorManager.contract.UnpackLog(event, "ValidationPeriodRegistered", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseValidationPeriodRegistered is a log parse operation binding the contract event 0xf8fd1c90fb9cfa2ca2358fdf5806b086ad43315d92b221c929efc7f105ce7568. +// +// Solidity: event ValidationPeriodRegistered(bytes32 indexed validationID, uint256 weight, uint256 timestamp) +func (_IValidatorManager *IValidatorManagerFilterer) ParseValidationPeriodRegistered(log types.Log) (*IValidatorManagerValidationPeriodRegistered, error) { + event := new(IValidatorManagerValidationPeriodRegistered) + if err := _IValidatorManager.contract.UnpackLog(event, "ValidationPeriodRegistered", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IValidatorManagerValidatorRemovalInitializedIterator is returned from FilterValidatorRemovalInitialized and is used to iterate over the raw logs and unpacked data for ValidatorRemovalInitialized events raised by the IValidatorManager contract. +type IValidatorManagerValidatorRemovalInitializedIterator struct { + Event *IValidatorManagerValidatorRemovalInitialized // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *IValidatorManagerValidatorRemovalInitializedIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(IValidatorManagerValidatorRemovalInitialized) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(IValidatorManagerValidatorRemovalInitialized) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *IValidatorManagerValidatorRemovalInitializedIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IValidatorManagerValidatorRemovalInitializedIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IValidatorManagerValidatorRemovalInitialized represents a ValidatorRemovalInitialized event raised by the IValidatorManager contract. +type IValidatorManagerValidatorRemovalInitialized struct { + ValidationID [32]byte + SetWeightMessageID [32]byte + Weight *big.Int + EndTime *big.Int + Raw types.Log // Blockchain specific contextual infos +} + +// FilterValidatorRemovalInitialized is a free log retrieval operation binding the contract event 0x13d58394cf269d48bcf927959a29a5ffee7c9924dafff8927ecdf3c48ffa7c67. +// +// Solidity: event ValidatorRemovalInitialized(bytes32 indexed validationID, bytes32 indexed setWeightMessageID, uint256 weight, uint256 endTime) +func (_IValidatorManager *IValidatorManagerFilterer) FilterValidatorRemovalInitialized(opts *bind.FilterOpts, validationID [][32]byte, setWeightMessageID [][32]byte) (*IValidatorManagerValidatorRemovalInitializedIterator, error) { + + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + var setWeightMessageIDRule []interface{} + for _, setWeightMessageIDItem := range setWeightMessageID { + setWeightMessageIDRule = append(setWeightMessageIDRule, setWeightMessageIDItem) + } + + logs, sub, err := _IValidatorManager.contract.FilterLogs(opts, "ValidatorRemovalInitialized", validationIDRule, setWeightMessageIDRule) + if err != nil { + return nil, err + } + return &IValidatorManagerValidatorRemovalInitializedIterator{contract: _IValidatorManager.contract, event: "ValidatorRemovalInitialized", logs: logs, sub: sub}, nil +} + +// WatchValidatorRemovalInitialized is a free log subscription operation binding the contract event 0x13d58394cf269d48bcf927959a29a5ffee7c9924dafff8927ecdf3c48ffa7c67. +// +// Solidity: event ValidatorRemovalInitialized(bytes32 indexed validationID, bytes32 indexed setWeightMessageID, uint256 weight, uint256 endTime) +func (_IValidatorManager *IValidatorManagerFilterer) WatchValidatorRemovalInitialized(opts *bind.WatchOpts, sink chan<- *IValidatorManagerValidatorRemovalInitialized, validationID [][32]byte, setWeightMessageID [][32]byte) (event.Subscription, error) { + + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + var setWeightMessageIDRule []interface{} + for _, setWeightMessageIDItem := range setWeightMessageID { + setWeightMessageIDRule = append(setWeightMessageIDRule, setWeightMessageIDItem) + } + + logs, sub, err := _IValidatorManager.contract.WatchLogs(opts, "ValidatorRemovalInitialized", validationIDRule, setWeightMessageIDRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(IValidatorManagerValidatorRemovalInitialized) + if err := _IValidatorManager.contract.UnpackLog(event, "ValidatorRemovalInitialized", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseValidatorRemovalInitialized is a log parse operation binding the contract event 0x13d58394cf269d48bcf927959a29a5ffee7c9924dafff8927ecdf3c48ffa7c67. +// +// Solidity: event ValidatorRemovalInitialized(bytes32 indexed validationID, bytes32 indexed setWeightMessageID, uint256 weight, uint256 endTime) +func (_IValidatorManager *IValidatorManagerFilterer) ParseValidatorRemovalInitialized(log types.Log) (*IValidatorManagerValidatorRemovalInitialized, error) { + event := new(IValidatorManagerValidatorRemovalInitialized) + if err := _IValidatorManager.contract.UnpackLog(event, "ValidatorRemovalInitialized", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} + +// IValidatorManagerValidatorWeightUpdateIterator is returned from FilterValidatorWeightUpdate and is used to iterate over the raw logs and unpacked data for ValidatorWeightUpdate events raised by the IValidatorManager contract. +type IValidatorManagerValidatorWeightUpdateIterator struct { + Event *IValidatorManagerValidatorWeightUpdate // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub interfaces.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *IValidatorManagerValidatorWeightUpdateIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(IValidatorManagerValidatorWeightUpdate) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(IValidatorManagerValidatorWeightUpdate) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *IValidatorManagerValidatorWeightUpdateIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *IValidatorManagerValidatorWeightUpdateIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// IValidatorManagerValidatorWeightUpdate represents a ValidatorWeightUpdate event raised by the IValidatorManager contract. +type IValidatorManagerValidatorWeightUpdate struct { + ValidationID [32]byte + Nonce uint64 + ValidatorWeight uint64 + SetWeightMessageID [32]byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterValidatorWeightUpdate is a free log retrieval operation binding the contract event 0x07de5ff35a674a8005e661f3333c907ca6333462808762d19dc7b3abb1a8c1df. +// +// Solidity: event ValidatorWeightUpdate(bytes32 indexed validationID, uint64 indexed nonce, uint64 validatorWeight, bytes32 setWeightMessageID) +func (_IValidatorManager *IValidatorManagerFilterer) FilterValidatorWeightUpdate(opts *bind.FilterOpts, validationID [][32]byte, nonce []uint64) (*IValidatorManagerValidatorWeightUpdateIterator, error) { + + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + var nonceRule []interface{} + for _, nonceItem := range nonce { + nonceRule = append(nonceRule, nonceItem) + } + + logs, sub, err := _IValidatorManager.contract.FilterLogs(opts, "ValidatorWeightUpdate", validationIDRule, nonceRule) + if err != nil { + return nil, err + } + return &IValidatorManagerValidatorWeightUpdateIterator{contract: _IValidatorManager.contract, event: "ValidatorWeightUpdate", logs: logs, sub: sub}, nil +} + +// WatchValidatorWeightUpdate is a free log subscription operation binding the contract event 0x07de5ff35a674a8005e661f3333c907ca6333462808762d19dc7b3abb1a8c1df. +// +// Solidity: event ValidatorWeightUpdate(bytes32 indexed validationID, uint64 indexed nonce, uint64 validatorWeight, bytes32 setWeightMessageID) +func (_IValidatorManager *IValidatorManagerFilterer) WatchValidatorWeightUpdate(opts *bind.WatchOpts, sink chan<- *IValidatorManagerValidatorWeightUpdate, validationID [][32]byte, nonce []uint64) (event.Subscription, error) { + + var validationIDRule []interface{} + for _, validationIDItem := range validationID { + validationIDRule = append(validationIDRule, validationIDItem) + } + var nonceRule []interface{} + for _, nonceItem := range nonce { + nonceRule = append(nonceRule, nonceItem) + } + + logs, sub, err := _IValidatorManager.contract.WatchLogs(opts, "ValidatorWeightUpdate", validationIDRule, nonceRule) + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(IValidatorManagerValidatorWeightUpdate) + if err := _IValidatorManager.contract.UnpackLog(event, "ValidatorWeightUpdate", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ParseValidatorWeightUpdate is a log parse operation binding the contract event 0x07de5ff35a674a8005e661f3333c907ca6333462808762d19dc7b3abb1a8c1df. +// +// Solidity: event ValidatorWeightUpdate(bytes32 indexed validationID, uint64 indexed nonce, uint64 validatorWeight, bytes32 setWeightMessageID) +func (_IValidatorManager *IValidatorManagerFilterer) ParseValidatorWeightUpdate(log types.Log) (*IValidatorManagerValidatorWeightUpdate, error) { + event := new(IValidatorManagerValidatorWeightUpdate) + if err := _IValidatorManager.contract.UnpackLog(event, "ValidatorWeightUpdate", log); err != nil { + return nil, err + } + event.Raw = log + return event, nil +} diff --git a/scripts/abi_bindings.sh b/scripts/abi_bindings.sh index 8a79ff82a..762af320d 100755 --- a/scripts/abi_bindings.sh +++ b/scripts/abi_bindings.sh @@ -17,8 +17,8 @@ export ARCH=$(uname -m) echo "ARCH set to $ARCH" DEFAULT_CONTRACT_LIST="TeleporterMessenger TeleporterRegistry ExampleERC20 ExampleRewardCalculator TestMessenger ValidatorSetSig NativeTokenStakingManager ERC20TokenStakingManager PoAValidatorManager -TokenHome TokenRemote ERC20TokenHome ERC20TokenHomeUpgradeable ERC20TokenRemote ERC20TokenRemoteUpgradeable NativeTokenHome NativeTokenHomeUpgradeable NativeTokenRemote NativeTokenRemoteUpgradeable WrappedNativeToken MockERC20SendAndCallReceiver MockNativeSendAndCallReceiver ExampleERC20Decimals" - +TokenHome TokenRemote ERC20TokenHome ERC20TokenHomeUpgradeable ERC20TokenRemote ERC20TokenRemoteUpgradeable NativeTokenHome NativeTokenHomeUpgradeable NativeTokenRemote NativeTokenRemoteUpgradeable +WrappedNativeToken MockERC20SendAndCallReceiver MockNativeSendAndCallReceiver ExampleERC20Decimals IValidatorManager IPoSValidatorManager" PROXY_LIST="TransparentUpgradeableProxy ProxyAdmin" SUBNET_EVM_LIST="INativeMinter" @@ -139,21 +139,30 @@ function generate_bindings() { # Filter out the contract we are generating bindings for filtered_contracts=$(remove_matching_string $contracts $contract_name) - - # Filter out external libraries - for lib in $EXTERNAL_LIBS; do - filtered_contracts=$(remove_matching_string $filtered_contracts $lib) - done - - echo "Generating Go bindings for $contract_name..." + gen_path=$TELEPORTER_PATH/abi-bindings/go/$dir/$contract_name mkdir -p $gen_path - - $GOPATH/bin/abigen --pkg $(convertToLower $contract_name) \ - --combined-json $combined_json \ - --type $contract_name \ - --out $gen_path/$contract_name.go \ - --exc $filtered_contracts + echo "Generating Go bindings for $contract_name..." + + if [ -z "$filtered_contracts" ]; then + echo "No external libraries found" + $GOPATH/bin/abigen --pkg $(convertToLower $contract_name) \ + --combined-json $combined_json \ + --type $contract_name \ + --out $gen_path/$contract_name.go + else + # Filter out external libraries + for lib in $EXTERNAL_LIBS; do + filtered_contracts=$(remove_matching_string $filtered_contracts $lib) + done + + $GOPATH/bin/abigen --pkg $(convertToLower $contract_name) \ + --combined-json $combined_json \ + --type $contract_name \ + --out $gen_path/$contract_name.go \ + --exc $filtered_contracts + fi + echo "Done generating Go bindings for $contract_name." done } diff --git a/tests/flows/validator-manager/poa_to_pos.go b/tests/flows/validator-manager/poa_to_pos.go index 7114f4af2..d7efbc94d 100644 --- a/tests/flows/validator-manager/poa_to_pos.go +++ b/tests/flows/validator-manager/poa_to_pos.go @@ -114,7 +114,6 @@ func PoAMigrationToPoS(network *localnetwork.LocalNetwork) { fundedKey, subnetAInfo, pChainInfo, - poaValidatorManager, proxyAddress, network.GetNetworkID(), signatureAggregator, diff --git a/tests/network/network.go b/tests/network/network.go index 0a8851c6a..43e489b16 100644 --- a/tests/network/network.go +++ b/tests/network/network.go @@ -32,6 +32,7 @@ import ( . "github.com/onsi/gomega" ) +// TODO: Add a mapping of subnetID -> {ivalidatormanager, address} // Implements Network, pointing to the network setup in local_network_setup.go type LocalNetwork struct { tmpnet.Network diff --git a/tests/suites/teleporter/teleporter_suite_test.go b/tests/suites/teleporter/teleporter_suite_test.go index 069265493..ae4ff1bd8 100644 --- a/tests/suites/teleporter/teleporter_suite_test.go +++ b/tests/suites/teleporter/teleporter_suite_test.go @@ -222,17 +222,17 @@ var _ = ginkgo.BeforeSuite(func() { utils.PChainProposerVMWorkaround(pChainWallet) utils.AdvanceProposerVM(ctx, subnet, fundedKey, 5) - utils.InitializePoAValidatorSet( + utils.InitializeValidatorSet( ctx, fundedKey, subnet, utils.GetPChainInfo(cChainInfo), - vdrManager, vdrManagerAddress, LocalNetworkInstance.GetNetworkID(), signatureAggregator, nodes, ) + // TODO: Remove the bootstrap node as a subnet validator } log.Info("Set up ginkgo before suite") }) diff --git a/tests/utils/validator_manager.go b/tests/utils/validator_manager.go index 8f9789cab..470e7bc27 100644 --- a/tests/utils/validator_manager.go +++ b/tests/utils/validator_manager.go @@ -37,6 +37,7 @@ import ( examplerewardcalculator "github.com/ava-labs/teleporter/abi-bindings/go/validator-manager/ExampleRewardCalculator" nativetokenstakingmanager "github.com/ava-labs/teleporter/abi-bindings/go/validator-manager/NativeTokenStakingManager" poavalidatormanager "github.com/ava-labs/teleporter/abi-bindings/go/validator-manager/PoAValidatorManager" + ivalidatormanager "github.com/ava-labs/teleporter/abi-bindings/go/validator-manager/interfaces/IValidatorManager" "github.com/ava-labs/teleporter/tests/interfaces" "github.com/ethereum/go-ethereum/common" "google.golang.org/protobuf/proto" @@ -277,161 +278,11 @@ func DeployExampleRewardCalculator( // Validator Set Initialization utils // -func InitializeNativeTokenValidatorSet( +func InitializeValidatorSet( ctx context.Context, senderKey *ecdsa.PrivateKey, subnetInfo interfaces.SubnetTestInfo, pChainInfo interfaces.SubnetTestInfo, - validatorManager *nativetokenstakingmanager.NativeTokenStakingManager, - validatorManagerAddress common.Address, - networkID uint32, - signatureAggregator *aggregator.SignatureAggregator, - nodes []Node, -) []ids.ID { - initialValidators := make([]warpMessage.SubnetConversionValidatorData, len(nodes)) - initialValidatorsABI := make([]nativetokenstakingmanager.InitialValidator, len(nodes)) - for i, node := range nodes { - initialValidators[i] = warpMessage.SubnetConversionValidatorData{ - NodeID: node.NodeID.Bytes(), - BLSPublicKey: node.NodePoP.PublicKey, - Weight: nodes[i].Weight, - } - initialValidatorsABI[i] = nativetokenstakingmanager.InitialValidator{ - NodeID: node.NodeID.Bytes(), - BlsPublicKey: node.NodePoP.PublicKey[:], - Weight: nodes[i].Weight, - } - } - - subnetConversionData := warpMessage.SubnetConversionData{ - SubnetID: subnetInfo.SubnetID, - ManagerChainID: subnetInfo.BlockchainID, - ManagerAddress: validatorManagerAddress[:], - Validators: initialValidators, - } - subnetConversionDataABI := nativetokenstakingmanager.ConversionData{ - SubnetID: subnetInfo.SubnetID, - ValidatorManagerBlockchainID: subnetInfo.BlockchainID, - ValidatorManagerAddress: validatorManagerAddress, - InitialValidators: initialValidatorsABI, - } - subnetConversionID, err := warpMessage.SubnetConversionID(subnetConversionData) - Expect(err).Should(BeNil()) - subnetConversionSignedMessage := ConstructSubnetConversionMessage( - subnetConversionID, - subnetInfo, - pChainInfo, - networkID, - signatureAggregator, - ) - // Deliver the Warp message to the subnet - receipt := DeliverNativeTokenSubnetConversion( - ctx, - senderKey, - subnetInfo, - validatorManagerAddress, - subnetConversionSignedMessage, - subnetConversionDataABI, - ) - initialValidatorCreatedEvent, err := GetEventFromLogs( - receipt.Logs, - validatorManager.ParseInitialValidatorCreated, - ) - Expect(err).Should(BeNil()) - var validationIDs []ids.ID - for i := range nodes { - validationIDs = append(validationIDs, subnetInfo.SubnetID.Append(uint32(i))) - } - - Expect(initialValidatorCreatedEvent.Weight).Should(Equal(new(big.Int).SetUint64(nodes[0].Weight))) - - emittedValidationID := ids.ID(initialValidatorCreatedEvent.ValidationID) - Expect(emittedValidationID).Should(Equal(validationIDs[0])) - - return validationIDs -} - -func InitializeERC20TokenValidatorSet( - ctx context.Context, - senderKey *ecdsa.PrivateKey, - subnetInfo interfaces.SubnetTestInfo, - pChainInfo interfaces.SubnetTestInfo, - validatorManager *erc20tokenstakingmanager.ERC20TokenStakingManager, - validatorManagerAddress common.Address, - networkID uint32, - signatureAggregator *aggregator.SignatureAggregator, - nodes []Node, -) []ids.ID { - initialValidators := make([]warpMessage.SubnetConversionValidatorData, len(nodes)) - initialValidatorsABI := make([]erc20tokenstakingmanager.InitialValidator, len(nodes)) - for i, node := range nodes { - initialValidators[i] = warpMessage.SubnetConversionValidatorData{ - NodeID: node.NodeID.Bytes(), - BLSPublicKey: node.NodePoP.PublicKey, - Weight: nodes[i].Weight, - } - initialValidatorsABI[i] = erc20tokenstakingmanager.InitialValidator{ - NodeID: node.NodeID.Bytes(), - BlsPublicKey: node.NodePoP.PublicKey[:], - Weight: nodes[i].Weight, - } - } - - subnetConversionData := warpMessage.SubnetConversionData{ - SubnetID: subnetInfo.SubnetID, - ManagerChainID: subnetInfo.BlockchainID, - ManagerAddress: validatorManagerAddress[:], - Validators: initialValidators, - } - subnetConversionDataABI := erc20tokenstakingmanager.ConversionData{ - SubnetID: subnetInfo.SubnetID, - ValidatorManagerBlockchainID: subnetInfo.BlockchainID, - ValidatorManagerAddress: validatorManagerAddress, - InitialValidators: initialValidatorsABI, - } - subnetConversionID, err := warpMessage.SubnetConversionID(subnetConversionData) - Expect(err).Should(BeNil()) - subnetConversionSignedMessage := ConstructSubnetConversionMessage( - subnetConversionID, - subnetInfo, - pChainInfo, - networkID, - signatureAggregator, - ) - - // Deliver the Warp message to the subnet - receipt := DeliverERC20TokenSubnetConversion( - ctx, - senderKey, - subnetInfo, - validatorManagerAddress, - subnetConversionSignedMessage, - subnetConversionDataABI, - ) - initialValidatorCreatedEvent, err := GetEventFromLogs( - receipt.Logs, - validatorManager.ParseInitialValidatorCreated, - ) - Expect(err).Should(BeNil()) - var validationIDs []ids.ID - for i := range nodes { - validationIDs = append(validationIDs, subnetInfo.SubnetID.Append(uint32(i))) - } - - Expect(initialValidatorCreatedEvent.Weight).Should(Equal(new(big.Int).SetUint64(nodes[0].Weight))) - - emittedValidationID := ids.ID(initialValidatorCreatedEvent.ValidationID) - Expect(emittedValidationID).Should(Equal(validationIDs[0])) - - return validationIDs -} - -func InitializePoAValidatorSet( - ctx context.Context, - senderKey *ecdsa.PrivateKey, - subnetInfo interfaces.SubnetTestInfo, - pChainInfo interfaces.SubnetTestInfo, - validatorManager *poavalidatormanager.PoAValidatorManager, validatorManagerAddress common.Address, networkID uint32, signatureAggregator *aggregator.SignatureAggregator, @@ -439,14 +290,14 @@ func InitializePoAValidatorSet( ) []ids.ID { log.Println("Initializing PoA validator set") initialValidators := make([]warpMessage.SubnetConversionValidatorData, len(nodes)) - initialValidatorsABI := make([]poavalidatormanager.InitialValidator, len(nodes)) + initialValidatorsABI := make([]ivalidatormanager.InitialValidator, len(nodes)) for i, node := range nodes { initialValidators[i] = warpMessage.SubnetConversionValidatorData{ NodeID: node.NodeID.Bytes(), BLSPublicKey: node.NodePoP.PublicKey, Weight: nodes[i].Weight, } - initialValidatorsABI[i] = poavalidatormanager.InitialValidator{ + initialValidatorsABI[i] = ivalidatormanager.InitialValidator{ NodeID: node.NodeID.Bytes(), BlsPublicKey: node.NodePoP.PublicKey[:], Weight: nodes[i].Weight, @@ -459,7 +310,7 @@ func InitializePoAValidatorSet( ManagerAddress: validatorManagerAddress[:], Validators: initialValidators, } - subnetConversionDataABI := poavalidatormanager.ConversionData{ + subnetConversionDataABI := ivalidatormanager.ConversionData{ SubnetID: subnetInfo.SubnetID, ValidatorManagerBlockchainID: subnetInfo.BlockchainID, ValidatorManagerAddress: validatorManagerAddress, @@ -475,7 +326,7 @@ func InitializePoAValidatorSet( signatureAggregator, ) // Deliver the Warp message to the subnet - receipt := DeliverPoASubnetConversion( + receipt := DeliverSubnetConversion( ctx, senderKey, subnetInfo, @@ -483,9 +334,11 @@ func InitializePoAValidatorSet( subnetConversionSignedMessage, subnetConversionDataABI, ) + manager, err := ivalidatormanager.NewIValidatorManager(validatorManagerAddress, subnetInfo.RPCClient) + Expect(err).Should(BeNil()) initialValidatorCreatedEvent, err := GetEventFromLogs( receipt.Logs, - validatorManager.ParseInitialValidatorCreated, + manager.ParseInitialValidatorCreated, ) Expect(err).Should(BeNil()) var validationIDs []ids.ID @@ -501,59 +354,15 @@ func InitializePoAValidatorSet( return validationIDs } -func DeliverNativeTokenSubnetConversion( - ctx context.Context, - senderKey *ecdsa.PrivateKey, - subnet interfaces.SubnetTestInfo, - validatorManagerAddress common.Address, - subnetConversionSignedMessage *avalancheWarp.Message, - subnetConversionData nativetokenstakingmanager.ConversionData, -) *types.Receipt { - abi, err := nativetokenstakingmanager.NativeTokenStakingManagerMetaData.GetAbi() - Expect(err).Should(BeNil()) - callData, err := abi.Pack("initializeValidatorSet", subnetConversionData, uint32(0)) - Expect(err).Should(BeNil()) - return CallWarpReceiver( - ctx, - callData, - senderKey, - subnet, - validatorManagerAddress, - subnetConversionSignedMessage, - ) -} - -func DeliverERC20TokenSubnetConversion( +func DeliverSubnetConversion( ctx context.Context, senderKey *ecdsa.PrivateKey, subnet interfaces.SubnetTestInfo, validatorManagerAddress common.Address, subnetConversionSignedMessage *avalancheWarp.Message, - subnetConversionData erc20tokenstakingmanager.ConversionData, + subnetConversionData ivalidatormanager.ConversionData, ) *types.Receipt { - abi, err := erc20tokenstakingmanager.ERC20TokenStakingManagerMetaData.GetAbi() - Expect(err).Should(BeNil()) - callData, err := abi.Pack("initializeValidatorSet", subnetConversionData, uint32(0)) - Expect(err).Should(BeNil()) - return CallWarpReceiver( - ctx, - callData, - senderKey, - subnet, - validatorManagerAddress, - subnetConversionSignedMessage, - ) -} - -func DeliverPoASubnetConversion( - ctx context.Context, - senderKey *ecdsa.PrivateKey, - subnet interfaces.SubnetTestInfo, - validatorManagerAddress common.Address, - subnetConversionSignedMessage *avalancheWarp.Message, - subnetConversionData poavalidatormanager.ConversionData, -) *types.Receipt { - abi, err := poavalidatormanager.PoAValidatorManagerMetaData.GetAbi() + abi, err := ivalidatormanager.IValidatorManagerMetaData.GetAbi() Expect(err).Should(BeNil()) callData, err := abi.Pack("initializeValidatorSet", subnetConversionData, uint32(0)) Expect(err).Should(BeNil()) @@ -1089,7 +898,7 @@ func CompleteEndNativeValidation( stakingManagerContractAddress common.Address, registrationSignedMessage *avalancheWarp.Message, ) *types.Receipt { - abi, err := nativetokenstakingmanager.NativeTokenStakingManagerMetaData.GetAbi() + abi, err := ivalidatormanager.IValidatorManagerMetaData.GetAbi() Expect(err).Should(BeNil()) callData, err := abi.Pack("completeEndValidation", uint32(0)) Expect(err).Should(BeNil()) From 901282528488065f936592dd5029c1183ee10ca4 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Thu, 7 Nov 2024 16:50:48 -0600 Subject: [PATCH 03/34] consolidate deploy methods --- .../validator-manager/erc20_token_staking.go | 3 +- .../validator-manager/native_token_staking.go | 3 +- tests/flows/validator-manager/poa_to_pos.go | 8 +- .../teleporter/teleporter_suite_test.go | 20 +-- tests/utils/validator_manager.go | 129 +++++++++--------- 5 files changed, 74 insertions(+), 89 deletions(-) diff --git a/tests/flows/validator-manager/erc20_token_staking.go b/tests/flows/validator-manager/erc20_token_staking.go index 4ccf1243b..4358f0c24 100644 --- a/tests/flows/validator-manager/erc20_token_staking.go +++ b/tests/flows/validator-manager/erc20_token_staking.go @@ -62,12 +62,11 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { // Initialize the validator set on the subnet log.Println("Initializing validator set") - initialValidationIDs := utils.InitializeERC20TokenValidatorSet( + initialValidationIDs := utils.InitializeValidatorSet( ctx, fundedKey, subnetAInfo, pChainInfo, - stakingManager, stakingManagerAddress, network.GetNetworkID(), signatureAggregator, diff --git a/tests/flows/validator-manager/native_token_staking.go b/tests/flows/validator-manager/native_token_staking.go index b3ef833a4..c844e5945 100644 --- a/tests/flows/validator-manager/native_token_staking.go +++ b/tests/flows/validator-manager/native_token_staking.go @@ -64,12 +64,11 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { // Initialize the validator set on the subnet log.Println("Initializing validator set") - initialValidationIDs := utils.InitializeNativeTokenValidatorSet( + initialValidationIDs := utils.InitializeValidatorSet( ctx, fundedKey, subnetAInfo, pChainInfo, - stakingManager, stakingManagerAddress, network.GetNetworkID(), signatureAggregator, diff --git a/tests/flows/validator-manager/poa_to_pos.go b/tests/flows/validator-manager/poa_to_pos.go index d7efbc94d..2ae102228 100644 --- a/tests/flows/validator-manager/poa_to_pos.go +++ b/tests/flows/validator-manager/poa_to_pos.go @@ -67,10 +67,11 @@ func PoAMigrationToPoS(network *localnetwork.LocalNetwork) { ) // Deploy PoAValidatorManager contract - implAddress, _ := utils.DeployPoAValidatorManager( + implAddress, _ := utils.DeployValidatorManager( ctx, fundedKey, subnetAInfo, + utils.PoAValidatorManager, ) // Deploy TransparentUpgradeableProxy contract pointing to PoAValidatorManager @@ -109,7 +110,7 @@ func PoAMigrationToPoS(network *localnetwork.LocalNetwork) { // Initialize the validator set on the subnet log.Println("Initializing validator set") - initialValidationIDs := utils.InitializePoAValidatorSet( + initialValidationIDs := utils.InitializeValidatorSet( ctx, fundedKey, subnetAInfo, @@ -183,10 +184,11 @@ func PoAMigrationToPoS(network *localnetwork.LocalNetwork) { */ // Deploy PoSValidatorManager contract - newImplAddress, _ := utils.DeployNativeTokenStakingManager( + newImplAddress, _ := utils.DeployValidatorManager( ctx, fundedKey, subnetAInfo, + utils.NativeTokenStakingManager, ) // Upgrade the TransparentUpgradeableProxy contract to use the new logic contract diff --git a/tests/suites/teleporter/teleporter_suite_test.go b/tests/suites/teleporter/teleporter_suite_test.go index ae4ff1bd8..7af7604c8 100644 --- a/tests/suites/teleporter/teleporter_suite_test.go +++ b/tests/suites/teleporter/teleporter_suite_test.go @@ -17,8 +17,6 @@ import ( "github.com/ava-labs/avalanchego/utils/units" "github.com/ava-labs/avalanchego/vms/platformvm/txs" warpMessage "github.com/ava-labs/avalanchego/vms/platformvm/warp/message" - "github.com/ava-labs/subnet-evm/accounts/abi/bind" - poavalidatormanager "github.com/ava-labs/teleporter/abi-bindings/go/validator-manager/PoAValidatorManager" teleporterFlows "github.com/ava-labs/teleporter/tests/flows/teleporter" registryFlows "github.com/ava-labs/teleporter/tests/flows/teleporter/registry" localnetwork "github.com/ava-labs/teleporter/tests/network" @@ -123,28 +121,12 @@ var _ = ginkgo.BeforeSuite(func() { subnet.SubnetID, }, ) - vdrManagerAddress, vdrManager := utils.DeployPoAValidatorManager( + vdrManagerAddress, _ := utils.DeployAndInitializePoAValidatorManager( ctx, fundedKey, subnet, - ) - opts, err := bind.NewKeyedTransactorWithChainID( - fundedKey, - subnet.EVMChainID, - ) - Expect(err).Should(BeNil()) - - tx, err := vdrManager.Initialize( - opts, - poavalidatormanager.ValidatorManagerSettings{ - SubnetID: subnet.SubnetID, - ChurnPeriodSeconds: uint64(0), - MaximumChurnPercentage: uint8(20), - }, fundedAddress, ) - Expect(err).Should(BeNil()) - utils.WaitForTransactionSuccess(context.Background(), subnet, tx.Hash()) tmpnetNodes := LocalNetworkInstance.GetExtraNodes(2) sort.Slice(tmpnetNodes, func(i, j int) bool { diff --git a/tests/utils/validator_manager.go b/tests/utils/validator_manager.go index 470e7bc27..12fa77141 100644 --- a/tests/utils/validator_manager.go +++ b/tests/utils/validator_manager.go @@ -57,32 +57,74 @@ const ( DefaultPChainAddress string = "P-local18jma8ppw3nhx5r4ap8clazz0dps7rv5u00z96u" ) +type ValidatorManagerConcreteType int + +const ( + PoAValidatorManager ValidatorManagerConcreteType = iota + ERC20TokenStakingManager + NativeTokenStakingManager +) + // // Deployment utils // -func DeployNativeTokenStakingManager( +func DeployValidatorManager( ctx context.Context, senderKey *ecdsa.PrivateKey, subnet interfaces.SubnetTestInfo, -) (common.Address, *nativetokenstakingmanager.NativeTokenStakingManager) { - // Reset the global binary data for better test isolation - nativetokenstakingmanager.NativeTokenStakingManagerBin = - nativetokenstakingmanager.NativeTokenStakingManagerMetaData.Bin - + managerType ValidatorManagerConcreteType, +) (common.Address, *ivalidatormanager.IValidatorManager) { opts, err := bind.NewKeyedTransactorWithChainID(senderKey, subnet.EVMChainID) Expect(err).Should(BeNil()) - address, tx, stakingManager, err := nativetokenstakingmanager.DeployNativeTokenStakingManager( - opts, - subnet.RPCClient, - 0, // ICMInitializable.Allowed + var ( + tx *types.Transaction + address common.Address + validatorManager *ivalidatormanager.IValidatorManager ) + switch managerType { + case PoAValidatorManager: + // Reset the global binary data for better test isolation + poavalidatormanager.PoAValidatorManagerBin = poavalidatormanager.PoAValidatorManagerMetaData.Bin + + address, tx, _, err = poavalidatormanager.DeployPoAValidatorManager( + opts, + subnet.RPCClient, + 0, // ICMInitializable.Allowed + ) + Expect(err).Should(BeNil()) + case ERC20TokenStakingManager: + // Reset the global binary data for better test isolation + erc20tokenstakingmanager.ERC20TokenStakingManagerBin = + erc20tokenstakingmanager.ERC20TokenStakingManagerMetaData.Bin + + address, tx, _, err = erc20tokenstakingmanager.DeployERC20TokenStakingManager( + opts, + subnet.RPCClient, + 0, // ICMInitializable.Allowed + ) + Expect(err).Should(BeNil()) + case NativeTokenStakingManager: + // Reset the global binary data for better test isolation + nativetokenstakingmanager.NativeTokenStakingManagerBin = + nativetokenstakingmanager.NativeTokenStakingManagerMetaData.Bin + + opts, err := bind.NewKeyedTransactorWithChainID(senderKey, subnet.EVMChainID) + Expect(err).Should(BeNil()) + address, tx, _, err = nativetokenstakingmanager.DeployNativeTokenStakingManager( + opts, + subnet.RPCClient, + 0, // ICMInitializable.Allowed + ) + Expect(err).Should(BeNil()) + } + + validatorManager, err = ivalidatormanager.NewIValidatorManager(address, subnet.RPCClient) Expect(err).Should(BeNil()) // Wait for the transaction to be mined WaitForTransactionSuccess(ctx, subnet, tx.Hash()) - - return address, stakingManager + return address, validatorManager } func DeployAndInitializeNativeTokenStakingManager( @@ -91,10 +133,11 @@ func DeployAndInitializeNativeTokenStakingManager( subnet interfaces.SubnetTestInfo, pChainInfo interfaces.SubnetTestInfo, ) (common.Address, *nativetokenstakingmanager.NativeTokenStakingManager) { - stakingManagerContractAddress, stakingManager := DeployNativeTokenStakingManager( + stakingManagerContractAddress, _ := DeployValidatorManager( ctx, senderKey, subnet, + NativeTokenStakingManager, ) rewardCalculatorAddress, _ := DeployExampleRewardCalculator( ctx, @@ -104,6 +147,8 @@ func DeployAndInitializeNativeTokenStakingManager( ) opts, err := bind.NewKeyedTransactorWithChainID(senderKey, subnet.EVMChainID) Expect(err).Should(BeNil()) + stakingManager, err := nativetokenstakingmanager.NewNativeTokenStakingManager(stakingManagerContractAddress, subnet.RPCClient) + Expect(err).Should(BeNil()) tx, err := stakingManager.Initialize( opts, nativetokenstakingmanager.PoSValidatorManagerSettings{ @@ -127,30 +172,6 @@ func DeployAndInitializeNativeTokenStakingManager( return stakingManagerContractAddress, stakingManager } -func DeployERC20TokenStakingManager( - ctx context.Context, - senderKey *ecdsa.PrivateKey, - subnet interfaces.SubnetTestInfo, -) (common.Address, *erc20tokenstakingmanager.ERC20TokenStakingManager) { - // Reset the global binary data for better test isolation - erc20tokenstakingmanager.ERC20TokenStakingManagerBin = - erc20tokenstakingmanager.ERC20TokenStakingManagerMetaData.Bin - - opts, err := bind.NewKeyedTransactorWithChainID(senderKey, subnet.EVMChainID) - Expect(err).Should(BeNil()) - address, tx, stakingManager, err := erc20tokenstakingmanager.DeployERC20TokenStakingManager( - opts, - subnet.RPCClient, - 0, // ICMInitializable.Allowed - ) - Expect(err).Should(BeNil()) - - // Wait for the transaction to be mined - WaitForTransactionSuccess(ctx, subnet, tx.Hash()) - - return address, stakingManager -} - func DeployAndInitializeERC20TokenStakingManager( ctx context.Context, senderKey *ecdsa.PrivateKey, @@ -162,10 +183,11 @@ func DeployAndInitializeERC20TokenStakingManager( common.Address, *exampleerc20.ExampleERC20, ) { - stakingManagerContractAddress, stakingManager := DeployERC20TokenStakingManager( + stakingManagerContractAddress, _ := DeployValidatorManager( ctx, senderKey, subnet, + ERC20TokenStakingManager, ) erc20Address, erc20 := DeployExampleERC20(ctx, senderKey, subnet) @@ -177,6 +199,8 @@ func DeployAndInitializeERC20TokenStakingManager( ) opts, err := bind.NewKeyedTransactorWithChainID(senderKey, subnet.EVMChainID) Expect(err).Should(BeNil()) + stakingManager, err := erc20tokenstakingmanager.NewERC20TokenStakingManager(stakingManagerContractAddress, subnet.RPCClient) + Expect(err).Should(BeNil()) tx, err := stakingManager.Initialize( opts, erc20tokenstakingmanager.PoSValidatorManagerSettings{ @@ -201,43 +225,22 @@ func DeployAndInitializeERC20TokenStakingManager( return stakingManagerContractAddress, stakingManager, erc20Address, erc20 } -func DeployPoAValidatorManager( - ctx context.Context, - senderKey *ecdsa.PrivateKey, - subnet interfaces.SubnetTestInfo, -) (common.Address, *poavalidatormanager.PoAValidatorManager) { - // Reset the global binary data for better test isolation - poavalidatormanager.PoAValidatorManagerBin = poavalidatormanager.PoAValidatorManagerMetaData.Bin - - opts, err := bind.NewKeyedTransactorWithChainID(senderKey, subnet.EVMChainID) - Expect(err).Should(BeNil()) - address, tx, validatorManager, err := poavalidatormanager.DeployPoAValidatorManager( - opts, - subnet.RPCClient, - 0, // ICMInitializable.Allowed - ) - Expect(err).Should(BeNil()) - - // Wait for the transaction to be mined - WaitForTransactionSuccess(ctx, subnet, tx.Hash()) - - return address, validatorManager -} - func DeployAndInitializePoAValidatorManager( ctx context.Context, senderKey *ecdsa.PrivateKey, subnet interfaces.SubnetTestInfo, - pChainInfo interfaces.SubnetTestInfo, ownerAddress common.Address, ) (common.Address, *poavalidatormanager.PoAValidatorManager) { - validatorManagerAddress, validatorManager := DeployPoAValidatorManager( + validatorManagerAddress, _ := DeployValidatorManager( ctx, senderKey, subnet, + PoAValidatorManager, ) opts, err := bind.NewKeyedTransactorWithChainID(senderKey, subnet.EVMChainID) Expect(err).Should(BeNil()) + validatorManager, err := poavalidatormanager.NewPoAValidatorManager(validatorManagerAddress, subnet.RPCClient) + Expect(err).Should(BeNil()) tx, err := validatorManager.Initialize( opts, poavalidatormanager.ValidatorManagerSettings{ From a47a34521d9e54d557bad2992d7c7ec373b59330 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Thu, 7 Nov 2024 17:05:53 -0600 Subject: [PATCH 04/34] consolidate validator manager function call helpers --- .../validator-manager/erc20_token_staking.go | 11 +- .../validator-manager/native_token_staking.go | 11 +- tests/flows/validator-manager/poa_to_pos.go | 20 +- tests/utils/validator_manager.go | 319 ++---------------- 4 files changed, 46 insertions(+), 315 deletions(-) diff --git a/tests/flows/validator-manager/erc20_token_staking.go b/tests/flows/validator-manager/erc20_token_staking.go index 4358f0c24..1f8beee9b 100644 --- a/tests/flows/validator-manager/erc20_token_staking.go +++ b/tests/flows/validator-manager/erc20_token_staking.go @@ -8,6 +8,7 @@ import ( "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/subnet-evm/accounts/abi/bind" + iposvalidatormanager "github.com/ava-labs/teleporter/abi-bindings/go/validator-manager/interfaces/IPoSValidatorManager" localnetwork "github.com/ava-labs/teleporter/tests/network" "github.com/ava-labs/teleporter/tests/utils" . "github.com/onsi/gomega" @@ -76,13 +77,15 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { // // Delist one initial validator // - utils.InitializeAndCompleteEndInitialERC20Validation( + posStakingManager, err := iposvalidatormanager.NewIPoSValidatorManager(stakingManagerAddress, subnetAInfo.RPCClient) + Expect(err).Should(BeNil()) + utils.InitializeAndCompleteEndInitialPoSValidation( ctx, signatureAggregator, fundedKey, subnetAInfo, pChainInfo, - stakingManager, + posStakingManager, stakingManagerAddress, initialValidationIDs[0], 0, @@ -251,13 +254,13 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { // // Delist the validator // - utils.InitializeAndCompleteEndERC20Validation( + utils.InitializeAndCompleteEndPoSValidation( ctx, signatureAggregator, fundedKey, subnetAInfo, pChainInfo, - stakingManager, + posStakingManager, stakingManagerAddress, validationID, expiry, diff --git a/tests/flows/validator-manager/native_token_staking.go b/tests/flows/validator-manager/native_token_staking.go index c844e5945..8056de40d 100644 --- a/tests/flows/validator-manager/native_token_staking.go +++ b/tests/flows/validator-manager/native_token_staking.go @@ -8,6 +8,7 @@ import ( "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/subnet-evm/accounts/abi/bind" + iposvalidatormanager "github.com/ava-labs/teleporter/abi-bindings/go/validator-manager/interfaces/IPoSValidatorManager" localnetwork "github.com/ava-labs/teleporter/tests/network" "github.com/ava-labs/teleporter/tests/utils" . "github.com/onsi/gomega" @@ -78,13 +79,15 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { // // Delist one initial validator // - utils.InitializeAndCompleteEndInitialNativeValidation( + posStakingManager, err := iposvalidatormanager.NewIPoSValidatorManager(stakingManagerAddress, subnetAInfo.RPCClient) + Expect(err).Should(BeNil()) + utils.InitializeAndCompleteEndInitialPoSValidation( ctx, signatureAggregator, fundedKey, subnetAInfo, pChainInfo, - stakingManager, + posStakingManager, stakingManagerAddress, initialValidationIDs[0], 0, @@ -250,13 +253,13 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { // // Delist the validator // - utils.InitializeAndCompleteEndNativeValidation( + utils.InitializeAndCompleteEndPoSValidation( ctx, signatureAggregator, fundedKey, subnetAInfo, pChainInfo, - stakingManager, + posStakingManager, stakingManagerAddress, validationID, expiry, diff --git a/tests/flows/validator-manager/poa_to_pos.go b/tests/flows/validator-manager/poa_to_pos.go index 2ae102228..0372f35bf 100644 --- a/tests/flows/validator-manager/poa_to_pos.go +++ b/tests/flows/validator-manager/poa_to_pos.go @@ -10,6 +10,7 @@ import ( "github.com/ava-labs/subnet-evm/accounts/abi/bind" nativetokenstakingmanager "github.com/ava-labs/teleporter/abi-bindings/go/validator-manager/NativeTokenStakingManager" poavalidatormanager "github.com/ava-labs/teleporter/abi-bindings/go/validator-manager/PoAValidatorManager" + iposvalidatormanager "github.com/ava-labs/teleporter/abi-bindings/go/validator-manager/interfaces/IPoSValidatorManager" localnetwork "github.com/ava-labs/teleporter/tests/network" "github.com/ava-labs/teleporter/tests/utils" "github.com/ethereum/go-ethereum/crypto" @@ -197,7 +198,7 @@ func PoAMigrationToPoS(network *localnetwork.LocalNetwork) { utils.WaitForTransactionSuccess(ctx, subnetAInfo, tx.Hash()) // Change the proxy contract type to NativeTokenStakingManager and initialize it - posValidatorManager, err := nativetokenstakingmanager.NewNativeTokenStakingManager( + nativeStakingManager, err := nativetokenstakingmanager.NewNativeTokenStakingManager( proxyAddress, subnetAInfo.RPCClient, ) @@ -212,7 +213,7 @@ func PoAMigrationToPoS(network *localnetwork.LocalNetwork) { uint64(10), ) - tx, err = posValidatorManager.Initialize( + tx, err = nativeStakingManager.Initialize( opts, nativetokenstakingmanager.PoSValidatorManagerSettings{ BaseSettings: nativetokenstakingmanager.ValidatorManagerSettings{ @@ -233,21 +234,22 @@ func PoAMigrationToPoS(network *localnetwork.LocalNetwork) { utils.WaitForTransactionSuccess(context.Background(), subnetAInfo, tx.Hash()) // Check that previous validator is still registered - validationID, err := posValidatorManager.RegisteredValidators(&bind.CallOpts{}, poaNodeID) + validationID, err := nativeStakingManager.RegisteredValidators(&bind.CallOpts{}, poaNodeID) Expect(err).Should(BeNil()) Expect(validationID[:]).Should(Equal(poaValidationID[:])) // // Remove the PoA validator and re-register as a PoS validator // - - utils.InitializeAndCompleteEndNativeValidation( + posStakingManager, err := iposvalidatormanager.NewIPoSValidatorManager(proxyAddress, subnetAInfo.RPCClient) + Expect(err).Should(BeNil()) + utils.InitializeAndCompleteEndPoSValidation( ctx, signatureAggregator, ownerKey, subnetAInfo, pChainInfo, - posValidatorManager, + posStakingManager, proxyAddress, poaValidationID, expiry, @@ -264,7 +266,7 @@ func PoAMigrationToPoS(network *localnetwork.LocalNetwork) { fundedKey, subnetAInfo, pChainInfo, - posValidatorManager, + nativeStakingManager, proxyAddress, expiry2, nodes[0], @@ -273,13 +275,13 @@ func PoAMigrationToPoS(network *localnetwork.LocalNetwork) { ) // Delist the PoS validator - utils.InitializeAndCompleteEndNativeValidation( + utils.InitializeAndCompleteEndPoSValidation( ctx, signatureAggregator, fundedKey, subnetAInfo, pChainInfo, - posValidatorManager, + posStakingManager, proxyAddress, posValidationID, expiry2, diff --git a/tests/utils/validator_manager.go b/tests/utils/validator_manager.go index 12fa77141..693a88973 100644 --- a/tests/utils/validator_manager.go +++ b/tests/utils/validator_manager.go @@ -37,6 +37,7 @@ import ( examplerewardcalculator "github.com/ava-labs/teleporter/abi-bindings/go/validator-manager/ExampleRewardCalculator" nativetokenstakingmanager "github.com/ava-labs/teleporter/abi-bindings/go/validator-manager/NativeTokenStakingManager" poavalidatormanager "github.com/ava-labs/teleporter/abi-bindings/go/validator-manager/PoAValidatorManager" + iposvalidatormanager "github.com/ava-labs/teleporter/abi-bindings/go/validator-manager/interfaces/IPoSValidatorManager" ivalidatormanager "github.com/ava-labs/teleporter/abi-bindings/go/validator-manager/interfaces/IValidatorManager" "github.com/ava-labs/teleporter/tests/interfaces" "github.com/ethereum/go-ethereum/common" @@ -490,35 +491,14 @@ func InitializePoAValidatorRegistration( return receipt, ids.ID(registrationInitiatedEvent.ValidationID) } -func CompleteNativeValidatorRegistration( +func CompleteValidatorRegistration( ctx context.Context, senderKey *ecdsa.PrivateKey, subnet interfaces.SubnetTestInfo, stakingManagerContractAddress common.Address, registrationSignedMessage *avalancheWarp.Message, ) *types.Receipt { - abi, err := nativetokenstakingmanager.NativeTokenStakingManagerMetaData.GetAbi() - Expect(err).Should(BeNil()) - callData, err := abi.Pack("completeValidatorRegistration", uint32(0)) - Expect(err).Should(BeNil()) - return CallWarpReceiver( - ctx, - callData, - senderKey, - subnet, - stakingManagerContractAddress, - registrationSignedMessage, - ) -} - -func CompleteERC20ValidatorRegistration( - ctx context.Context, - senderKey *ecdsa.PrivateKey, - subnet interfaces.SubnetTestInfo, - stakingManagerContractAddress common.Address, - registrationSignedMessage *avalancheWarp.Message, -) *types.Receipt { - abi, err := erc20tokenstakingmanager.ERC20TokenStakingManagerMetaData.GetAbi() + abi, err := ivalidatormanager.IValidatorManagerMetaData.GetAbi() Expect(err).Should(BeNil()) callData, err := abi.Pack("completeValidatorRegistration", uint32(0)) Expect(err).Should(BeNil()) @@ -532,27 +512,6 @@ func CompleteERC20ValidatorRegistration( ) } -func CompletePoAValidatorRegistration( - ctx context.Context, - senderKey *ecdsa.PrivateKey, - subnet interfaces.SubnetTestInfo, - validatorManagerAddress common.Address, - registrationSignedMessage *avalancheWarp.Message, -) *types.Receipt { - abi, err := poavalidatormanager.PoAValidatorManagerMetaData.GetAbi() - Expect(err).Should(BeNil()) - callData, err := abi.Pack("completeValidatorRegistration", uint32(0)) - Expect(err).Should(BeNil()) - return CallWarpReceiver( - ctx, - callData, - senderKey, - subnet, - validatorManagerAddress, - registrationSignedMessage, - ) -} - // Calls a method that retreived a signed Warp message from the transaction's access list func CallWarpReceiver( ctx context.Context, @@ -636,7 +595,7 @@ func InitializeAndCompleteNativeValidatorRegistration( ) // Deliver the Warp message to the subnet - receipt = CompleteNativeValidatorRegistration( + receipt = CompleteValidatorRegistration( ctx, fundedKey, subnetInfo, @@ -714,7 +673,7 @@ func InitializeAndCompleteERC20ValidatorRegistration( ) // Deliver the Warp message to the subnet - receipt = CompleteERC20ValidatorRegistration( + receipt = CompleteValidatorRegistration( ctx, fundedKey, subnetInfo, @@ -782,7 +741,7 @@ func InitializeAndCompletePoAValidatorRegistration( ) // Deliver the Warp message to the subnet - receipt = CompletePoAValidatorRegistration( + receipt = CompleteValidatorRegistration( ctx, fundedKey, subnetInfo, @@ -800,11 +759,11 @@ func InitializeAndCompletePoAValidatorRegistration( return validationID } -func InitializeEndNativeValidation( +func InitializeEndPoSValidation( ctx context.Context, senderKey *ecdsa.PrivateKey, subnet interfaces.SubnetTestInfo, - stakingManager *nativetokenstakingmanager.NativeTokenStakingManager, + stakingManager *iposvalidatormanager.IPoSValidatorManager, validationID ids.ID, ) *types.Receipt { opts, err := bind.NewKeyedTransactorWithChainID(senderKey, subnet.EVMChainID) @@ -819,50 +778,11 @@ func InitializeEndNativeValidation( return WaitForTransactionSuccess(ctx, subnet, tx.Hash()) } -func ForceInitializeEndNativeValidation( +func ForceInitializeEndPoSValidation( ctx context.Context, senderKey *ecdsa.PrivateKey, subnet interfaces.SubnetTestInfo, - stakingManager *nativetokenstakingmanager.NativeTokenStakingManager, - validationID ids.ID, -) *types.Receipt { - opts, err := bind.NewKeyedTransactorWithChainID(senderKey, subnet.EVMChainID) - Expect(err).Should(BeNil()) - tx, err := stakingManager.ForceInitializeEndValidation( - opts, - validationID, - false, - 0, - ) - Expect(err).Should(BeNil()) - return WaitForTransactionSuccess(ctx, subnet, tx.Hash()) -} - -func InitializeEndERC20Validation( - ctx context.Context, - senderKey *ecdsa.PrivateKey, - subnet interfaces.SubnetTestInfo, - stakingManager *erc20tokenstakingmanager.ERC20TokenStakingManager, - validationID ids.ID, - force bool, -) *types.Receipt { - opts, err := bind.NewKeyedTransactorWithChainID(senderKey, subnet.EVMChainID) - Expect(err).Should(BeNil()) - tx, err := stakingManager.InitializeEndValidation( - opts, - validationID, - false, - 0, - ) - Expect(err).Should(BeNil()) - return WaitForTransactionSuccess(ctx, subnet, tx.Hash()) -} - -func ForceInitializeEndERC20Validation( - ctx context.Context, - senderKey *ecdsa.PrivateKey, - subnet interfaces.SubnetTestInfo, - stakingManager *erc20tokenstakingmanager.ERC20TokenStakingManager, + stakingManager *iposvalidatormanager.IPoSValidatorManager, validationID ids.ID, ) *types.Receipt { opts, err := bind.NewKeyedTransactorWithChainID(senderKey, subnet.EVMChainID) @@ -894,7 +814,7 @@ func InitializeEndPoAValidation( return WaitForTransactionSuccess(ctx, subnet, tx.Hash()) } -func CompleteEndNativeValidation( +func CompleteEndValidation( ctx context.Context, senderKey *ecdsa.PrivateKey, subnet interfaces.SubnetTestInfo, @@ -915,48 +835,6 @@ func CompleteEndNativeValidation( ) } -func CompleteEndERC20Validation( - ctx context.Context, - senderKey *ecdsa.PrivateKey, - subnet interfaces.SubnetTestInfo, - stakingManagerContractAddress common.Address, - registrationSignedMessage *avalancheWarp.Message, -) *types.Receipt { - abi, err := erc20tokenstakingmanager.ERC20TokenStakingManagerMetaData.GetAbi() - Expect(err).Should(BeNil()) - callData, err := abi.Pack("completeEndValidation", uint32(0)) - Expect(err).Should(BeNil()) - return CallWarpReceiver( - ctx, - callData, - senderKey, - subnet, - stakingManagerContractAddress, - registrationSignedMessage, - ) -} - -func CompleteEndPoAValidation( - ctx context.Context, - senderKey *ecdsa.PrivateKey, - subnet interfaces.SubnetTestInfo, - validatorManagerAddress common.Address, - registrationSignedMessage *avalancheWarp.Message, -) *types.Receipt { - abi, err := poavalidatormanager.PoAValidatorManagerMetaData.GetAbi() - Expect(err).Should(BeNil()) - callData, err := abi.Pack("completeEndValidation", uint32(0)) - Expect(err).Should(BeNil()) - return CallWarpReceiver( - ctx, - callData, - senderKey, - subnet, - validatorManagerAddress, - registrationSignedMessage, - ) -} - func InitializeERC20DelegatorRegistration( ctx context.Context, senderKey *ecdsa.PrivateKey, @@ -1149,13 +1027,13 @@ func CompleteEndNativeDelegation( ) } -func InitializeAndCompleteEndInitialNativeValidation( +func InitializeAndCompleteEndInitialPoSValidation( ctx context.Context, signatureAggregator *aggregator.SignatureAggregator, fundedKey *ecdsa.PrivateKey, subnetInfo interfaces.SubnetTestInfo, pChainInfo interfaces.SubnetTestInfo, - stakingManager *nativetokenstakingmanager.NativeTokenStakingManager, + stakingManager *iposvalidatormanager.IPoSValidatorManager, stakingManagerAddress common.Address, validationID ids.ID, index uint32, @@ -1165,7 +1043,7 @@ func InitializeAndCompleteEndInitialNativeValidation( ) { log.Println("Initializing initial validator removal") WaitMinStakeDuration(ctx, subnetInfo, fundedKey) - receipt := ForceInitializeEndNativeValidation( + receipt := ForceInitializeEndPoSValidation( ctx, fundedKey, subnetInfo, @@ -1209,7 +1087,7 @@ func InitializeAndCompleteEndInitialNativeValidation( ) // Deliver the Warp message to the subnet - receipt = CompleteEndNativeValidation( + receipt = CompleteEndValidation( ctx, fundedKey, subnetInfo, @@ -1226,13 +1104,13 @@ func InitializeAndCompleteEndInitialNativeValidation( Expect(validationEndedEvent.ValidationID[:]).Should(Equal(validationID[:])) } -func InitializeAndCompleteEndNativeValidation( +func InitializeAndCompleteEndPoSValidation( ctx context.Context, signatureAggregator *aggregator.SignatureAggregator, fundedKey *ecdsa.PrivateKey, subnetInfo interfaces.SubnetTestInfo, pChainInfo interfaces.SubnetTestInfo, - stakingManager *nativetokenstakingmanager.NativeTokenStakingManager, + stakingManager *iposvalidatormanager.IPoSValidatorManager, stakingManagerAddress common.Address, validationID ids.ID, expiry uint64, @@ -1243,7 +1121,7 @@ func InitializeAndCompleteEndNativeValidation( ) { log.Println("Initializing validator removal") WaitMinStakeDuration(ctx, subnetInfo, fundedKey) - receipt := ForceInitializeEndNativeValidation( + receipt := ForceInitializeEndPoSValidation( ctx, fundedKey, subnetInfo, @@ -1287,7 +1165,7 @@ func InitializeAndCompleteEndNativeValidation( ) // Deliver the Warp message to the subnet - receipt = CompleteEndNativeValidation( + receipt = CompleteEndValidation( ctx, fundedKey, subnetInfo, @@ -1304,161 +1182,6 @@ func InitializeAndCompleteEndNativeValidation( Expect(registrationEvent.ValidationID[:]).Should(Equal(validationID[:])) } -func InitializeAndCompleteEndInitialERC20Validation( - ctx context.Context, - signatureAggregator *aggregator.SignatureAggregator, - fundedKey *ecdsa.PrivateKey, - subnetInfo interfaces.SubnetTestInfo, - pChainInfo interfaces.SubnetTestInfo, - stakingManager *erc20tokenstakingmanager.ERC20TokenStakingManager, - stakingManagerAddress common.Address, - validationID ids.ID, - index uint32, - weight uint64, - pchainWallet pwallet.Wallet, - networkID uint32, -) { - log.Println("Initializing initial validator removal") - WaitMinStakeDuration(ctx, subnetInfo, fundedKey) - receipt := ForceInitializeEndERC20Validation( - ctx, - fundedKey, - subnetInfo, - stakingManager, - validationID, - ) - validatorRemovalEvent, err := GetEventFromLogs( - receipt.Logs, - stakingManager.ParseValidatorRemovalInitialized, - ) - Expect(err).Should(BeNil()) - Expect(validatorRemovalEvent.ValidationID[:]).Should(Equal(validationID[:])) - Expect(validatorRemovalEvent.Weight.Uint64()).Should(Equal(weight)) - - // Gather subnet-evm Warp signatures for the SetSubnetValidatorWeightMessage & relay to the P-Chain - // (Sending to the P-Chain will be skipped for now) - unsignedMessage := ExtractWarpMessageFromLog(ctx, receipt, subnetInfo) - signedWarpMessage, err := signatureAggregator.CreateSignedMessage( - unsignedMessage, - nil, - subnetInfo.SubnetID, - 67, - ) - Expect(err).Should(BeNil()) - - // Deliver the Warp message to the P-Chain - pchainWallet.IssueSetSubnetValidatorWeightTx(signedWarpMessage.Bytes()) - PChainProposerVMWorkaround(pchainWallet) - AdvanceProposerVM(ctx, subnetInfo, fundedKey, 5) - - // Construct a SubnetValidatorRegistrationMessage Warp message from the P-Chain - log.Println("Completing initial validator removal") - registrationSignedMessage := ConstructSubnetValidatorRegistrationMessageForInitialValidator( - validationID, - index, - false, - subnetInfo, - pChainInfo, - networkID, - signatureAggregator, - ) - - // Deliver the Warp message to the subnet - receipt = CompleteEndERC20Validation( - ctx, - fundedKey, - subnetInfo, - stakingManagerAddress, - registrationSignedMessage, - ) - - // Check that the validator is has been delisted from the staking contract - validationEndedEvent, err := GetEventFromLogs( - receipt.Logs, - stakingManager.ParseValidationPeriodEnded, - ) - Expect(err).Should(BeNil()) - Expect(validationEndedEvent.ValidationID[:]).Should(Equal(validationID[:])) -} - -func InitializeAndCompleteEndERC20Validation( - ctx context.Context, - signatureAggregator *aggregator.SignatureAggregator, - fundedKey *ecdsa.PrivateKey, - subnetInfo interfaces.SubnetTestInfo, - pChainInfo interfaces.SubnetTestInfo, - stakingManager *erc20tokenstakingmanager.ERC20TokenStakingManager, - stakingManagerAddress common.Address, - validationID ids.ID, - expiry uint64, - node Node, - nonce uint64, - pchainWallet pwallet.Wallet, - networkID uint32, -) { - log.Println("Initializing validator removal") - WaitMinStakeDuration(ctx, subnetInfo, fundedKey) - receipt := ForceInitializeEndERC20Validation( - ctx, - fundedKey, - subnetInfo, - stakingManager, - validationID, - ) - validatorRemovalEvent, err := GetEventFromLogs( - receipt.Logs, - stakingManager.ParseValidatorRemovalInitialized, - ) - Expect(err).Should(BeNil()) - Expect(validatorRemovalEvent.ValidationID[:]).Should(Equal(validationID[:])) - Expect(validatorRemovalEvent.Weight.Uint64()).Should(Equal(node.Weight)) - - // Gather subnet-evm Warp signatures for the SetSubnetValidatorWeightMessage & relay to the P-Chain - unsignedMessage := ExtractWarpMessageFromLog(ctx, receipt, subnetInfo) - signedWarpMessage, err := signatureAggregator.CreateSignedMessage( - unsignedMessage, - nil, - subnetInfo.SubnetID, - 67, - ) - Expect(err).Should(BeNil()) - - // Deliver the Warp message to the P-Chain - pchainWallet.IssueSetSubnetValidatorWeightTx(signedWarpMessage.Bytes()) - PChainProposerVMWorkaround(pchainWallet) - AdvanceProposerVM(ctx, subnetInfo, fundedKey, 5) - - // Construct a SubnetValidatorRegistrationMessage Warp message from the P-Chain - log.Println("Completing validator removal") - registrationSignedMessage := ConstructSubnetValidatorRegistrationMessage( - validationID, - expiry, - node, - false, - subnetInfo, - pChainInfo, - networkID, - signatureAggregator, - ) - - // Deliver the Warp message to the subnet - receipt = CompleteEndERC20Validation( - ctx, - fundedKey, - subnetInfo, - stakingManagerAddress, - registrationSignedMessage, - ) - - // Check that the validator is has been delisted from the staking contract - validationEndedEvent, err := GetEventFromLogs( - receipt.Logs, - stakingManager.ParseValidationPeriodEnded, - ) - Expect(err).Should(BeNil()) - Expect(validationEndedEvent.ValidationID[:]).Should(Equal(validationID[:])) -} - func InitializeAndCompleteEndInitialPoAValidation( ctx context.Context, signatureAggregator *aggregator.SignatureAggregator, @@ -1520,7 +1243,7 @@ func InitializeAndCompleteEndInitialPoAValidation( ) // Deliver the Warp message to the subnet - receipt = CompleteEndPoAValidation( + receipt = CompleteEndValidation( ctx, fundedKey, subnetInfo, @@ -1587,7 +1310,7 @@ func InitializeAndCompleteEndPoAValidation( ) // Deliver the Warp message to the subnet - receipt = CompleteEndPoAValidation( + receipt = CompleteEndValidation( ctx, ownerKey, subnetInfo, From fb8af1905c331a9cc2d4df2c36b128a336c1e1cd Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Thu, 7 Nov 2024 18:26:26 -0600 Subject: [PATCH 05/34] convert subnet on network creation --- tests/flows/validator-manager/poa_to_pos.go | 1 + tests/network/network.go | 130 +++++++++++++++++- .../teleporter/teleporter_suite_test.go | 114 +-------------- 3 files changed, 132 insertions(+), 113 deletions(-) diff --git a/tests/flows/validator-manager/poa_to_pos.go b/tests/flows/validator-manager/poa_to_pos.go index 0372f35bf..4dbc4fc1b 100644 --- a/tests/flows/validator-manager/poa_to_pos.go +++ b/tests/flows/validator-manager/poa_to_pos.go @@ -75,6 +75,7 @@ func PoAMigrationToPoS(network *localnetwork.LocalNetwork) { utils.PoAValidatorManager, ) + // TODDO: check if it's valid to initialize the PoA contract before deploying the proxy // Deploy TransparentUpgradeableProxy contract pointing to PoAValidatorManager proxyAddress, proxyAdmin, poaValidatorManager := utils.DeployTransparentUpgradeableProxy( ctx, diff --git a/tests/network/network.go b/tests/network/network.go index 43e489b16..a63c957d3 100644 --- a/tests/network/network.go +++ b/tests/network/network.go @@ -6,8 +6,10 @@ import ( "encoding/base64" "encoding/hex" "encoding/json" + goLog "log" "os" "slices" + "sort" "time" "github.com/ava-labs/avalanchego/api/info" @@ -17,7 +19,11 @@ import ( "github.com/ava-labs/avalanchego/tests/fixture/tmpnet" "github.com/ava-labs/avalanchego/upgrade" "github.com/ava-labs/avalanchego/utils/crypto/secp256k1" + "github.com/ava-labs/avalanchego/utils/formatting/address" + "github.com/ava-labs/avalanchego/utils/units" "github.com/ava-labs/avalanchego/vms/platformvm" + "github.com/ava-labs/avalanchego/vms/platformvm/txs" + warpMessage "github.com/ava-labs/avalanchego/vms/platformvm/warp/message" "github.com/ava-labs/avalanchego/vms/secp256k1fx" pwallet "github.com/ava-labs/avalanchego/wallet/chain/p/wallet" "github.com/ava-labs/avalanchego/wallet/subnet/primary" @@ -32,7 +38,6 @@ import ( . "github.com/onsi/gomega" ) -// TODO: Add a mapping of subnetID -> {ivalidatormanager, address} // Implements Network, pointing to the network setup in local_network_setup.go type LocalNetwork struct { tmpnet.Network @@ -40,6 +45,7 @@ type LocalNetwork struct { extraNodes []*tmpnet.Node // to add as more subnet validators in the tests primaryNetworkValidators []ids.NodeID globalFundedKey *secp256k1.PrivateKey + validatorManagers map[ids.ID]common.Address } const ( @@ -109,7 +115,6 @@ func NewLocalNetwork( subnet.OwningKey = globalFundedKey subnets = append(subnets, subnet) } - network := subnetEvmTestUtils.NewTmpnetNetwork( name, bootstrapNodes, @@ -155,6 +160,7 @@ func NewLocalNetwork( avalancheGoBuildPath+"/plugins", ) Expect(err).Should(BeNil()) + goLog.Println("Network bootstrapped") // Issue transactions to activate the proposerVM fork on the chains for _, subnet := range network.Subnets { @@ -172,11 +178,131 @@ func NewLocalNetwork( extraNodes: extraNodes, globalFundedKey: globalFundedKey, primaryNetworkValidators: primaryNetworkValidators, + validatorManagers: make(map[ids.ID]common.Address), } return localNetwork } +func (n *LocalNetwork) ConvertSubnet(ctx context.Context, subnet interfaces.SubnetTestInfo) { + cChainInfo := n.GetPrimaryNetworkInfo() + pClient := platformvm.NewClient(cChainInfo.NodeURIs[0]) + currentValidators, err := pClient.GetCurrentValidators(ctx, subnet.SubnetID, nil) + Expect(err).Should(BeNil()) + + fundedAddress, fundedKey := n.GetFundedAccountInfo() + signatureAggregator := utils.NewSignatureAggregator( + cChainInfo.NodeURIs[0], + []ids.ID{ + subnet.SubnetID, + }, + ) + // TODO: support other manager types, including deploying a proxy + vdrManagerAddress, _ := utils.DeployAndInitializePoAValidatorManager( + ctx, + fundedKey, + subnet, + fundedAddress, + ) + n.validatorManagers[subnet.SubnetID] = vdrManagerAddress + + // TODO: parameterize the number of nodes + tmpnetNodes := n.GetExtraNodes(2) + sort.Slice(tmpnetNodes, func(i, j int) bool { + return string(tmpnetNodes[i].NodeID.Bytes()) < string(tmpnetNodes[j].NodeID.Bytes()) + }) + totalWeight := uint64(len(tmpnetNodes)-1) * units.Schmeckle + var nodes []utils.Node + // Construct the convert subnet info + destAddr, err := address.ParseToID(utils.DefaultPChainAddress) + Expect(err).Should(BeNil()) + vdrs := make([]*txs.ConvertSubnetValidator, len(tmpnetNodes)) + for i, node := range tmpnetNodes { + weight := units.Schmeckle + if i == len(tmpnetNodes)-1 { + weight = 4 * totalWeight + } + + signer, err := node.GetProofOfPossession() + Expect(err).Should(BeNil()) + nodes = append(nodes, utils.Node{ + NodeID: node.NodeID, + NodePoP: signer, + Weight: weight, + }) + vdrs[i] = &txs.ConvertSubnetValidator{ + NodeID: node.NodeID.Bytes(), + Weight: weight, + Balance: units.Avax * 100, + Signer: *signer, + RemainingBalanceOwner: warpMessage.PChainOwner{ + Threshold: 1, + Addresses: []ids.ShortID{destAddr}, + }, + DeactivationOwner: warpMessage.PChainOwner{ + Threshold: 1, + Addresses: []ids.ShortID{destAddr}, + }, + } + } + pChainWallet := n.GetPChainWallet() + _, err = pChainWallet.IssueConvertSubnetTx( + subnet.SubnetID, + subnet.BlockchainID, + vdrManagerAddress[:], + vdrs, + ) + Expect(err).Should(BeNil()) + + // Modify the each node's config to track the subnet + for _, node := range tmpnetNodes { + existingTrackedSubnets, err := node.Flags.GetStringVal(config.TrackSubnetsKey) + Expect(err).Should(BeNil()) + if existingTrackedSubnets == subnet.SubnetID.String() { + goLog.Printf("Node %s @ %s already tracking subnet %s\n", node.NodeID, node.URI, subnet.SubnetID) + continue + } + node.Flags[config.TrackSubnetsKey] = subnet.SubnetID.String() + + // Add the node to the network + n.Network.Nodes = append(n.Network.Nodes, node) + } + n.Network.StartNodes(context.Background(), os.Stdout, tmpnetNodes...) + + // Update the tmpnet Subnet struct + for _, tmpnetSubnet := range n.Network.Subnets { + if tmpnetSubnet.SubnetID == subnet.SubnetID { + for _, tmpnetNode := range tmpnetNodes { + tmpnetSubnet.ValidatorIDs = append(tmpnetSubnet.ValidatorIDs, tmpnetNode.NodeID) + } + } + } + // Refresh the subnet info after restarting the nodes + subnet = n.GetSubnetInfo(subnet.SubnetID) + + utils.PChainProposerVMWorkaround(pChainWallet) + utils.AdvanceProposerVM(ctx, subnet, fundedKey, 5) + + utils.InitializeValidatorSet( + ctx, + fundedKey, + subnet, + utils.GetPChainInfo(cChainInfo), + vdrManagerAddress, + n.GetNetworkID(), + signatureAggregator, + nodes, + ) + + // Remove the bootstrap node as a subnet validator + // TODO: This is not currently supported by the poc tag + // for _, vdr := range currentValidators { + // tx, err := pChainWallet.IssueRemoveSubnetValidatorTx(vdr.NodeID, subnet.SubnetID) + // Expect(err).Should(BeNil()) + // utils.WaitForTransactionSuccess(ctx, subnet, common.BytesToHash(tx.TxID[:])) + // } +} + func (n *LocalNetwork) GetExtraNodes(count uint) []*tmpnet.Node { Expect(count > 0).Should(BeTrue(), "can't add 0 validators") Expect(uint(len(n.extraNodes)) >= count).Should( diff --git a/tests/suites/teleporter/teleporter_suite_test.go b/tests/suites/teleporter/teleporter_suite_test.go index 7af7604c8..b7999f800 100644 --- a/tests/suites/teleporter/teleporter_suite_test.go +++ b/tests/suites/teleporter/teleporter_suite_test.go @@ -5,18 +5,10 @@ package teleporter_test import ( "context" - goLog "log" "os" - "sort" "testing" "time" - "github.com/ava-labs/avalanchego/config" - "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/utils/formatting/address" - "github.com/ava-labs/avalanchego/utils/units" - "github.com/ava-labs/avalanchego/vms/platformvm/txs" - warpMessage "github.com/ava-labs/avalanchego/vms/platformvm/warp/message" teleporterFlows "github.com/ava-labs/teleporter/tests/flows/teleporter" registryFlows "github.com/ava-labs/teleporter/tests/flows/teleporter/registry" localnetwork "github.com/ava-labs/teleporter/tests/network" @@ -96,7 +88,7 @@ var _ = ginkgo.BeforeSuite(func() { log.Info("Started local network") // Only need to deploy Teleporter on the C-Chain since it is included in the genesis of the subnet chains. - fundedAddress, fundedKey := LocalNetworkInstance.GetFundedAccountInfo() + _, fundedKey := LocalNetworkInstance.GetFundedAccountInfo() TeleporterInfo.DeployTeleporterMessenger( ctx, LocalNetworkInstance.GetPrimaryNetworkInfo(), @@ -112,110 +104,10 @@ var _ = ginkgo.BeforeSuite(func() { TeleporterInfo.DeployTeleporterRegistry(subnet, fundedKey) } - // Convert the subnets to be managed by a PoAValidatorManager - cChainInfo := LocalNetworkInstance.GetPrimaryNetworkInfo() for _, subnet := range LocalNetworkInstance.GetSubnetsInfo() { - signatureAggregator := utils.NewSignatureAggregator( - cChainInfo.NodeURIs[0], - []ids.ID{ - subnet.SubnetID, - }, - ) - vdrManagerAddress, _ := utils.DeployAndInitializePoAValidatorManager( - ctx, - fundedKey, - subnet, - fundedAddress, - ) - - tmpnetNodes := LocalNetworkInstance.GetExtraNodes(2) - sort.Slice(tmpnetNodes, func(i, j int) bool { - return string(tmpnetNodes[i].NodeID.Bytes()) < string(tmpnetNodes[j].NodeID.Bytes()) - }) - totalWeight := uint64(len(tmpnetNodes)-1) * units.Schmeckle - var nodes []utils.Node - // Construct the convert subnet info - destAddr, err := address.ParseToID(utils.DefaultPChainAddress) - Expect(err).Should(BeNil()) - vdrs := make([]*txs.ConvertSubnetValidator, len(tmpnetNodes)) - for i, node := range tmpnetNodes { - weight := units.Schmeckle - if i == len(tmpnetNodes)-1 { - weight = 4 * totalWeight - } - - signer, err := node.GetProofOfPossession() - Expect(err).Should(BeNil()) - nodes = append(nodes, utils.Node{ - NodeID: node.NodeID, - NodePoP: signer, - Weight: weight, - }) - vdrs[i] = &txs.ConvertSubnetValidator{ - NodeID: node.NodeID.Bytes(), - Weight: weight, - Balance: units.Avax * 100, - Signer: *signer, - RemainingBalanceOwner: warpMessage.PChainOwner{ - Threshold: 1, - Addresses: []ids.ShortID{destAddr}, - }, - DeactivationOwner: warpMessage.PChainOwner{ - Threshold: 1, - Addresses: []ids.ShortID{destAddr}, - }, - } - } - pChainWallet := LocalNetworkInstance.GetPChainWallet() - _, err = pChainWallet.IssueConvertSubnetTx( - subnet.SubnetID, - subnet.BlockchainID, - vdrManagerAddress[:], - vdrs, - ) - Expect(err).Should(BeNil()) - - // Modify the each node's config to track the subnet - for _, node := range tmpnetNodes { - existingTrackedSubnets, err := node.Flags.GetStringVal(config.TrackSubnetsKey) - Expect(err).Should(BeNil()) - if existingTrackedSubnets == subnet.SubnetID.String() { - goLog.Printf("Node %s @ %s already tracking subnet %s\n", node.NodeID, node.URI, subnet.SubnetID) - continue - } - node.Flags[config.TrackSubnetsKey] = subnet.SubnetID.String() - - // Add the node to the network - LocalNetworkInstance.Network.Nodes = append(LocalNetworkInstance.Network.Nodes, node) - } - LocalNetworkInstance.Network.StartNodes(context.Background(), os.Stdout, tmpnetNodes...) - - // Update the tmpnet Subnet struct - for _, tmpnetSubnet := range LocalNetworkInstance.Network.Subnets { - if tmpnetSubnet.SubnetID == subnet.SubnetID { - for _, tmpnetNode := range tmpnetNodes { - tmpnetSubnet.ValidatorIDs = append(tmpnetSubnet.ValidatorIDs, tmpnetNode.NodeID) - } - } - } - // Refresh the subnet info after restarting the nodes - subnet = LocalNetworkInstance.GetSubnetInfo(subnet.SubnetID) - - utils.PChainProposerVMWorkaround(pChainWallet) - utils.AdvanceProposerVM(ctx, subnet, fundedKey, 5) - - utils.InitializeValidatorSet( - ctx, - fundedKey, - subnet, - utils.GetPChainInfo(cChainInfo), - vdrManagerAddress, - LocalNetworkInstance.GetNetworkID(), - signatureAggregator, - nodes, - ) - // TODO: Remove the bootstrap node as a subnet validator + LocalNetworkInstance.ConvertSubnet(ctx, subnet) } + log.Info("Set up ginkgo before suite") }) From 68af482479a915024c5b136c27be51a6132cbcff Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Thu, 7 Nov 2024 18:30:01 -0600 Subject: [PATCH 06/34] build fix --- tests/network/network.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/network/network.go b/tests/network/network.go index a63c957d3..8ab1e9bfd 100644 --- a/tests/network/network.go +++ b/tests/network/network.go @@ -187,7 +187,7 @@ func NewLocalNetwork( func (n *LocalNetwork) ConvertSubnet(ctx context.Context, subnet interfaces.SubnetTestInfo) { cChainInfo := n.GetPrimaryNetworkInfo() pClient := platformvm.NewClient(cChainInfo.NodeURIs[0]) - currentValidators, err := pClient.GetCurrentValidators(ctx, subnet.SubnetID, nil) + _, err := pClient.GetCurrentValidators(ctx, subnet.SubnetID, nil) Expect(err).Should(BeNil()) fundedAddress, fundedKey := n.GetFundedAccountInfo() From ad53a4749f3d50d59656a1160acabe70c0686597 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Fri, 8 Nov 2024 09:46:20 -0600 Subject: [PATCH 07/34] consolidate init and deploy helpers --- .../ERC20TokenStakingManager.go | 35 +++- .../ERC20TokenStakingManager.sol | 7 + .../validator-manager/erc20_token_staking.go | 30 ++- .../validator-manager/native_token_staking.go | 25 ++- tests/network/network.go | 3 +- tests/utils/validator_manager.go | 193 ++++++++---------- 6 files changed, 156 insertions(+), 137 deletions(-) diff --git a/abi-bindings/go/validator-manager/ERC20TokenStakingManager/ERC20TokenStakingManager.go b/abi-bindings/go/validator-manager/ERC20TokenStakingManager/ERC20TokenStakingManager.go index 5d4c0753d..f46edfe4b 100644 --- a/abi-bindings/go/validator-manager/ERC20TokenStakingManager/ERC20TokenStakingManager.go +++ b/abi-bindings/go/validator-manager/ERC20TokenStakingManager/ERC20TokenStakingManager.go @@ -102,8 +102,8 @@ type ValidatorRegistrationInput struct { // ERC20TokenStakingManagerMetaData contains all meta data concerning the ERC20TokenStakingManager contract. var ERC20TokenStakingManagerMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"enumICMInitializable\",\"name\":\"init\",\"type\":\"uint8\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"AddressEmptyCode\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"AddressInsufficientBalance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"}],\"name\":\"DelegatorIneligibleForRewards\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FailedInnerCall\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"length\",\"type\":\"uint256\"}],\"name\":\"InvalidBLSKeyLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"encodedConversionID\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"expectedConversionID\",\"type\":\"bytes32\"}],\"name\":\"InvalidConversionID\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"delegationFeeBips\",\"type\":\"uint16\"}],\"name\":\"InvalidDelegationFee\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"}],\"name\":\"InvalidDelegationID\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"enumDelegatorStatus\",\"name\":\"status\",\"type\":\"uint8\"}],\"name\":\"InvalidDelegatorStatus\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidInitialization\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidInitializationStatus\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"maximumChurnPercentage\",\"type\":\"uint8\"}],\"name\":\"InvalidMaximumChurnPercentage\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"minStakeDuration\",\"type\":\"uint64\"}],\"name\":\"InvalidMinStakeDuration\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"nodeID\",\"type\":\"bytes\"}],\"name\":\"InvalidNodeID\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"nonce\",\"type\":\"uint64\"}],\"name\":\"InvalidNonce\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"threshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addressesLength\",\"type\":\"uint256\"}],\"name\":\"InvalidPChainOwnerThreshold\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"registrationExpiry\",\"type\":\"uint64\"}],\"name\":\"InvalidRegistrationExpiry\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"stakeAmount\",\"type\":\"uint256\"}],\"name\":\"InvalidStakeAmount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"maximumStakeMultiplier\",\"type\":\"uint8\"}],\"name\":\"InvalidStakeMultiplier\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"}],\"name\":\"InvalidTokenAddress\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"}],\"name\":\"InvalidTotalWeight\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"}],\"name\":\"InvalidValidationID\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"validatorManagerAddress\",\"type\":\"address\"}],\"name\":\"InvalidValidatorManagerAddress\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"blockchainID\",\"type\":\"bytes32\"}],\"name\":\"InvalidValidatorManagerBlockchainID\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"}],\"name\":\"InvalidValidatorStatus\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidWarpMessage\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"}],\"name\":\"InvalidWarpOriginSenderAddress\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"sourceChainID\",\"type\":\"bytes32\"}],\"name\":\"InvalidWarpSourceChainID\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"churnAmount\",\"type\":\"uint64\"}],\"name\":\"MaxChurnRateExceeded\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"newValidatorWeight\",\"type\":\"uint64\"}],\"name\":\"MaxWeightExceeded\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"endTime\",\"type\":\"uint64\"}],\"name\":\"MinStakeDurationNotPassed\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"nodeID\",\"type\":\"bytes\"}],\"name\":\"NodeAlreadyRegistered\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotInitializing\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PChainOwnerAddressesNotSorted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ReentrancyGuardReentrantCall\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"SafeERC20FailedOperation\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"UnauthorizedOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"validRegistration\",\"type\":\"bool\"}],\"name\":\"UnexpectedRegistrationStatus\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"}],\"name\":\"ValidatorIneligibleForRewards\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"}],\"name\":\"ValidatorNotPoS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroWeightToValueFactor\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rewards\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fees\",\"type\":\"uint256\"}],\"name\":\"DelegationEnded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegatorAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"nonce\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"validatorWeight\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"delegatorWeight\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"setWeightMessageID\",\"type\":\"bytes32\"}],\"name\":\"DelegatorAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startTime\",\"type\":\"uint256\"}],\"name\":\"DelegatorRegistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"}],\"name\":\"DelegatorRemovalInitialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes\",\"name\":\"nodeID\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"}],\"name\":\"InitialValidatorCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"version\",\"type\":\"uint64\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"uptime\",\"type\":\"uint64\"}],\"name\":\"UptimeUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes\",\"name\":\"nodeID\",\"type\":\"bytes\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"registerValidationMessageID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"registrationExpiry\",\"type\":\"uint64\"}],\"name\":\"ValidationPeriodCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"}],\"name\":\"ValidationPeriodEnded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"ValidationPeriodRegistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"setWeightMessageID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"endTime\",\"type\":\"uint256\"}],\"name\":\"ValidatorRemovalInitialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint64\",\"name\":\"nonce\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"validatorWeight\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"setWeightMessageID\",\"type\":\"bytes32\"}],\"name\":\"ValidatorWeightUpdate\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"ADDRESS_LENGTH\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BIPS_CONVERSION_FACTOR\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BLS_PUBLIC_KEY_LENGTH\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ERC20_STAKING_MANAGER_STORAGE_LOCATION\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAXIMUM_CHURN_PERCENTAGE_LIMIT\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAXIMUM_DELEGATION_FEE_BIPS\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAXIMUM_REGISTRATION_EXPIRY_LENGTH\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAXIMUM_STAKE_MULTIPLIER_LIMIT\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"POS_VALIDATOR_MANAGER_STORAGE_LOCATION\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"P_CHAIN_BLOCKCHAIN_ID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"VALIDATOR_MANAGER_STORAGE_LOCATION\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WARP_MESSENGER\",\"outputs\":[{\"internalType\":\"contractIWarpMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"}],\"name\":\"claimDelegationFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"completeDelegatorRegistration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"completeEndDelegation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"completeEndValidation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"completeValidatorRegistration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"includeUptimeProof\",\"type\":\"bool\"},{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"forceInitializeEndDelegation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"includeUptimeProof\",\"type\":\"bool\"},{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"forceInitializeEndValidation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"}],\"name\":\"getValidator\",\"outputs\":[{\"components\":[{\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"nodeID\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"startingWeight\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"messageNonce\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"weight\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"startedAt\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"endedAt\",\"type\":\"uint64\"}],\"internalType\":\"structValidator\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"}],\"name\":\"getWeight\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"subnetID\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"churnPeriodSeconds\",\"type\":\"uint64\"},{\"internalType\":\"uint8\",\"name\":\"maximumChurnPercentage\",\"type\":\"uint8\"}],\"internalType\":\"structValidatorManagerSettings\",\"name\":\"baseSettings\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"minimumStakeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maximumStakeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"minimumStakeDuration\",\"type\":\"uint64\"},{\"internalType\":\"uint16\",\"name\":\"minimumDelegationFeeBips\",\"type\":\"uint16\"},{\"internalType\":\"uint8\",\"name\":\"maximumStakeMultiplier\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"weightToValueFactor\",\"type\":\"uint256\"},{\"internalType\":\"contractIRewardCalculator\",\"name\":\"rewardCalculator\",\"type\":\"address\"}],\"internalType\":\"structPoSValidatorManagerSettings\",\"name\":\"settings\",\"type\":\"tuple\"},{\"internalType\":\"contractIERC20Mintable\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"delegationAmount\",\"type\":\"uint256\"}],\"name\":\"initializeDelegatorRegistration\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"includeUptimeProof\",\"type\":\"bool\"},{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"initializeEndDelegation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"includeUptimeProof\",\"type\":\"bool\"},{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"initializeEndValidation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"nodeID\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"blsPublicKey\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"registrationExpiry\",\"type\":\"uint64\"},{\"components\":[{\"internalType\":\"uint32\",\"name\":\"threshold\",\"type\":\"uint32\"},{\"internalType\":\"address[]\",\"name\":\"addresses\",\"type\":\"address[]\"}],\"internalType\":\"structPChainOwner\",\"name\":\"remainingBalanceOwner\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint32\",\"name\":\"threshold\",\"type\":\"uint32\"},{\"internalType\":\"address[]\",\"name\":\"addresses\",\"type\":\"address[]\"}],\"internalType\":\"structPChainOwner\",\"name\":\"disableOwner\",\"type\":\"tuple\"}],\"internalType\":\"structValidatorRegistrationInput\",\"name\":\"registrationInput\",\"type\":\"tuple\"},{\"internalType\":\"uint16\",\"name\":\"delegationFeeBips\",\"type\":\"uint16\"},{\"internalType\":\"uint64\",\"name\":\"minStakeDuration\",\"type\":\"uint64\"},{\"internalType\":\"uint256\",\"name\":\"stakeAmount\",\"type\":\"uint256\"}],\"name\":\"initializeValidatorRegistration\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"subnetID\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"validatorManagerBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"validatorManagerAddress\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"bytes\",\"name\":\"nodeID\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"blsPublicKey\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"weight\",\"type\":\"uint64\"}],\"internalType\":\"structInitialValidator[]\",\"name\":\"initialValidators\",\"type\":\"tuple[]\"}],\"internalType\":\"structConversionData\",\"name\":\"conversionData\",\"type\":\"tuple\"},{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"initializeValidatorSet\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"nodeID\",\"type\":\"bytes\"}],\"name\":\"registeredValidators\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"}],\"name\":\"resendEndValidatorMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"}],\"name\":\"resendRegisterValidatorMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"}],\"name\":\"resendUpdateDelegation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"submitUptimeProof\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"valueToWeight\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"weight\",\"type\":\"uint64\"}],\"name\":\"weightToValue\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x608060405234801561000f575f80fd5b50604051615b6c380380615b6c83398101604081905261002e91610107565b60018160018111156100425761004261012c565b0361004f5761004f610055565b50610140565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff16156100a55760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b03908116146101045780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b5f60208284031215610117575f80fd5b815160028110610125575f80fd5b9392505050565b634e487b7160e01b5f52602160045260245ffd5b615a1f8061014d5f395ff3fe608060405234801561000f575f80fd5b50600436106101fd575f3560e01c806380dd672f11610114578063ba3a4b97116100a9578063d5f20ff611610079578063d5f20ff61461044f578063df93d8de1461046f578063e4a63c4014610479578063f74c607b1461048d578063fd7ac5e7146104a0575f80fd5b8063ba3a4b971461040d578063bc5fbfec14610420578063bee0a03f14610434578063c974d1b614610447575f80fd5b8063a3a65e48116100e4578063a3a65e48146103c0578063a9778a7a146102ac578063afb98096146103d3578063b771b3bc146103e7575f80fd5b806380dd672f1461037f5780638280a25a1461039257806393e245981461039a5780639e1bc4ef146103ad575f80fd5b80633a1cfff61161019557806360ad77841161016557806360ad77841461032c578063620658561461033f57806366435abf14610352578063732214f81461036557806376f786211461036c575f80fd5b80633a1cfff6146102c8578063467ef06f146102db5780634bee0040146102ee57806360305d621461030f575f80fd5b806320d91b7a116101d057806320d91b7a1461025b57806325e1c7761461026e5780632e2194d81461028157806335455ded146102ac575f80fd5b80630118acc4146102015780630322ed9814610216578063151d30d1146102295780631ec4472414610248575b5f80fd5b61021461020f3660046149a8565b6104b3565b005b6102146102243660046149e3565b6104e8565b610231600a81565b60405160ff90911681526020015b60405180910390f35b6102146102563660046149a8565b61076f565b6102146102693660046149fa565b61077a565b61021461027c366004614a48565b610cff565b61029461028f3660046149e3565b610d73565b6040516001600160401b03909116815260200161023f565b6102b561271081565b60405161ffff909116815260200161023f565b6102146102d63660046149a8565b610dcd565b6102146102e9366004614a69565b610dd8565b6103016102fc366004614aa7565b610e99565b60405190815260200161023f565b610317601481565b60405163ffffffff909116815260200161023f565b61021461033a366004614a48565b610ece565b61030161034d366004614b0e565b6111a6565b6102946103603660046149e3565b6111dd565b6103015f81565b61021461037a3660046149a8565b6111f1565b61021461038d366004614a48565b61121c565b610231603081565b6102146103a83660046149e3565b611461565b6103016103bb366004614b29565b61152c565b6102146103ce366004614a69565b611558565b6103015f8051602061594a83398151915281565b6103f56005600160991b0181565b6040516001600160a01b03909116815260200161023f565b61021461041b3660046149e3565b61174d565b6103015f8051602061596a83398151915281565b6102146104423660046149e3565b6119b8565b610231601481565b61046261045d3660046149e3565b611af5565b60405161023f9190614bbe565b6102946202a30081565b6103015f8051602061592a83398151915281565b61021461049b366004614c52565b611c44565b6103016104ae366004614c90565b611d23565b6104be838383611d7e565b6104e357604051631036cf9160e11b8152600481018490526024015b60405180910390fd5b505050565b5f8181525f805160206159ca8339815191526020526040808220815160e0810190925280545f8051602061596a83398151915293929190829060ff16600581111561053557610535614b49565b600581111561054657610546614b49565b815260200160018201805461055a90614cfb565b80601f016020809104026020016040519081016040528092919081815260200182805461058690614cfb565b80156105d15780601f106105a8576101008083540402835291602001916105d1565b820191905f5260205f20905b8154815290600101906020018083116105b457829003601f168201915b505050918352505060028201546001600160401b038082166020840152600160401b820481166040840152600160801b820481166060840152600160c01b909104811660808301526003928301541660a0909101529091508151600581111561063c5761063c614b49565b1461066f575f8381526007830160205260409081902054905163170cc93360e21b81526104da9160ff1690600401614d33565b606081015160405163854a893f60e01b8152600481018590526001600160401b0390911660248201525f60448201526005600160991b019063ee5b48eb9073__$fd0c147b4031eef6079b0498cbafa865f0$__9063854a893f906064015f60405180830381865af41580156106e6573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261070d9190810190614e3c565b6040518263ffffffff1660e01b81526004016107299190614e6d565b6020604051808303815f875af1158015610745573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107699190614e7f565b50505050565b610769838383611d7e565b7fe92546d698950ddd38910d2e15ed1d923cd0a7b3dde9e2a6a3f380565559cb09545f8051602061596a8339815191529060ff16156107cc57604051637fab81e560e01b815260040160405180910390fd5b6005600160991b016001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa15801561080f573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108339190614e7f565b83602001351461085c576040516372b0a7e760e11b8152602084013560048201526024016104da565b3061086d6060850160408601614e96565b6001600160a01b0316146108b05761088b6060840160408501614e96565b604051632f88120d60e21b81526001600160a01b0390911660048201526024016104da565b5f6108be6060850185614eb1565b905090505f805b828163ffffffff161015610b25575f6108e16060880188614eb1565b8363ffffffff168181106108f7576108f7614ef6565b90506020028101906109099190614f0a565b61091290614f75565b80516040519192505f91600888019161092a91614ff0565b9081526020016040518091039020541461095a57805160405163a41f772f60e01b81526104da9190600401614e6d565b5f6002885f01358460405160200161098992919091825260e01b6001600160e01b031916602082015260240190565b60408051601f19818403018152908290526109a391614ff0565b602060405180830381855afa1580156109be573d5f803e3d5ffd5b5050506040513d601f19601f820116820180604052508101906109e19190614e7f565b90508086600801835f01516040516109f99190614ff0565b90815260408051918290036020908101909220929092555f8381526007890190915220805460ff191660021781558251600190910190610a399082615045565b50604080830180515f84815260078a01602052929092206002810180549251426001600160401b03908116600160c01b026001600160c01b03928216600160801b81026001600160c01b03199097169290971691909117949094171692909217909155600301805467ffffffffffffffff19169055610ab89085615114565b8251604051919550610ac991614ff0565b60408051918290038220908401516001600160401b031682529082907f9d47fef9da077661546e646d61830bfcbda90506c2e5eed38195e82c4eb1cbdf9060200160405180910390a3505080610b1e90615127565b90506108c5565b50600483018190556001830154606490610b4990600160401b900460ff1683615149565b1015610b6b57604051635943317f60e01b8152600481018290526024016104da565b5f73__$fd0c147b4031eef6079b0498cbafa865f0$__634d847884610b8f876120d6565b604001516040518263ffffffff1660e01b8152600401610baf9190614e6d565b602060405180830381865af4158015610bca573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610bee9190614e7f565b90505f73__$fd0c147b4031eef6079b0498cbafa865f0$__6387418b8e886040518263ffffffff1660e01b8152600401610c28919061528b565b5f60405180830381865af4158015610c42573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610c699190810190614e3c565b90505f600282604051610c7c9190614ff0565b602060405180830381855afa158015610c97573d5f803e3d5ffd5b5050506040513d601f19601f82011682018060405250810190610cba9190614e7f565b9050828114610ce65760405163baaea89d60e01b815260048101829052602481018490526044016104da565b5050506009909201805460ff1916600117905550505050565b610d08826121ec565b610d28576040516330efa98b60e01b8152600481018390526024016104da565b5f610d3283611af5565b5190506002816005811115610d4957610d49614b49565b14610d69578060405163170cc93360e21b81526004016104da9190614d33565b6107698383612227565b5f805f8051602061594a83398151915260030154610d919084615316565b9050801580610da657506001600160401b0381115b15610dc75760405163222d164360e21b8152600481018490526024016104da565b92915050565b61076983838361250d565b610de06126f9565b5f8051602061594a8339815191525f80610df984612730565b91509150610e06826121ec565b610e1257505050610e80565b5f8281526005840160205260409020546001600160a01b0316600482516005811115610e4057610e40614b49565b03610e65575f83815260088501602052604081208054919055610e638282612ae3565b505b610e7b81610e7684604001516111a6565b612b59565b505050505b610e9660015f805160206159aa83398151915255565b50565b5f610ea26126f9565b610eae85858585612b8f565b9050610ec660015f805160206159aa83398151915255565b949350505050565b5f8281525f8051602061598a8339815191526020526040808220815160e0810190925280545f8051602061594a83398151915293929190829060ff166003811115610f1b57610f1b614b49565b6003811115610f2c57610f2c614b49565b8152815461010090046001600160a01b0316602082015260018201546040808301919091526002909201546001600160401b038082166060840152600160401b820481166080840152600160801b8204811660a0840152600160c01b9091041660c0909101528101519091505f610fa282611af5565b9050600183516003811115610fb957610fb9614b49565b14610fda578251604051633b0d540d60e21b81526104da9190600401615335565b600481516005811115610fef57610fef614b49565b0361100557610ffd86612d15565b505050505050565b5f8073__$fd0c147b4031eef6079b0498cbafa865f0$__6350782b0f61102a896120d6565b604001516040518263ffffffff1660e01b815260040161104a9190614e6d565b606060405180830381865af4158015611065573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611089919061534f565b50915091508184146110b657846040015160405163089938b360e11b81526004016104da91815260200190565b806001600160401b031683606001516001600160401b031610806110ef5750806001600160401b03168560a001516001600160401b0316115b1561111857604051632e19bc2d60e11b81526001600160401b03821660048201526024016104da565b5f888152600687016020908152604091829020805460ff1916600290811782550180546001600160401b034216600160401b81026fffffffffffffffff00000000000000001990921691909117909155915191825285918a917f047059b465069b8b751836b41f9f1d83daff583d2238cc7fbb461437ec23a4f6910160405180910390a35050505050505050565b7f4317713f7ecbdddd4bc99e95d903adedaa883b2e7c2551610bd13e2c7e473d03545f90610dc7906001600160401b038416615149565b5f6111e782611af5565b6080015192915050565b6111fc83838361250d565b6104e357604051635bff683f60e11b8152600481018490526024016104da565b6112246126f9565b5f8281525f8051602061598a8339815191526020526040808220815160e0810190925280545f8051602061594a83398151915293929190829060ff16600381111561127157611271614b49565b600381111561128257611282614b49565b8152815461010090046001600160a01b03166020820152600182015460408201526002909101546001600160401b038082166060840152600160401b820481166080840152600160801b8204811660a0840152600160c01b9091041660c09091015290506003815160038111156112fb576112fb614b49565b1461131c578051604051633b0d540d60e21b81526104da9190600401615335565b600461132b8260400151611af5565b51600581111561133d5761133d614b49565b1461143c575f61134c846120d6565b90505f8073__$fd0c147b4031eef6079b0498cbafa865f0$__6350782b0f84604001516040518263ffffffff1660e01b815260040161138b9190614e6d565b606060405180830381865af41580156113a6573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113ca919061534f565b5091509150818460400151146113f65760405163089938b360e11b8152600481018390526024016104da565b806001600160401b03168460c001516001600160401b0316111561143857604051632e19bc2d60e11b81526001600160401b03821660048201526024016104da565b5050505b61144584612d15565b505061145d60015f805160206159aa83398151915255565b5050565b5f8051602061594a8339815191525f61147983611af5565b519050600481600581111561149057611490614b49565b146114b0578060405163170cc93360e21b81526004016104da9190614d33565b5f8381526005830160205260409020546001600160a01b031633146114f657335b604051636e2ccd7560e11b81526001600160a01b0390911660048201526024016104da565b5f83815260088301602090815260408083208054908490556005860190925290912054610769906001600160a01b031682612ae3565b5f6115356126f9565b611540833384612f69565b9050610dc760015f805160206159aa83398151915255565b5f8051602061596a8339815191525f8073__$fd0c147b4031eef6079b0498cbafa865f0$__63021de88f61158b866120d6565b604001516040518263ffffffff1660e01b81526004016115ab9190614e6d565b6040805180830381865af41580156115c5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906115e9919061538f565b915091508061160f57604051632d07135360e01b815281151560048201526024016104da565b5f8281526006840160205260409020805461162990614cfb565b90505f0361164d5760405163089938b360e11b8152600481018390526024016104da565b60015f83815260078501602052604090205460ff16600581111561167357611673614b49565b146116a6575f8281526007840160205260409081902054905163170cc93360e21b81526104da9160ff1690600401614d33565b5f82815260068401602052604081206116be916148f7565b5f828152600784016020908152604091829020805460ff1916600290811782550180546001600160401b0342818116600160c01b026001600160c01b0390931692909217928390558451600160801b9093041682529181019190915283917ff8fd1c90fb9cfa2ca2358fdf5806b086ad43315d92b221c929efc7f105ce7568910160405180910390a250505050565b5f8181525f8051602061598a8339815191526020526040808220815160e0810190925280545f8051602061594a83398151915293929190829060ff16600381111561179a5761179a614b49565b60038111156117ab576117ab614b49565b8152815461010090046001600160a01b0316602082015260018083015460408301526002909201546001600160401b038082166060840152600160401b820481166080840152600160801b8204811660a0840152600160c01b9091041660c0909101529091508151600381111561182457611824614b49565b14158015611845575060038151600381111561184257611842614b49565b14155b15611866578051604051633b0d540d60e21b81526104da9190600401615335565b5f6118748260400151611af5565b905080606001516001600160401b03165f036118a6576040516339b894f960e21b8152600481018590526024016104da565b60408083015160608301516080840151925163854a893f60e01b81526005600160991b019363ee5b48eb9373__$fd0c147b4031eef6079b0498cbafa865f0$__9363854a893f9361191493906004019283526001600160401b03918216602084015216604082015260600190565b5f60405180830381865af415801561192e573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526119559190810190614e3c565b6040518263ffffffff1660e01b81526004016119719190614e6d565b6020604051808303815f875af115801561198d573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119b19190614e7f565b5050505050565b5f8181527fe92546d698950ddd38910d2e15ed1d923cd0a7b3dde9e2a6a3f380565559cb066020526040902080545f8051602061596a83398151915291906119ff90614cfb565b90505f03611a235760405163089938b360e11b8152600481018390526024016104da565b60015f83815260078301602052604090205460ff166005811115611a4957611a49614b49565b14611a7c575f8281526007820160205260409081902054905163170cc93360e21b81526104da9160ff1690600401614d33565b5f82815260068201602052604090819020905163ee5b48eb60e01b81526005600160991b019163ee5b48eb91611ab591906004016153b2565b6020604051808303815f875af1158015611ad1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104e39190614e7f565b611afd61492e565b5f8281525f805160206159ca833981519152602052604090819020815160e0810190925280545f8051602061596a833981519152929190829060ff166005811115611b4a57611b4a614b49565b6005811115611b5b57611b5b614b49565b8152602001600182018054611b6f90614cfb565b80601f0160208091040260200160405190810160405280929190818152602001828054611b9b90614cfb565b8015611be65780601f10611bbd57610100808354040283529160200191611be6565b820191905f5260205f20905b815481529060010190602001808311611bc957829003601f168201915b505050918352505060028201546001600160401b038082166020840152600160401b820481166040840152600160801b820481166060840152600160c01b9091048116608083015260039092015490911660a0909101529392505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805460029190600160401b900460ff1680611c8d575080546001600160401b03808416911610155b15611cab5760405163f92ee8a960e01b815260040160405180910390fd5b805468ffffffffffffffffff19166001600160401b03831617600160401b178155611cd684846131af565b805460ff60401b191681556040516001600160401b03831681527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a150505050565b6040515f905f8051602061596a833981519152907fe92546d698950ddd38910d2e15ed1d923cd0a7b3dde9e2a6a3f380565559cb0890611d66908690869061543c565b90815260200160405180910390205491505092915050565b5f8381525f8051602061598a8339815191526020526040808220815160e0810190925280545f8051602061594a8339815191529284929091829060ff166003811115611dcc57611dcc614b49565b6003811115611ddd57611ddd614b49565b8152815461010090046001600160a01b0316602082015260018201546040808301919091526002909201546001600160401b038082166060840152600160401b820481166080840152600160801b8204811660a0840152600160c01b9091041660c0909101528101519091505f611e5382611af5565b9050600283516003811115611e6a57611e6a614b49565b14611e8b578251604051633b0d540d60e21b81526104da9190600401615335565b60208301516001600160a01b03163314611f27575f8281526005850160205260409020546001600160a01b03163314611ec457336114d1565b5f82815260058501602052604090205460a0820151611ef391600160b01b90046001600160401b03169061544b565b6001600160401b0316421015611f275760405163fb6ce63f60e01b81526001600160401b03421660048201526024016104da565b600281516005811115611f3c57611f3c614b49565b0361206a5760028401546080840151611f5e916001600160401b03169061544b565b6001600160401b0316421015611f925760405163fb6ce63f60e01b81526001600160401b03421660048201526024016104da565b8615611fa457611fa28287612227565b505b5f8881526006850160205260409020805460ff1916600317905560608301516080820151611fdd918491611fd8919061546b565b6131c9565b505f898152600686016020526040812060020180546001600160401b03909316600160c01b026001600160c01b039093169290921790915561201e846133a0565b5f8a81526007870160205260408082208390555191925084918b917f366d336c0ab380dc799f095a6f82a26326585c52909cc698b09ba4540709ed5791a3151594506120cf9350505050565b60048151600581111561207f5761207f614b49565b036120b35761208d836133a0565b5f8981526007860160205260409020556120a688612d15565b60019450505050506120cf565b805160405163170cc93360e21b81526104da9190600401614d33565b9392505050565b60408051606080820183525f8083526020830152918101919091526040516306f8253560e41b815263ffffffff831660048201525f9081906005600160991b0190636f825350906024015f60405180830381865afa15801561213a573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052612161919081019061548b565b915091508061218357604051636b2f19e960e01b815260040160405180910390fd5b8151156121a9578151604051636ba589a560e01b815260048101919091526024016104da565b60208201516001600160a01b0316156121e5576020820151604051624de75d60e31b81526001600160a01b0390911660048201526024016104da565b5092915050565b5f9081527f4317713f7ecbdddd4bc99e95d903adedaa883b2e7c2551610bd13e2c7e473d0560205260409020546001600160a01b0316151590565b6040516306f8253560e41b815263ffffffff821660048201525f90819081906005600160991b0190636f825350906024015f60405180830381865afa158015612272573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052612299919081019061548b565b91509150806122bb57604051636b2f19e960e01b815260040160405180910390fd5b6005600160991b016001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa1580156122fe573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906123229190614e7f565b825114612348578151604051636ba589a560e01b815260048101919091526024016104da565b60208201516001600160a01b031615612384576020820151604051624de75d60e31b81526001600160a01b0390911660048201526024016104da565b5f8073__$fd0c147b4031eef6079b0498cbafa865f0$__63088c246385604001516040518263ffffffff1660e01b81526004016123c19190614e6d565b6040805180830381865af41580156123db573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906123ff919061551b565b915091508187146124265760405163089938b360e11b8152600481018890526024016104da565b5f8781527f4317713f7ecbdddd4bc99e95d903adedaa883b2e7c2551610bd13e2c7e473d0560205260409020600101545f8051602061594a833981519152906001600160401b0390811690831611156124e3575f888152600582016020908152604091829020600101805467ffffffffffffffff19166001600160401b038616908117909155915191825289917fec44148e8ff271f2d0bacef1142154abacb0abb3a29eb3eb50e2ca97e86d0435910160405180910390a2612502565b5f8881526005820160205260409020600101546001600160401b031691505b509695505050505050565b5f5f8051602061594a833981519152816125268661353d565b9050612531866121ec565b612540576001925050506120cf565b5f8681526005830160205260409020546001600160a01b0316331461256557336114d1565b5f86815260058301602052604090205460a082015161259491600160b01b90046001600160401b03169061544b565b6001600160401b03168160c001516001600160401b031610156125db5760c081015160405163fb6ce63f60e01b81526001600160401b0390911660048201526024016104da565b5f85156125f3576125ec8786612227565b9050612611565b505f8681526005830160205260409020600101546001600160401b03165b600483015460408301515f916001600160a01b031690634f22429f90612636906111a6565b60a086015160c087015160405160e085901b6001600160e01b031916815260048101939093526001600160401b03918216602484018190526044840152811660648301528516608482015260a401602060405180830381865afa15801561269f573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906126c39190614e7f565b905080846008015f8a81526020019081526020015f205f8282546126e79190615114565b90915550501515979650505050505050565b5f805160206159aa83398151915280546001190161272a57604051633ee5aeb560e01b815260040160405180910390fd5b60029055565b5f61273961492e565b5f8051602061596a8339815191525f8073__$fd0c147b4031eef6079b0498cbafa865f0$__63021de88f61276c886120d6565b604001516040518263ffffffff1660e01b815260040161278c9190614e6d565b6040805180830381865af41580156127a6573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906127ca919061538f565b9150915080156127f157604051632d07135360e01b815281151560048201526024016104da565b5f828152600784016020526040808220815160e081019092528054829060ff16600581111561282257612822614b49565b600581111561283357612833614b49565b815260200160018201805461284790614cfb565b80601f016020809104026020016040519081016040528092919081815260200182805461287390614cfb565b80156128be5780601f10612895576101008083540402835291602001916128be565b820191905f5260205f20905b8154815290600101906020018083116128a157829003601f168201915b505050918352505060028201546001600160401b038082166020840152600160401b820481166040840152600160801b820481166060840152600160c01b909104811660808301526003928301541660a0909101529091508151600581111561292957612929614b49565b1415801561294a575060018151600581111561294757612947614b49565b14155b1561296b57805160405163170cc93360e21b81526104da9190600401614d33565b60038151600581111561298057612980614b49565b0361298e5760048152612993565b600581525b8360080181602001516040516129a99190614ff0565b90815260408051602092819003830190205f908190558581526007870190925290208151815483929190829060ff191660018360058111156129ed576129ed614b49565b021790555060208201516001820190612a069082615045565b5060408201516002820180546060850151608086015160a08701516001600160401b039586166001600160801b031990941693909317600160401b92861692909202919091176001600160801b0316600160801b918516919091026001600160c01b031617600160c01b9184169190910217905560c0909201516003909101805467ffffffffffffffff19169190921617905580516005811115612aac57612aac614b49565b60405184907f1c08e59656f1a18dc2da76826cdc52805c43e897a17c50faefb8ab3c1526cc16905f90a39196919550909350505050565b5f5f8051602061592a83398151915280546040516340c10f1960e01b81526001600160a01b038681166004830152602482018690529293509116906340c10f19906044015f604051808303815f87803b158015612b3e575f80fd5b505af1158015612b50573d5f803e3d5ffd5b50505050505050565b5f8051602061592a8339815191525461145d906001600160a01b03168383613821565b60015f805160206159aa83398151915255565b7f4317713f7ecbdddd4bc99e95d903adedaa883b2e7c2551610bd13e2c7e473d02545f905f8051602061594a83398151915290600160401b900461ffff9081169086161080612be3575061271061ffff8616115b15612c0757604051635f12e6c360e11b815261ffff861660048201526024016104da565b60028101546001600160401b039081169085161015612c43576040516202a06d60e11b81526001600160401b03851660048201526024016104da565b8054831080612c555750806001015483115b15612c765760405163222d164360e21b8152600481018490526024016104da565b5f612c8084613880565b90505f612c8c82610d73565b90505f612c9989836138a3565b5f818152600595909501602052604090942080546001600160b01b0319163317600160a01b61ffff9a909a16999099029890981767ffffffffffffffff60b01b1916600160b01b6001600160401b03989098169790970296909617875550506001909401805467ffffffffffffffff1916905550919392505050565b5f8181525f8051602061598a8339815191526020526040808220815160e0810190925280545f8051602061594a83398151915293929190829060ff166003811115612d6257612d62614b49565b6003811115612d7357612d73614b49565b8152815461010090046001600160a01b0316602082015260018201546040808301919091526002909201546001600160401b038082166060840152600160401b820481166080840152600160801b8204811660a0840152600160c01b9091041660c090910152810151909150612e107fe92546d698950ddd38910d2e15ed1d923cd0a7b3dde9e2a6a3f380565559cb01546001600160401b031690565b8260800151612e1f919061544b565b6001600160401b0316421015612e535760405163fb6ce63f60e01b81526001600160401b03421660048201526024016104da565b5f848152600684016020908152604080832080546001600160a81b03191681556001810184905560020183905560078601909152812080549082905590808215612f0e575f84815260058701602052604090205461271090612ec090600160a01b900461ffff1685615149565b612eca9190615316565b915081866008015f8681526020019081526020015f205f828254612eee9190615114565b90915550612efe9050828461553e565b9050612f0e856020015182612ae3565b612f238560200151610e7687606001516111a6565b6040805182815260208101849052859189917f8ececf510070c320d9a55323ffabe350e294ae505fc0c509dc5736da6f5cc993910160405180910390a350505050505050565b5f5f8051602061594a83398151915281612f8561028f85613880565b90505f612f9187611af5565b9050612f9c876121ec565b612fbc576040516330efa98b60e01b8152600481018890526024016104da565b600281516005811115612fd157612fd1614b49565b14612ff257805160405163170cc93360e21b81526104da9190600401614d33565b5f828260800151613003919061544b565b905083600201600a9054906101000a90046001600160401b0316826040015161302c9190615551565b6001600160401b0316816001600160401b0316111561306957604051636d51fe0560e11b81526001600160401b03821660048201526024016104da565b5f806130758a846131c9565b915091505f8a836040516020016130a392919091825260c01b6001600160c01b031916602082015260280190565b60408051601f1981840301815291815281516020928301205f81815260068b019093529120805491925060019160ff1916828002179055505f8181526006880160209081526040918290208054610100600160a81b0319166101006001600160a01b038f16908102919091178255600182018f9055600290910180546001600160401b038b81166001600160c01b03199092168217600160801b8a8316908102919091176001600160c01b031690935585519283528916938201939093529283019190915260608201849052908c9083907fb0024b263bc3a0b728a6edea50a69efa841189f8d32ee8af9d1c2b1a1a2234269060800160405180910390a49a9950505050505050505050565b6131b7613dc8565b6131c082613e13565b61145d81613e87565b5f8281525f805160206159ca833981519152602052604081206002015481905f8051602061596a83398151915290600160801b90046001600160401b03166132118582613eef565b5f61321b87614112565b5f888152600785016020526040808220600201805467ffffffffffffffff60801b1916600160801b6001600160401b038c811691820292909217909255915163854a893f60e01b8152600481018c905291841660248301526044820152919250906005600160991b019063ee5b48eb9073__$fd0c147b4031eef6079b0498cbafa865f0$__9063854a893f906064015f60405180830381865af41580156132c4573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526132eb9190810190614e3c565b6040518263ffffffff1660e01b81526004016133079190614e6d565b6020604051808303815f875af1158015613323573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906133479190614e7f565b604080516001600160401b038a811682526020820184905282519394508516928b927f07de5ff35a674a8005e661f3333c907ca6333462808762d19dc7b3abb1a8c1df928290030190a3909450925050505b9250929050565b5f805f8051602061594a83398151915290505f6133c08460400151611af5565b90505f6003825160058111156133d8576133d8614b49565b14806133f657506004825160058111156133f4576133f4614b49565b145b15613406575060c0810151613443565b60028251600581111561341b5761341b614b49565b03613427575042613443565b815160405163170cc93360e21b81526104da9190600401614d33565b84608001516001600160401b0316816001600160401b03161161346a57505f949350505050565b600483015460608601516001600160a01b0390911690634f22429f9061348f906111a6565b60a085015160808901516040808b01515f90815260058a0160205281902060010154905160e086901b6001600160e01b031916815260048101949094526001600160401b0392831660248501529082166044840152818616606484015216608482015260a401602060405180830381865afa158015613510573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906135349190614e7f565b95945050505050565b61354561492e565b5f8281525f805160206159ca8339815191526020526040808220815160e0810190925280545f8051602061596a83398151915293929190829060ff16600581111561359257613592614b49565b60058111156135a3576135a3614b49565b81526020016001820180546135b790614cfb565b80601f01602080910402602001604051908101604052809291908181526020018280546135e390614cfb565b801561362e5780601f106136055761010080835404028352916020019161362e565b820191905f5260205f20905b81548152906001019060200180831161361157829003601f168201915b50505091835250506002828101546001600160401b038082166020850152600160401b820481166040850152600160801b820481166060850152600160c01b9091048116608084015260039093015490921660a0909101529091508151600581111561369c5761369c614b49565b146136cf575f8481526007830160205260409081902054905163170cc93360e21b81526104da9160ff1690600401614d33565b60038152426001600160401b031660c08201525f84815260078301602052604090208151815483929190829060ff1916600183600581111561371357613713614b49565b02179055506020820151600182019061372c9082615045565b5060408201516002820180546060850151608086015160a08701516001600160401b039586166001600160801b031990941693909317600160401b92861692909202919091176001600160801b0316600160801b918516919091026001600160c01b031617600160c01b9184169190910217905560c0909201516003909101805467ffffffffffffffff1916919092161790555f6137ca85826131c9565b6080840151604080516001600160401b03909216825242602083015291935083925087917f13d58394cf269d48bcf927959a29a5ffee7c9924dafff8927ecdf3c48ffa7c67910160405180910390a3509392505050565b6040516001600160a01b038381166024830152604482018390526104e391859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050614187565b5f610dc7825f8051602061592a833981519152546001600160a01b0316906141e8565b7fe92546d698950ddd38910d2e15ed1d923cd0a7b3dde9e2a6a3f380565559cb09545f9060ff166138e757604051637fab81e560e01b815260040160405180910390fd5b5f8051602061596a833981519152426139066060860160408701614b0e565b6001600160401b031611158061394057506139246202a30042615114565b6139346060860160408701614b0e565b6001600160401b031610155b1561397a576139556060850160408601614b0e565b604051635879da1360e11b81526001600160401b0390911660048201526024016104da565b61398f61398a606086018661557c565b6141f4565b61399f61398a608086018661557c565b60306139ae6020860186615590565b9050146139e0576139c26020850185615590565b6040516326475b2f60e11b81526104da925060040190815260200190565b6139ea8480615590565b90505f03613a17576139fc8480615590565b604051633e08a12560e11b81526004016104da9291906155d2565b5f60088201613a268680615590565b604051613a3492919061543c565b90815260200160405180910390205414613a6d57613a528480615590565b60405163a41f772f60e01b81526004016104da9291906155d2565b613a77835f613eef565b6040805160e08101909152815481525f90819073__$fd0c147b4031eef6079b0498cbafa865f0$__9063eb97ce519060208101613ab48a80615590565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250505090825250602090810190613afc908b018b615590565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250505090825250602001613b4560608b0160408c01614b0e565b6001600160401b03168152602001613b6060608b018b61557c565b613b69906155e5565b8152602001613b7b60808b018b61557c565b613b84906155e5565b8152602001886001600160401b03168152506040518263ffffffff1660e01b8152600401613bb29190615707565b5f60405180830381865af4158015613bcc573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052613bf391908101906157be565b5f82815260068601602052604090209193509150613c118282615045565b508160088401613c218880615590565b604051613c2f92919061543c565b9081526040519081900360200181209190915563ee5b48eb60e01b81525f906005600160991b019063ee5b48eb90613c6b908590600401614e6d565b6020604051808303815f875af1158015613c87573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613cab9190614e7f565b5f8481526007860160205260409020805460ff191660011790559050613cd18780615590565b5f858152600787016020526040902060010191613cef919083615801565b505f83815260078501602052604090206002810180546001600160c01b0319166001600160401b038916908117600160801b91909102176001600160c01b03169055600301805467ffffffffffffffff1916905580613d4e8880615590565b604051613d5c92919061543c565b6040518091039020847fb77297e3befc691bfc864a81e241f83e2ef722b6e7becaa2ecec250c6d52b430898b6040016020810190613d9a9190614b0e565b604080516001600160401b0393841681529290911660208301520160405180910390a4509095945050505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff16613e1157604051631afcd79f60e31b815260040160405180910390fd5b565b613e1b613dc8565b613e248161435d565b613e2c614376565b610e9660608201356080830135613e4960c0850160a08601614b0e565b613e5960e0860160c087016158ba565b613e6a610100870160e088016158d3565b610100870135613e8261014089016101208a01614e96565b614386565b613e8f613dc8565b5f8051602061592a8339815191526001600160a01b038216613ecf57604051637330680360e01b81526001600160a01b03831660048201526024016104da565b80546001600160a01b0319166001600160a01b0392909216919091179055565b5f8051602061596a8339815191525f6001600160401b038084169085161115613f2357613f1c838561546b565b9050613f30565b613f2d848461546b565b90505b6040805160808101825260028401548082526003850154602083015260048501549282019290925260058401546001600160401b0316606082015242911580613f92575060018401548151613f8e916001600160401b031690615114565b8210155b15613fb8576001600160401b038316606082015281815260408101516020820152613fd7565b8281606001818151613fca919061544b565b6001600160401b03169052505b6060810151613fe7906064615551565b602082015160018601546001600160401b0392909216916140129190600160401b900460ff16615149565b101561404257606081015160405163dfae880160e01b81526001600160401b0390911660048201526024016104da565b856001600160401b03168160400181815161405d9190615114565b9052506040810180516001600160401b038716919061407d90839061553e565b905250600184015460408201516064916140a291600160401b90910460ff1690615149565b10156140c9578060400151604051635943317f60e01b81526004016104da91815260200190565b805160028501556020810151600385015560408101516004850155606001516005909301805467ffffffffffffffff19166001600160401b039094169390931790925550505050565b5f8181525f805160206159ca8339815191526020526040812060020180545f8051602061596a833981519152919060089061415c90600160401b90046001600160401b03166158f3565b91906101000a8154816001600160401b0302191690836001600160401b031602179055915050919050565b5f61419b6001600160a01b03841683614542565b905080515f141580156141bf5750808060200190518101906141bd919061590e565b155b156104e357604051635274afe760e01b81526001600160a01b03841660048201526024016104da565b5f6120cf83338461454f565b6142016020820182614a69565b63ffffffff16158015614221575061421c6020820182614eb1565b151590505b15614268576142336020820182614a69565b6142406020830183614eb1565b60405163c08a0f1d60e01b815263ffffffff90931660048401526024830152506044016104da565b6142756020820182614eb1565b90506142846020830183614a69565b63ffffffff16111561429d576142336020820182614a69565b60015b6142ad6020830183614eb1565b905081101561145d576142c36020830183614eb1565b6142ce60018461553e565b8181106142dd576142dd614ef6565b90506020020160208101906142f29190614e96565b6001600160a01b03166143086020840184614eb1565b8381811061431857614318614ef6565b905060200201602081019061432d9190614e96565b6001600160a01b0316101561435557604051630dbc8d5f60e31b815260040160405180910390fd5b6001016142a0565b614365613dc8565b61436d6146b2565b610e96816146ba565b61437e613dc8565b613e116147a2565b61438e613dc8565b5f8051602061594a83398151915261ffff851615806143b2575061271061ffff8616115b156143d657604051635f12e6c360e11b815261ffff861660048201526024016104da565b868811156143fa5760405163222d164360e21b8152600481018990526024016104da565b60ff8416158061440d5750600a60ff8516115b156144305760405163170db35960e31b815260ff851660048201526024016104da565b7fe92546d698950ddd38910d2e15ed1d923cd0a7b3dde9e2a6a3f380565559cb01546001600160401b03166001600160401b0316866001600160401b03161015614497576040516202a06d60e11b81526001600160401b03871660048201526024016104da565b825f036144b75760405163a733007160e01b815260040160405180910390fd5b96875560018701959095556002860180546001600160401b039590951669ffffffffffffffffffff1990951694909417600160401b61ffff94909416939093029290921767ffffffffffffffff60501b191660ff91909116600160501b02179091556003830155600490910180546001600160a01b0319166001600160a01b03909216919091179055565b60606120cf83835f6147aa565b6040516370a0823160e01b81523060048201525f9081906001600160a01b038616906370a0823190602401602060405180830381865afa158015614595573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906145b99190614e7f565b90506145d06001600160a01b038616853086614839565b6040516370a0823160e01b81523060048201525f906001600160a01b038716906370a0823190602401602060405180830381865afa158015614614573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906146389190614e7f565b905081811161469e5760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016104da565b6146a8828261553e565b9695505050505050565b613e11613dc8565b6146c2613dc8565b80355f8051602061596a83398151915290815560146146e760608401604085016158d3565b60ff161180614706575061470160608301604084016158d3565b60ff16155b1561473a5761471b60608301604084016158d3565b604051634a59bbff60e11b815260ff90911660048201526024016104da565b61474a60608301604084016158d3565b60018201805460ff92909216600160401b0260ff60401b1990921691909117905561477b6040830160208401614b0e565b600191909101805467ffffffffffffffff19166001600160401b0390921691909117905550565b612b7c613dc8565b6060814710156147cf5760405163cd78605960e01b81523060048201526024016104da565b5f80856001600160a01b031684866040516147ea9190614ff0565b5f6040518083038185875af1925050503d805f8114614824576040519150601f19603f3d011682016040523d82523d5f602084013e614829565b606091505b50915091506146a8868383614872565b6040516001600160a01b0384811660248301528381166044830152606482018390526107699186918216906323b872dd9060840161384e565b60608261488757614882826148ce565b6120cf565b815115801561489e57506001600160a01b0384163b155b156148c757604051639996b31560e01b81526001600160a01b03851660048201526024016104da565b50806120cf565b8051156148de5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b50805461490390614cfb565b5f825580601f10614912575050565b601f0160209004905f5260205f2090810190610e96919061496b565b6040805160e08101909152805f81526060602082018190525f604083018190529082018190526080820181905260a0820181905260c09091015290565b5b8082111561497f575f815560010161496c565b5090565b8015158114610e96575f80fd5b803563ffffffff811681146149a3575f80fd5b919050565b5f805f606084860312156149ba575f80fd5b8335925060208401356149cc81614983565b91506149da60408501614990565b90509250925092565b5f602082840312156149f3575f80fd5b5035919050565b5f8060408385031215614a0b575f80fd5b82356001600160401b03811115614a20575f80fd5b830160808186031215614a31575f80fd5b9150614a3f60208401614990565b90509250929050565b5f8060408385031215614a59575f80fd5b82359150614a3f60208401614990565b5f60208284031215614a79575f80fd5b6120cf82614990565b803561ffff811681146149a3575f80fd5b6001600160401b0381168114610e96575f80fd5b5f805f8060808587031215614aba575f80fd5b84356001600160401b03811115614acf575f80fd5b850160a08188031215614ae0575f80fd5b9350614aee60208601614a82565b92506040850135614afe81614a93565b9396929550929360600135925050565b5f60208284031215614b1e575f80fd5b81356120cf81614a93565b5f8060408385031215614b3a575f80fd5b50508035926020909101359150565b634e487b7160e01b5f52602160045260245ffd5b60068110614b6d57614b6d614b49565b9052565b5f5b83811015614b8b578181015183820152602001614b73565b50505f910152565b5f8151808452614baa816020860160208601614b71565b601f01601f19169290920160200192915050565b60208152614bd0602082018351614b5d565b5f602083015160e06040840152614beb610100840182614b93565b905060408401516001600160401b0380821660608601528060608701511660808601528060808701511660a08601528060a08701511660c08601528060c08701511660e086015250508091505092915050565b6001600160a01b0381168114610e96575f80fd5b5f80828403610160811215614c65575f80fd5b61014080821215614c74575f80fd5b8493508301359050614c8581614c3e565b809150509250929050565b5f8060208385031215614ca1575f80fd5b82356001600160401b0380821115614cb7575f80fd5b818501915085601f830112614cca575f80fd5b813581811115614cd8575f80fd5b866020828501011115614ce9575f80fd5b60209290920196919550909350505050565b600181811c90821680614d0f57607f821691505b602082108103614d2d57634e487b7160e01b5f52602260045260245ffd5b50919050565b60208101610dc78284614b5d565b634e487b7160e01b5f52604160045260245ffd5b604051606081016001600160401b0381118282101715614d7757614d77614d41565b60405290565b604080519081016001600160401b0381118282101715614d7757614d77614d41565b604051601f8201601f191681016001600160401b0381118282101715614dc757614dc7614d41565b604052919050565b5f6001600160401b03821115614de757614de7614d41565b50601f01601f191660200190565b5f82601f830112614e04575f80fd5b8151614e17614e1282614dcf565b614d9f565b818152846020838601011115614e2b575f80fd5b610ec6826020830160208701614b71565b5f60208284031215614e4c575f80fd5b81516001600160401b03811115614e61575f80fd5b610ec684828501614df5565b602081525f6120cf6020830184614b93565b5f60208284031215614e8f575f80fd5b5051919050565b5f60208284031215614ea6575f80fd5b81356120cf81614c3e565b5f808335601e19843603018112614ec6575f80fd5b8301803591506001600160401b03821115614edf575f80fd5b6020019150600581901b3603821315613399575f80fd5b634e487b7160e01b5f52603260045260245ffd5b5f8235605e19833603018112614f1e575f80fd5b9190910192915050565b5f82601f830112614f37575f80fd5b8135614f45614e1282614dcf565b818152846020838601011115614f59575f80fd5b816020850160208301375f918101602001919091529392505050565b5f60608236031215614f85575f80fd5b614f8d614d55565b82356001600160401b0380821115614fa3575f80fd5b614faf36838701614f28565b83526020850135915080821115614fc4575f80fd5b50614fd136828601614f28565b6020830152506040830135614fe581614a93565b604082015292915050565b5f8251614f1e818460208701614b71565b601f8211156104e357805f5260205f20601f840160051c810160208510156150265750805b601f840160051c820191505b818110156119b1575f8155600101615032565b81516001600160401b0381111561505e5761505e614d41565b6150728161506c8454614cfb565b84615001565b602080601f8311600181146150a5575f841561508e5750858301515b5f19600386901b1c1916600185901b178555610ffd565b5f85815260208120601f198616915b828110156150d3578886015182559484019460019091019084016150b4565b50858210156150f057878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b5f52601160045260245ffd5b80820180821115610dc757610dc7615100565b5f63ffffffff80831681810361513f5761513f615100565b6001019392505050565b8082028115828204841417610dc757610dc7615100565b5f808335601e19843603018112615175575f80fd5b83016020810192503590506001600160401b03811115615193575f80fd5b803603821315613399575f80fd5b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b5f8383855260208086019550808560051b830101845f5b8781101561527e57848303601f19018952813536889003605e19018112615205575f80fd5b870160606152138280615160565b82875261522383880182846151a1565b9250505061523386830183615160565b868303888801526152458382846151a1565b92505050604080830135925061525a83614a93565b6001600160401b0392909216949091019390935297830197908301906001016151e0565b5090979650505050505050565b6020815281356020820152602082013560408201525f60408301356152af81614c3e565b6001600160a01b031660608381019190915283013536849003601e190181126152d6575f80fd5b83016020810190356001600160401b038111156152f1575f80fd5b8060051b3603821315615302575f80fd5b60808085015261353460a0850182846151c9565b5f8261533057634e487b7160e01b5f52601260045260245ffd5b500490565b602081016004831061534957615349614b49565b91905290565b5f805f60608486031215615361575f80fd5b83519250602084015161537381614a93565b604085015190925061538481614a93565b809150509250925092565b5f80604083850312156153a0575f80fd5b825191506020830151614c8581614983565b5f60208083525f84546153c481614cfb565b806020870152604060018084165f81146153e557600181146154015761542e565b60ff19851660408a0152604084151560051b8a0101955061542e565b895f5260205f205f5b858110156154255781548b820186015290830190880161540a565b8a016040019650505b509398975050505050505050565b818382375f9101908152919050565b6001600160401b038181168382160190808211156121e5576121e5615100565b6001600160401b038281168282160390808211156121e5576121e5615100565b5f806040838503121561549c575f80fd5b82516001600160401b03808211156154b2575f80fd5b90840190606082870312156154c5575f80fd5b6154cd614d55565b8251815260208301516154df81614c3e565b60208201526040830151828111156154f5575f80fd5b61550188828601614df5565b6040830152508094505050506020830151614c8581614983565b5f806040838503121561552c575f80fd5b825191506020830151614c8581614a93565b81810381811115610dc757610dc7615100565b6001600160401b0381811683821602808216919082811461557457615574615100565b505092915050565b5f8235603e19833603018112614f1e575f80fd5b5f808335601e198436030181126155a5575f80fd5b8301803591506001600160401b038211156155be575f80fd5b602001915036819003821315613399575f80fd5b602081525f610ec66020830184866151a1565b5f604082360312156155f5575f80fd5b6155fd614d7d565b61560683614990565b81526020808401356001600160401b0380821115615622575f80fd5b9085019036601f830112615634575f80fd5b81358181111561564657615646614d41565b8060051b9150615657848301614d9f565b8181529183018401918481019036841115615670575f80fd5b938501935b8385101561569a578435925061568a83614c3e565b8282529385019390850190615675565b94860194909452509295945050505050565b5f6040830163ffffffff8351168452602080840151604060208701528281518085526060880191506020830194505f92505b808310156125025784516001600160a01b031682529383019360019290920191908301906156de565b60208152815160208201525f602083015160e0604084015261572d610100840182614b93565b90506040840151601f198085840301606086015261574b8383614b93565b92506001600160401b03606087015116608086015260808601519150808584030160a086015261577b83836156ac565b925060a08601519150808584030160c08601525061579982826156ac565b91505060c08401516157b660e08501826001600160401b03169052565b509392505050565b5f80604083850312156157cf575f80fd5b8251915060208301516001600160401b038111156157eb575f80fd5b6157f785828601614df5565b9150509250929050565b6001600160401b0383111561581857615818614d41565b61582c836158268354614cfb565b83615001565b5f601f84116001811461585d575f85156158465750838201355b5f19600387901b1c1916600186901b1783556119b1565b5f83815260208120601f198716915b8281101561588c578685013582556020948501946001909201910161586c565b50868210156158a8575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b5f602082840312156158ca575f80fd5b6120cf82614a82565b5f602082840312156158e3575f80fd5b813560ff811681146120cf575f80fd5b5f6001600160401b0380831681810361513f5761513f615100565b5f6020828403121561591e575f80fd5b81516120cf8161498356fe6e5bdfcce15e53c3406ea67bfce37dcd26f5152d5492824e43fd5e3c8ac5ab004317713f7ecbdddd4bc99e95d903adedaa883b2e7c2551610bd13e2c7e473d00e92546d698950ddd38910d2e15ed1d923cd0a7b3dde9e2a6a3f380565559cb004317713f7ecbdddd4bc99e95d903adedaa883b2e7c2551610bd13e2c7e473d069b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00e92546d698950ddd38910d2e15ed1d923cd0a7b3dde9e2a6a3f380565559cb07a2646970667358221220caa31d1b6a4d5b2139a71f42b963cce2eefd847911a8578b6b6e5f508b96974964736f6c63430008190033", + ABI: "[{\"inputs\":[{\"internalType\":\"enumICMInitializable\",\"name\":\"init\",\"type\":\"uint8\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"AddressEmptyCode\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"AddressInsufficientBalance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"}],\"name\":\"DelegatorIneligibleForRewards\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FailedInnerCall\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"length\",\"type\":\"uint256\"}],\"name\":\"InvalidBLSKeyLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"encodedConversionID\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"expectedConversionID\",\"type\":\"bytes32\"}],\"name\":\"InvalidConversionID\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"delegationFeeBips\",\"type\":\"uint16\"}],\"name\":\"InvalidDelegationFee\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"}],\"name\":\"InvalidDelegationID\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"enumDelegatorStatus\",\"name\":\"status\",\"type\":\"uint8\"}],\"name\":\"InvalidDelegatorStatus\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidInitialization\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidInitializationStatus\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"maximumChurnPercentage\",\"type\":\"uint8\"}],\"name\":\"InvalidMaximumChurnPercentage\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"minStakeDuration\",\"type\":\"uint64\"}],\"name\":\"InvalidMinStakeDuration\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"nodeID\",\"type\":\"bytes\"}],\"name\":\"InvalidNodeID\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"nonce\",\"type\":\"uint64\"}],\"name\":\"InvalidNonce\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"threshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addressesLength\",\"type\":\"uint256\"}],\"name\":\"InvalidPChainOwnerThreshold\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"registrationExpiry\",\"type\":\"uint64\"}],\"name\":\"InvalidRegistrationExpiry\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"stakeAmount\",\"type\":\"uint256\"}],\"name\":\"InvalidStakeAmount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"maximumStakeMultiplier\",\"type\":\"uint8\"}],\"name\":\"InvalidStakeMultiplier\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"}],\"name\":\"InvalidTokenAddress\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"}],\"name\":\"InvalidTotalWeight\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"}],\"name\":\"InvalidValidationID\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"validatorManagerAddress\",\"type\":\"address\"}],\"name\":\"InvalidValidatorManagerAddress\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"blockchainID\",\"type\":\"bytes32\"}],\"name\":\"InvalidValidatorManagerBlockchainID\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"}],\"name\":\"InvalidValidatorStatus\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidWarpMessage\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"senderAddress\",\"type\":\"address\"}],\"name\":\"InvalidWarpOriginSenderAddress\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"sourceChainID\",\"type\":\"bytes32\"}],\"name\":\"InvalidWarpSourceChainID\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"churnAmount\",\"type\":\"uint64\"}],\"name\":\"MaxChurnRateExceeded\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"newValidatorWeight\",\"type\":\"uint64\"}],\"name\":\"MaxWeightExceeded\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"endTime\",\"type\":\"uint64\"}],\"name\":\"MinStakeDurationNotPassed\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"nodeID\",\"type\":\"bytes\"}],\"name\":\"NodeAlreadyRegistered\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotInitializing\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"PChainOwnerAddressesNotSorted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ReentrancyGuardReentrantCall\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"SafeERC20FailedOperation\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"UnauthorizedOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"validRegistration\",\"type\":\"bool\"}],\"name\":\"UnexpectedRegistrationStatus\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"}],\"name\":\"ValidatorIneligibleForRewards\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"}],\"name\":\"ValidatorNotPoS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroWeightToValueFactor\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rewards\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fees\",\"type\":\"uint256\"}],\"name\":\"DelegationEnded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegatorAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"nonce\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"validatorWeight\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"delegatorWeight\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"setWeightMessageID\",\"type\":\"bytes32\"}],\"name\":\"DelegatorAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startTime\",\"type\":\"uint256\"}],\"name\":\"DelegatorRegistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"}],\"name\":\"DelegatorRemovalInitialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes\",\"name\":\"nodeID\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"}],\"name\":\"InitialValidatorCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"version\",\"type\":\"uint64\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"uptime\",\"type\":\"uint64\"}],\"name\":\"UptimeUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes\",\"name\":\"nodeID\",\"type\":\"bytes\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"registerValidationMessageID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"registrationExpiry\",\"type\":\"uint64\"}],\"name\":\"ValidationPeriodCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"}],\"name\":\"ValidationPeriodEnded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"}],\"name\":\"ValidationPeriodRegistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"setWeightMessageID\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"endTime\",\"type\":\"uint256\"}],\"name\":\"ValidatorRemovalInitialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint64\",\"name\":\"nonce\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"validatorWeight\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"setWeightMessageID\",\"type\":\"bytes32\"}],\"name\":\"ValidatorWeightUpdate\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"ADDRESS_LENGTH\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BIPS_CONVERSION_FACTOR\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"BLS_PUBLIC_KEY_LENGTH\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ERC20_STAKING_MANAGER_STORAGE_LOCATION\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAXIMUM_CHURN_PERCENTAGE_LIMIT\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAXIMUM_DELEGATION_FEE_BIPS\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAXIMUM_REGISTRATION_EXPIRY_LENGTH\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"MAXIMUM_STAKE_MULTIPLIER_LIMIT\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"POS_VALIDATOR_MANAGER_STORAGE_LOCATION\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"P_CHAIN_BLOCKCHAIN_ID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"VALIDATOR_MANAGER_STORAGE_LOCATION\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WARP_MESSENGER\",\"outputs\":[{\"internalType\":\"contractIWarpMessenger\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"}],\"name\":\"claimDelegationFees\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"completeDelegatorRegistration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"completeEndDelegation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"completeEndValidation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"completeValidatorRegistration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"erc20\",\"outputs\":[{\"internalType\":\"contractIERC20Mintable\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"includeUptimeProof\",\"type\":\"bool\"},{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"forceInitializeEndDelegation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"includeUptimeProof\",\"type\":\"bool\"},{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"forceInitializeEndValidation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"}],\"name\":\"getValidator\",\"outputs\":[{\"components\":[{\"internalType\":\"enumValidatorStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"nodeID\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"startingWeight\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"messageNonce\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"weight\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"startedAt\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"endedAt\",\"type\":\"uint64\"}],\"internalType\":\"structValidator\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"}],\"name\":\"getWeight\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"subnetID\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"churnPeriodSeconds\",\"type\":\"uint64\"},{\"internalType\":\"uint8\",\"name\":\"maximumChurnPercentage\",\"type\":\"uint8\"}],\"internalType\":\"structValidatorManagerSettings\",\"name\":\"baseSettings\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"minimumStakeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maximumStakeAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"minimumStakeDuration\",\"type\":\"uint64\"},{\"internalType\":\"uint16\",\"name\":\"minimumDelegationFeeBips\",\"type\":\"uint16\"},{\"internalType\":\"uint8\",\"name\":\"maximumStakeMultiplier\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"weightToValueFactor\",\"type\":\"uint256\"},{\"internalType\":\"contractIRewardCalculator\",\"name\":\"rewardCalculator\",\"type\":\"address\"}],\"internalType\":\"structPoSValidatorManagerSettings\",\"name\":\"settings\",\"type\":\"tuple\"},{\"internalType\":\"contractIERC20Mintable\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"delegationAmount\",\"type\":\"uint256\"}],\"name\":\"initializeDelegatorRegistration\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"includeUptimeProof\",\"type\":\"bool\"},{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"initializeEndDelegation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"includeUptimeProof\",\"type\":\"bool\"},{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"initializeEndValidation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"nodeID\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"blsPublicKey\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"registrationExpiry\",\"type\":\"uint64\"},{\"components\":[{\"internalType\":\"uint32\",\"name\":\"threshold\",\"type\":\"uint32\"},{\"internalType\":\"address[]\",\"name\":\"addresses\",\"type\":\"address[]\"}],\"internalType\":\"structPChainOwner\",\"name\":\"remainingBalanceOwner\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint32\",\"name\":\"threshold\",\"type\":\"uint32\"},{\"internalType\":\"address[]\",\"name\":\"addresses\",\"type\":\"address[]\"}],\"internalType\":\"structPChainOwner\",\"name\":\"disableOwner\",\"type\":\"tuple\"}],\"internalType\":\"structValidatorRegistrationInput\",\"name\":\"registrationInput\",\"type\":\"tuple\"},{\"internalType\":\"uint16\",\"name\":\"delegationFeeBips\",\"type\":\"uint16\"},{\"internalType\":\"uint64\",\"name\":\"minStakeDuration\",\"type\":\"uint64\"},{\"internalType\":\"uint256\",\"name\":\"stakeAmount\",\"type\":\"uint256\"}],\"name\":\"initializeValidatorRegistration\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"subnetID\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"validatorManagerBlockchainID\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"validatorManagerAddress\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"bytes\",\"name\":\"nodeID\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"blsPublicKey\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"weight\",\"type\":\"uint64\"}],\"internalType\":\"structInitialValidator[]\",\"name\":\"initialValidators\",\"type\":\"tuple[]\"}],\"internalType\":\"structConversionData\",\"name\":\"conversionData\",\"type\":\"tuple\"},{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"initializeValidatorSet\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"nodeID\",\"type\":\"bytes\"}],\"name\":\"registeredValidators\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"}],\"name\":\"resendEndValidatorMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"}],\"name\":\"resendRegisterValidatorMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"delegationID\",\"type\":\"bytes32\"}],\"name\":\"resendUpdateDelegation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"validationID\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"messageIndex\",\"type\":\"uint32\"}],\"name\":\"submitUptimeProof\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"valueToWeight\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"weight\",\"type\":\"uint64\"}],\"name\":\"weightToValue\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + Bin: "0x608060405234801561000f575f80fd5b50604051615b90380380615b9083398101604081905261002e91610107565b60018160018111156100425761004261012c565b0361004f5761004f610055565b50610140565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff16156100a55760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b03908116146101045780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b5f60208284031215610117575f80fd5b815160028110610125575f80fd5b9392505050565b634e487b7160e01b5f52602160045260245ffd5b615a438061014d5f395ff3fe608060405234801561000f575f80fd5b5060043610610208575f3560e01c8063785e9e861161011f578063ba3a4b97116100a9578063d5f20ff611610079578063d5f20ff614610473578063df93d8de14610493578063e4a63c401461049d578063f74c607b146104b1578063fd7ac5e7146104c4575f80fd5b8063ba3a4b9714610431578063bc5fbfec14610444578063bee0a03f14610458578063c974d1b61461046b575f80fd5b80639e1bc4ef116100ef5780639e1bc4ef146103e9578063a3a65e48146103fc578063a9778a7a146102b7578063afb980961461040f578063b771b3bc14610423575f80fd5b8063785e9e861461038a57806380dd672f146103bb5780638280a25a146103ce57806393e24598146103d6575f80fd5b80633a1cfff6116101a057806360ad77841161017057806360ad778414610337578063620658561461034a57806366435abf1461035d578063732214f81461037057806376f7862114610377575f80fd5b80633a1cfff6146102d3578063467ef06f146102e65780634bee0040146102f957806360305d621461031a575f80fd5b806320d91b7a116101db57806320d91b7a1461026657806325e1c776146102795780632e2194d81461028c57806335455ded146102b7575f80fd5b80630118acc41461020c5780630322ed9814610221578063151d30d1146102345780631ec4472414610253575b5f80fd5b61021f61021a3660046149cc565b6104d7565b005b61021f61022f366004614a07565b61050c565b61023c600a81565b60405160ff90911681526020015b60405180910390f35b61021f6102613660046149cc565b610793565b61021f610274366004614a1e565b61079e565b61021f610287366004614a6c565b610d23565b61029f61029a366004614a07565b610d97565b6040516001600160401b03909116815260200161024a565b6102c061271081565b60405161ffff909116815260200161024a565b61021f6102e13660046149cc565b610df1565b61021f6102f4366004614a8d565b610dfc565b61030c610307366004614acb565b610ebd565b60405190815260200161024a565b610322601481565b60405163ffffffff909116815260200161024a565b61021f610345366004614a6c565b610ef2565b61030c610358366004614b32565b6111ca565b61029f61036b366004614a07565b611201565b61030c5f81565b61021f6103853660046149cc565b611215565b5f8051602061594e833981519152546001600160a01b03165b6040516001600160a01b03909116815260200161024a565b61021f6103c9366004614a6c565b611240565b61023c603081565b61021f6103e4366004614a07565b611485565b61030c6103f7366004614b4d565b611550565b61021f61040a366004614a8d565b61157c565b61030c5f8051602061596e83398151915281565b6103a36005600160991b0181565b61021f61043f366004614a07565b611771565b61030c5f8051602061598e83398151915281565b61021f610466366004614a07565b6119dc565b61023c601481565b610486610481366004614a07565b611b19565b60405161024a9190614be2565b61029f6202a30081565b61030c5f8051602061594e83398151915281565b61021f6104bf366004614c76565b611c68565b61030c6104d2366004614cb4565b611d47565b6104e2838383611da2565b61050757604051631036cf9160e11b8152600481018490526024015b60405180910390fd5b505050565b5f8181525f805160206159ee8339815191526020526040808220815160e0810190925280545f8051602061598e83398151915293929190829060ff16600581111561055957610559614b6d565b600581111561056a5761056a614b6d565b815260200160018201805461057e90614d1f565b80601f01602080910402602001604051908101604052809291908181526020018280546105aa90614d1f565b80156105f55780601f106105cc576101008083540402835291602001916105f5565b820191905f5260205f20905b8154815290600101906020018083116105d857829003601f168201915b505050918352505060028201546001600160401b038082166020840152600160401b820481166040840152600160801b820481166060840152600160c01b909104811660808301526003928301541660a0909101529091508151600581111561066057610660614b6d565b14610693575f8381526007830160205260409081902054905163170cc93360e21b81526104fe9160ff1690600401614d57565b606081015160405163854a893f60e01b8152600481018590526001600160401b0390911660248201525f60448201526005600160991b019063ee5b48eb9073__$fd0c147b4031eef6079b0498cbafa865f0$__9063854a893f906064015f60405180830381865af415801561070a573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526107319190810190614e60565b6040518263ffffffff1660e01b815260040161074d9190614e91565b6020604051808303815f875af1158015610769573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061078d9190614ea3565b50505050565b61078d838383611da2565b7fe92546d698950ddd38910d2e15ed1d923cd0a7b3dde9e2a6a3f380565559cb09545f8051602061598e8339815191529060ff16156107f057604051637fab81e560e01b815260040160405180910390fd5b6005600160991b016001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa158015610833573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108579190614ea3565b836020013514610880576040516372b0a7e760e11b8152602084013560048201526024016104fe565b306108916060850160408601614eba565b6001600160a01b0316146108d4576108af6060840160408501614eba565b604051632f88120d60e21b81526001600160a01b0390911660048201526024016104fe565b5f6108e26060850185614ed5565b905090505f805b828163ffffffff161015610b49575f6109056060880188614ed5565b8363ffffffff1681811061091b5761091b614f1a565b905060200281019061092d9190614f2e565b61093690614f99565b80516040519192505f91600888019161094e91615014565b9081526020016040518091039020541461097e57805160405163a41f772f60e01b81526104fe9190600401614e91565b5f6002885f0135846040516020016109ad92919091825260e01b6001600160e01b031916602082015260240190565b60408051601f19818403018152908290526109c791615014565b602060405180830381855afa1580156109e2573d5f803e3d5ffd5b5050506040513d601f19601f82011682018060405250810190610a059190614ea3565b90508086600801835f0151604051610a1d9190615014565b90815260408051918290036020908101909220929092555f8381526007890190915220805460ff191660021781558251600190910190610a5d9082615069565b50604080830180515f84815260078a01602052929092206002810180549251426001600160401b03908116600160c01b026001600160c01b03928216600160801b81026001600160c01b03199097169290971691909117949094171692909217909155600301805467ffffffffffffffff19169055610adc9085615138565b8251604051919550610aed91615014565b60408051918290038220908401516001600160401b031682529082907f9d47fef9da077661546e646d61830bfcbda90506c2e5eed38195e82c4eb1cbdf9060200160405180910390a3505080610b429061514b565b90506108e9565b50600483018190556001830154606490610b6d90600160401b900460ff168361516d565b1015610b8f57604051635943317f60e01b8152600481018290526024016104fe565b5f73__$fd0c147b4031eef6079b0498cbafa865f0$__634d847884610bb3876120fa565b604001516040518263ffffffff1660e01b8152600401610bd39190614e91565b602060405180830381865af4158015610bee573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c129190614ea3565b90505f73__$fd0c147b4031eef6079b0498cbafa865f0$__6387418b8e886040518263ffffffff1660e01b8152600401610c4c91906152af565b5f60405180830381865af4158015610c66573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052610c8d9190810190614e60565b90505f600282604051610ca09190615014565b602060405180830381855afa158015610cbb573d5f803e3d5ffd5b5050506040513d601f19601f82011682018060405250810190610cde9190614ea3565b9050828114610d0a5760405163baaea89d60e01b815260048101829052602481018490526044016104fe565b5050506009909201805460ff1916600117905550505050565b610d2c82612210565b610d4c576040516330efa98b60e01b8152600481018390526024016104fe565b5f610d5683611b19565b5190506002816005811115610d6d57610d6d614b6d565b14610d8d578060405163170cc93360e21b81526004016104fe9190614d57565b61078d838361224b565b5f805f8051602061596e83398151915260030154610db5908461533a565b9050801580610dca57506001600160401b0381115b15610deb5760405163222d164360e21b8152600481018490526024016104fe565b92915050565b61078d838383612531565b610e0461271d565b5f8051602061596e8339815191525f80610e1d84612754565b91509150610e2a82612210565b610e3657505050610ea4565b5f8281526005840160205260409020546001600160a01b0316600482516005811115610e6457610e64614b6d565b03610e89575f83815260088501602052604081208054919055610e878282612b07565b505b610e9f81610e9a84604001516111ca565b612b7d565b505050505b610eba60015f805160206159ce83398151915255565b50565b5f610ec661271d565b610ed285858585612bb3565b9050610eea60015f805160206159ce83398151915255565b949350505050565b5f8281525f805160206159ae8339815191526020526040808220815160e0810190925280545f8051602061596e83398151915293929190829060ff166003811115610f3f57610f3f614b6d565b6003811115610f5057610f50614b6d565b8152815461010090046001600160a01b0316602082015260018201546040808301919091526002909201546001600160401b038082166060840152600160401b820481166080840152600160801b8204811660a0840152600160c01b9091041660c0909101528101519091505f610fc682611b19565b9050600183516003811115610fdd57610fdd614b6d565b14610ffe578251604051633b0d540d60e21b81526104fe9190600401615359565b60048151600581111561101357611013614b6d565b036110295761102186612d39565b505050505050565b5f8073__$fd0c147b4031eef6079b0498cbafa865f0$__6350782b0f61104e896120fa565b604001516040518263ffffffff1660e01b815260040161106e9190614e91565b606060405180830381865af4158015611089573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110ad9190615373565b50915091508184146110da57846040015160405163089938b360e11b81526004016104fe91815260200190565b806001600160401b031683606001516001600160401b031610806111135750806001600160401b03168560a001516001600160401b0316115b1561113c57604051632e19bc2d60e11b81526001600160401b03821660048201526024016104fe565b5f888152600687016020908152604091829020805460ff1916600290811782550180546001600160401b034216600160401b81026fffffffffffffffff00000000000000001990921691909117909155915191825285918a917f047059b465069b8b751836b41f9f1d83daff583d2238cc7fbb461437ec23a4f6910160405180910390a35050505050505050565b7f4317713f7ecbdddd4bc99e95d903adedaa883b2e7c2551610bd13e2c7e473d03545f90610deb906001600160401b03841661516d565b5f61120b82611b19565b6080015192915050565b611220838383612531565b61050757604051635bff683f60e11b8152600481018490526024016104fe565b61124861271d565b5f8281525f805160206159ae8339815191526020526040808220815160e0810190925280545f8051602061596e83398151915293929190829060ff16600381111561129557611295614b6d565b60038111156112a6576112a6614b6d565b8152815461010090046001600160a01b03166020820152600182015460408201526002909101546001600160401b038082166060840152600160401b820481166080840152600160801b8204811660a0840152600160c01b9091041660c090910152905060038151600381111561131f5761131f614b6d565b14611340578051604051633b0d540d60e21b81526104fe9190600401615359565b600461134f8260400151611b19565b51600581111561136157611361614b6d565b14611460575f611370846120fa565b90505f8073__$fd0c147b4031eef6079b0498cbafa865f0$__6350782b0f84604001516040518263ffffffff1660e01b81526004016113af9190614e91565b606060405180830381865af41580156113ca573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113ee9190615373565b50915091508184604001511461141a5760405163089938b360e11b8152600481018390526024016104fe565b806001600160401b03168460c001516001600160401b0316111561145c57604051632e19bc2d60e11b81526001600160401b03821660048201526024016104fe565b5050505b61146984612d39565b505061148160015f805160206159ce83398151915255565b5050565b5f8051602061596e8339815191525f61149d83611b19565b51905060048160058111156114b4576114b4614b6d565b146114d4578060405163170cc93360e21b81526004016104fe9190614d57565b5f8381526005830160205260409020546001600160a01b0316331461151a57335b604051636e2ccd7560e11b81526001600160a01b0390911660048201526024016104fe565b5f8381526008830160209081526040808320805490849055600586019092529091205461078d906001600160a01b031682612b07565b5f61155961271d565b611564833384612f8d565b9050610deb60015f805160206159ce83398151915255565b5f8051602061598e8339815191525f8073__$fd0c147b4031eef6079b0498cbafa865f0$__63021de88f6115af866120fa565b604001516040518263ffffffff1660e01b81526004016115cf9190614e91565b6040805180830381865af41580156115e9573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061160d91906153b3565b915091508061163357604051632d07135360e01b815281151560048201526024016104fe565b5f8281526006840160205260409020805461164d90614d1f565b90505f036116715760405163089938b360e11b8152600481018390526024016104fe565b60015f83815260078501602052604090205460ff16600581111561169757611697614b6d565b146116ca575f8281526007840160205260409081902054905163170cc93360e21b81526104fe9160ff1690600401614d57565b5f82815260068401602052604081206116e29161491b565b5f828152600784016020908152604091829020805460ff1916600290811782550180546001600160401b0342818116600160c01b026001600160c01b0390931692909217928390558451600160801b9093041682529181019190915283917ff8fd1c90fb9cfa2ca2358fdf5806b086ad43315d92b221c929efc7f105ce7568910160405180910390a250505050565b5f8181525f805160206159ae8339815191526020526040808220815160e0810190925280545f8051602061596e83398151915293929190829060ff1660038111156117be576117be614b6d565b60038111156117cf576117cf614b6d565b8152815461010090046001600160a01b0316602082015260018083015460408301526002909201546001600160401b038082166060840152600160401b820481166080840152600160801b8204811660a0840152600160c01b9091041660c0909101529091508151600381111561184857611848614b6d565b14158015611869575060038151600381111561186657611866614b6d565b14155b1561188a578051604051633b0d540d60e21b81526104fe9190600401615359565b5f6118988260400151611b19565b905080606001516001600160401b03165f036118ca576040516339b894f960e21b8152600481018590526024016104fe565b60408083015160608301516080840151925163854a893f60e01b81526005600160991b019363ee5b48eb9373__$fd0c147b4031eef6079b0498cbafa865f0$__9363854a893f9361193893906004019283526001600160401b03918216602084015216604082015260600190565b5f60405180830381865af4158015611952573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526119799190810190614e60565b6040518263ffffffff1660e01b81526004016119959190614e91565b6020604051808303815f875af11580156119b1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119d59190614ea3565b5050505050565b5f8181527fe92546d698950ddd38910d2e15ed1d923cd0a7b3dde9e2a6a3f380565559cb066020526040902080545f8051602061598e8339815191529190611a2390614d1f565b90505f03611a475760405163089938b360e11b8152600481018390526024016104fe565b60015f83815260078301602052604090205460ff166005811115611a6d57611a6d614b6d565b14611aa0575f8281526007820160205260409081902054905163170cc93360e21b81526104fe9160ff1690600401614d57565b5f82815260068201602052604090819020905163ee5b48eb60e01b81526005600160991b019163ee5b48eb91611ad991906004016153d6565b6020604051808303815f875af1158015611af5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105079190614ea3565b611b21614952565b5f8281525f805160206159ee833981519152602052604090819020815160e0810190925280545f8051602061598e833981519152929190829060ff166005811115611b6e57611b6e614b6d565b6005811115611b7f57611b7f614b6d565b8152602001600182018054611b9390614d1f565b80601f0160208091040260200160405190810160405280929190818152602001828054611bbf90614d1f565b8015611c0a5780601f10611be157610100808354040283529160200191611c0a565b820191905f5260205f20905b815481529060010190602001808311611bed57829003601f168201915b505050918352505060028201546001600160401b038082166020840152600160401b820481166040840152600160801b820481166060840152600160c01b9091048116608083015260039092015490911660a0909101529392505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805460029190600160401b900460ff1680611cb1575080546001600160401b03808416911610155b15611ccf5760405163f92ee8a960e01b815260040160405180910390fd5b805468ffffffffffffffffff19166001600160401b03831617600160401b178155611cfa84846131d3565b805460ff60401b191681556040516001600160401b03831681527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a150505050565b6040515f905f8051602061598e833981519152907fe92546d698950ddd38910d2e15ed1d923cd0a7b3dde9e2a6a3f380565559cb0890611d8a9086908690615460565b90815260200160405180910390205491505092915050565b5f8381525f805160206159ae8339815191526020526040808220815160e0810190925280545f8051602061596e8339815191529284929091829060ff166003811115611df057611df0614b6d565b6003811115611e0157611e01614b6d565b8152815461010090046001600160a01b0316602082015260018201546040808301919091526002909201546001600160401b038082166060840152600160401b820481166080840152600160801b8204811660a0840152600160c01b9091041660c0909101528101519091505f611e7782611b19565b9050600283516003811115611e8e57611e8e614b6d565b14611eaf578251604051633b0d540d60e21b81526104fe9190600401615359565b60208301516001600160a01b03163314611f4b575f8281526005850160205260409020546001600160a01b03163314611ee857336114f5565b5f82815260058501602052604090205460a0820151611f1791600160b01b90046001600160401b03169061546f565b6001600160401b0316421015611f4b5760405163fb6ce63f60e01b81526001600160401b03421660048201526024016104fe565b600281516005811115611f6057611f60614b6d565b0361208e5760028401546080840151611f82916001600160401b03169061546f565b6001600160401b0316421015611fb65760405163fb6ce63f60e01b81526001600160401b03421660048201526024016104fe565b8615611fc857611fc6828761224b565b505b5f8881526006850160205260409020805460ff1916600317905560608301516080820151612001918491611ffc919061548f565b6131ed565b505f898152600686016020526040812060020180546001600160401b03909316600160c01b026001600160c01b0390931692909217909155612042846133c4565b5f8a81526007870160205260408082208390555191925084918b917f366d336c0ab380dc799f095a6f82a26326585c52909cc698b09ba4540709ed5791a3151594506120f39350505050565b6004815160058111156120a3576120a3614b6d565b036120d7576120b1836133c4565b5f8981526007860160205260409020556120ca88612d39565b60019450505050506120f3565b805160405163170cc93360e21b81526104fe9190600401614d57565b9392505050565b60408051606080820183525f8083526020830152918101919091526040516306f8253560e41b815263ffffffff831660048201525f9081906005600160991b0190636f825350906024015f60405180830381865afa15801561215e573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261218591908101906154af565b91509150806121a757604051636b2f19e960e01b815260040160405180910390fd5b8151156121cd578151604051636ba589a560e01b815260048101919091526024016104fe565b60208201516001600160a01b031615612209576020820151604051624de75d60e31b81526001600160a01b0390911660048201526024016104fe565b5092915050565b5f9081527f4317713f7ecbdddd4bc99e95d903adedaa883b2e7c2551610bd13e2c7e473d0560205260409020546001600160a01b0316151590565b6040516306f8253560e41b815263ffffffff821660048201525f90819081906005600160991b0190636f825350906024015f60405180830381865afa158015612296573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526122bd91908101906154af565b91509150806122df57604051636b2f19e960e01b815260040160405180910390fd5b6005600160991b016001600160a01b0316634213cf786040518163ffffffff1660e01b8152600401602060405180830381865afa158015612322573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906123469190614ea3565b82511461236c578151604051636ba589a560e01b815260048101919091526024016104fe565b60208201516001600160a01b0316156123a8576020820151604051624de75d60e31b81526001600160a01b0390911660048201526024016104fe565b5f8073__$fd0c147b4031eef6079b0498cbafa865f0$__63088c246385604001516040518263ffffffff1660e01b81526004016123e59190614e91565b6040805180830381865af41580156123ff573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612423919061553f565b9150915081871461244a5760405163089938b360e11b8152600481018890526024016104fe565b5f8781527f4317713f7ecbdddd4bc99e95d903adedaa883b2e7c2551610bd13e2c7e473d0560205260409020600101545f8051602061596e833981519152906001600160401b039081169083161115612507575f888152600582016020908152604091829020600101805467ffffffffffffffff19166001600160401b038616908117909155915191825289917fec44148e8ff271f2d0bacef1142154abacb0abb3a29eb3eb50e2ca97e86d0435910160405180910390a2612526565b5f8881526005820160205260409020600101546001600160401b031691505b509695505050505050565b5f5f8051602061596e8339815191528161254a86613561565b905061255586612210565b612564576001925050506120f3565b5f8681526005830160205260409020546001600160a01b0316331461258957336114f5565b5f86815260058301602052604090205460a08201516125b891600160b01b90046001600160401b03169061546f565b6001600160401b03168160c001516001600160401b031610156125ff5760c081015160405163fb6ce63f60e01b81526001600160401b0390911660048201526024016104fe565b5f851561261757612610878661224b565b9050612635565b505f8681526005830160205260409020600101546001600160401b03165b600483015460408301515f916001600160a01b031690634f22429f9061265a906111ca565b60a086015160c087015160405160e085901b6001600160e01b031916815260048101939093526001600160401b03918216602484018190526044840152811660648301528516608482015260a401602060405180830381865afa1580156126c3573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906126e79190614ea3565b905080846008015f8a81526020019081526020015f205f82825461270b9190615138565b90915550501515979650505050505050565b5f805160206159ce83398151915280546001190161274e57604051633ee5aeb560e01b815260040160405180910390fd5b60029055565b5f61275d614952565b5f8051602061598e8339815191525f8073__$fd0c147b4031eef6079b0498cbafa865f0$__63021de88f612790886120fa565b604001516040518263ffffffff1660e01b81526004016127b09190614e91565b6040805180830381865af41580156127ca573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906127ee91906153b3565b91509150801561281557604051632d07135360e01b815281151560048201526024016104fe565b5f828152600784016020526040808220815160e081019092528054829060ff16600581111561284657612846614b6d565b600581111561285757612857614b6d565b815260200160018201805461286b90614d1f565b80601f016020809104026020016040519081016040528092919081815260200182805461289790614d1f565b80156128e25780601f106128b9576101008083540402835291602001916128e2565b820191905f5260205f20905b8154815290600101906020018083116128c557829003601f168201915b505050918352505060028201546001600160401b038082166020840152600160401b820481166040840152600160801b820481166060840152600160c01b909104811660808301526003928301541660a0909101529091508151600581111561294d5761294d614b6d565b1415801561296e575060018151600581111561296b5761296b614b6d565b14155b1561298f57805160405163170cc93360e21b81526104fe9190600401614d57565b6003815160058111156129a4576129a4614b6d565b036129b257600481526129b7565b600581525b8360080181602001516040516129cd9190615014565b90815260408051602092819003830190205f908190558581526007870190925290208151815483929190829060ff19166001836005811115612a1157612a11614b6d565b021790555060208201516001820190612a2a9082615069565b5060408201516002820180546060850151608086015160a08701516001600160401b039586166001600160801b031990941693909317600160401b92861692909202919091176001600160801b0316600160801b918516919091026001600160c01b031617600160c01b9184169190910217905560c0909201516003909101805467ffffffffffffffff19169190921617905580516005811115612ad057612ad0614b6d565b60405184907f1c08e59656f1a18dc2da76826cdc52805c43e897a17c50faefb8ab3c1526cc16905f90a39196919550909350505050565b5f5f8051602061594e83398151915280546040516340c10f1960e01b81526001600160a01b038681166004830152602482018690529293509116906340c10f19906044015f604051808303815f87803b158015612b62575f80fd5b505af1158015612b74573d5f803e3d5ffd5b50505050505050565b5f8051602061594e83398151915254611481906001600160a01b03168383613845565b60015f805160206159ce83398151915255565b7f4317713f7ecbdddd4bc99e95d903adedaa883b2e7c2551610bd13e2c7e473d02545f905f8051602061596e83398151915290600160401b900461ffff9081169086161080612c07575061271061ffff8616115b15612c2b57604051635f12e6c360e11b815261ffff861660048201526024016104fe565b60028101546001600160401b039081169085161015612c67576040516202a06d60e11b81526001600160401b03851660048201526024016104fe565b8054831080612c795750806001015483115b15612c9a5760405163222d164360e21b8152600481018490526024016104fe565b5f612ca4846138a4565b90505f612cb082610d97565b90505f612cbd89836138c7565b5f818152600595909501602052604090942080546001600160b01b0319163317600160a01b61ffff9a909a16999099029890981767ffffffffffffffff60b01b1916600160b01b6001600160401b03989098169790970296909617875550506001909401805467ffffffffffffffff1916905550919392505050565b5f8181525f805160206159ae8339815191526020526040808220815160e0810190925280545f8051602061596e83398151915293929190829060ff166003811115612d8657612d86614b6d565b6003811115612d9757612d97614b6d565b8152815461010090046001600160a01b0316602082015260018201546040808301919091526002909201546001600160401b038082166060840152600160401b820481166080840152600160801b8204811660a0840152600160c01b9091041660c090910152810151909150612e347fe92546d698950ddd38910d2e15ed1d923cd0a7b3dde9e2a6a3f380565559cb01546001600160401b031690565b8260800151612e43919061546f565b6001600160401b0316421015612e775760405163fb6ce63f60e01b81526001600160401b03421660048201526024016104fe565b5f848152600684016020908152604080832080546001600160a81b03191681556001810184905560020183905560078601909152812080549082905590808215612f32575f84815260058701602052604090205461271090612ee490600160a01b900461ffff168561516d565b612eee919061533a565b915081866008015f8681526020019081526020015f205f828254612f129190615138565b90915550612f2290508284615562565b9050612f32856020015182612b07565b612f478560200151610e9a87606001516111ca565b6040805182815260208101849052859189917f8ececf510070c320d9a55323ffabe350e294ae505fc0c509dc5736da6f5cc993910160405180910390a350505050505050565b5f5f8051602061596e83398151915281612fa961029a856138a4565b90505f612fb587611b19565b9050612fc087612210565b612fe0576040516330efa98b60e01b8152600481018890526024016104fe565b600281516005811115612ff557612ff5614b6d565b1461301657805160405163170cc93360e21b81526104fe9190600401614d57565b5f828260800151613027919061546f565b905083600201600a9054906101000a90046001600160401b031682604001516130509190615575565b6001600160401b0316816001600160401b0316111561308d57604051636d51fe0560e11b81526001600160401b03821660048201526024016104fe565b5f806130998a846131ed565b915091505f8a836040516020016130c792919091825260c01b6001600160c01b031916602082015260280190565b60408051601f1981840301815291815281516020928301205f81815260068b019093529120805491925060019160ff1916828002179055505f8181526006880160209081526040918290208054610100600160a81b0319166101006001600160a01b038f16908102919091178255600182018f9055600290910180546001600160401b038b81166001600160c01b03199092168217600160801b8a8316908102919091176001600160c01b031690935585519283528916938201939093529283019190915260608201849052908c9083907fb0024b263bc3a0b728a6edea50a69efa841189f8d32ee8af9d1c2b1a1a2234269060800160405180910390a49a9950505050505050505050565b6131db613dec565b6131e482613e37565b61148181613eab565b5f8281525f805160206159ee833981519152602052604081206002015481905f8051602061598e83398151915290600160801b90046001600160401b03166132358582613f13565b5f61323f87614136565b5f888152600785016020526040808220600201805467ffffffffffffffff60801b1916600160801b6001600160401b038c811691820292909217909255915163854a893f60e01b8152600481018c905291841660248301526044820152919250906005600160991b019063ee5b48eb9073__$fd0c147b4031eef6079b0498cbafa865f0$__9063854a893f906064015f60405180830381865af41580156132e8573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261330f9190810190614e60565b6040518263ffffffff1660e01b815260040161332b9190614e91565b6020604051808303815f875af1158015613347573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061336b9190614ea3565b604080516001600160401b038a811682526020820184905282519394508516928b927f07de5ff35a674a8005e661f3333c907ca6333462808762d19dc7b3abb1a8c1df928290030190a3909450925050505b9250929050565b5f805f8051602061596e83398151915290505f6133e48460400151611b19565b90505f6003825160058111156133fc576133fc614b6d565b148061341a575060048251600581111561341857613418614b6d565b145b1561342a575060c0810151613467565b60028251600581111561343f5761343f614b6d565b0361344b575042613467565b815160405163170cc93360e21b81526104fe9190600401614d57565b84608001516001600160401b0316816001600160401b03161161348e57505f949350505050565b600483015460608601516001600160a01b0390911690634f22429f906134b3906111ca565b60a085015160808901516040808b01515f90815260058a0160205281902060010154905160e086901b6001600160e01b031916815260048101949094526001600160401b0392831660248501529082166044840152818616606484015216608482015260a401602060405180830381865afa158015613534573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906135589190614ea3565b95945050505050565b613569614952565b5f8281525f805160206159ee8339815191526020526040808220815160e0810190925280545f8051602061598e83398151915293929190829060ff1660058111156135b6576135b6614b6d565b60058111156135c7576135c7614b6d565b81526020016001820180546135db90614d1f565b80601f016020809104026020016040519081016040528092919081815260200182805461360790614d1f565b80156136525780601f1061362957610100808354040283529160200191613652565b820191905f5260205f20905b81548152906001019060200180831161363557829003601f168201915b50505091835250506002828101546001600160401b038082166020850152600160401b820481166040850152600160801b820481166060850152600160c01b9091048116608084015260039093015490921660a090910152909150815160058111156136c0576136c0614b6d565b146136f3575f8481526007830160205260409081902054905163170cc93360e21b81526104fe9160ff1690600401614d57565b60038152426001600160401b031660c08201525f84815260078301602052604090208151815483929190829060ff1916600183600581111561373757613737614b6d565b0217905550602082015160018201906137509082615069565b5060408201516002820180546060850151608086015160a08701516001600160401b039586166001600160801b031990941693909317600160401b92861692909202919091176001600160801b0316600160801b918516919091026001600160c01b031617600160c01b9184169190910217905560c0909201516003909101805467ffffffffffffffff1916919092161790555f6137ee85826131ed565b6080840151604080516001600160401b03909216825242602083015291935083925087917f13d58394cf269d48bcf927959a29a5ffee7c9924dafff8927ecdf3c48ffa7c67910160405180910390a3509392505050565b6040516001600160a01b0383811660248301526044820183905261050791859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b0383818316178352505050506141ab565b5f610deb825f8051602061594e833981519152546001600160a01b03169061420c565b7fe92546d698950ddd38910d2e15ed1d923cd0a7b3dde9e2a6a3f380565559cb09545f9060ff1661390b57604051637fab81e560e01b815260040160405180910390fd5b5f8051602061598e8339815191524261392a6060860160408701614b32565b6001600160401b031611158061396457506139486202a30042615138565b6139586060860160408701614b32565b6001600160401b031610155b1561399e576139796060850160408601614b32565b604051635879da1360e11b81526001600160401b0390911660048201526024016104fe565b6139b36139ae60608601866155a0565b614218565b6139c36139ae60808601866155a0565b60306139d260208601866155b4565b905014613a04576139e660208501856155b4565b6040516326475b2f60e11b81526104fe925060040190815260200190565b613a0e84806155b4565b90505f03613a3b57613a2084806155b4565b604051633e08a12560e11b81526004016104fe9291906155f6565b5f60088201613a4a86806155b4565b604051613a58929190615460565b90815260200160405180910390205414613a9157613a7684806155b4565b60405163a41f772f60e01b81526004016104fe9291906155f6565b613a9b835f613f13565b6040805160e08101909152815481525f90819073__$fd0c147b4031eef6079b0498cbafa865f0$__9063eb97ce519060208101613ad88a806155b4565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250505090825250602090810190613b20908b018b6155b4565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250505090825250602001613b6960608b0160408c01614b32565b6001600160401b03168152602001613b8460608b018b6155a0565b613b8d90615609565b8152602001613b9f60808b018b6155a0565b613ba890615609565b8152602001886001600160401b03168152506040518263ffffffff1660e01b8152600401613bd6919061572b565b5f60405180830381865af4158015613bf0573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052613c1791908101906157e2565b5f82815260068601602052604090209193509150613c358282615069565b508160088401613c4588806155b4565b604051613c53929190615460565b9081526040519081900360200181209190915563ee5b48eb60e01b81525f906005600160991b019063ee5b48eb90613c8f908590600401614e91565b6020604051808303815f875af1158015613cab573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613ccf9190614ea3565b5f8481526007860160205260409020805460ff191660011790559050613cf587806155b4565b5f858152600787016020526040902060010191613d13919083615825565b505f83815260078501602052604090206002810180546001600160c01b0319166001600160401b038916908117600160801b91909102176001600160c01b03169055600301805467ffffffffffffffff1916905580613d7288806155b4565b604051613d80929190615460565b6040518091039020847fb77297e3befc691bfc864a81e241f83e2ef722b6e7becaa2ecec250c6d52b430898b6040016020810190613dbe9190614b32565b604080516001600160401b0393841681529290911660208301520160405180910390a4509095945050505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff16613e3557604051631afcd79f60e31b815260040160405180910390fd5b565b613e3f613dec565b613e4881614381565b613e5061439a565b610eba60608201356080830135613e6d60c0850160a08601614b32565b613e7d60e0860160c087016158de565b613e8e610100870160e088016158f7565b610100870135613ea661014089016101208a01614eba565b6143aa565b613eb3613dec565b5f8051602061594e8339815191526001600160a01b038216613ef357604051637330680360e01b81526001600160a01b03831660048201526024016104fe565b80546001600160a01b0319166001600160a01b0392909216919091179055565b5f8051602061598e8339815191525f6001600160401b038084169085161115613f4757613f40838561548f565b9050613f54565b613f51848461548f565b90505b6040805160808101825260028401548082526003850154602083015260048501549282019290925260058401546001600160401b0316606082015242911580613fb6575060018401548151613fb2916001600160401b031690615138565b8210155b15613fdc576001600160401b038316606082015281815260408101516020820152613ffb565b8281606001818151613fee919061546f565b6001600160401b03169052505b606081015161400b906064615575565b602082015160018601546001600160401b0392909216916140369190600160401b900460ff1661516d565b101561406657606081015160405163dfae880160e01b81526001600160401b0390911660048201526024016104fe565b856001600160401b0316816040018181516140819190615138565b9052506040810180516001600160401b03871691906140a1908390615562565b905250600184015460408201516064916140c691600160401b90910460ff169061516d565b10156140ed578060400151604051635943317f60e01b81526004016104fe91815260200190565b805160028501556020810151600385015560408101516004850155606001516005909301805467ffffffffffffffff19166001600160401b039094169390931790925550505050565b5f8181525f805160206159ee8339815191526020526040812060020180545f8051602061598e833981519152919060089061418090600160401b90046001600160401b0316615917565b91906101000a8154816001600160401b0302191690836001600160401b031602179055915050919050565b5f6141bf6001600160a01b03841683614566565b905080515f141580156141e35750808060200190518101906141e19190615932565b155b1561050757604051635274afe760e01b81526001600160a01b03841660048201526024016104fe565b5f6120f3833384614573565b6142256020820182614a8d565b63ffffffff1615801561424557506142406020820182614ed5565b151590505b1561428c576142576020820182614a8d565b6142646020830183614ed5565b60405163c08a0f1d60e01b815263ffffffff90931660048401526024830152506044016104fe565b6142996020820182614ed5565b90506142a86020830183614a8d565b63ffffffff1611156142c1576142576020820182614a8d565b60015b6142d16020830183614ed5565b9050811015611481576142e76020830183614ed5565b6142f2600184615562565b81811061430157614301614f1a565b90506020020160208101906143169190614eba565b6001600160a01b031661432c6020840184614ed5565b8381811061433c5761433c614f1a565b90506020020160208101906143519190614eba565b6001600160a01b0316101561437957604051630dbc8d5f60e31b815260040160405180910390fd5b6001016142c4565b614389613dec565b6143916146d6565b610eba816146de565b6143a2613dec565b613e356147c6565b6143b2613dec565b5f8051602061596e83398151915261ffff851615806143d6575061271061ffff8616115b156143fa57604051635f12e6c360e11b815261ffff861660048201526024016104fe565b8688111561441e5760405163222d164360e21b8152600481018990526024016104fe565b60ff841615806144315750600a60ff8516115b156144545760405163170db35960e31b815260ff851660048201526024016104fe565b7fe92546d698950ddd38910d2e15ed1d923cd0a7b3dde9e2a6a3f380565559cb01546001600160401b03166001600160401b0316866001600160401b031610156144bb576040516202a06d60e11b81526001600160401b03871660048201526024016104fe565b825f036144db5760405163a733007160e01b815260040160405180910390fd5b96875560018701959095556002860180546001600160401b039590951669ffffffffffffffffffff1990951694909417600160401b61ffff94909416939093029290921767ffffffffffffffff60501b191660ff91909116600160501b02179091556003830155600490910180546001600160a01b0319166001600160a01b03909216919091179055565b60606120f383835f6147ce565b6040516370a0823160e01b81523060048201525f9081906001600160a01b038616906370a0823190602401602060405180830381865afa1580156145b9573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906145dd9190614ea3565b90506145f46001600160a01b03861685308661485d565b6040516370a0823160e01b81523060048201525f906001600160a01b038716906370a0823190602401602060405180830381865afa158015614638573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061465c9190614ea3565b90508181116146c25760405162461bcd60e51b815260206004820152602c60248201527f5361666545524332305472616e7366657246726f6d3a2062616c616e6365206e60448201526b1bdd081a5b98dc99585cd95960a21b60648201526084016104fe565b6146cc8282615562565b9695505050505050565b613e35613dec565b6146e6613dec565b80355f8051602061598e833981519152908155601461470b60608401604085016158f7565b60ff16118061472a575061472560608301604084016158f7565b60ff16155b1561475e5761473f60608301604084016158f7565b604051634a59bbff60e11b815260ff90911660048201526024016104fe565b61476e60608301604084016158f7565b60018201805460ff92909216600160401b0260ff60401b1990921691909117905561479f6040830160208401614b32565b600191909101805467ffffffffffffffff19166001600160401b0390921691909117905550565b612ba0613dec565b6060814710156147f35760405163cd78605960e01b81523060048201526024016104fe565b5f80856001600160a01b0316848660405161480e9190615014565b5f6040518083038185875af1925050503d805f8114614848576040519150601f19603f3d011682016040523d82523d5f602084013e61484d565b606091505b50915091506146cc868383614896565b6040516001600160a01b03848116602483015283811660448301526064820183905261078d9186918216906323b872dd90608401613872565b6060826148ab576148a6826148f2565b6120f3565b81511580156148c257506001600160a01b0384163b155b156148eb57604051639996b31560e01b81526001600160a01b03851660048201526024016104fe565b50806120f3565b8051156149025780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b50805461492790614d1f565b5f825580601f10614936575050565b601f0160209004905f5260205f2090810190610eba919061498f565b6040805160e08101909152805f81526060602082018190525f604083018190529082018190526080820181905260a0820181905260c09091015290565b5b808211156149a3575f8155600101614990565b5090565b8015158114610eba575f80fd5b803563ffffffff811681146149c7575f80fd5b919050565b5f805f606084860312156149de575f80fd5b8335925060208401356149f0816149a7565b91506149fe604085016149b4565b90509250925092565b5f60208284031215614a17575f80fd5b5035919050565b5f8060408385031215614a2f575f80fd5b82356001600160401b03811115614a44575f80fd5b830160808186031215614a55575f80fd5b9150614a63602084016149b4565b90509250929050565b5f8060408385031215614a7d575f80fd5b82359150614a63602084016149b4565b5f60208284031215614a9d575f80fd5b6120f3826149b4565b803561ffff811681146149c7575f80fd5b6001600160401b0381168114610eba575f80fd5b5f805f8060808587031215614ade575f80fd5b84356001600160401b03811115614af3575f80fd5b850160a08188031215614b04575f80fd5b9350614b1260208601614aa6565b92506040850135614b2281614ab7565b9396929550929360600135925050565b5f60208284031215614b42575f80fd5b81356120f381614ab7565b5f8060408385031215614b5e575f80fd5b50508035926020909101359150565b634e487b7160e01b5f52602160045260245ffd5b60068110614b9157614b91614b6d565b9052565b5f5b83811015614baf578181015183820152602001614b97565b50505f910152565b5f8151808452614bce816020860160208601614b95565b601f01601f19169290920160200192915050565b60208152614bf4602082018351614b81565b5f602083015160e06040840152614c0f610100840182614bb7565b905060408401516001600160401b0380821660608601528060608701511660808601528060808701511660a08601528060a08701511660c08601528060c08701511660e086015250508091505092915050565b6001600160a01b0381168114610eba575f80fd5b5f80828403610160811215614c89575f80fd5b61014080821215614c98575f80fd5b8493508301359050614ca981614c62565b809150509250929050565b5f8060208385031215614cc5575f80fd5b82356001600160401b0380821115614cdb575f80fd5b818501915085601f830112614cee575f80fd5b813581811115614cfc575f80fd5b866020828501011115614d0d575f80fd5b60209290920196919550909350505050565b600181811c90821680614d3357607f821691505b602082108103614d5157634e487b7160e01b5f52602260045260245ffd5b50919050565b60208101610deb8284614b81565b634e487b7160e01b5f52604160045260245ffd5b604051606081016001600160401b0381118282101715614d9b57614d9b614d65565b60405290565b604080519081016001600160401b0381118282101715614d9b57614d9b614d65565b604051601f8201601f191681016001600160401b0381118282101715614deb57614deb614d65565b604052919050565b5f6001600160401b03821115614e0b57614e0b614d65565b50601f01601f191660200190565b5f82601f830112614e28575f80fd5b8151614e3b614e3682614df3565b614dc3565b818152846020838601011115614e4f575f80fd5b610eea826020830160208701614b95565b5f60208284031215614e70575f80fd5b81516001600160401b03811115614e85575f80fd5b610eea84828501614e19565b602081525f6120f36020830184614bb7565b5f60208284031215614eb3575f80fd5b5051919050565b5f60208284031215614eca575f80fd5b81356120f381614c62565b5f808335601e19843603018112614eea575f80fd5b8301803591506001600160401b03821115614f03575f80fd5b6020019150600581901b36038213156133bd575f80fd5b634e487b7160e01b5f52603260045260245ffd5b5f8235605e19833603018112614f42575f80fd5b9190910192915050565b5f82601f830112614f5b575f80fd5b8135614f69614e3682614df3565b818152846020838601011115614f7d575f80fd5b816020850160208301375f918101602001919091529392505050565b5f60608236031215614fa9575f80fd5b614fb1614d79565b82356001600160401b0380821115614fc7575f80fd5b614fd336838701614f4c565b83526020850135915080821115614fe8575f80fd5b50614ff536828601614f4c565b602083015250604083013561500981614ab7565b604082015292915050565b5f8251614f42818460208701614b95565b601f82111561050757805f5260205f20601f840160051c8101602085101561504a5750805b601f840160051c820191505b818110156119d5575f8155600101615056565b81516001600160401b0381111561508257615082614d65565b615096816150908454614d1f565b84615025565b602080601f8311600181146150c9575f84156150b25750858301515b5f19600386901b1c1916600185901b178555611021565b5f85815260208120601f198616915b828110156150f7578886015182559484019460019091019084016150d8565b508582101561511457878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b5f52601160045260245ffd5b80820180821115610deb57610deb615124565b5f63ffffffff80831681810361516357615163615124565b6001019392505050565b8082028115828204841417610deb57610deb615124565b5f808335601e19843603018112615199575f80fd5b83016020810192503590506001600160401b038111156151b7575f80fd5b8036038213156133bd575f80fd5b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b5f8383855260208086019550808560051b830101845f5b878110156152a257848303601f19018952813536889003605e19018112615229575f80fd5b870160606152378280615184565b82875261524783880182846151c5565b9250505061525786830183615184565b868303888801526152698382846151c5565b92505050604080830135925061527e83614ab7565b6001600160401b039290921694909101939093529783019790830190600101615204565b5090979650505050505050565b6020815281356020820152602082013560408201525f60408301356152d381614c62565b6001600160a01b031660608381019190915283013536849003601e190181126152fa575f80fd5b83016020810190356001600160401b03811115615315575f80fd5b8060051b3603821315615326575f80fd5b60808085015261355860a0850182846151ed565b5f8261535457634e487b7160e01b5f52601260045260245ffd5b500490565b602081016004831061536d5761536d614b6d565b91905290565b5f805f60608486031215615385575f80fd5b83519250602084015161539781614ab7565b60408501519092506153a881614ab7565b809150509250925092565b5f80604083850312156153c4575f80fd5b825191506020830151614ca9816149a7565b5f60208083525f84546153e881614d1f565b806020870152604060018084165f8114615409576001811461542557615452565b60ff19851660408a0152604084151560051b8a01019550615452565b895f5260205f205f5b858110156154495781548b820186015290830190880161542e565b8a016040019650505b509398975050505050505050565b818382375f9101908152919050565b6001600160401b0381811683821601908082111561220957612209615124565b6001600160401b0382811682821603908082111561220957612209615124565b5f80604083850312156154c0575f80fd5b82516001600160401b03808211156154d6575f80fd5b90840190606082870312156154e9575f80fd5b6154f1614d79565b82518152602083015161550381614c62565b6020820152604083015182811115615519575f80fd5b61552588828601614e19565b6040830152508094505050506020830151614ca9816149a7565b5f8060408385031215615550575f80fd5b825191506020830151614ca981614ab7565b81810381811115610deb57610deb615124565b6001600160401b0381811683821602808216919082811461559857615598615124565b505092915050565b5f8235603e19833603018112614f42575f80fd5b5f808335601e198436030181126155c9575f80fd5b8301803591506001600160401b038211156155e2575f80fd5b6020019150368190038213156133bd575f80fd5b602081525f610eea6020830184866151c5565b5f60408236031215615619575f80fd5b615621614da1565b61562a836149b4565b81526020808401356001600160401b0380821115615646575f80fd5b9085019036601f830112615658575f80fd5b81358181111561566a5761566a614d65565b8060051b915061567b848301614dc3565b8181529183018401918481019036841115615694575f80fd5b938501935b838510156156be57843592506156ae83614c62565b8282529385019390850190615699565b94860194909452509295945050505050565b5f6040830163ffffffff8351168452602080840151604060208701528281518085526060880191506020830194505f92505b808310156125265784516001600160a01b03168252938301936001929092019190830190615702565b60208152815160208201525f602083015160e06040840152615751610100840182614bb7565b90506040840151601f198085840301606086015261576f8383614bb7565b92506001600160401b03606087015116608086015260808601519150808584030160a086015261579f83836156d0565b925060a08601519150808584030160c0860152506157bd82826156d0565b91505060c08401516157da60e08501826001600160401b03169052565b509392505050565b5f80604083850312156157f3575f80fd5b8251915060208301516001600160401b0381111561580f575f80fd5b61581b85828601614e19565b9150509250929050565b6001600160401b0383111561583c5761583c614d65565b6158508361584a8354614d1f565b83615025565b5f601f841160018114615881575f851561586a5750838201355b5f19600387901b1c1916600186901b1783556119d5565b5f83815260208120601f198716915b828110156158b05786850135825560209485019460019092019101615890565b50868210156158cc575f1960f88860031b161c19848701351681555b505060018560011b0183555050505050565b5f602082840312156158ee575f80fd5b6120f382614aa6565b5f60208284031215615907575f80fd5b813560ff811681146120f3575f80fd5b5f6001600160401b0380831681810361516357615163615124565b5f60208284031215615942575f80fd5b81516120f3816149a756fe6e5bdfcce15e53c3406ea67bfce37dcd26f5152d5492824e43fd5e3c8ac5ab004317713f7ecbdddd4bc99e95d903adedaa883b2e7c2551610bd13e2c7e473d00e92546d698950ddd38910d2e15ed1d923cd0a7b3dde9e2a6a3f380565559cb004317713f7ecbdddd4bc99e95d903adedaa883b2e7c2551610bd13e2c7e473d069b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00e92546d698950ddd38910d2e15ed1d923cd0a7b3dde9e2a6a3f380565559cb07a26469706673582212204ea445ace2c37f5ac039cc54cad9de84a97cbfbda72d2cc16570442de2ac308d64736f6c63430008190033", } // ERC20TokenStakingManagerABI is the input ABI used to generate the binding from. @@ -648,6 +648,37 @@ func (_ERC20TokenStakingManager *ERC20TokenStakingManagerCallerSession) WARPMESS return _ERC20TokenStakingManager.Contract.WARPMESSENGER(&_ERC20TokenStakingManager.CallOpts) } +// Erc20 is a free data retrieval call binding the contract method 0x785e9e86. +// +// Solidity: function erc20() view returns(address) +func (_ERC20TokenStakingManager *ERC20TokenStakingManagerCaller) Erc20(opts *bind.CallOpts) (common.Address, error) { + var out []interface{} + err := _ERC20TokenStakingManager.contract.Call(opts, &out, "erc20") + + if err != nil { + return *new(common.Address), err + } + + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + + return out0, err + +} + +// Erc20 is a free data retrieval call binding the contract method 0x785e9e86. +// +// Solidity: function erc20() view returns(address) +func (_ERC20TokenStakingManager *ERC20TokenStakingManagerSession) Erc20() (common.Address, error) { + return _ERC20TokenStakingManager.Contract.Erc20(&_ERC20TokenStakingManager.CallOpts) +} + +// Erc20 is a free data retrieval call binding the contract method 0x785e9e86. +// +// Solidity: function erc20() view returns(address) +func (_ERC20TokenStakingManager *ERC20TokenStakingManagerCallerSession) Erc20() (common.Address, error) { + return _ERC20TokenStakingManager.Contract.Erc20(&_ERC20TokenStakingManager.CallOpts) +} + // GetValidator is a free data retrieval call binding the contract method 0xd5f20ff6. // // Solidity: function getValidator(bytes32 validationID) view returns((uint8,bytes,uint64,uint64,uint64,uint64,uint64)) diff --git a/contracts/validator-manager/ERC20TokenStakingManager.sol b/contracts/validator-manager/ERC20TokenStakingManager.sol index 64e7fff2a..a5e6af656 100644 --- a/contracts/validator-manager/ERC20TokenStakingManager.sol +++ b/contracts/validator-manager/ERC20TokenStakingManager.sol @@ -119,6 +119,13 @@ contract ERC20TokenStakingManager is return _initializeDelegatorRegistration(validationID, _msgSender(), delegationAmount); } + /** + * @notice Returns the ERC20 token being staked + */ + function erc20() external view returns (IERC20Mintable) { + return _getERC20StakingManagerStorage()._token; + } + /** * @notice See {PoSValidatorManager-_lock} * Note: Must be guarded with reentrancy guard for safe transfer from. diff --git a/tests/flows/validator-manager/erc20_token_staking.go b/tests/flows/validator-manager/erc20_token_staking.go index 1f8beee9b..a498bab1c 100644 --- a/tests/flows/validator-manager/erc20_token_staking.go +++ b/tests/flows/validator-manager/erc20_token_staking.go @@ -8,6 +8,8 @@ import ( "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/subnet-evm/accounts/abi/bind" + exampleerc20 "github.com/ava-labs/teleporter/abi-bindings/go/mocks/ExampleERC20" + erc20tokenstakingmanager "github.com/ava-labs/teleporter/abi-bindings/go/validator-manager/ERC20TokenStakingManager" iposvalidatormanager "github.com/ava-labs/teleporter/abi-bindings/go/validator-manager/interfaces/IPoSValidatorManager" localnetwork "github.com/ava-labs/teleporter/tests/network" "github.com/ava-labs/teleporter/tests/utils" @@ -46,12 +48,18 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { ctx := context.Background() // Deploy the staking manager contract - stakingManagerAddress, stakingManager, _, erc20 := utils.DeployAndInitializeERC20TokenStakingManager( + stakingManagerAddress, _ := utils.DeployAndInitializeValidatorManager( ctx, fundedKey, subnetAInfo, - pChainInfo, + utils.ERC20TokenStakingManager, ) + erc20StakingManager, err := erc20tokenstakingmanager.NewERC20TokenStakingManager(stakingManagerAddress, subnetAInfo.RPCClient) + Expect(err).Should(BeNil()) + erc20Address, err := erc20StakingManager.Erc20(&bind.CallOpts{}) + Expect(err).Should(BeNil()) + erc20, err := exampleerc20.NewExampleERC20(erc20Address, subnetAInfo.RPCClient) + Expect(err).Should(BeNil()) nodes := utils.ConvertSubnet( ctx, @@ -104,7 +112,7 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { fundedKey, subnetAInfo, pChainInfo, - stakingManager, + erc20StakingManager, stakingManagerAddress, erc20, expiry, @@ -119,13 +127,13 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { var delegationID ids.ID { log.Println("Registering delegator") - delegatorStake, err := stakingManager.WeightToValue( + delegatorStake, err := erc20StakingManager.WeightToValue( &bind.CallOpts{}, nodes[0].Weight, ) Expect(err).Should(BeNil()) delegatorStake.Div(delegatorStake, big.NewInt(10)) - delegatorWeight, err := stakingManager.ValueToWeight( + delegatorWeight, err := erc20StakingManager.ValueToWeight( &bind.CallOpts{}, delegatorStake, ) @@ -142,11 +150,11 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { delegatorStake, erc20, stakingManagerAddress, - stakingManager, + erc20StakingManager, ) initRegistrationEvent, err := utils.GetEventFromLogs( receipt.Logs, - stakingManager.ParseDelegatorAdded, + erc20StakingManager.ParseDelegatorAdded, ) Expect(err).Should(BeNil()) delegationID = initRegistrationEvent.DelegationID @@ -182,7 +190,7 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { // Check that the validator is registered in the staking contract registrationEvent, err := utils.GetEventFromLogs( receipt.Logs, - stakingManager.ParseDelegatorRegistered, + erc20StakingManager.ParseDelegatorRegistered, ) Expect(err).Should(BeNil()) Expect(registrationEvent.ValidationID[:]).Should(Equal(validationID[:])) @@ -199,12 +207,12 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { ctx, fundedKey, subnetAInfo, - stakingManager, + erc20StakingManager, delegationID, ) delegatorRemovalEvent, err := utils.GetEventFromLogs( receipt.Logs, - stakingManager.ParseDelegatorRemovalInitialized, + erc20StakingManager.ParseDelegatorRemovalInitialized, ) Expect(err).Should(BeNil()) Expect(delegatorRemovalEvent.ValidationID[:]).Should(Equal(validationID[:])) @@ -244,7 +252,7 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { // Check that the delegator has been delisted from the staking contract registrationEvent, err := utils.GetEventFromLogs( receipt.Logs, - stakingManager.ParseDelegationEnded, + erc20StakingManager.ParseDelegationEnded, ) Expect(err).Should(BeNil()) Expect(registrationEvent.ValidationID[:]).Should(Equal(validationID[:])) diff --git a/tests/flows/validator-manager/native_token_staking.go b/tests/flows/validator-manager/native_token_staking.go index 8056de40d..f768c4419 100644 --- a/tests/flows/validator-manager/native_token_staking.go +++ b/tests/flows/validator-manager/native_token_staking.go @@ -8,6 +8,7 @@ import ( "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/subnet-evm/accounts/abi/bind" + nativetokenstakingmanager "github.com/ava-labs/teleporter/abi-bindings/go/validator-manager/NativeTokenStakingManager" iposvalidatormanager "github.com/ava-labs/teleporter/abi-bindings/go/validator-manager/interfaces/IPoSValidatorManager" localnetwork "github.com/ava-labs/teleporter/tests/network" "github.com/ava-labs/teleporter/tests/utils" @@ -46,12 +47,14 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { ctx := context.Background() // Deploy the staking manager contract - stakingManagerAddress, stakingManager := utils.DeployAndInitializeNativeTokenStakingManager( + stakingManagerAddress, _ := utils.DeployAndInitializeValidatorManager( ctx, fundedKey, subnetAInfo, - pChainInfo, + utils.NativeTokenStakingManager, ) + nativeStakingManager, err := nativetokenstakingmanager.NewNativeTokenStakingManager(stakingManagerAddress, subnetAInfo.RPCClient) + Expect(err).Should(BeNil()) utils.AddNativeMinterAdmin(ctx, subnetAInfo, fundedKey, stakingManagerAddress) @@ -106,7 +109,7 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { fundedKey, subnetAInfo, pChainInfo, - stakingManager, + nativeStakingManager, stakingManagerAddress, expiry, nodes[0], @@ -120,13 +123,13 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { var delegationID ids.ID { log.Println("Registering delegator") - delegatorStake, err := stakingManager.WeightToValue( + delegatorStake, err := nativeStakingManager.WeightToValue( &bind.CallOpts{}, nodes[0].Weight, ) Expect(err).Should(BeNil()) delegatorStake.Div(delegatorStake, big.NewInt(10)) - delegatorWeight, err := stakingManager.ValueToWeight( + delegatorWeight, err := nativeStakingManager.ValueToWeight( &bind.CallOpts{}, delegatorStake, ) @@ -142,11 +145,11 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { validationID, delegatorStake, stakingManagerAddress, - stakingManager, + nativeStakingManager, ) initRegistrationEvent, err := utils.GetEventFromLogs( receipt.Logs, - stakingManager.ParseDelegatorAdded, + nativeStakingManager.ParseDelegatorAdded, ) Expect(err).Should(BeNil()) delegationID = initRegistrationEvent.DelegationID @@ -182,7 +185,7 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { // Check that the validator is registered in the staking contract registrationEvent, err := utils.GetEventFromLogs( receipt.Logs, - stakingManager.ParseDelegatorRegistered, + nativeStakingManager.ParseDelegatorRegistered, ) Expect(err).Should(BeNil()) Expect(registrationEvent.ValidationID[:]).Should(Equal(validationID[:])) @@ -198,12 +201,12 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { ctx, fundedKey, subnetAInfo, - stakingManager, + nativeStakingManager, delegationID, ) delegatorRemovalEvent, err := utils.GetEventFromLogs( receipt.Logs, - stakingManager.ParseDelegatorRemovalInitialized, + nativeStakingManager.ParseDelegatorRemovalInitialized, ) Expect(err).Should(BeNil()) Expect(delegatorRemovalEvent.ValidationID[:]).Should(Equal(validationID[:])) @@ -243,7 +246,7 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { // Check that the delegator has been delisted from the staking contract registrationEvent, err := utils.GetEventFromLogs( receipt.Logs, - stakingManager.ParseDelegationEnded, + nativeStakingManager.ParseDelegationEnded, ) Expect(err).Should(BeNil()) Expect(registrationEvent.ValidationID[:]).Should(Equal(validationID[:])) diff --git a/tests/network/network.go b/tests/network/network.go index 8ab1e9bfd..9f1075fee 100644 --- a/tests/network/network.go +++ b/tests/network/network.go @@ -198,10 +198,11 @@ func (n *LocalNetwork) ConvertSubnet(ctx context.Context, subnet interfaces.Subn }, ) // TODO: support other manager types, including deploying a proxy - vdrManagerAddress, _ := utils.DeployAndInitializePoAValidatorManager( + vdrManagerAddress, _ := utils.DeployAndInitializeValidatorManager( ctx, fundedKey, subnet, + utils.PoAValidatorManager, fundedAddress, ) n.validatorManagers[subnet.SubnetID] = vdrManagerAddress diff --git a/tests/utils/validator_manager.go b/tests/utils/validator_manager.go index 693a88973..6d3ceeee3 100644 --- a/tests/utils/validator_manager.go +++ b/tests/utils/validator_manager.go @@ -128,132 +128,98 @@ func DeployValidatorManager( return address, validatorManager } -func DeployAndInitializeNativeTokenStakingManager( +func DeployAndInitializeValidatorManager( ctx context.Context, senderKey *ecdsa.PrivateKey, subnet interfaces.SubnetTestInfo, - pChainInfo interfaces.SubnetTestInfo, -) (common.Address, *nativetokenstakingmanager.NativeTokenStakingManager) { - stakingManagerContractAddress, _ := DeployValidatorManager( + managerType ValidatorManagerConcreteType, + args ...interface{}, +) (common.Address, *ivalidatormanager.IValidatorManager) { + validatorManagerAddress, validatorManager := DeployValidatorManager( ctx, senderKey, subnet, NativeTokenStakingManager, ) - rewardCalculatorAddress, _ := DeployExampleRewardCalculator( - ctx, - senderKey, - subnet, - uint64(10), - ) opts, err := bind.NewKeyedTransactorWithChainID(senderKey, subnet.EVMChainID) Expect(err).Should(BeNil()) - stakingManager, err := nativetokenstakingmanager.NewNativeTokenStakingManager(stakingManagerContractAddress, subnet.RPCClient) - Expect(err).Should(BeNil()) - tx, err := stakingManager.Initialize( - opts, - nativetokenstakingmanager.PoSValidatorManagerSettings{ - BaseSettings: nativetokenstakingmanager.ValidatorManagerSettings{ - SubnetID: subnet.SubnetID, - ChurnPeriodSeconds: DefaultChurnPeriodSeconds, - MaximumChurnPercentage: DefaultMaxChurnPercentage, - }, - MinimumStakeAmount: big.NewInt(0).SetUint64(DefaultMinStakeAmount), - MaximumStakeAmount: big.NewInt(0).SetUint64(DefaultMaxStakeAmount), - MinimumStakeDuration: DefaultMinStakeDurationSeconds, - MinimumDelegationFeeBips: DefaultMinDelegateFeeBips, - MaximumStakeMultiplier: DefaultMaxStakeMultiplier, - WeightToValueFactor: big.NewInt(0).SetUint64(DefaultWeightToValueFactor), - RewardCalculator: rewardCalculatorAddress, - }, - ) - Expect(err).Should(BeNil()) - WaitForTransactionSuccess(ctx, subnet, tx.Hash()) - - return stakingManagerContractAddress, stakingManager -} - -func DeployAndInitializeERC20TokenStakingManager( - ctx context.Context, - senderKey *ecdsa.PrivateKey, - subnet interfaces.SubnetTestInfo, - pChainInfo interfaces.SubnetTestInfo, -) ( - common.Address, - *erc20tokenstakingmanager.ERC20TokenStakingManager, - common.Address, - *exampleerc20.ExampleERC20, -) { - stakingManagerContractAddress, _ := DeployValidatorManager( - ctx, - senderKey, - subnet, - ERC20TokenStakingManager, - ) - erc20Address, erc20 := DeployExampleERC20(ctx, senderKey, subnet) - rewardCalculatorAddress, _ := DeployExampleRewardCalculator( - ctx, - senderKey, - subnet, - uint64(10), - ) - opts, err := bind.NewKeyedTransactorWithChainID(senderKey, subnet.EVMChainID) - Expect(err).Should(BeNil()) - stakingManager, err := erc20tokenstakingmanager.NewERC20TokenStakingManager(stakingManagerContractAddress, subnet.RPCClient) - Expect(err).Should(BeNil()) - tx, err := stakingManager.Initialize( - opts, - erc20tokenstakingmanager.PoSValidatorManagerSettings{ - BaseSettings: erc20tokenstakingmanager.ValidatorManagerSettings{ + var tx *types.Transaction + switch managerType { + case PoAValidatorManager: + Expect(len(args)).Should(Equal(1)) + ownerAddress := args[0].(common.Address) + poaValidatorManager, err := poavalidatormanager.NewPoAValidatorManager(validatorManagerAddress, subnet.RPCClient) + Expect(err).Should(BeNil()) + tx, err = poaValidatorManager.Initialize( + opts, + poavalidatormanager.ValidatorManagerSettings{ SubnetID: subnet.SubnetID, - ChurnPeriodSeconds: DefaultChurnPeriodSeconds, - MaximumChurnPercentage: DefaultMaxChurnPercentage, + ChurnPeriodSeconds: uint64(0), + MaximumChurnPercentage: uint8(20), }, - MinimumStakeAmount: big.NewInt(0).SetUint64(DefaultMinStakeAmount), - MaximumStakeAmount: big.NewInt(0).SetUint64(DefaultMaxStakeAmount), - MinimumStakeDuration: DefaultMinStakeDurationSeconds, - MinimumDelegationFeeBips: DefaultMinDelegateFeeBips, - MaximumStakeMultiplier: DefaultMaxStakeMultiplier, - WeightToValueFactor: big.NewInt(0).SetUint64(DefaultWeightToValueFactor), - RewardCalculator: rewardCalculatorAddress, - }, - erc20Address, - ) - Expect(err).Should(BeNil()) - WaitForTransactionSuccess(ctx, subnet, tx.Hash()) - - return stakingManagerContractAddress, stakingManager, erc20Address, erc20 -} - -func DeployAndInitializePoAValidatorManager( - ctx context.Context, - senderKey *ecdsa.PrivateKey, - subnet interfaces.SubnetTestInfo, - ownerAddress common.Address, -) (common.Address, *poavalidatormanager.PoAValidatorManager) { - validatorManagerAddress, _ := DeployValidatorManager( - ctx, - senderKey, - subnet, - PoAValidatorManager, - ) - opts, err := bind.NewKeyedTransactorWithChainID(senderKey, subnet.EVMChainID) - Expect(err).Should(BeNil()) - validatorManager, err := poavalidatormanager.NewPoAValidatorManager(validatorManagerAddress, subnet.RPCClient) - Expect(err).Should(BeNil()) - tx, err := validatorManager.Initialize( - opts, - poavalidatormanager.ValidatorManagerSettings{ - SubnetID: subnet.SubnetID, - ChurnPeriodSeconds: uint64(0), - MaximumChurnPercentage: uint8(20), - }, - ownerAddress, - ) - Expect(err).Should(BeNil()) + ownerAddress, + ) + Expect(err).Should(BeNil()) + case ERC20TokenStakingManager: + Expect(len(args)).Should(Equal(0)) + erc20Address, _ := DeployExampleERC20(ctx, senderKey, subnet) + rewardCalculatorAddress, _ := DeployExampleRewardCalculator( + ctx, + senderKey, + subnet, + uint64(10), + ) + erc20StakingManager, err := erc20tokenstakingmanager.NewERC20TokenStakingManager(validatorManagerAddress, subnet.RPCClient) + Expect(err).Should(BeNil()) + tx, err = erc20StakingManager.Initialize( + opts, + erc20tokenstakingmanager.PoSValidatorManagerSettings{ + BaseSettings: erc20tokenstakingmanager.ValidatorManagerSettings{ + SubnetID: subnet.SubnetID, + ChurnPeriodSeconds: DefaultChurnPeriodSeconds, + MaximumChurnPercentage: DefaultMaxChurnPercentage, + }, + MinimumStakeAmount: big.NewInt(0).SetUint64(DefaultMinStakeAmount), + MaximumStakeAmount: big.NewInt(0).SetUint64(DefaultMaxStakeAmount), + MinimumStakeDuration: DefaultMinStakeDurationSeconds, + MinimumDelegationFeeBips: DefaultMinDelegateFeeBips, + MaximumStakeMultiplier: DefaultMaxStakeMultiplier, + WeightToValueFactor: big.NewInt(0).SetUint64(DefaultWeightToValueFactor), + RewardCalculator: rewardCalculatorAddress, + }, + erc20Address, + ) + Expect(err).Should(BeNil()) + case NativeTokenStakingManager: + Expect(len(args)).Should(Equal(0)) + rewardCalculatorAddress, _ := DeployExampleRewardCalculator( + ctx, + senderKey, + subnet, + uint64(10), + ) + nativeStakingManager, err := nativetokenstakingmanager.NewNativeTokenStakingManager(validatorManagerAddress, subnet.RPCClient) + Expect(err).Should(BeNil()) + tx, err = nativeStakingManager.Initialize( + opts, + nativetokenstakingmanager.PoSValidatorManagerSettings{ + BaseSettings: nativetokenstakingmanager.ValidatorManagerSettings{ + SubnetID: subnet.SubnetID, + ChurnPeriodSeconds: DefaultChurnPeriodSeconds, + MaximumChurnPercentage: DefaultMaxChurnPercentage, + }, + MinimumStakeAmount: big.NewInt(0).SetUint64(DefaultMinStakeAmount), + MaximumStakeAmount: big.NewInt(0).SetUint64(DefaultMaxStakeAmount), + MinimumStakeDuration: DefaultMinStakeDurationSeconds, + MinimumDelegationFeeBips: DefaultMinDelegateFeeBips, + MaximumStakeMultiplier: DefaultMaxStakeMultiplier, + WeightToValueFactor: big.NewInt(0).SetUint64(DefaultWeightToValueFactor), + RewardCalculator: rewardCalculatorAddress, + }, + ) + } WaitForTransactionSuccess(ctx, subnet, tx.Hash()) - return validatorManagerAddress, validatorManager } @@ -872,6 +838,7 @@ func InitializeERC20DelegatorRegistration( return receipt } +// TODO: Consolidate this with native function func CompleteERC20DelegatorRegistration( ctx context.Context, senderKey *ecdsa.PrivateKey, @@ -894,6 +861,7 @@ func CompleteERC20DelegatorRegistration( ) } +// TODO: Consolidate this with native function func InitializeEndERC20Delegation( ctx context.Context, senderKey *ecdsa.PrivateKey, @@ -914,6 +882,7 @@ func InitializeEndERC20Delegation( return WaitForTransactionSuccess(ctx, subnet, tx.Hash()) } +// TODO: Consolidate this with native function func CompleteEndERC20Delegation( ctx context.Context, senderKey *ecdsa.PrivateKey, From f4d418d396df99be384af1874fe1c86594b8c4d4 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Fri, 8 Nov 2024 10:04:49 -0600 Subject: [PATCH 08/34] vdr churn test uses manager --- tests/flows/teleporter/validator_churn.go | 34 +++++++++++++++++++++-- tests/network/network.go | 30 +++++++++++++++----- 2 files changed, 55 insertions(+), 9 deletions(-) diff --git a/tests/flows/teleporter/validator_churn.go b/tests/flows/teleporter/validator_churn.go index ef4fc1f01..cba1ebcb1 100644 --- a/tests/flows/teleporter/validator_churn.go +++ b/tests/flows/teleporter/validator_churn.go @@ -5,9 +5,11 @@ import ( "math/big" "time" + "github.com/ava-labs/avalanchego/utils/units" "github.com/ava-labs/subnet-evm/accounts/abi/bind" subnetEvmUtils "github.com/ava-labs/subnet-evm/tests/utils" teleportermessenger "github.com/ava-labs/teleporter/abi-bindings/go/teleporter/TeleporterMessenger" + poavalidatormanager "github.com/ava-labs/teleporter/abi-bindings/go/validator-manager/PoAValidatorManager" localnetwork "github.com/ava-labs/teleporter/tests/network" "github.com/ava-labs/teleporter/tests/utils" "github.com/ethereum/go-ethereum/common" @@ -64,9 +66,37 @@ func ValidatorChurn(network *localnetwork.LocalNetwork, teleporter utils.Telepor // // Add new nodes to the validator set - addValidatorsCtx, cancel := context.WithTimeout(ctx, 60*time.Second) + addValidatorsCtx, cancel := context.WithTimeout(ctx, 60*newNodeCount*time.Second) defer cancel() - network.AddSubnetValidators(addValidatorsCtx, subnetAInfo.SubnetID, newNodeCount) + newNodes := network.GetExtraNodes(newNodeCount) + validatorManagerAddress := network.GetValidatorManager(subnetAInfo.SubnetID) + validatorManager, err := poavalidatormanager.NewPoAValidatorManager(validatorManagerAddress, subnetAInfo.RPCClient) + pChainInfo := utils.GetPChainInfo(network.GetPrimaryNetworkInfo()) + Expect(err).Should(BeNil()) + for i := 0; i < newNodeCount; i++ { + expiry := uint64(time.Now().Add(24 * time.Hour).Unix()) + pop, err := newNodes[i].GetProofOfPossession() + Expect(err).Should(BeNil()) + node := utils.Node{ + NodeID: newNodes[i].NodeID, + NodePoP: pop, + Weight: units.Schmeckle, + } + utils.InitializeAndCompletePoAValidatorRegistration( + addValidatorsCtx, + network.GetSignatureAggregator(), + fundedKey, + fundedKey, + subnetAInfo, + pChainInfo, + validatorManager, + validatorManagerAddress, + expiry, + node, + network.GetPChainWallet(), + network.GetNetworkID(), + ) + } // Refresh the subnet info subnetAInfo, subnetBInfo = network.GetTwoSubnets() diff --git a/tests/network/network.go b/tests/network/network.go index 9f1075fee..de35892c3 100644 --- a/tests/network/network.go +++ b/tests/network/network.go @@ -27,6 +27,7 @@ import ( "github.com/ava-labs/avalanchego/vms/secp256k1fx" pwallet "github.com/ava-labs/avalanchego/wallet/chain/p/wallet" "github.com/ava-labs/avalanchego/wallet/subnet/primary" + "github.com/ava-labs/awm-relayer/signature-aggregator/aggregator" "github.com/ava-labs/subnet-evm/ethclient" subnetEvmTestUtils "github.com/ava-labs/subnet-evm/tests/utils" "github.com/ava-labs/teleporter/tests/interfaces" @@ -46,6 +47,7 @@ type LocalNetwork struct { primaryNetworkValidators []ids.NodeID globalFundedKey *secp256k1.PrivateKey validatorManagers map[ids.ID]common.Address + signatureAggregator *aggregator.SignatureAggregator } const ( @@ -181,6 +183,17 @@ func NewLocalNetwork( validatorManagers: make(map[ids.ID]common.Address), } + // Construct the signature aggregator + var subnetIDs []ids.ID + for _, subnet := range localNetwork.GetSubnetsInfo() { + subnetIDs = append(subnetIDs, subnet.SubnetID) + } + signatureAggregator := utils.NewSignatureAggregator( + localNetwork.GetPrimaryNetworkInfo().NodeURIs[0], + subnetIDs, + ) + localNetwork.signatureAggregator = signatureAggregator + return localNetwork } @@ -191,12 +204,7 @@ func (n *LocalNetwork) ConvertSubnet(ctx context.Context, subnet interfaces.Subn Expect(err).Should(BeNil()) fundedAddress, fundedKey := n.GetFundedAccountInfo() - signatureAggregator := utils.NewSignatureAggregator( - cChainInfo.NodeURIs[0], - []ids.ID{ - subnet.SubnetID, - }, - ) + // TODO: support other manager types, including deploying a proxy vdrManagerAddress, _ := utils.DeployAndInitializeValidatorManager( ctx, @@ -291,7 +299,7 @@ func (n *LocalNetwork) ConvertSubnet(ctx context.Context, subnet interfaces.Subn utils.GetPChainInfo(cChainInfo), vdrManagerAddress, n.GetNetworkID(), - signatureAggregator, + n.signatureAggregator, nodes, ) @@ -304,6 +312,14 @@ func (n *LocalNetwork) ConvertSubnet(ctx context.Context, subnet interfaces.Subn // } } +func (n *LocalNetwork) GetValidatorManager(subnetID ids.ID) common.Address { + return n.validatorManagers[subnetID] +} + +func (n *LocalNetwork) GetSignatureAggregator() *aggregator.SignatureAggregator { + return n.signatureAggregator +} + func (n *LocalNetwork) GetExtraNodes(count uint) []*tmpnet.Node { Expect(count > 0).Should(BeTrue(), "can't add 0 validators") Expect(uint(len(n.extraNodes)) >= count).Should( From 41b1f1364dbdad3cb123b09ff0caa308ab3e3149 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Fri, 8 Nov 2024 10:55:28 -0600 Subject: [PATCH 09/34] fix: use type param --- tests/utils/validator_manager.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/utils/validator_manager.go b/tests/utils/validator_manager.go index 6d3ceeee3..5de10a437 100644 --- a/tests/utils/validator_manager.go +++ b/tests/utils/validator_manager.go @@ -139,7 +139,7 @@ func DeployAndInitializeValidatorManager( ctx, senderKey, subnet, - NativeTokenStakingManager, + managerType, ) opts, err := bind.NewKeyedTransactorWithChainID(senderKey, subnet.EVMChainID) Expect(err).Should(BeNil()) From 8a21d86c57a3681789249ba7802e378e797fea9a Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Fri, 8 Nov 2024 11:14:05 -0600 Subject: [PATCH 10/34] vdr churn uses manager --- tests/flows/teleporter/validator_churn.go | 3 + tests/network/network.go | 96 ++++++++--------------- 2 files changed, 36 insertions(+), 63 deletions(-) diff --git a/tests/flows/teleporter/validator_churn.go b/tests/flows/teleporter/validator_churn.go index cba1ebcb1..f8c7350cb 100644 --- a/tests/flows/teleporter/validator_churn.go +++ b/tests/flows/teleporter/validator_churn.go @@ -73,6 +73,9 @@ func ValidatorChurn(network *localnetwork.LocalNetwork, teleporter utils.Telepor validatorManager, err := poavalidatormanager.NewPoAValidatorManager(validatorManagerAddress, subnetAInfo.RPCClient) pChainInfo := utils.GetPChainInfo(network.GetPrimaryNetworkInfo()) Expect(err).Should(BeNil()) + + subnetAInfo = network.AddSubnetValidators(newNodes, subnetAInfo) + for i := 0; i < newNodeCount; i++ { expiry := uint64(time.Now().Add(24 * time.Hour).Unix()) pop, err := newNodes[i].GetProofOfPossession() diff --git a/tests/network/network.go b/tests/network/network.go index de35892c3..db6d6c020 100644 --- a/tests/network/network.go +++ b/tests/network/network.go @@ -8,7 +8,6 @@ import ( "encoding/json" goLog "log" "os" - "slices" "sort" "time" @@ -263,31 +262,7 @@ func (n *LocalNetwork) ConvertSubnet(ctx context.Context, subnet interfaces.Subn ) Expect(err).Should(BeNil()) - // Modify the each node's config to track the subnet - for _, node := range tmpnetNodes { - existingTrackedSubnets, err := node.Flags.GetStringVal(config.TrackSubnetsKey) - Expect(err).Should(BeNil()) - if existingTrackedSubnets == subnet.SubnetID.String() { - goLog.Printf("Node %s @ %s already tracking subnet %s\n", node.NodeID, node.URI, subnet.SubnetID) - continue - } - node.Flags[config.TrackSubnetsKey] = subnet.SubnetID.String() - - // Add the node to the network - n.Network.Nodes = append(n.Network.Nodes, node) - } - n.Network.StartNodes(context.Background(), os.Stdout, tmpnetNodes...) - - // Update the tmpnet Subnet struct - for _, tmpnetSubnet := range n.Network.Subnets { - if tmpnetSubnet.SubnetID == subnet.SubnetID { - for _, tmpnetNode := range tmpnetNodes { - tmpnetSubnet.ValidatorIDs = append(tmpnetSubnet.ValidatorIDs, tmpnetNode.NodeID) - } - } - } - // Refresh the subnet info after restarting the nodes - subnet = n.GetSubnetInfo(subnet.SubnetID) + subnet = n.AddSubnetValidators(tmpnetNodes, subnet) utils.PChainProposerVMWorkaround(pChainWallet) utils.AdvanceProposerVM(ctx, subnet, fundedKey, 5) @@ -312,6 +287,38 @@ func (n *LocalNetwork) ConvertSubnet(ctx context.Context, subnet interfaces.Subn // } } +func (n *LocalNetwork) AddSubnetValidators( + nodes []*tmpnet.Node, + subnet interfaces.SubnetTestInfo, +) interfaces.SubnetTestInfo { + // Modify the each node's config to track the subnet + for _, node := range nodes { + existingTrackedSubnets, err := node.Flags.GetStringVal(config.TrackSubnetsKey) + Expect(err).Should(BeNil()) + if existingTrackedSubnets == subnet.SubnetID.String() { + goLog.Printf("Node %s @ %s already tracking subnet %s\n", node.NodeID, node.URI, subnet.SubnetID) + continue + } + node.Flags[config.TrackSubnetsKey] = subnet.SubnetID.String() + + // Add the node to the network + n.Network.Nodes = append(n.Network.Nodes, node) + } + n.Network.StartNodes(context.Background(), os.Stdout, nodes...) + + // Update the tmpnet Subnet struct + for _, tmpnetSubnet := range n.Network.Subnets { + if tmpnetSubnet.SubnetID == subnet.SubnetID { + for _, tmpnetNode := range nodes { + tmpnetSubnet.ValidatorIDs = append(tmpnetSubnet.ValidatorIDs, tmpnetNode.NodeID) + } + } + } + + // Refresh the subnet info after restarting the nodes + return n.GetSubnetInfo(subnet.SubnetID) +} + func (n *LocalNetwork) GetValidatorManager(subnetID ids.ID) common.Address { return n.validatorManagers[subnetID] } @@ -442,43 +449,6 @@ func (n *LocalNetwork) TearDownNetwork() { Expect(n.Network.Stop(context.Background())).Should(BeNil()) } -func (n *LocalNetwork) AddSubnetValidators(ctx context.Context, subnetID ids.ID, count uint) { - subnet := n.Network.Subnets[slices.IndexFunc( - n.Network.Subnets, - func(s *tmpnet.Subnet) bool { return s.SubnetID == subnetID }, - )] - - // consume some of the extraNodes - newValidatorNodes := n.GetExtraNodes(count) - - apiURI, err := n.Network.GetURIForNodeID(subnet.ValidatorIDs[0]) - Expect(err).Should(BeNil()) - - ctx, cancel := context.WithCancel(ctx) - defer cancel() - err = subnet.AddValidators( - ctx, - os.Stdout, - apiURI, - newValidatorNodes..., - ) - Expect(err).Should(BeNil()) - - for _, node := range newValidatorNodes { - subnet.ValidatorIDs = append(subnet.ValidatorIDs, node.NodeID) - node.Flags[config.TrackSubnetsKey] = subnetID.String() - } - - tmpnet.WaitForActiveValidators(ctx, os.Stdout, platformvm.NewClient(n.Network.Nodes[0].URI), subnet) - - nodeIdsToRestart := make([]ids.NodeID, len(newValidatorNodes)) - for i, node := range newValidatorNodes { - n.primaryNetworkValidators = append(n.primaryNetworkValidators, node.NodeID) - nodeIdsToRestart[i] = node.NodeID - } - n.RestartNodes(ctx, nodeIdsToRestart) -} - // Restarts the nodes with the given nodeIDs. If nodeIDs is empty, restarts all nodes. func (n *LocalNetwork) RestartNodes(ctx context.Context, nodeIDs []ids.NodeID) { log.Info("Restarting nodes", "nodeIDs", nodeIDs) From 0d8309e90e8df2131cb60e78bc245f32bd598139 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Fri, 8 Nov 2024 13:45:33 -0600 Subject: [PATCH 11/34] collect signatures using sigagg --- tests/flows/governance/validator_set_sig.go | 10 +++--- tests/flows/ictt/erc20_home_erc20_remote.go | 5 +++ .../ictt/erc20_home_erc20_remote_multihop.go | 6 ++++ .../erc20_home_erc20_remote_send_and_call.go | 7 ++++ tests/flows/ictt/erc20_home_native_remote.go | 5 +++ .../ictt/erc20_home_native_remote_multihop.go | 8 +++++ tests/flows/ictt/native_home_erc20_remote.go | 5 +++ .../ictt/native_home_erc20_remote_multihop.go | 5 +++ tests/flows/ictt/native_home_native_remote.go | 5 +++ .../native_home_native_remote_multihop.go | 8 +++++ .../ictt/registration_and_collateral_check.go | 3 ++ .../ictt/transparent_proxy_upgradeability.go | 5 +++ tests/flows/teleporter/add_fee_amount.go | 13 ++++++- tests/flows/teleporter/basic_send_receive.go | 6 ++-- .../deliver_to_nonexistent_contract.go | 2 +- .../teleporter/deliver_to_wrong_chain.go | 2 +- tests/flows/teleporter/insufficient_gas.go | 2 +- .../teleporter/registry/pause_teleporter.go | 2 ++ .../registry/teleporter_registry.go | 14 +++++--- tests/flows/teleporter/relay_message_twice.go | 4 +-- .../teleporter/relayer_modifies_message.go | 2 +- .../teleporter/resubmit_altered_message.go | 2 +- .../teleporter/retry_successful_execution.go | 2 +- .../teleporter/send_specific_receipts.go | 19 ++++++++-- tests/flows/teleporter/unallowed_relayer.go | 2 +- tests/flows/teleporter/validator_churn.go | 4 +-- tests/network/network.go | 23 +++++------- tests/utils/chain.go | 36 ++++++------------- tests/utils/governance.go | 4 ++- tests/utils/ictt.go | 16 ++++++++- tests/utils/teleporter.go | 14 +++++--- tests/utils/validator_manager.go | 8 ++--- 32 files changed, 174 insertions(+), 75 deletions(-) diff --git a/tests/flows/governance/validator_set_sig.go b/tests/flows/governance/validator_set_sig.go index 270b22afa..d67113737 100644 --- a/tests/flows/governance/validator_set_sig.go +++ b/tests/flows/governance/validator_set_sig.go @@ -3,7 +3,7 @@ package governance import ( "context" "math/big" - "time" + "os" "github.com/ava-labs/subnet-evm/accounts/abi/bind" validatorsetsig "github.com/ava-labs/teleporter/abi-bindings/go/governance/ValidatorSetSig" @@ -141,9 +141,7 @@ func ValidatorSetSig(network *localnetwork.LocalNetwork) { // Restart nodes with new chain config network.SetChainConfigs(chainConfigs) - restartCtx, cancel := context.WithTimeout(ctx, time.Second*30) - defer cancel() - network.RestartNodes(restartCtx, nil) + network.Network.Restart(ctx, os.Stdout) // ************************************************************************************************ // Test Case 1: validatorChain (subnetB) != targetChain (subnetA) @@ -157,6 +155,7 @@ func ValidatorSetSig(network *localnetwork.LocalNetwork) { validatorSetSigContractAddress, fundedKey, &offchainMessages[0], + network.GetSignatureAggregator(), true, ) @@ -179,6 +178,7 @@ func ValidatorSetSig(network *localnetwork.LocalNetwork) { validatorSetSigContractAddress, fundedKey, &offchainMessages[0], + network.GetSignatureAggregator(), false, ) @@ -195,6 +195,7 @@ func ValidatorSetSig(network *localnetwork.LocalNetwork) { validatorSetSigContractAddress, fundedKey, &offchainMessages[1], + network.GetSignatureAggregator(), true, ) @@ -226,6 +227,7 @@ func ValidatorSetSig(network *localnetwork.LocalNetwork) { validatorSetSigContractAddress2, fundedKey, &offchainMessages[2], + network.GetSignatureAggregator(), true, ) diff --git a/tests/flows/ictt/erc20_home_erc20_remote.go b/tests/flows/ictt/erc20_home_erc20_remote.go index 80a9c007a..9f996b60b 100644 --- a/tests/flows/ictt/erc20_home_erc20_remote.go +++ b/tests/flows/ictt/erc20_home_erc20_remote.go @@ -79,6 +79,7 @@ func ERC20TokenHomeERC20TokenRemote(network *localnetwork.LocalNetwork, teleport subnetAInfo, erc20TokenRemoteAddress, fundedKey, + network.GetSignatureAggregator(), ) // Generate new recipient to receive transferred tokens @@ -117,6 +118,8 @@ func ERC20TokenHomeERC20TokenRemote(network *localnetwork.LocalNetwork, teleport subnetAInfo, true, fundedKey, + nil, + network.GetSignatureAggregator(), ) utils.CheckERC20TokenRemoteWithdrawal( @@ -168,6 +171,8 @@ func ERC20TokenHomeERC20TokenRemote(network *localnetwork.LocalNetwork, teleport cChainInfo, true, fundedKey, + nil, + network.GetSignatureAggregator(), ) utils.CheckERC20TokenHomeWithdrawal( diff --git a/tests/flows/ictt/erc20_home_erc20_remote_multihop.go b/tests/flows/ictt/erc20_home_erc20_remote_multihop.go index 5f3addf52..4cfa4abea 100644 --- a/tests/flows/ictt/erc20_home_erc20_remote_multihop.go +++ b/tests/flows/ictt/erc20_home_erc20_remote_multihop.go @@ -95,6 +95,7 @@ func ERC20TokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, subnetAInfo, erc20TokenRemoteAddressA, fundedKey, + network.GetSignatureAggregator(), ) utils.RegisterERC20TokenRemoteOnHome( ctx, @@ -104,6 +105,7 @@ func ERC20TokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, subnetBInfo, erc20TokenRemoteAddressB, fundedKey, + network.GetSignatureAggregator(), ) // Generate new recipient to receive transferred tokens @@ -142,6 +144,8 @@ func ERC20TokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, subnetAInfo, true, fundedKey, + nil, + network.GetSignatureAggregator(), ) utils.CheckERC20TokenRemoteWithdrawal( @@ -175,6 +179,7 @@ func ERC20TokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, cChainInfo, transferredAmount, secondaryFeeAmount, + network.GetSignatureAggregator(), ) // Multi-hop transfer back to Subnet A @@ -195,5 +200,6 @@ func ERC20TokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, cChainInfo, transferredAmount, secondaryFeeAmount, + network.GetSignatureAggregator(), ) } diff --git a/tests/flows/ictt/erc20_home_erc20_remote_send_and_call.go b/tests/flows/ictt/erc20_home_erc20_remote_send_and_call.go index 87971b9c6..d76eb4907 100644 --- a/tests/flows/ictt/erc20_home_erc20_remote_send_and_call.go +++ b/tests/flows/ictt/erc20_home_erc20_remote_send_and_call.go @@ -95,6 +95,7 @@ func ERC20TokenHomeERC20TokenRemoteSendAndCall( subnetAInfo, erc20TokenRemoteAddress, fundedKey, + network.GetSignatureAggregator(), ) // Generate new recipient to receive transferred tokens @@ -145,6 +146,8 @@ func ERC20TokenHomeERC20TokenRemoteSendAndCall( subnetAInfo, true, fundedKey, + nil, + network.GetSignatureAggregator(), ) event, err := utils.GetEventFromLogs(receipt.Logs, erc20TokenRemote.ParseCallSucceeded) @@ -195,6 +198,8 @@ func ERC20TokenHomeERC20TokenRemoteSendAndCall( subnetAInfo, true, fundedKey, + nil, + network.GetSignatureAggregator(), ) utils.CheckERC20TokenRemoteWithdrawal( @@ -252,6 +257,8 @@ func ERC20TokenHomeERC20TokenRemoteSendAndCall( cChainInfo, true, fundedKey, + nil, + network.GetSignatureAggregator(), ) homeEvent, err := utils.GetEventFromLogs(receipt.Logs, erc20TokenHome.ParseCallSucceeded) diff --git a/tests/flows/ictt/erc20_home_native_remote.go b/tests/flows/ictt/erc20_home_native_remote.go index 06ad686ae..00b4f9e98 100644 --- a/tests/flows/ictt/erc20_home_native_remote.go +++ b/tests/flows/ictt/erc20_home_native_remote.go @@ -85,6 +85,7 @@ func ERC20TokenHomeNativeTokenRemote(network *localnetwork.LocalNetwork, telepor utils.GetTokenMultiplier(decimalsShift), multiplyOnRemote, fundedKey, + network.GetSignatureAggregator(), ) utils.AddCollateralToERC20TokenHome( @@ -136,6 +137,8 @@ func ERC20TokenHomeNativeTokenRemote(network *localnetwork.LocalNetwork, telepor subnetAInfo, true, fundedKey, + nil, + network.GetSignatureAggregator(), ) // Verify the recipient received the tokens @@ -170,6 +173,8 @@ func ERC20TokenHomeNativeTokenRemote(network *localnetwork.LocalNetwork, telepor cChainInfo, true, fundedKey, + nil, + network.GetSignatureAggregator(), ) // Check that the recipient received the tokens diff --git a/tests/flows/ictt/erc20_home_native_remote_multihop.go b/tests/flows/ictt/erc20_home_native_remote_multihop.go index 33d38d6b5..03e340c0d 100644 --- a/tests/flows/ictt/erc20_home_native_remote_multihop.go +++ b/tests/flows/ictt/erc20_home_native_remote_multihop.go @@ -90,6 +90,7 @@ func ERC20TokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork, utils.GetTokenMultiplier(decimalsShift), multiplyOnRemote, fundedKey, + network.GetSignatureAggregator(), ) collateralAmountB := utils.RegisterTokenRemoteOnHome( @@ -103,6 +104,7 @@ func ERC20TokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork, utils.GetTokenMultiplier(decimalsShift), multiplyOnRemote, fundedKey, + network.GetSignatureAggregator(), ) // Add collateral for both NativeTokenDestinations @@ -168,6 +170,8 @@ func ERC20TokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork, subnetAInfo, true, fundedKey, + nil, + network.GetSignatureAggregator(), ) // Verify the recipient received the tokens @@ -203,6 +207,8 @@ func ERC20TokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork, subnetBInfo, true, fundedKey, + nil, + network.GetSignatureAggregator(), ) // Verify the recipient received the tokens @@ -226,6 +232,7 @@ func ERC20TokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork, cChainInfo, amountToSend, big.NewInt(0), + network.GetSignatureAggregator(), ) // Multi-hop transfer back to Subnet A @@ -244,5 +251,6 @@ func ERC20TokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork, cChainInfo, amountToSend, secondaryFeeAmount, + network.GetSignatureAggregator(), ) } diff --git a/tests/flows/ictt/native_home_erc20_remote.go b/tests/flows/ictt/native_home_erc20_remote.go index 5bf88611c..c52d5c268 100644 --- a/tests/flows/ictt/native_home_erc20_remote.go +++ b/tests/flows/ictt/native_home_erc20_remote.go @@ -75,6 +75,7 @@ func NativeTokenHomeERC20TokenRemote(network *localnetwork.LocalNetwork, telepor subnetAInfo, erc20TokenRemoteAddress, fundedKey, + network.GetSignatureAggregator(), ) // Generate new recipient to receive transferred tokens @@ -114,6 +115,8 @@ func NativeTokenHomeERC20TokenRemote(network *localnetwork.LocalNetwork, telepor subnetAInfo, true, fundedKey, + nil, + network.GetSignatureAggregator(), ) utils.CheckERC20TokenRemoteWithdrawal( @@ -165,6 +168,8 @@ func NativeTokenHomeERC20TokenRemote(network *localnetwork.LocalNetwork, telepor cChainInfo, true, fundedKey, + nil, + network.GetSignatureAggregator(), ) // Check that the recipient received the tokens diff --git a/tests/flows/ictt/native_home_erc20_remote_multihop.go b/tests/flows/ictt/native_home_erc20_remote_multihop.go index 9b6a8fdd3..b8220b7bc 100644 --- a/tests/flows/ictt/native_home_erc20_remote_multihop.go +++ b/tests/flows/ictt/native_home_erc20_remote_multihop.go @@ -90,6 +90,7 @@ func NativeTokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, subnetAInfo, erc20TokenRemoteAddressA, fundedKey, + network.GetSignatureAggregator(), ) utils.RegisterERC20TokenRemoteOnHome( @@ -100,6 +101,7 @@ func NativeTokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, subnetBInfo, erc20TokenRemoteAddressB, fundedKey, + network.GetSignatureAggregator(), ) // Generate new recipient to receive transferred tokens @@ -139,6 +141,8 @@ func NativeTokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, subnetAInfo, true, fundedKey, + nil, + network.GetSignatureAggregator(), ) utils.CheckERC20TokenRemoteWithdrawal( @@ -171,5 +175,6 @@ func NativeTokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, cChainInfo, transferredAmount, secondaryFeeAmount, + network.GetSignatureAggregator(), ) } diff --git a/tests/flows/ictt/native_home_native_remote.go b/tests/flows/ictt/native_home_native_remote.go index fff3a86ec..37e426b6b 100644 --- a/tests/flows/ictt/native_home_native_remote.go +++ b/tests/flows/ictt/native_home_native_remote.go @@ -69,6 +69,7 @@ func NativeTokenHomeNativeDestination(network *localnetwork.LocalNetwork, telepo big.NewInt(1), multiplyOnRemote, fundedKey, + network.GetSignatureAggregator(), ) utils.AddCollateralToNativeTokenHome( @@ -119,6 +120,8 @@ func NativeTokenHomeNativeDestination(network *localnetwork.LocalNetwork, telepo subnetAInfo, true, fundedKey, + nil, + network.GetSignatureAggregator(), ) utils.CheckBalance( @@ -160,6 +163,8 @@ func NativeTokenHomeNativeDestination(network *localnetwork.LocalNetwork, telepo cChainInfo, true, fundedKey, + nil, + network.GetSignatureAggregator(), ) // Check that the recipient received the tokens diff --git a/tests/flows/ictt/native_home_native_remote_multihop.go b/tests/flows/ictt/native_home_native_remote_multihop.go index 4866a2af4..4569fd727 100644 --- a/tests/flows/ictt/native_home_native_remote_multihop.go +++ b/tests/flows/ictt/native_home_native_remote_multihop.go @@ -89,6 +89,7 @@ func NativeTokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork utils.GetTokenMultiplier(decimalsShift), multiplyOnRemote, fundedKey, + network.GetSignatureAggregator(), ) collateralAmountB := utils.RegisterTokenRemoteOnHome( @@ -102,6 +103,7 @@ func NativeTokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork utils.GetTokenMultiplier(decimalsShift), multiplyOnRemote, fundedKey, + network.GetSignatureAggregator(), ) // Add collateral for both NativeTokenDestinations @@ -164,6 +166,8 @@ func NativeTokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork subnetAInfo, true, fundedKey, + nil, + network.GetSignatureAggregator(), ) // Verify the recipient received the tokens @@ -198,6 +202,8 @@ func NativeTokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork subnetBInfo, true, fundedKey, + nil, + network.GetSignatureAggregator(), ) // Verify the recipient received the tokens @@ -221,6 +227,7 @@ func NativeTokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork cChainInfo, amountToSendA, big.NewInt(0), + network.GetSignatureAggregator(), ) // Again, send half of the received amount to account for gas expenses @@ -242,5 +249,6 @@ func NativeTokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork cChainInfo, amountToSendB, secondaryFeeAmount, + network.GetSignatureAggregator(), ) } diff --git a/tests/flows/ictt/registration_and_collateral_check.go b/tests/flows/ictt/registration_and_collateral_check.go index 39f612a0e..442db7fe5 100644 --- a/tests/flows/ictt/registration_and_collateral_check.go +++ b/tests/flows/ictt/registration_and_collateral_check.go @@ -110,6 +110,7 @@ func RegistrationAndCollateralCheck(network *localnetwork.LocalNetwork, teleport utils.GetTokenMultiplier(decimalsShift), multiplyOnRemote, fundedKey, + network.GetSignatureAggregator(), ) // Try sending again and expect failure since remote is not collateralized @@ -188,6 +189,8 @@ func RegistrationAndCollateralCheck(network *localnetwork.LocalNetwork, teleport subnetAInfo, true, fundedKey, + nil, + network.GetSignatureAggregator(), ) // Verify the recipient received the tokens diff --git a/tests/flows/ictt/transparent_proxy_upgradeability.go b/tests/flows/ictt/transparent_proxy_upgradeability.go index 15132f009..658e53645 100644 --- a/tests/flows/ictt/transparent_proxy_upgradeability.go +++ b/tests/flows/ictt/transparent_proxy_upgradeability.go @@ -104,6 +104,7 @@ func TransparentUpgradeableProxy(network *localnetwork.LocalNetwork, teleporter subnetAInfo, erc20TokenRemoteAddress, fundedKey, + network.GetSignatureAggregator(), ) // Send a transfer from primary network to Subnet A @@ -142,6 +143,8 @@ func TransparentUpgradeableProxy(network *localnetwork.LocalNetwork, teleporter subnetAInfo, true, fundedKey, + nil, + network.GetSignatureAggregator(), ) utils.CheckERC20TokenRemoteWithdrawal( @@ -206,6 +209,8 @@ func TransparentUpgradeableProxy(network *localnetwork.LocalNetwork, teleporter cChainInfo, true, fundedKey, + nil, + network.GetSignatureAggregator(), ) // Check that the transfer was successful, and expected balances are correct diff --git a/tests/flows/teleporter/add_fee_amount.go b/tests/flows/teleporter/add_fee_amount.go index 843b38a83..44cd95b25 100644 --- a/tests/flows/teleporter/add_fee_amount.go +++ b/tests/flows/teleporter/add_fee_amount.go @@ -79,6 +79,8 @@ func AddFeeAmount(network *localnetwork.LocalNetwork, teleporter utils.Teleporte subnetBInfo, true, fundedKey, + nil, + network.GetSignatureAggregator(), ) receiveEvent, err := utils.GetEventFromLogs( deliveryReceipt.Logs, @@ -112,7 +114,16 @@ func AddFeeAmount(network *localnetwork.LocalNetwork, teleporter utils.Teleporte fundedKey) // Relay message containing the specific receipt from Subnet B to Subnet A - teleporter.RelayTeleporterMessage(ctx, sendSpecificReceiptsReceipt, subnetBInfo, subnetAInfo, true, fundedKey) + teleporter.RelayTeleporterMessage( + ctx, + sendSpecificReceiptsReceipt, + subnetBInfo, + subnetAInfo, + true, + fundedKey, + nil, + network.GetSignatureAggregator(), + ) // Check message delivered delivered, err = teleporter.TeleporterMessenger(subnetAInfo).MessageReceived( diff --git a/tests/flows/teleporter/basic_send_receive.go b/tests/flows/teleporter/basic_send_receive.go index 41ae53be2..a2c7748af 100644 --- a/tests/flows/teleporter/basic_send_receive.go +++ b/tests/flows/teleporter/basic_send_receive.go @@ -25,7 +25,7 @@ func BasicSendReceive(network *localnetwork.LocalNetwork, teleporter utils.Telep // Clear the receipt queue from Subnet B -> Subnet A to have a clean slate for the test flow. // This is only done if the test non-external networks because external networks may have // an arbitrarily high number of receipts to be cleared from a given queue from unrelated messages. - teleporter.ClearReceiptQueue(ctx, fundedKey, subnetBInfo, subnetAInfo) + teleporter.ClearReceiptQueue(ctx, fundedKey, subnetBInfo, subnetAInfo, network.GetSignatureAggregator()) feeAmount := big.NewInt(1) feeTokenAddress, feeToken := utils.DeployExampleERC20( @@ -66,7 +66,7 @@ func BasicSendReceive(network *localnetwork.LocalNetwork, teleporter utils.Telep expectedReceiptID := teleporterMessageID // Relay the message to the destination - deliveryReceipt := teleporter.RelayTeleporterMessage(ctx, receipt, subnetAInfo, subnetBInfo, true, fundedKey) + deliveryReceipt := teleporter.RelayTeleporterMessage(ctx, receipt, subnetAInfo, subnetBInfo, true, fundedKey, nil, network.GetSignatureAggregator()) receiveEvent, err := utils.GetEventFromLogs( deliveryReceipt.Logs, teleporter.TeleporterMessenger(subnetBInfo).ParseReceiveCrossChainMessage) @@ -92,7 +92,7 @@ func BasicSendReceive(network *localnetwork.LocalNetwork, teleporter utils.Telep ) // Relay the message to the destination - deliveryReceipt = teleporter.RelayTeleporterMessage(ctx, receipt, subnetBInfo, subnetAInfo, true, fundedKey) + deliveryReceipt = teleporter.RelayTeleporterMessage(ctx, receipt, subnetBInfo, subnetAInfo, true, fundedKey, nil, network.GetSignatureAggregator()) Expect(utils.CheckReceiptReceived( deliveryReceipt, diff --git a/tests/flows/teleporter/deliver_to_nonexistent_contract.go b/tests/flows/teleporter/deliver_to_nonexistent_contract.go index 9a4f976fc..0207186e3 100644 --- a/tests/flows/teleporter/deliver_to_nonexistent_contract.go +++ b/tests/flows/teleporter/deliver_to_nonexistent_contract.go @@ -88,7 +88,7 @@ func DeliverToNonExistentContract(network *localnetwork.LocalNetwork, teleporter // Relay the message to the destination // log.Info("Relaying the message to the destination") - receipt = teleporter.RelayTeleporterMessage(ctx, receipt, subnetAInfo, subnetBInfo, true, fundedKey) + receipt = teleporter.RelayTeleporterMessage(ctx, receipt, subnetAInfo, subnetBInfo, true, fundedKey, nil, network.GetSignatureAggregator()) receiveEvent, err := utils.GetEventFromLogs(receipt.Logs, teleporter.TeleporterMessenger(subnetAInfo).ParseReceiveCrossChainMessage) Expect(err).Should(BeNil()) diff --git a/tests/flows/teleporter/deliver_to_wrong_chain.go b/tests/flows/teleporter/deliver_to_wrong_chain.go index 3ce462d69..f503eee1b 100644 --- a/tests/flows/teleporter/deliver_to_wrong_chain.go +++ b/tests/flows/teleporter/deliver_to_wrong_chain.go @@ -57,7 +57,7 @@ func DeliverToWrongChain(network *localnetwork.LocalNetwork, teleporter utils.Te fundedKey, ) - teleporter.RelayTeleporterMessage(ctx, receipt, subnetAInfo, subnetCInfo, false, fundedKey) + teleporter.RelayTeleporterMessage(ctx, receipt, subnetAInfo, subnetCInfo, false, fundedKey, nil, network.GetSignatureAggregator()) // // Check that the message was not received on the Subnet C diff --git a/tests/flows/teleporter/insufficient_gas.go b/tests/flows/teleporter/insufficient_gas.go index 66bcef13c..888f59a65 100644 --- a/tests/flows/teleporter/insufficient_gas.go +++ b/tests/flows/teleporter/insufficient_gas.go @@ -56,7 +56,7 @@ func InsufficientGas(network *localnetwork.LocalNetwork, teleporter utils.Telepo messageID := event.MessageID // Relay message from SubnetA to SubnetB - receipt = teleporter.RelayTeleporterMessage(ctx, receipt, subnetAInfo, subnetBInfo, true, fundedKey) + receipt = teleporter.RelayTeleporterMessage(ctx, receipt, subnetAInfo, subnetBInfo, true, fundedKey, nil, network.GetSignatureAggregator()) // Check Teleporter message received on the destination delivered, err := diff --git a/tests/flows/teleporter/registry/pause_teleporter.go b/tests/flows/teleporter/registry/pause_teleporter.go index 4f6fa2763..84b713d90 100644 --- a/tests/flows/teleporter/registry/pause_teleporter.go +++ b/tests/flows/teleporter/registry/pause_teleporter.go @@ -60,6 +60,7 @@ func PauseTeleporter(network *localnetwork.LocalNetwork, teleporter utils.Telepo testMessengerB, fundedKey, "message_1", + network.GetSignatureAggregator(), false, ) @@ -86,6 +87,7 @@ func PauseTeleporter(network *localnetwork.LocalNetwork, teleporter utils.Telepo testMessengerB, fundedKey, "message_2", + network.GetSignatureAggregator(), true, ) } diff --git a/tests/flows/teleporter/registry/teleporter_registry.go b/tests/flows/teleporter/registry/teleporter_registry.go index 60bfb3431..445b5d957 100644 --- a/tests/flows/teleporter/registry/teleporter_registry.go +++ b/tests/flows/teleporter/registry/teleporter_registry.go @@ -2,7 +2,7 @@ package registry import ( "context" - "time" + "os" "github.com/ava-labs/subnet-evm/accounts/abi/bind" localnetwork "github.com/ava-labs/teleporter/tests/network" @@ -87,9 +87,8 @@ func TeleporterRegistry(network *localnetwork.LocalNetwork, teleporter utils.Tel // Restart nodes with new chain config network.SetChainConfigs(chainConfigs) - restartCtx, cancel := context.WithTimeout(ctx, 30*time.Second) - defer cancel() - network.RestartNodes(restartCtx, nil) + err := network.Network.Restart(ctx, os.Stdout) + Expect(err).Should(BeNil()) // Call addProtocolVersion on subnetB to register the new Teleporter version teleporter.AddProtocolVersionAndWaitForAcceptance( @@ -98,6 +97,7 @@ func TeleporterRegistry(network *localnetwork.LocalNetwork, teleporter utils.Tel newTeleporterAddress, fundedKey, offchainMessageB, + network.GetSignatureAggregator(), ) // Send a message using old Teleporter version to test messenger using new Teleporter version. @@ -111,6 +111,7 @@ func TeleporterRegistry(network *localnetwork.LocalNetwork, teleporter utils.Tel testMessengerB, fundedKey, "message_1", + network.GetSignatureAggregator(), true, ) @@ -147,6 +148,7 @@ func TeleporterRegistry(network *localnetwork.LocalNetwork, teleporter utils.Tel testMessengerB, fundedKey, "message_2", + network.GetSignatureAggregator(), false, ) @@ -165,6 +167,7 @@ func TeleporterRegistry(network *localnetwork.LocalNetwork, teleporter utils.Tel testMessengerC, fundedKey, "message_3", + network.GetSignatureAggregator(), false, ) @@ -175,6 +178,7 @@ func TeleporterRegistry(network *localnetwork.LocalNetwork, teleporter utils.Tel newTeleporterAddress, fundedKey, offchainMessageC, + network.GetSignatureAggregator(), ) // Send a message from A->B, which previously failed, but now using the new Teleporter version. @@ -188,6 +192,7 @@ func TeleporterRegistry(network *localnetwork.LocalNetwork, teleporter utils.Tel testMessengerC, fundedKey, "message_4", + network.GetSignatureAggregator(), true, ) @@ -199,6 +204,7 @@ func TeleporterRegistry(network *localnetwork.LocalNetwork, teleporter utils.Tel newTeleporterAddress, fundedKey, offchainMessageA, + network.GetSignatureAggregator(), ) latestVersionA, err := teleporter.TeleporterRegistry(subnetAInfo).LatestVersion(&bind.CallOpts{}) diff --git a/tests/flows/teleporter/relay_message_twice.go b/tests/flows/teleporter/relay_message_twice.go index 791e177b8..9e517c643 100644 --- a/tests/flows/teleporter/relay_message_twice.go +++ b/tests/flows/teleporter/relay_message_twice.go @@ -47,7 +47,7 @@ func RelayMessageTwice(network *localnetwork.LocalNetwork, teleporter utils.Tele // // Relay the message to the destination // - teleporter.RelayTeleporterMessage(ctx, receipt, subnetAInfo, subnetBInfo, true, fundedKey) + teleporter.RelayTeleporterMessage(ctx, receipt, subnetAInfo, subnetBInfo, true, fundedKey, nil, network.GetSignatureAggregator()) // // Check Teleporter message received on the destination @@ -63,5 +63,5 @@ func RelayMessageTwice(network *localnetwork.LocalNetwork, teleporter utils.Tele // Attempt to send the same message again, should fail // log.Info("Relaying the same Teleporter message again on the destination") - teleporter.RelayTeleporterMessage(ctx, receipt, subnetAInfo, subnetBInfo, false, fundedKey) + teleporter.RelayTeleporterMessage(ctx, receipt, subnetAInfo, subnetBInfo, false, fundedKey, nil, network.GetSignatureAggregator()) } diff --git a/tests/flows/teleporter/relayer_modifies_message.go b/tests/flows/teleporter/relayer_modifies_message.go index a328593c7..82c6e63ca 100644 --- a/tests/flows/teleporter/relayer_modifies_message.go +++ b/tests/flows/teleporter/relayer_modifies_message.go @@ -78,7 +78,7 @@ func relayAlteredMessage( ) Expect(err).Should(BeNil()) - signedWarpMessage := utils.ConstructSignedWarpMessage(ctx, sourceReceipt, source, destination) + signedWarpMessage := utils.ConstructSignedWarpMessage(ctx, sourceReceipt, source, destination, nil, network.GetSignatureAggregator()) // Construct the transaction to send the Warp message to the destination chain _, fundedKey := network.GetFundedAccountInfo() diff --git a/tests/flows/teleporter/resubmit_altered_message.go b/tests/flows/teleporter/resubmit_altered_message.go index 3df24f170..94911f1da 100644 --- a/tests/flows/teleporter/resubmit_altered_message.go +++ b/tests/flows/teleporter/resubmit_altered_message.go @@ -37,7 +37,7 @@ func ResubmitAlteredMessage(network *localnetwork.LocalNetwork, teleporter utils ctx, teleporter.TeleporterMessenger(subnetAInfo), subnetAInfo, subnetBInfo, sendCrossChainMessageInput, fundedKey) // Relay the message to the destination - receipt = teleporter.RelayTeleporterMessage(ctx, receipt, subnetAInfo, subnetBInfo, true, fundedKey) + receipt = teleporter.RelayTeleporterMessage(ctx, receipt, subnetAInfo, subnetBInfo, true, fundedKey, nil, network.GetSignatureAggregator()) log.Info("Checking the message was received on the destination") delivered, err := teleporter.TeleporterMessenger(subnetBInfo).MessageReceived(&bind.CallOpts{}, messageID) diff --git a/tests/flows/teleporter/retry_successful_execution.go b/tests/flows/teleporter/retry_successful_execution.go index 23b9a64fe..3847be86c 100644 --- a/tests/flows/teleporter/retry_successful_execution.go +++ b/tests/flows/teleporter/retry_successful_execution.go @@ -68,7 +68,7 @@ func RetrySuccessfulExecution(network *localnetwork.LocalNetwork, teleporter uti // // Relay the message to the destination // - receipt = teleporter.RelayTeleporterMessage(ctx, receipt, subnetAInfo, subnetBInfo, true, fundedKey) + receipt = teleporter.RelayTeleporterMessage(ctx, receipt, subnetAInfo, subnetBInfo, true, fundedKey, nil, network.GetSignatureAggregator()) receiveEvent, err := utils.GetEventFromLogs(receipt.Logs, teleporter.TeleporterMessenger(subnetBInfo).ParseReceiveCrossChainMessage) Expect(err).Should(BeNil()) diff --git a/tests/flows/teleporter/send_specific_receipts.go b/tests/flows/teleporter/send_specific_receipts.go index 386aee8e1..73c6f10fd 100644 --- a/tests/flows/teleporter/send_specific_receipts.go +++ b/tests/flows/teleporter/send_specific_receipts.go @@ -3,6 +3,7 @@ package teleporter import ( "bytes" "context" + goLog "log" "math/big" "github.com/ava-labs/avalanchego/ids" @@ -27,7 +28,7 @@ func SendSpecificReceipts(network *localnetwork.LocalNetwork, teleporter utils.T ctx := context.Background() // Clear the receipt queue from Subnet B -> Subnet A to have a clean slate for the test flow. - teleporter.ClearReceiptQueue(ctx, fundedKey, subnetBInfo, subnetAInfo) + teleporter.ClearReceiptQueue(ctx, fundedKey, subnetBInfo, subnetAInfo, network.GetSignatureAggregator()) // Use mock token as the fee token mockTokenAddress, mockToken := utils.DeployExampleERC20( @@ -57,11 +58,13 @@ func SendSpecificReceipts(network *localnetwork.LocalNetwork, teleporter utils.T AllowedRelayerAddresses: []common.Address{}, Message: []byte{1, 2, 3, 4}, } + goLog.Println("Sending two messages from Subnet A to Subnet B") // Send first message from Subnet A to Subnet B with fee amount 5 sendCrossChainMsgReceipt, messageID1 := utils.SendCrossChainMessageAndWaitForAcceptance( ctx, subnetATeleporterMessenger, subnetAInfo, subnetBInfo, sendCrossChainMessageInput, fundedKey) + goLog.Println("Relaying the first message from Subnet A to Subnet B") // Relay the message from SubnetA to SubnetB deliveryReceipt1 := teleporter.RelayTeleporterMessage( ctx, @@ -70,6 +73,8 @@ func SendSpecificReceipts(network *localnetwork.LocalNetwork, teleporter utils.T subnetBInfo, true, fundedKey, + nil, + network.GetSignatureAggregator(), ) receiveEvent1, err := utils.GetEventFromLogs( deliveryReceipt1.Logs, @@ -82,10 +87,12 @@ func SendSpecificReceipts(network *localnetwork.LocalNetwork, teleporter utils.T Expect(err).Should(BeNil()) Expect(delivered).Should(BeTrue()) + goLog.Println("Sending the second message from Subnet A to Subnet B") // Send second message from Subnet A to Subnet B with fee amount 5 sendCrossChainMsgReceipt, messageID2 := utils.SendCrossChainMessageAndWaitForAcceptance( ctx, subnetATeleporterMessenger, subnetAInfo, subnetBInfo, sendCrossChainMessageInput, fundedKey) + goLog.Println("Relaying the second message from Subnet A to Subnet B") // Relay the message from SubnetA to SubnetB deliveryReceipt2 := teleporter.RelayTeleporterMessage( ctx, @@ -94,6 +101,8 @@ func SendSpecificReceipts(network *localnetwork.LocalNetwork, teleporter utils.T subnetBInfo, true, fundedKey, + nil, + network.GetSignatureAggregator(), ) receiveEvent2, err := utils.GetEventFromLogs( deliveryReceipt2.Logs, @@ -107,6 +116,7 @@ func SendSpecificReceipts(network *localnetwork.LocalNetwork, teleporter utils.T Expect(delivered).Should(BeTrue()) // Call send specific receipts to get reward of relaying two messages + goLog.Println("Sending specific receipts from Subnet B to Subnet A") receipt, messageID := utils.SendSpecifiedReceiptsAndWaitForAcceptance( ctx, subnetBTeleporterMessenger, @@ -122,7 +132,8 @@ func SendSpecificReceipts(network *localnetwork.LocalNetwork, teleporter utils.T ) // Relay message from Subnet B to Subnet A - receipt = teleporter.RelayTeleporterMessage(ctx, receipt, subnetBInfo, subnetAInfo, true, fundedKey) + goLog.Println("Relaying the specific receipts from Subnet B to Subnet A") + receipt = teleporter.RelayTeleporterMessage(ctx, receipt, subnetBInfo, subnetAInfo, true, fundedKey, nil, network.GetSignatureAggregator()) // Check that the message back to Subnet A was delivered delivered, err = subnetATeleporterMessenger.MessageReceived(&bind.CallOpts{}, messageID) @@ -160,12 +171,14 @@ func SendSpecificReceipts(network *localnetwork.LocalNetwork, teleporter utils.T Message: []byte{1, 2, 3, 4}, } + goLog.Println("Sending a message from Subnet B to Subnet A to trigger receipts") // This message will also have the same receipts as the previous message receipt, messageID = utils.SendCrossChainMessageAndWaitForAcceptance( ctx, subnetBTeleporterMessenger, subnetBInfo, subnetAInfo, sendCrossChainMessageInput, fundedKey) + goLog.Println("Relaying the message from Subnet B to Subnet A") // Relay message from Subnet B to Subnet A - receipt = teleporter.RelayTeleporterMessage(ctx, receipt, subnetBInfo, subnetAInfo, true, fundedKey) + receipt = teleporter.RelayTeleporterMessage(ctx, receipt, subnetBInfo, subnetAInfo, true, fundedKey, nil, network.GetSignatureAggregator()) // Check delivered delivered, err = subnetATeleporterMessenger.MessageReceived( &bind.CallOpts{}, diff --git a/tests/flows/teleporter/unallowed_relayer.go b/tests/flows/teleporter/unallowed_relayer.go index 252523733..5f37e2b52 100644 --- a/tests/flows/teleporter/unallowed_relayer.go +++ b/tests/flows/teleporter/unallowed_relayer.go @@ -49,7 +49,7 @@ func UnallowedRelayer(network *localnetwork.LocalNetwork, teleporter utils.Telep // // Relay the message to the destination // - teleporter.RelayTeleporterMessage(ctx, receipt, subnetAInfo, subnetBInfo, false, fundedKey) + teleporter.RelayTeleporterMessage(ctx, receipt, subnetAInfo, subnetBInfo, false, fundedKey, nil, network.GetSignatureAggregator()) // // Check Teleporter message was not received on the destination diff --git a/tests/flows/teleporter/validator_churn.go b/tests/flows/teleporter/validator_churn.go index f8c7350cb..0cf77c880 100644 --- a/tests/flows/teleporter/validator_churn.go +++ b/tests/flows/teleporter/validator_churn.go @@ -59,7 +59,7 @@ func ValidatorChurn(network *localnetwork.LocalNetwork, teleporter utils.Telepor sentTeleporterMessage := sendEvent.Message // Construct the signed warp message - signedWarpMessage := utils.ConstructSignedWarpMessage(ctx, receipt, subnetAInfo, subnetBInfo) + signedWarpMessage := utils.ConstructSignedWarpMessage(ctx, receipt, subnetAInfo, subnetBInfo, nil, network.GetSignatureAggregator()) // // Modify the validator set on Subnet A @@ -151,7 +151,7 @@ func ValidatorChurn(network *localnetwork.LocalNetwork, teleporter utils.Telepor // Wait for the transaction to be mined receipt = utils.WaitForTransactionSuccess(ctx, subnetAInfo, tx.Hash()) - teleporter.RelayTeleporterMessage(ctx, receipt, subnetAInfo, subnetBInfo, true, fundedKey) + teleporter.RelayTeleporterMessage(ctx, receipt, subnetAInfo, subnetBInfo, true, fundedKey, nil, network.GetSignatureAggregator()) // Verify the message was delivered delivered, err = teleporter.TeleporterMessenger(subnetBInfo).MessageReceived( diff --git a/tests/network/network.go b/tests/network/network.go index db6d6c020..74a467f7b 100644 --- a/tests/network/network.go +++ b/tests/network/network.go @@ -46,7 +46,6 @@ type LocalNetwork struct { primaryNetworkValidators []ids.NodeID globalFundedKey *secp256k1.PrivateKey validatorManagers map[ids.ID]common.Address - signatureAggregator *aggregator.SignatureAggregator } const ( @@ -182,17 +181,6 @@ func NewLocalNetwork( validatorManagers: make(map[ids.ID]common.Address), } - // Construct the signature aggregator - var subnetIDs []ids.ID - for _, subnet := range localNetwork.GetSubnetsInfo() { - subnetIDs = append(subnetIDs, subnet.SubnetID) - } - signatureAggregator := utils.NewSignatureAggregator( - localNetwork.GetPrimaryNetworkInfo().NodeURIs[0], - subnetIDs, - ) - localNetwork.signatureAggregator = signatureAggregator - return localNetwork } @@ -274,7 +262,7 @@ func (n *LocalNetwork) ConvertSubnet(ctx context.Context, subnet interfaces.Subn utils.GetPChainInfo(cChainInfo), vdrManagerAddress, n.GetNetworkID(), - n.signatureAggregator, + n.GetSignatureAggregator(), nodes, ) @@ -324,7 +312,14 @@ func (n *LocalNetwork) GetValidatorManager(subnetID ids.ID) common.Address { } func (n *LocalNetwork) GetSignatureAggregator() *aggregator.SignatureAggregator { - return n.signatureAggregator + var subnetIDs []ids.ID + for _, subnet := range n.GetSubnetsInfo() { + subnetIDs = append(subnetIDs, subnet.SubnetID) + } + return utils.NewSignatureAggregator( + n.GetPrimaryNetworkInfo().NodeURIs[0], + subnetIDs, + ) } func (n *LocalNetwork) GetExtraNodes(count uint) []*tmpnet.Node { diff --git a/tests/utils/chain.go b/tests/utils/chain.go index 6286e7e92..713014596 100644 --- a/tests/utils/chain.go +++ b/tests/utils/chain.go @@ -36,7 +36,6 @@ import ( "github.com/ava-labs/subnet-evm/precompile/contracts/nativeminter" "github.com/ava-labs/subnet-evm/precompile/contracts/warp" subnetEvmUtils "github.com/ava-labs/subnet-evm/tests/utils" - warpBackend "github.com/ava-labs/subnet-evm/warp" nativeMinter "github.com/ava-labs/teleporter/abi-bindings/go/INativeMinter" "github.com/ava-labs/teleporter/tests/interfaces" gasUtils "github.com/ava-labs/teleporter/utils/gas-utils" @@ -656,17 +655,11 @@ func ConstructSignedWarpMessage( sourceReceipt *types.Receipt, source interfaces.SubnetTestInfo, destination interfaces.SubnetTestInfo, + justification []byte, + signatureAggregator *aggregator.SignatureAggregator, ) *avalancheWarp.Message { unsignedMsg := ExtractWarpMessageFromLog(ctx, sourceReceipt, source) - // Set local variables for the duration of the test - unsignedWarpMessageID := unsignedMsg.ID() - log.Info( - "Parsed unsignedWarpMsg", - "unsignedWarpMessageID", unsignedWarpMessageID, - "unsignedWarpMessage", unsignedMsg, - ) - // Loop over each client on source chain to ensure they all have time to accept the block. // Note: if we did not confirm this here, the next stage could be racy since it assumes every node // has accepted the block. @@ -674,37 +667,30 @@ func ConstructSignedWarpMessage( // Get the aggregate signature for the Warp message log.Info("Fetching aggregate signature from the source chain validators") - return GetSignedMessage(ctx, source, destination, unsignedWarpMessageID) + return GetSignedMessage(source, destination, unsignedMsg, justification, signatureAggregator) } func GetSignedMessage( - ctx context.Context, source interfaces.SubnetTestInfo, destination interfaces.SubnetTestInfo, - unsignedWarpMessageID ids.ID, + unsignedWarpMessage *avalancheWarp.UnsignedMessage, + justification []byte, + signatureAggregator *aggregator.SignatureAggregator, ) *avalancheWarp.Message { - Expect(len(source.NodeURIs)).Should(BeNumerically(">", 0)) - warpClient, err := warpBackend.NewClient(source.NodeURIs[0], source.BlockchainID.String()) - Expect(err).Should(BeNil()) - signingSubnetID := source.SubnetID if source.SubnetID == constants.PrimaryNetworkID { signingSubnetID = destination.SubnetID } - // Get the aggregate signature for the Warp message - signedWarpMessageBytes, err := warpClient.GetMessageAggregateSignature( - ctx, - unsignedWarpMessageID, + signedWarpMessage, err := signatureAggregator.CreateSignedMessage( + unsignedWarpMessage, + justification, + signingSubnetID, warp.WarpDefaultQuorumNumerator, - signingSubnetID.String(), ) Expect(err).Should(BeNil()) - signedWarpMsg, err := avalancheWarp.ParseMessage(signedWarpMessageBytes) - Expect(err).Should(BeNil()) - - return signedWarpMsg + return signedWarpMessage } func SetupProposerVM(ctx context.Context, fundedKey *ecdsa.PrivateKey, network *tmpnet.Network, subnetID ids.ID) { diff --git a/tests/utils/governance.go b/tests/utils/governance.go index 3df3ae29b..8bf3ceaa5 100644 --- a/tests/utils/governance.go +++ b/tests/utils/governance.go @@ -6,6 +6,7 @@ import ( avalancheWarp "github.com/ava-labs/avalanchego/vms/platformvm/warp" "github.com/ava-labs/avalanchego/vms/platformvm/warp/payload" + "github.com/ava-labs/awm-relayer/signature-aggregator/aggregator" "github.com/ava-labs/subnet-evm/accounts/abi/bind" "github.com/ava-labs/subnet-evm/core/types" validatorsetsig "github.com/ava-labs/teleporter/abi-bindings/go/governance/ValidatorSetSig" @@ -45,9 +46,10 @@ func ExecuteValidatorSetSigCallAndVerify( validatorSetSigAddress common.Address, senderKey *ecdsa.PrivateKey, unsignedMessage *avalancheWarp.UnsignedMessage, + signatureAggregator *aggregator.SignatureAggregator, expectSuccess bool, ) *types.Receipt { - signedWarpMsg := GetSignedMessage(ctx, source, destination, unsignedMessage.ID()) + signedWarpMsg := GetSignedMessage(source, destination, unsignedMessage, nil, signatureAggregator) log.Info("Got signed warp message", "messageID", signedWarpMsg.ID()) signedPredicateTx := CreateExecuteCallPredicateTransaction( diff --git a/tests/utils/ictt.go b/tests/utils/ictt.go index d41e801d4..aa25e9fb5 100644 --- a/tests/utils/ictt.go +++ b/tests/utils/ictt.go @@ -10,6 +10,7 @@ import ( "math/big" "github.com/ava-labs/avalanchego/ids" + "github.com/ava-labs/awm-relayer/signature-aggregator/aggregator" "github.com/ava-labs/subnet-evm/accounts/abi/bind" "github.com/ava-labs/subnet-evm/core/types" erc20tokenhome "github.com/ava-labs/teleporter/abi-bindings/go/ictt/TokenHome/ERC20TokenHome" @@ -307,6 +308,7 @@ func RegisterERC20TokenRemoteOnHome( remoteSubnet interfaces.SubnetTestInfo, remoteAddress common.Address, fundedKey *ecdsa.PrivateKey, + signatureAggregator *aggregator.SignatureAggregator, ) { RegisterTokenRemoteOnHome( ctx, @@ -319,6 +321,7 @@ func RegisterERC20TokenRemoteOnHome( big.NewInt(1), false, fundedKey, + signatureAggregator, ) } @@ -333,6 +336,7 @@ func RegisterTokenRemoteOnHome( expectedTokenMultiplier *big.Int, expectedmultiplyOnRemote bool, fundedKey *ecdsa.PrivateKey, + signatureAggregator *aggregator.SignatureAggregator, ) *big.Int { // Call the remote to send a register message to the home tokenRemote, err := tokenremote.NewTokenRemote( @@ -374,7 +378,7 @@ func RegisterTokenRemoteOnHome( receipt := WaitForTransactionSuccess(ctx, remoteSubnet, sendRegisterTx.Hash()) // Relay the register message to the home - receipt = teleporter.RelayTeleporterMessage(ctx, receipt, remoteSubnet, homeSubnet, true, fundedKey) + receipt = teleporter.RelayTeleporterMessage(ctx, receipt, remoteSubnet, homeSubnet, true, fundedKey, nil, signatureAggregator) _, err = GetEventFromLogs( receipt.Logs, teleporter.TeleporterMessenger(homeSubnet).ParseMessageExecuted, @@ -836,6 +840,7 @@ func SendNativeMultiHopAndVerify( cChainInfo interfaces.SubnetTestInfo, amount *big.Int, secondaryFeeAmount *big.Int, + signatureAggregator *aggregator.SignatureAggregator, ) { input := nativetokenremote.SendTokensInput{ DestinationBlockchainID: toSubnet.BlockchainID, @@ -868,6 +873,8 @@ func SendNativeMultiHopAndVerify( cChainInfo, true, sendingKey, + nil, + signatureAggregator, ) initialBalance, err := toSubnet.RPCClient.BalanceAt(ctx, recipientAddress, nil) @@ -883,6 +890,8 @@ func SendNativeMultiHopAndVerify( toSubnet, true, sendingKey, + nil, + signatureAggregator, ) transferredAmount := big.NewInt(0).Sub(amount, input.SecondaryFee) @@ -909,6 +918,7 @@ func SendERC20TokenMultiHopAndVerify( cChainInfo interfaces.SubnetTestInfo, amount *big.Int, secondaryFeeAmount *big.Int, + signatureAggregator *aggregator.SignatureAggregator, ) { // Send tokens to the sender address to have gas for submitting the send tokens transaction SendNativeTransfer( @@ -949,6 +959,8 @@ func SendERC20TokenMultiHopAndVerify( cChainInfo, true, fundedKey, + nil, + signatureAggregator, ) _, err := GetEventFromLogs( intermediateReceipt.Logs, @@ -971,6 +983,8 @@ func SendERC20TokenMultiHopAndVerify( toSubnet, true, fundedKey, + nil, + signatureAggregator, ) _, err = GetEventFromLogs(remoteReceipt.Logs, teleporter.TeleporterMessenger(toSubnet).ParseMessageExecuted) if err != nil { diff --git a/tests/utils/teleporter.go b/tests/utils/teleporter.go index a140d51eb..3b942ff0f 100644 --- a/tests/utils/teleporter.go +++ b/tests/utils/teleporter.go @@ -9,6 +9,7 @@ import ( "github.com/ava-labs/avalanchego/ids" avalancheWarp "github.com/ava-labs/avalanchego/vms/platformvm/warp" "github.com/ava-labs/avalanchego/vms/platformvm/warp/payload" + "github.com/ava-labs/awm-relayer/signature-aggregator/aggregator" "github.com/ava-labs/subnet-evm/accounts/abi/bind" "github.com/ava-labs/subnet-evm/core/types" "github.com/ava-labs/subnet-evm/precompile/contracts/warp" @@ -154,12 +155,14 @@ func (t TeleporterTestInfo) RelayTeleporterMessage( destination interfaces.SubnetTestInfo, expectSuccess bool, fundedKey *ecdsa.PrivateKey, + justification []byte, + signatureAggregator *aggregator.SignatureAggregator, ) *types.Receipt { // Fetch the Teleporter message from the logs sendEvent, err := GetEventFromLogs(sourceReceipt.Logs, t.TeleporterMessenger(source).ParseSendCrossChainMessage) Expect(err).Should(BeNil()) - signedWarpMessage := ConstructSignedWarpMessage(ctx, sourceReceipt, source, destination) + signedWarpMessage := ConstructSignedWarpMessage(ctx, sourceReceipt, source, destination, justification, signatureAggregator) // Construct the transaction to send the Warp message to the destination chain signedTx := CreateReceiveCrossChainMessageTransaction( @@ -197,6 +200,7 @@ func (t TeleporterTestInfo) SendExampleCrossChainMessageAndVerify( destExampleMessenger *testmessenger.TestMessenger, senderKey *ecdsa.PrivateKey, message string, + signatureAggregator *aggregator.SignatureAggregator, expectSuccess bool, ) { // Call the example messenger contract on Subnet A @@ -228,7 +232,7 @@ func (t TeleporterTestInfo) SendExampleCrossChainMessageAndVerify( // // Relay the message to the destination // - receipt = t.RelayTeleporterMessage(ctx, receipt, source, destination, true, senderKey) + receipt = t.RelayTeleporterMessage(ctx, receipt, source, destination, true, senderKey, nil, signatureAggregator) // // Check Teleporter message received on the destination @@ -275,8 +279,9 @@ func (t TeleporterTestInfo) AddProtocolVersionAndWaitForAcceptance( newTeleporterAddress common.Address, senderKey *ecdsa.PrivateKey, unsignedMessage *avalancheWarp.UnsignedMessage, + signatureAggregator *aggregator.SignatureAggregator, ) { - signedWarpMsg := GetSignedMessage(ctx, subnet, subnet, unsignedMessage.ID()) + signedWarpMsg := GetSignedMessage(subnet, subnet, unsignedMessage, nil, signatureAggregator) log.Info("Got signed warp message", "messageID", signedWarpMsg.ID()) // Construct tx to add protocol version and send to destination chain @@ -316,6 +321,7 @@ func (t TeleporterTestInfo) ClearReceiptQueue( fundedKey *ecdsa.PrivateKey, source interfaces.SubnetTestInfo, destination interfaces.SubnetTestInfo, + signatureAggregator *aggregator.SignatureAggregator, ) { sourceTeleporterMessenger := t.TeleporterMessenger(source) outstandReceiptCount := GetOutstandingReceiptCount( @@ -344,7 +350,7 @@ func (t TeleporterTestInfo) ClearReceiptQueue( ctx, sourceTeleporterMessenger, source, destination, sendCrossChainMessageInput, fundedKey) // Relay message - t.RelayTeleporterMessage(ctx, receipt, source, destination, true, fundedKey) + t.RelayTeleporterMessage(ctx, receipt, source, destination, true, fundedKey, nil, signatureAggregator) outstandReceiptCount = GetOutstandingReceiptCount(sourceTeleporterMessenger, destination.BlockchainID) } diff --git a/tests/utils/validator_manager.go b/tests/utils/validator_manager.go index 5de10a437..49c995f16 100644 --- a/tests/utils/validator_manager.go +++ b/tests/utils/validator_manager.go @@ -536,7 +536,7 @@ func InitializeAndCompleteNativeValidatorRegistration( // Gather subnet-evm Warp signatures for the RegisterSubnetValidatorMessage & relay to the P-Chain // (Sending to the P-Chain will be skipped for now) - signedWarpMessage := ConstructSignedWarpMessage(ctx, receipt, subnetInfo, pChainInfo) + signedWarpMessage := ConstructSignedWarpMessage(ctx, receipt, subnetInfo, pChainInfo, nil, signatureAggregator) _, err = pchainWallet.IssueRegisterSubnetValidatorTx( 100*units.Avax, @@ -614,7 +614,7 @@ func InitializeAndCompleteERC20ValidatorRegistration( ) // Gather subnet-evm Warp signatures for the RegisterSubnetValidatorMessage & relay to the P-Chain - signedWarpMessage := ConstructSignedWarpMessage(ctx, receipt, subnetInfo, pChainInfo) + signedWarpMessage := ConstructSignedWarpMessage(ctx, receipt, subnetInfo, pChainInfo, nil, signatureAggregator) _, err = pchainWallet.IssueRegisterSubnetValidatorTx( 100*units.Avax, @@ -682,7 +682,7 @@ func InitializeAndCompletePoAValidatorRegistration( ) // Gather subnet-evm Warp signatures for the RegisterSubnetValidatorMessage & relay to the P-Chain - signedWarpMessage := ConstructSignedWarpMessage(ctx, receipt, subnetInfo, pChainInfo) + signedWarpMessage := ConstructSignedWarpMessage(ctx, receipt, subnetInfo, pChainInfo, nil, signatureAggregator) _, err := pchainWallet.IssueRegisterSubnetValidatorTx( 100*units.Avax, @@ -1260,7 +1260,7 @@ func InitializeAndCompleteEndPoAValidation( // Gather subnet-evm Warp signatures for the SetSubnetValidatorWeightMessage & relay to the P-Chain // (Sending to the P-Chain will be skipped for now) - signedWarpMessage := ConstructSignedWarpMessage(ctx, receipt, subnetInfo, pChainInfo) + signedWarpMessage := ConstructSignedWarpMessage(ctx, receipt, subnetInfo, pChainInfo, nil, signatureAggregator) Expect(err).Should(BeNil()) // Validate the Warp message, (this will be done on the P-Chain in the future) From 2995f90e05e6d72f9b0350702f78119f90f53e67 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Fri, 8 Nov 2024 13:45:59 -0600 Subject: [PATCH 12/34] skip registry test --- tests/flows/teleporter/registry/teleporter_registry.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/flows/teleporter/registry/teleporter_registry.go b/tests/flows/teleporter/registry/teleporter_registry.go index 445b5d957..1252dec54 100644 --- a/tests/flows/teleporter/registry/teleporter_registry.go +++ b/tests/flows/teleporter/registry/teleporter_registry.go @@ -8,6 +8,7 @@ import ( localnetwork "github.com/ava-labs/teleporter/tests/network" "github.com/ava-labs/teleporter/tests/utils" "github.com/ethereum/go-ethereum/common" + "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) @@ -16,6 +17,8 @@ const ( ) func TeleporterRegistry(network *localnetwork.LocalNetwork, teleporter utils.TeleporterTestInfo) { + ginkgo.Skip("Skipping test until Avalanchego supports restarting sov nodes") + // Deploy dApp on both chains that use Teleporter Registry // Deploy version 2 of Teleporter to both chains // Construct AddProtocolVersion txs for both chains From 1c9e89fceb845fe027916f5c077b52afa83ee01f Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Fri, 8 Nov 2024 15:15:59 -0600 Subject: [PATCH 13/34] consolidate delegation helpers --- .../validator-manager/erc20_token_staking.go | 12 +-- .../validator-manager/native_token_staking.go | 12 +-- tests/utils/validator_manager.go | 82 ++----------------- 3 files changed, 21 insertions(+), 85 deletions(-) diff --git a/tests/flows/validator-manager/erc20_token_staking.go b/tests/flows/validator-manager/erc20_token_staking.go index a498bab1c..e1659db9d 100644 --- a/tests/flows/validator-manager/erc20_token_staking.go +++ b/tests/flows/validator-manager/erc20_token_staking.go @@ -160,7 +160,7 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { delegationID = initRegistrationEvent.DelegationID // Gather subnet-evm Warp signatures for the SubnetValidatorWeightUpdateMessage & relay to the P-Chain - signedWarpMessage := utils.ConstructSignedWarpMessage(context.Background(), receipt, subnetAInfo, pChainInfo) + signedWarpMessage := utils.ConstructSignedWarpMessage(context.Background(), receipt, subnetAInfo, pChainInfo, nil, network.GetSignatureAggregator()) // Issue a tx to update the validator's weight on the P-Chain network.GetPChainWallet().IssueSetSubnetValidatorWeightTx(signedWarpMessage.Bytes()) @@ -179,7 +179,7 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { ) // Deliver the Warp message to the subnet - receipt = utils.CompleteERC20DelegatorRegistration( + receipt = utils.CompleteDelegatorRegistration( ctx, fundedKey, delegationID, @@ -203,11 +203,11 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { { log.Println("Delisting delegator") nonce := uint64(2) - receipt := utils.InitializeEndERC20Delegation( + receipt := utils.InitializeEndDelegation( ctx, fundedKey, subnetAInfo, - erc20StakingManager, + stakingManagerAddress, delegationID, ) delegatorRemovalEvent, err := utils.GetEventFromLogs( @@ -220,7 +220,7 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { // Gather subnet-evm Warp signatures for the SetSubnetValidatorWeightMessage & relay to the P-Chain // (Sending to the P-Chain will be skipped for now) - signedWarpMessage := utils.ConstructSignedWarpMessage(context.Background(), receipt, subnetAInfo, pChainInfo) + signedWarpMessage := utils.ConstructSignedWarpMessage(context.Background(), receipt, subnetAInfo, pChainInfo, nil, network.GetSignatureAggregator()) Expect(err).Should(BeNil()) // Issue a tx to update the validator's weight on the P-Chain @@ -240,7 +240,7 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { ) // Deliver the Warp message to the subnet - receipt = utils.CompleteEndERC20Delegation( + receipt = utils.CompleteEndDelegation( ctx, fundedKey, delegationID, diff --git a/tests/flows/validator-manager/native_token_staking.go b/tests/flows/validator-manager/native_token_staking.go index f768c4419..038bf8906 100644 --- a/tests/flows/validator-manager/native_token_staking.go +++ b/tests/flows/validator-manager/native_token_staking.go @@ -155,7 +155,7 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { delegationID = initRegistrationEvent.DelegationID // Gather subnet-evm Warp signatures for the SubnetValidatorWeightUpdateMessage & relay to the P-Chain - signedWarpMessage := utils.ConstructSignedWarpMessage(context.Background(), receipt, subnetAInfo, pChainInfo) + signedWarpMessage := utils.ConstructSignedWarpMessage(context.Background(), receipt, subnetAInfo, pChainInfo, nil, network.GetSignatureAggregator()) // Issue a tx to update the validator's weight on the P-Chain network.GetPChainWallet().IssueSetSubnetValidatorWeightTx(signedWarpMessage.Bytes()) @@ -174,7 +174,7 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { ) // Deliver the Warp message to the subnet - receipt = utils.CompleteNativeDelegatorRegistration( + receipt = utils.CompleteDelegatorRegistration( ctx, fundedKey, delegationID, @@ -197,11 +197,11 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { { log.Println("Delisting delegator") nonce := uint64(2) - receipt := utils.InitializeEndNativeDelegation( + receipt := utils.InitializeEndDelegation( ctx, fundedKey, subnetAInfo, - nativeStakingManager, + stakingManagerAddress, delegationID, ) delegatorRemovalEvent, err := utils.GetEventFromLogs( @@ -214,7 +214,7 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { // Gather subnet-evm Warp signatures for the SetSubnetValidatorWeightMessage & relay to the P-Chain // (Sending to the P-Chain will be skipped for now) - signedWarpMessage := utils.ConstructSignedWarpMessage(context.Background(), receipt, subnetAInfo, pChainInfo) + signedWarpMessage := utils.ConstructSignedWarpMessage(context.Background(), receipt, subnetAInfo, pChainInfo, nil, network.GetSignatureAggregator()) Expect(err).Should(BeNil()) // Issue a tx to update the validator's weight on the P-Chain @@ -234,7 +234,7 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { ) // Deliver the Warp message to the subnet - receipt = utils.CompleteEndNativeDelegation( + receipt = utils.CompleteEndDelegation( ctx, fundedKey, delegationID, diff --git a/tests/utils/validator_manager.go b/tests/utils/validator_manager.go index 49c995f16..4eafd66d1 100644 --- a/tests/utils/validator_manager.go +++ b/tests/utils/validator_manager.go @@ -218,6 +218,7 @@ func DeployAndInitializeValidatorManager( RewardCalculator: rewardCalculatorAddress, }, ) + Expect(err).Should(BeNil()) } WaitForTransactionSuccess(ctx, subnet, tx.Hash()) return validatorManagerAddress, validatorManager @@ -838,73 +839,6 @@ func InitializeERC20DelegatorRegistration( return receipt } -// TODO: Consolidate this with native function -func CompleteERC20DelegatorRegistration( - ctx context.Context, - senderKey *ecdsa.PrivateKey, - delegationID ids.ID, - subnet interfaces.SubnetTestInfo, - stakingManagerContractAddress common.Address, - signedMessage *avalancheWarp.Message, -) *types.Receipt { - abi, err := erc20tokenstakingmanager.ERC20TokenStakingManagerMetaData.GetAbi() - Expect(err).Should(BeNil()) - callData, err := abi.Pack("completeDelegatorRegistration", delegationID, uint32(0)) - Expect(err).Should(BeNil()) - return CallWarpReceiver( - ctx, - callData, - senderKey, - subnet, - stakingManagerContractAddress, - signedMessage, - ) -} - -// TODO: Consolidate this with native function -func InitializeEndERC20Delegation( - ctx context.Context, - senderKey *ecdsa.PrivateKey, - subnet interfaces.SubnetTestInfo, - stakingManager *erc20tokenstakingmanager.ERC20TokenStakingManager, - delegationID ids.ID, -) *types.Receipt { - WaitMinStakeDuration(ctx, subnet, senderKey) - opts, err := bind.NewKeyedTransactorWithChainID(senderKey, subnet.EVMChainID) - Expect(err).Should(BeNil()) - tx, err := stakingManager.ForceInitializeEndDelegation( - opts, - delegationID, - false, - 0, - ) - Expect(err).Should(BeNil()) - return WaitForTransactionSuccess(ctx, subnet, tx.Hash()) -} - -// TODO: Consolidate this with native function -func CompleteEndERC20Delegation( - ctx context.Context, - senderKey *ecdsa.PrivateKey, - delegationID ids.ID, - subnet interfaces.SubnetTestInfo, - stakingManagerContractAddress common.Address, - signedMessage *avalancheWarp.Message, -) *types.Receipt { - abi, err := erc20tokenstakingmanager.ERC20TokenStakingManagerMetaData.GetAbi() - Expect(err).Should(BeNil()) - callData, err := abi.Pack("completeEndDelegation", delegationID, uint32(0)) - Expect(err).Should(BeNil()) - return CallWarpReceiver( - ctx, - callData, - senderKey, - subnet, - stakingManagerContractAddress, - signedMessage, - ) -} - func InitializeNativeDelegatorRegistration( ctx context.Context, senderKey *ecdsa.PrivateKey, @@ -932,7 +866,7 @@ func InitializeNativeDelegatorRegistration( return receipt } -func CompleteNativeDelegatorRegistration( +func CompleteDelegatorRegistration( ctx context.Context, senderKey *ecdsa.PrivateKey, delegationID ids.ID, @@ -940,7 +874,7 @@ func CompleteNativeDelegatorRegistration( stakingManagerContractAddress common.Address, signedMessage *avalancheWarp.Message, ) *types.Receipt { - abi, err := nativetokenstakingmanager.NativeTokenStakingManagerMetaData.GetAbi() + abi, err := iposvalidatormanager.IPoSValidatorManagerMetaData.GetAbi() Expect(err).Should(BeNil()) callData, err := abi.Pack("completeDelegatorRegistration", delegationID, uint32(0)) Expect(err).Should(BeNil()) @@ -954,13 +888,15 @@ func CompleteNativeDelegatorRegistration( ) } -func InitializeEndNativeDelegation( +func InitializeEndDelegation( ctx context.Context, senderKey *ecdsa.PrivateKey, subnet interfaces.SubnetTestInfo, - stakingManager *nativetokenstakingmanager.NativeTokenStakingManager, + stakingManagerAddress common.Address, delegationID ids.ID, ) *types.Receipt { + stakingManager, err := iposvalidatormanager.NewIPoSValidatorManager(stakingManagerAddress, subnet.RPCClient) + Expect(err).Should(BeNil()) WaitMinStakeDuration(ctx, subnet, senderKey) opts, err := bind.NewKeyedTransactorWithChainID(senderKey, subnet.EVMChainID) Expect(err).Should(BeNil()) @@ -974,7 +910,7 @@ func InitializeEndNativeDelegation( return WaitForTransactionSuccess(ctx, subnet, tx.Hash()) } -func CompleteEndNativeDelegation( +func CompleteEndDelegation( ctx context.Context, senderKey *ecdsa.PrivateKey, delegationID ids.ID, @@ -982,7 +918,7 @@ func CompleteEndNativeDelegation( stakingManagerContractAddress common.Address, signedMessage *avalancheWarp.Message, ) *types.Receipt { - abi, err := nativetokenstakingmanager.NativeTokenStakingManagerMetaData.GetAbi() + abi, err := iposvalidatormanager.IPoSValidatorManagerMetaData.GetAbi() Expect(err).Should(BeNil()) callData, err := abi.Pack("completeEndDelegation", delegationID, uint32(0)) Expect(err).Should(BeNil()) From 064f8494dd9098ab3dfbd460544796a56e29afd9 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Fri, 8 Nov 2024 18:08:27 -0600 Subject: [PATCH 14/34] convert subnet supports proxy & all manager types --- tests/flows/governance/validator_set_sig.go | 2 - .../ictt/transparent_proxy_upgradeability.go | 5 +- .../registry/teleporter_registry.go | 2 - tests/flows/teleporter/validator_churn.go | 2 +- .../validator-manager/erc20_token_staking.go | 29 +---- .../validator-manager/native_token_staking.go | 30 +---- tests/flows/validator-manager/poa_to_pos.go | 64 ++-------- tests/network/network.go | 48 +++++--- .../teleporter/teleporter_suite_test.go | 2 +- tests/utils/proxy.go | 10 +- tests/utils/validator_manager.go | 110 ++++-------------- 11 files changed, 81 insertions(+), 223 deletions(-) diff --git a/tests/flows/governance/validator_set_sig.go b/tests/flows/governance/validator_set_sig.go index d67113737..9ff4f3e99 100644 --- a/tests/flows/governance/validator_set_sig.go +++ b/tests/flows/governance/validator_set_sig.go @@ -3,7 +3,6 @@ package governance import ( "context" "math/big" - "os" "github.com/ava-labs/subnet-evm/accounts/abi/bind" validatorsetsig "github.com/ava-labs/teleporter/abi-bindings/go/governance/ValidatorSetSig" @@ -141,7 +140,6 @@ func ValidatorSetSig(network *localnetwork.LocalNetwork) { // Restart nodes with new chain config network.SetChainConfigs(chainConfigs) - network.Network.Restart(ctx, os.Stdout) // ************************************************************************************************ // Test Case 1: validatorChain (subnetB) != targetChain (subnetA) diff --git a/tests/flows/ictt/transparent_proxy_upgradeability.go b/tests/flows/ictt/transparent_proxy_upgradeability.go index 658e53645..b7cea02a0 100644 --- a/tests/flows/ictt/transparent_proxy_upgradeability.go +++ b/tests/flows/ictt/transparent_proxy_upgradeability.go @@ -62,13 +62,14 @@ func TransparentUpgradeableProxy(network *localnetwork.LocalNetwork, teleporter utils.WaitForTransactionSuccess(ctx, cChainInfo, tx.Hash()) // Deploy a TransparentUpgradeableProxy contract on primary network for the ERC20TokenHome logic contract - erc20TokenHomeAddress, proxyAdmin, erc20TokenHome := utils.DeployTransparentUpgradeableProxy( + erc20TokenHomeAddress, proxyAdmin := utils.DeployTransparentUpgradeableProxy( ctx, cChainInfo, fundedKey, implAddress, - erc20tokenhome.NewERC20TokenHome, ) + erc20TokenHome, err := erc20tokenhome.NewERC20TokenHome(erc20TokenHomeAddress, cChainInfo.RPCClient) + Expect(err).Should(BeNil() tx, err = erc20TokenHome.Initialize( opts, diff --git a/tests/flows/teleporter/registry/teleporter_registry.go b/tests/flows/teleporter/registry/teleporter_registry.go index 1252dec54..e87515b20 100644 --- a/tests/flows/teleporter/registry/teleporter_registry.go +++ b/tests/flows/teleporter/registry/teleporter_registry.go @@ -90,8 +90,6 @@ func TeleporterRegistry(network *localnetwork.LocalNetwork, teleporter utils.Tel // Restart nodes with new chain config network.SetChainConfigs(chainConfigs) - err := network.Network.Restart(ctx, os.Stdout) - Expect(err).Should(BeNil()) // Call addProtocolVersion on subnetB to register the new Teleporter version teleporter.AddProtocolVersionAndWaitForAcceptance( diff --git a/tests/flows/teleporter/validator_churn.go b/tests/flows/teleporter/validator_churn.go index 0cf77c880..5ff9944d9 100644 --- a/tests/flows/teleporter/validator_churn.go +++ b/tests/flows/teleporter/validator_churn.go @@ -66,7 +66,7 @@ func ValidatorChurn(network *localnetwork.LocalNetwork, teleporter utils.Telepor // // Add new nodes to the validator set - addValidatorsCtx, cancel := context.WithTimeout(ctx, 60*newNodeCount*time.Second) + addValidatorsCtx, cancel := context.WithTimeout(ctx, 90*newNodeCount*time.Second) defer cancel() newNodes := network.GetExtraNodes(newNodeCount) validatorManagerAddress := network.GetValidatorManager(subnetAInfo.SubnetID) diff --git a/tests/flows/validator-manager/erc20_token_staking.go b/tests/flows/validator-manager/erc20_token_staking.go index e1659db9d..1572901a8 100644 --- a/tests/flows/validator-manager/erc20_token_staking.go +++ b/tests/flows/validator-manager/erc20_token_staking.go @@ -47,13 +47,15 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { ) ctx := context.Background() - // Deploy the staking manager contract - stakingManagerAddress, _ := utils.DeployAndInitializeValidatorManager( + nodes, initialValidationIDs, _ := network.ConvertSubnet( ctx, - fundedKey, subnetAInfo, utils.ERC20TokenStakingManager, + 2, + fundedKey, + false, ) + stakingManagerAddress := network.GetValidatorManager(subnetAInfo.SubnetID) erc20StakingManager, err := erc20tokenstakingmanager.NewERC20TokenStakingManager(stakingManagerAddress, subnetAInfo.RPCClient) Expect(err).Should(BeNil()) erc20Address, err := erc20StakingManager.Erc20(&bind.CallOpts{}) @@ -61,27 +63,6 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { erc20, err := exampleerc20.NewExampleERC20(erc20Address, subnetAInfo.RPCClient) Expect(err).Should(BeNil()) - nodes := utils.ConvertSubnet( - ctx, - subnetAInfo, - network.GetPChainWallet(), - stakingManagerAddress, - fundedKey, - ) - - // Initialize the validator set on the subnet - log.Println("Initializing validator set") - initialValidationIDs := utils.InitializeValidatorSet( - ctx, - fundedKey, - subnetAInfo, - pChainInfo, - stakingManagerAddress, - network.GetNetworkID(), - signatureAggregator, - nodes, - ) - // // Delist one initial validator // diff --git a/tests/flows/validator-manager/native_token_staking.go b/tests/flows/validator-manager/native_token_staking.go index 038bf8906..b377d3b2b 100644 --- a/tests/flows/validator-manager/native_token_staking.go +++ b/tests/flows/validator-manager/native_token_staking.go @@ -46,39 +46,19 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { ) ctx := context.Background() - // Deploy the staking manager contract - stakingManagerAddress, _ := utils.DeployAndInitializeValidatorManager( + nodes, initialValidationIDs, _ := network.ConvertSubnet( ctx, - fundedKey, subnetAInfo, utils.NativeTokenStakingManager, + 2, + fundedKey, + false, ) + stakingManagerAddress := network.GetValidatorManager(subnetAInfo.SubnetID) nativeStakingManager, err := nativetokenstakingmanager.NewNativeTokenStakingManager(stakingManagerAddress, subnetAInfo.RPCClient) Expect(err).Should(BeNil()) - utils.AddNativeMinterAdmin(ctx, subnetAInfo, fundedKey, stakingManagerAddress) - nodes := utils.ConvertSubnet( - ctx, - subnetAInfo, - network.GetPChainWallet(), - stakingManagerAddress, - fundedKey, - ) - - // Initialize the validator set on the subnet - log.Println("Initializing validator set") - initialValidationIDs := utils.InitializeValidatorSet( - ctx, - fundedKey, - subnetAInfo, - pChainInfo, - stakingManagerAddress, - network.GetNetworkID(), - signatureAggregator, - nodes, - ) - // // Delist one initial validator // diff --git a/tests/flows/validator-manager/poa_to_pos.go b/tests/flows/validator-manager/poa_to_pos.go index 4dbc4fc1b..409741f02 100644 --- a/tests/flows/validator-manager/poa_to_pos.go +++ b/tests/flows/validator-manager/poa_to_pos.go @@ -2,7 +2,6 @@ package staking import ( "context" - "log" "math/big" "time" @@ -67,61 +66,18 @@ func PoAMigrationToPoS(network *localnetwork.LocalNetwork) { fundAmount, ) - // Deploy PoAValidatorManager contract - implAddress, _ := utils.DeployValidatorManager( + // Deploy PoAValidatorManager contract with a proxy + nodes, initialValidationIDs, proxyAdmin := network.ConvertSubnet( ctx, - fundedKey, subnetAInfo, utils.PoAValidatorManager, + 2, + ownerKey, + true, ) - - // TODDO: check if it's valid to initialize the PoA contract before deploying the proxy - // Deploy TransparentUpgradeableProxy contract pointing to PoAValidatorManager - proxyAddress, proxyAdmin, poaValidatorManager := utils.DeployTransparentUpgradeableProxy( - ctx, - subnetAInfo, - fundedKey, - implAddress, - poavalidatormanager.NewPoAValidatorManager, - ) - opts, err := bind.NewKeyedTransactorWithChainID( - fundedKey, - subnetAInfo.EVMChainID, - ) - Expect(err).Should(BeNil()) - - tx, err := poaValidatorManager.Initialize( - opts, - poavalidatormanager.ValidatorManagerSettings{ - SubnetID: subnetAInfo.SubnetID, - ChurnPeriodSeconds: uint64(0), - MaximumChurnPercentage: uint8(20), - }, - ownerAddress, - ) + proxyAddress := network.GetValidatorManager(subnetAInfo.SubnetID) + poaValidatorManager, err := poavalidatormanager.NewPoAValidatorManager(proxyAddress, subnetAInfo.RPCClient) Expect(err).Should(BeNil()) - utils.WaitForTransactionSuccess(context.Background(), subnetAInfo, tx.Hash()) - - nodes := utils.ConvertSubnet( - ctx, - subnetAInfo, - network.GetPChainWallet(), - proxyAddress, - fundedKey, - ) - - // Initialize the validator set on the subnet - log.Println("Initializing validator set") - initialValidationIDs := utils.InitializeValidatorSet( - ctx, - fundedKey, - subnetAInfo, - pChainInfo, - proxyAddress, - network.GetNetworkID(), - signatureAggregator, - nodes, - ) // // Delist one initial validator @@ -143,7 +99,7 @@ func PoAMigrationToPoS(network *localnetwork.LocalNetwork) { ) // Try to call with invalid owner - opts, err = bind.NewKeyedTransactorWithChainID(fundedKey, subnetAInfo.EVMChainID) + opts, err := bind.NewKeyedTransactorWithChainID(fundedKey, subnetAInfo.EVMChainID) Expect(err).Should(BeNil()) _, err = poaValidatorManager.InitializeValidatorRegistration( @@ -194,7 +150,9 @@ func PoAMigrationToPoS(network *localnetwork.LocalNetwork) { ) // Upgrade the TransparentUpgradeableProxy contract to use the new logic contract - tx, err = proxyAdmin.UpgradeAndCall(opts, proxyAddress, newImplAddress, []byte{}) + opts, err = bind.NewKeyedTransactorWithChainID(ownerKey, subnetAInfo.EVMChainID) + Expect(err).Should(BeNil()) + tx, err := proxyAdmin.UpgradeAndCall(opts, proxyAddress, newImplAddress, []byte{}) Expect(err).Should(BeNil()) utils.WaitForTransactionSuccess(ctx, subnetAInfo, tx.Hash()) diff --git a/tests/network/network.go b/tests/network/network.go index 74a467f7b..06f072577 100644 --- a/tests/network/network.go +++ b/tests/network/network.go @@ -29,6 +29,7 @@ import ( "github.com/ava-labs/awm-relayer/signature-aggregator/aggregator" "github.com/ava-labs/subnet-evm/ethclient" subnetEvmTestUtils "github.com/ava-labs/subnet-evm/tests/utils" + proxyadmin "github.com/ava-labs/teleporter/abi-bindings/go/ProxyAdmin" "github.com/ava-labs/teleporter/tests/interfaces" "github.com/ava-labs/teleporter/tests/utils" @@ -138,7 +139,6 @@ func NewLocalNetwork( Expect(ok).Should(Equal(true)) // Specify only a subset of the nodes to be bootstrapped - // TODO: clean this up keysToFund := []*secp256k1.PrivateKey{ genesis.VMRQKey, genesis.EWOQKey, @@ -184,30 +184,33 @@ func NewLocalNetwork( return localNetwork } -func (n *LocalNetwork) ConvertSubnet(ctx context.Context, subnet interfaces.SubnetTestInfo) { +func (n *LocalNetwork) ConvertSubnet( + ctx context.Context, + subnet interfaces.SubnetTestInfo, + managerType utils.ValidatorManagerConcreteType, + numInitialNodes int, + senderKey *ecdsa.PrivateKey, + proxy bool, +) ([]utils.Node, []ids.ID, *proxyadmin.ProxyAdmin) { cChainInfo := n.GetPrimaryNetworkInfo() pClient := platformvm.NewClient(cChainInfo.NodeURIs[0]) _, err := pClient.GetCurrentValidators(ctx, subnet.SubnetID, nil) Expect(err).Should(BeNil()) - fundedAddress, fundedKey := n.GetFundedAccountInfo() - - // TODO: support other manager types, including deploying a proxy - vdrManagerAddress, _ := utils.DeployAndInitializeValidatorManager( + vdrManagerAddress, proxyAdmin := utils.DeployAndInitializeValidatorManager( ctx, - fundedKey, + senderKey, subnet, - utils.PoAValidatorManager, - fundedAddress, + managerType, + proxy, ) n.validatorManagers[subnet.SubnetID] = vdrManagerAddress - // TODO: parameterize the number of nodes - tmpnetNodes := n.GetExtraNodes(2) + tmpnetNodes := n.GetExtraNodes(numInitialNodes) sort.Slice(tmpnetNodes, func(i, j int) bool { return string(tmpnetNodes[i].NodeID.Bytes()) < string(tmpnetNodes[j].NodeID.Bytes()) }) - totalWeight := uint64(len(tmpnetNodes)-1) * units.Schmeckle + var nodes []utils.Node // Construct the convert subnet info destAddr, err := address.ParseToID(utils.DefaultPChainAddress) @@ -216,7 +219,8 @@ func (n *LocalNetwork) ConvertSubnet(ctx context.Context, subnet interfaces.Subn for i, node := range tmpnetNodes { weight := units.Schmeckle if i == len(tmpnetNodes)-1 { - weight = 4 * totalWeight + // Give one validator a higher weight so churn limits aren't violated + weight = 1000 * weight } signer, err := node.GetProofOfPossession() @@ -253,11 +257,11 @@ func (n *LocalNetwork) ConvertSubnet(ctx context.Context, subnet interfaces.Subn subnet = n.AddSubnetValidators(tmpnetNodes, subnet) utils.PChainProposerVMWorkaround(pChainWallet) - utils.AdvanceProposerVM(ctx, subnet, fundedKey, 5) + utils.AdvanceProposerVM(ctx, subnet, senderKey, 5) - utils.InitializeValidatorSet( + validationIDs := utils.InitializeValidatorSet( ctx, - fundedKey, + senderKey, subnet, utils.GetPChainInfo(cChainInfo), vdrManagerAddress, @@ -273,6 +277,7 @@ func (n *LocalNetwork) ConvertSubnet(ctx context.Context, subnet interfaces.Subn // Expect(err).Should(BeNil()) // utils.WaitForTransactionSuccess(ctx, subnet, common.BytesToHash(tx.TxID[:])) // } + return nodes, validationIDs, proxyAdmin } func (n *LocalNetwork) AddSubnetValidators( @@ -281,6 +286,7 @@ func (n *LocalNetwork) AddSubnetValidators( ) interfaces.SubnetTestInfo { // Modify the each node's config to track the subnet for _, node := range nodes { + goLog.Printf("Adding node %s @ %s to subnet %s", node.NodeID, node.URI, subnet.SubnetID) existingTrackedSubnets, err := node.Flags.GetStringVal(config.TrackSubnetsKey) Expect(err).Should(BeNil()) if existingTrackedSubnets == subnet.SubnetID.String() { @@ -322,9 +328,9 @@ func (n *LocalNetwork) GetSignatureAggregator() *aggregator.SignatureAggregator ) } -func (n *LocalNetwork) GetExtraNodes(count uint) []*tmpnet.Node { +func (n *LocalNetwork) GetExtraNodes(count int) []*tmpnet.Node { Expect(count > 0).Should(BeTrue(), "can't add 0 validators") - Expect(uint(len(n.extraNodes)) >= count).Should( + Expect(len(n.extraNodes) >= count).Should( BeTrue(), "not enough extra nodes to use", ) @@ -516,6 +522,12 @@ func (n *LocalNetwork) SetChainConfigs(chainConfigs map[string]string) { log.Error("failed to write subnets", "error", err) } } + + // Restart the network to apply the new chain configs + ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) + defer cancel() + err = n.Network.Restart(ctx, os.Stdout) + Expect(err).Should(BeNil()) } func (n *LocalNetwork) GetNetworkID() uint32 { diff --git a/tests/suites/teleporter/teleporter_suite_test.go b/tests/suites/teleporter/teleporter_suite_test.go index b7999f800..30c917570 100644 --- a/tests/suites/teleporter/teleporter_suite_test.go +++ b/tests/suites/teleporter/teleporter_suite_test.go @@ -105,7 +105,7 @@ var _ = ginkgo.BeforeSuite(func() { } for _, subnet := range LocalNetworkInstance.GetSubnetsInfo() { - LocalNetworkInstance.ConvertSubnet(ctx, subnet) + LocalNetworkInstance.ConvertSubnet(ctx, subnet, utils.PoAValidatorManager, 2, fundedKey, false) } log.Info("Set up ginkgo before suite") diff --git a/tests/utils/proxy.go b/tests/utils/proxy.go index 36b6413d3..5a5e07517 100644 --- a/tests/utils/proxy.go +++ b/tests/utils/proxy.go @@ -13,13 +13,12 @@ import ( . "github.com/onsi/gomega" ) -func DeployTransparentUpgradeableProxy[T any]( +func DeployTransparentUpgradeableProxy( ctx context.Context, subnet interfaces.SubnetTestInfo, senderKey *ecdsa.PrivateKey, implAddress common.Address, - newInstance func(address common.Address, backend bind.ContractBackend) (*T, error), -) (common.Address, *proxyadmin.ProxyAdmin, *T) { +) (common.Address, *proxyadmin.ProxyAdmin) { opts, err := bind.NewKeyedTransactorWithChainID( senderKey, subnet.EVMChainID, @@ -42,8 +41,5 @@ func DeployTransparentUpgradeableProxy[T any]( proxyAdmin, err := proxyadmin.NewProxyAdmin(proxyAdminEvent.NewAdmin, subnet.RPCClient) Expect(err).Should(BeNil()) - contract, err := newInstance(proxyAddress, subnet.RPCClient) - Expect(err).Should(BeNil()) - - return proxyAddress, proxyAdmin, contract + return proxyAddress, proxyAdmin } diff --git a/tests/utils/validator_manager.go b/tests/utils/validator_manager.go index 4eafd66d1..8bdbad2ce 100644 --- a/tests/utils/validator_manager.go +++ b/tests/utils/validator_manager.go @@ -9,10 +9,8 @@ import ( "log" "math/big" "reflect" - "sort" "time" - "github.com/ava-labs/avalanchego/api/info" "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/proto/pb/platformvm" "github.com/ava-labs/avalanchego/utils/crypto/bls" @@ -20,7 +18,6 @@ import ( "github.com/ava-labs/avalanchego/utils/units" "github.com/ava-labs/avalanchego/vms/components/avax" "github.com/ava-labs/avalanchego/vms/platformvm/stakeable" - "github.com/ava-labs/avalanchego/vms/platformvm/txs" avalancheWarp "github.com/ava-labs/avalanchego/vms/platformvm/warp" warpMessage "github.com/ava-labs/avalanchego/vms/platformvm/warp/message" warpPayload "github.com/ava-labs/avalanchego/vms/platformvm/warp/payload" @@ -32,6 +29,7 @@ import ( "github.com/ava-labs/subnet-evm/precompile/contracts/warp" predicateutils "github.com/ava-labs/subnet-evm/predicate" subnetEvmUtils "github.com/ava-labs/subnet-evm/tests/utils" + proxyadmin "github.com/ava-labs/teleporter/abi-bindings/go/ProxyAdmin" exampleerc20 "github.com/ava-labs/teleporter/abi-bindings/go/mocks/ExampleERC20" erc20tokenstakingmanager "github.com/ava-labs/teleporter/abi-bindings/go/validator-manager/ERC20TokenStakingManager" examplerewardcalculator "github.com/ava-labs/teleporter/abi-bindings/go/validator-manager/ExampleRewardCalculator" @@ -128,14 +126,15 @@ func DeployValidatorManager( return address, validatorManager } +// The senderKey is used as the owner of proxy and PoAValidatorManager contracts func DeployAndInitializeValidatorManager( ctx context.Context, senderKey *ecdsa.PrivateKey, subnet interfaces.SubnetTestInfo, managerType ValidatorManagerConcreteType, - args ...interface{}, -) (common.Address, *ivalidatormanager.IValidatorManager) { - validatorManagerAddress, validatorManager := DeployValidatorManager( + proxy bool, +) (common.Address, *proxyadmin.ProxyAdmin) { + validatorManagerAddress, _ := DeployValidatorManager( ctx, senderKey, subnet, @@ -144,11 +143,22 @@ func DeployAndInitializeValidatorManager( opts, err := bind.NewKeyedTransactorWithChainID(senderKey, subnet.EVMChainID) Expect(err).Should(BeNil()) - var tx *types.Transaction + var ( + tx *types.Transaction + proxyAdmin *proxyadmin.ProxyAdmin + ) + if proxy { + // Overwrite the manager address with the proxy address + validatorManagerAddress, proxyAdmin = DeployTransparentUpgradeableProxy( + ctx, + subnet, + senderKey, + validatorManagerAddress, + ) + } + switch managerType { case PoAValidatorManager: - Expect(len(args)).Should(Equal(1)) - ownerAddress := args[0].(common.Address) poaValidatorManager, err := poavalidatormanager.NewPoAValidatorManager(validatorManagerAddress, subnet.RPCClient) Expect(err).Should(BeNil()) tx, err = poaValidatorManager.Initialize( @@ -158,11 +168,10 @@ func DeployAndInitializeValidatorManager( ChurnPeriodSeconds: uint64(0), MaximumChurnPercentage: uint8(20), }, - ownerAddress, + PrivateKeyToAddress(senderKey), ) Expect(err).Should(BeNil()) case ERC20TokenStakingManager: - Expect(len(args)).Should(Equal(0)) erc20Address, _ := DeployExampleERC20(ctx, senderKey, subnet) rewardCalculatorAddress, _ := DeployExampleRewardCalculator( ctx, @@ -192,7 +201,6 @@ func DeployAndInitializeValidatorManager( ) Expect(err).Should(BeNil()) case NativeTokenStakingManager: - Expect(len(args)).Should(Equal(0)) rewardCalculatorAddress, _ := DeployExampleRewardCalculator( ctx, senderKey, @@ -221,7 +229,7 @@ func DeployAndInitializeValidatorManager( Expect(err).Should(BeNil()) } WaitForTransactionSuccess(ctx, subnet, tx.Hash()) - return validatorManagerAddress, validatorManager + return validatorManagerAddress, proxyAdmin } func DeployExampleRewardCalculator( @@ -259,7 +267,7 @@ func InitializeValidatorSet( signatureAggregator *aggregator.SignatureAggregator, nodes []Node, ) []ids.ID { - log.Println("Initializing PoA validator set") + log.Println("Initializing validator set") initialValidators := make([]warpMessage.SubnetConversionValidatorData, len(nodes)) initialValidatorsABI := make([]ivalidatormanager.InitialValidator, len(nodes)) for i, node := range nodes { @@ -1652,77 +1660,3 @@ func AdvanceProposerVM( Expect(err).Should(BeNil()) } } - -func ConvertSubnet( - ctx context.Context, - subnetInfo interfaces.SubnetTestInfo, - pchainWallet pwallet.Wallet, - stakingManagerAddress common.Address, - fundedKey *ecdsa.PrivateKey, -) []Node { - // Remove the current validators before converting the subnet - var nodes []Node - for _, uri := range subnetInfo.NodeURIs { - infoClient := info.NewClient(uri) - nodeID, nodePoP, err := infoClient.GetNodeID(ctx) - Expect(err).Should(BeNil()) - nodes = append(nodes, Node{ - NodeID: nodeID, - NodePoP: nodePoP, - }) - - _, err = pchainWallet.IssueRemoveSubnetValidatorTx( - nodeID, - subnetInfo.SubnetID, - ) - Expect(err).Should(BeNil()) - } - - // Sort the nodeIDs so that the subnet conversion ID matches the P-Chain - sort.Slice(nodes, func(i, j int) bool { - return string(nodes[i].NodeID.Bytes()) < string(nodes[j].NodeID.Bytes()) - }) - - totalWeight := uint64(len(nodes)-1) * units.Schmeckle - for i := 0; i < len(nodes)-1; i++ { - nodes[i].Weight = units.Schmeckle - totalWeight += units.Schmeckle - } - // Set the last node's weight such that removing any other node will not violate the churn limit - nodes[len(nodes)-1].Weight = 4 * totalWeight - - // Construct the convert subnet info - destAddr, err := address.ParseToID(DefaultPChainAddress) - Expect(err).Should(BeNil()) - vdrs := make([]*txs.ConvertSubnetValidator, len(nodes)) - for i, node := range nodes { - vdrs[i] = &txs.ConvertSubnetValidator{ - NodeID: node.NodeID.Bytes(), - Weight: nodes[i].Weight, - Balance: units.Avax * 100, - Signer: *node.NodePoP, - RemainingBalanceOwner: warpMessage.PChainOwner{ - Threshold: 1, - Addresses: []ids.ShortID{destAddr}, - }, - DeactivationOwner: warpMessage.PChainOwner{ - Threshold: 1, - Addresses: []ids.ShortID{destAddr}, - }, - } - } - - log.Println("Issuing ConvertSubnetTx") - _, err = pchainWallet.IssueConvertSubnetTx( - subnetInfo.SubnetID, - subnetInfo.BlockchainID, - stakingManagerAddress[:], - vdrs, - ) - Expect(err).Should(BeNil()) - - PChainProposerVMWorkaround(pchainWallet) - AdvanceProposerVM(ctx, subnetInfo, fundedKey, 5) - - return nodes -} From 1fd68ff49954504103a5bd95310b826837324d93 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Fri, 8 Nov 2024 18:21:05 -0600 Subject: [PATCH 15/34] lint --- .../ictt/transparent_proxy_upgradeability.go | 2 +- tests/flows/teleporter/basic_send_receive.go | 22 ++++++++++++-- .../deliver_to_nonexistent_contract.go | 11 ++++++- .../teleporter/deliver_to_wrong_chain.go | 11 ++++++- tests/flows/teleporter/insufficient_gas.go | 11 ++++++- .../registry/teleporter_registry.go | 1 - tests/flows/teleporter/relay_message_twice.go | 29 +++++++++++++++++-- .../teleporter/relayer_modifies_message.go | 9 +++++- .../teleporter/resubmit_altered_message.go | 11 ++++++- .../teleporter/retry_successful_execution.go | 11 ++++++- .../teleporter/send_specific_receipts.go | 22 ++++++++++++-- tests/flows/teleporter/unallowed_relayer.go | 11 ++++++- tests/flows/teleporter/validator_churn.go | 20 +++++++++++-- .../validator-manager/erc20_token_staking.go | 23 +++++++++++++-- .../validator-manager/native_token_staking.go | 23 +++++++++++++-- tests/network/network.go | 3 +- tests/utils/ictt.go | 11 ++++++- tests/utils/teleporter.go | 9 +++++- tests/utils/validator_manager.go | 10 +++++-- 19 files changed, 221 insertions(+), 29 deletions(-) diff --git a/tests/flows/ictt/transparent_proxy_upgradeability.go b/tests/flows/ictt/transparent_proxy_upgradeability.go index b7cea02a0..7dc99ee4e 100644 --- a/tests/flows/ictt/transparent_proxy_upgradeability.go +++ b/tests/flows/ictt/transparent_proxy_upgradeability.go @@ -69,7 +69,7 @@ func TransparentUpgradeableProxy(network *localnetwork.LocalNetwork, teleporter implAddress, ) erc20TokenHome, err := erc20tokenhome.NewERC20TokenHome(erc20TokenHomeAddress, cChainInfo.RPCClient) - Expect(err).Should(BeNil() + Expect(err).Should(BeNil()) tx, err = erc20TokenHome.Initialize( opts, diff --git a/tests/flows/teleporter/basic_send_receive.go b/tests/flows/teleporter/basic_send_receive.go index a2c7748af..e01577982 100644 --- a/tests/flows/teleporter/basic_send_receive.go +++ b/tests/flows/teleporter/basic_send_receive.go @@ -66,7 +66,16 @@ func BasicSendReceive(network *localnetwork.LocalNetwork, teleporter utils.Telep expectedReceiptID := teleporterMessageID // Relay the message to the destination - deliveryReceipt := teleporter.RelayTeleporterMessage(ctx, receipt, subnetAInfo, subnetBInfo, true, fundedKey, nil, network.GetSignatureAggregator()) + deliveryReceipt := teleporter.RelayTeleporterMessage( + ctx, + receipt, + subnetAInfo, + subnetBInfo, + true, + fundedKey, + nil, + network.GetSignatureAggregator(), + ) receiveEvent, err := utils.GetEventFromLogs( deliveryReceipt.Logs, teleporter.TeleporterMessenger(subnetBInfo).ParseReceiveCrossChainMessage) @@ -92,7 +101,16 @@ func BasicSendReceive(network *localnetwork.LocalNetwork, teleporter utils.Telep ) // Relay the message to the destination - deliveryReceipt = teleporter.RelayTeleporterMessage(ctx, receipt, subnetBInfo, subnetAInfo, true, fundedKey, nil, network.GetSignatureAggregator()) + deliveryReceipt = teleporter.RelayTeleporterMessage( + ctx, + receipt, + subnetBInfo, + subnetAInfo, + true, + fundedKey, + nil, + network.GetSignatureAggregator(), + ) Expect(utils.CheckReceiptReceived( deliveryReceipt, diff --git a/tests/flows/teleporter/deliver_to_nonexistent_contract.go b/tests/flows/teleporter/deliver_to_nonexistent_contract.go index 0207186e3..2257ba1d6 100644 --- a/tests/flows/teleporter/deliver_to_nonexistent_contract.go +++ b/tests/flows/teleporter/deliver_to_nonexistent_contract.go @@ -88,7 +88,16 @@ func DeliverToNonExistentContract(network *localnetwork.LocalNetwork, teleporter // Relay the message to the destination // log.Info("Relaying the message to the destination") - receipt = teleporter.RelayTeleporterMessage(ctx, receipt, subnetAInfo, subnetBInfo, true, fundedKey, nil, network.GetSignatureAggregator()) + receipt = teleporter.RelayTeleporterMessage( + ctx, + receipt, + subnetAInfo, + subnetBInfo, + true, + fundedKey, + nil, + network.GetSignatureAggregator(), + ) receiveEvent, err := utils.GetEventFromLogs(receipt.Logs, teleporter.TeleporterMessenger(subnetAInfo).ParseReceiveCrossChainMessage) Expect(err).Should(BeNil()) diff --git a/tests/flows/teleporter/deliver_to_wrong_chain.go b/tests/flows/teleporter/deliver_to_wrong_chain.go index f503eee1b..22345242b 100644 --- a/tests/flows/teleporter/deliver_to_wrong_chain.go +++ b/tests/flows/teleporter/deliver_to_wrong_chain.go @@ -57,7 +57,16 @@ func DeliverToWrongChain(network *localnetwork.LocalNetwork, teleporter utils.Te fundedKey, ) - teleporter.RelayTeleporterMessage(ctx, receipt, subnetAInfo, subnetCInfo, false, fundedKey, nil, network.GetSignatureAggregator()) + teleporter.RelayTeleporterMessage( + ctx, + receipt, + subnetAInfo, + subnetCInfo, + false, + fundedKey, + nil, + network.GetSignatureAggregator(), + ) // // Check that the message was not received on the Subnet C diff --git a/tests/flows/teleporter/insufficient_gas.go b/tests/flows/teleporter/insufficient_gas.go index 888f59a65..1b593b145 100644 --- a/tests/flows/teleporter/insufficient_gas.go +++ b/tests/flows/teleporter/insufficient_gas.go @@ -56,7 +56,16 @@ func InsufficientGas(network *localnetwork.LocalNetwork, teleporter utils.Telepo messageID := event.MessageID // Relay message from SubnetA to SubnetB - receipt = teleporter.RelayTeleporterMessage(ctx, receipt, subnetAInfo, subnetBInfo, true, fundedKey, nil, network.GetSignatureAggregator()) + receipt = teleporter.RelayTeleporterMessage( + ctx, + receipt, + subnetAInfo, + subnetBInfo, + true, + fundedKey, + nil, + network.GetSignatureAggregator(), + ) // Check Teleporter message received on the destination delivered, err := diff --git a/tests/flows/teleporter/registry/teleporter_registry.go b/tests/flows/teleporter/registry/teleporter_registry.go index e87515b20..1251fb820 100644 --- a/tests/flows/teleporter/registry/teleporter_registry.go +++ b/tests/flows/teleporter/registry/teleporter_registry.go @@ -2,7 +2,6 @@ package registry import ( "context" - "os" "github.com/ava-labs/subnet-evm/accounts/abi/bind" localnetwork "github.com/ava-labs/teleporter/tests/network" diff --git a/tests/flows/teleporter/relay_message_twice.go b/tests/flows/teleporter/relay_message_twice.go index 9e517c643..61e19f568 100644 --- a/tests/flows/teleporter/relay_message_twice.go +++ b/tests/flows/teleporter/relay_message_twice.go @@ -41,13 +41,27 @@ func RelayMessageTwice(network *localnetwork.LocalNetwork, teleporter utils.Tele "destinationBlockchainID", subnetBInfo.BlockchainID, ) receipt, teleporterMessageID := utils.SendCrossChainMessageAndWaitForAcceptance( - ctx, teleporter.TeleporterMessenger(subnetAInfo), subnetAInfo, subnetBInfo, sendCrossChainMessageInput, fundedKey, + ctx, + teleporter.TeleporterMessenger(subnetAInfo), + subnetAInfo, + subnetBInfo, + sendCrossChainMessageInput, + fundedKey, ) // // Relay the message to the destination // - teleporter.RelayTeleporterMessage(ctx, receipt, subnetAInfo, subnetBInfo, true, fundedKey, nil, network.GetSignatureAggregator()) + teleporter.RelayTeleporterMessage( + ctx, + receipt, + subnetAInfo, + subnetBInfo, + true, + fundedKey, + nil, + network.GetSignatureAggregator(), + ) // // Check Teleporter message received on the destination @@ -63,5 +77,14 @@ func RelayMessageTwice(network *localnetwork.LocalNetwork, teleporter utils.Tele // Attempt to send the same message again, should fail // log.Info("Relaying the same Teleporter message again on the destination") - teleporter.RelayTeleporterMessage(ctx, receipt, subnetAInfo, subnetBInfo, false, fundedKey, nil, network.GetSignatureAggregator()) + teleporter.RelayTeleporterMessage( + ctx, + receipt, + subnetAInfo, + subnetBInfo, + false, + fundedKey, + nil, + network.GetSignatureAggregator(), + ) } diff --git a/tests/flows/teleporter/relayer_modifies_message.go b/tests/flows/teleporter/relayer_modifies_message.go index 82c6e63ca..366c142f1 100644 --- a/tests/flows/teleporter/relayer_modifies_message.go +++ b/tests/flows/teleporter/relayer_modifies_message.go @@ -78,7 +78,14 @@ func relayAlteredMessage( ) Expect(err).Should(BeNil()) - signedWarpMessage := utils.ConstructSignedWarpMessage(ctx, sourceReceipt, source, destination, nil, network.GetSignatureAggregator()) + signedWarpMessage := utils.ConstructSignedWarpMessage( + ctx, + sourceReceipt, + source, + destination, + nil, + network.GetSignatureAggregator(), + ) // Construct the transaction to send the Warp message to the destination chain _, fundedKey := network.GetFundedAccountInfo() diff --git a/tests/flows/teleporter/resubmit_altered_message.go b/tests/flows/teleporter/resubmit_altered_message.go index 94911f1da..869d27273 100644 --- a/tests/flows/teleporter/resubmit_altered_message.go +++ b/tests/flows/teleporter/resubmit_altered_message.go @@ -37,7 +37,16 @@ func ResubmitAlteredMessage(network *localnetwork.LocalNetwork, teleporter utils ctx, teleporter.TeleporterMessenger(subnetAInfo), subnetAInfo, subnetBInfo, sendCrossChainMessageInput, fundedKey) // Relay the message to the destination - receipt = teleporter.RelayTeleporterMessage(ctx, receipt, subnetAInfo, subnetBInfo, true, fundedKey, nil, network.GetSignatureAggregator()) + receipt = teleporter.RelayTeleporterMessage( + ctx, + receipt, + subnetAInfo, + subnetBInfo, + true, + fundedKey, + nil, + network.GetSignatureAggregator(), + ) log.Info("Checking the message was received on the destination") delivered, err := teleporter.TeleporterMessenger(subnetBInfo).MessageReceived(&bind.CallOpts{}, messageID) diff --git a/tests/flows/teleporter/retry_successful_execution.go b/tests/flows/teleporter/retry_successful_execution.go index 3847be86c..067ac9adf 100644 --- a/tests/flows/teleporter/retry_successful_execution.go +++ b/tests/flows/teleporter/retry_successful_execution.go @@ -68,7 +68,16 @@ func RetrySuccessfulExecution(network *localnetwork.LocalNetwork, teleporter uti // // Relay the message to the destination // - receipt = teleporter.RelayTeleporterMessage(ctx, receipt, subnetAInfo, subnetBInfo, true, fundedKey, nil, network.GetSignatureAggregator()) + receipt = teleporter.RelayTeleporterMessage( + ctx, + receipt, + subnetAInfo, + subnetBInfo, + true, + fundedKey, + nil, + network.GetSignatureAggregator(), + ) receiveEvent, err := utils.GetEventFromLogs(receipt.Logs, teleporter.TeleporterMessenger(subnetBInfo).ParseReceiveCrossChainMessage) Expect(err).Should(BeNil()) diff --git a/tests/flows/teleporter/send_specific_receipts.go b/tests/flows/teleporter/send_specific_receipts.go index 73c6f10fd..588a4b6a9 100644 --- a/tests/flows/teleporter/send_specific_receipts.go +++ b/tests/flows/teleporter/send_specific_receipts.go @@ -133,7 +133,16 @@ func SendSpecificReceipts(network *localnetwork.LocalNetwork, teleporter utils.T // Relay message from Subnet B to Subnet A goLog.Println("Relaying the specific receipts from Subnet B to Subnet A") - receipt = teleporter.RelayTeleporterMessage(ctx, receipt, subnetBInfo, subnetAInfo, true, fundedKey, nil, network.GetSignatureAggregator()) + receipt = teleporter.RelayTeleporterMessage( + ctx, + receipt, + subnetBInfo, + subnetAInfo, + true, + fundedKey, + nil, + network.GetSignatureAggregator(), + ) // Check that the message back to Subnet A was delivered delivered, err = subnetATeleporterMessenger.MessageReceived(&bind.CallOpts{}, messageID) @@ -178,7 +187,16 @@ func SendSpecificReceipts(network *localnetwork.LocalNetwork, teleporter utils.T goLog.Println("Relaying the message from Subnet B to Subnet A") // Relay message from Subnet B to Subnet A - receipt = teleporter.RelayTeleporterMessage(ctx, receipt, subnetBInfo, subnetAInfo, true, fundedKey, nil, network.GetSignatureAggregator()) + receipt = teleporter.RelayTeleporterMessage( + ctx, + receipt, + subnetBInfo, + subnetAInfo, + true, + fundedKey, + nil, + network.GetSignatureAggregator(), + ) // Check delivered delivered, err = subnetATeleporterMessenger.MessageReceived( &bind.CallOpts{}, diff --git a/tests/flows/teleporter/unallowed_relayer.go b/tests/flows/teleporter/unallowed_relayer.go index 5f37e2b52..47ae8c8f9 100644 --- a/tests/flows/teleporter/unallowed_relayer.go +++ b/tests/flows/teleporter/unallowed_relayer.go @@ -49,7 +49,16 @@ func UnallowedRelayer(network *localnetwork.LocalNetwork, teleporter utils.Telep // // Relay the message to the destination // - teleporter.RelayTeleporterMessage(ctx, receipt, subnetAInfo, subnetBInfo, false, fundedKey, nil, network.GetSignatureAggregator()) + teleporter.RelayTeleporterMessage( + ctx, + receipt, + subnetAInfo, + subnetBInfo, + false, + fundedKey, + nil, + network.GetSignatureAggregator(), + ) // // Check Teleporter message was not received on the destination diff --git a/tests/flows/teleporter/validator_churn.go b/tests/flows/teleporter/validator_churn.go index 5ff9944d9..a823e0a65 100644 --- a/tests/flows/teleporter/validator_churn.go +++ b/tests/flows/teleporter/validator_churn.go @@ -59,7 +59,14 @@ func ValidatorChurn(network *localnetwork.LocalNetwork, teleporter utils.Telepor sentTeleporterMessage := sendEvent.Message // Construct the signed warp message - signedWarpMessage := utils.ConstructSignedWarpMessage(ctx, receipt, subnetAInfo, subnetBInfo, nil, network.GetSignatureAggregator()) + signedWarpMessage := utils.ConstructSignedWarpMessage( + ctx, + receipt, + subnetAInfo, + subnetBInfo, + nil, + network.GetSignatureAggregator(), + ) // // Modify the validator set on Subnet A @@ -151,7 +158,16 @@ func ValidatorChurn(network *localnetwork.LocalNetwork, teleporter utils.Telepor // Wait for the transaction to be mined receipt = utils.WaitForTransactionSuccess(ctx, subnetAInfo, tx.Hash()) - teleporter.RelayTeleporterMessage(ctx, receipt, subnetAInfo, subnetBInfo, true, fundedKey, nil, network.GetSignatureAggregator()) + teleporter.RelayTeleporterMessage( + ctx, + receipt, + subnetAInfo, + subnetBInfo, + true, + fundedKey, + nil, + network.GetSignatureAggregator(), + ) // Verify the message was delivered delivered, err = teleporter.TeleporterMessenger(subnetBInfo).MessageReceived( diff --git a/tests/flows/validator-manager/erc20_token_staking.go b/tests/flows/validator-manager/erc20_token_staking.go index 1572901a8..82d8549b8 100644 --- a/tests/flows/validator-manager/erc20_token_staking.go +++ b/tests/flows/validator-manager/erc20_token_staking.go @@ -56,7 +56,10 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { false, ) stakingManagerAddress := network.GetValidatorManager(subnetAInfo.SubnetID) - erc20StakingManager, err := erc20tokenstakingmanager.NewERC20TokenStakingManager(stakingManagerAddress, subnetAInfo.RPCClient) + erc20StakingManager, err := erc20tokenstakingmanager.NewERC20TokenStakingManager( + stakingManagerAddress, + subnetAInfo.RPCClient, + ) Expect(err).Should(BeNil()) erc20Address, err := erc20StakingManager.Erc20(&bind.CallOpts{}) Expect(err).Should(BeNil()) @@ -141,7 +144,14 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { delegationID = initRegistrationEvent.DelegationID // Gather subnet-evm Warp signatures for the SubnetValidatorWeightUpdateMessage & relay to the P-Chain - signedWarpMessage := utils.ConstructSignedWarpMessage(context.Background(), receipt, subnetAInfo, pChainInfo, nil, network.GetSignatureAggregator()) + signedWarpMessage := utils.ConstructSignedWarpMessage( + context.Background(), + receipt, + subnetAInfo, + pChainInfo, + nil, + network.GetSignatureAggregator(), + ) // Issue a tx to update the validator's weight on the P-Chain network.GetPChainWallet().IssueSetSubnetValidatorWeightTx(signedWarpMessage.Bytes()) @@ -201,7 +211,14 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { // Gather subnet-evm Warp signatures for the SetSubnetValidatorWeightMessage & relay to the P-Chain // (Sending to the P-Chain will be skipped for now) - signedWarpMessage := utils.ConstructSignedWarpMessage(context.Background(), receipt, subnetAInfo, pChainInfo, nil, network.GetSignatureAggregator()) + signedWarpMessage := utils.ConstructSignedWarpMessage( + context.Background(), + receipt, + subnetAInfo, + pChainInfo, + nil, + network.GetSignatureAggregator(), + ) Expect(err).Should(BeNil()) // Issue a tx to update the validator's weight on the P-Chain diff --git a/tests/flows/validator-manager/native_token_staking.go b/tests/flows/validator-manager/native_token_staking.go index b377d3b2b..102ebb046 100644 --- a/tests/flows/validator-manager/native_token_staking.go +++ b/tests/flows/validator-manager/native_token_staking.go @@ -55,7 +55,10 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { false, ) stakingManagerAddress := network.GetValidatorManager(subnetAInfo.SubnetID) - nativeStakingManager, err := nativetokenstakingmanager.NewNativeTokenStakingManager(stakingManagerAddress, subnetAInfo.RPCClient) + nativeStakingManager, err := nativetokenstakingmanager.NewNativeTokenStakingManager( + stakingManagerAddress, + subnetAInfo.RPCClient, + ) Expect(err).Should(BeNil()) utils.AddNativeMinterAdmin(ctx, subnetAInfo, fundedKey, stakingManagerAddress) @@ -135,7 +138,14 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { delegationID = initRegistrationEvent.DelegationID // Gather subnet-evm Warp signatures for the SubnetValidatorWeightUpdateMessage & relay to the P-Chain - signedWarpMessage := utils.ConstructSignedWarpMessage(context.Background(), receipt, subnetAInfo, pChainInfo, nil, network.GetSignatureAggregator()) + signedWarpMessage := utils.ConstructSignedWarpMessage( + context.Background(), + receipt, + subnetAInfo, + pChainInfo, + nil, + network.GetSignatureAggregator(), + ) // Issue a tx to update the validator's weight on the P-Chain network.GetPChainWallet().IssueSetSubnetValidatorWeightTx(signedWarpMessage.Bytes()) @@ -194,7 +204,14 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { // Gather subnet-evm Warp signatures for the SetSubnetValidatorWeightMessage & relay to the P-Chain // (Sending to the P-Chain will be skipped for now) - signedWarpMessage := utils.ConstructSignedWarpMessage(context.Background(), receipt, subnetAInfo, pChainInfo, nil, network.GetSignatureAggregator()) + signedWarpMessage := utils.ConstructSignedWarpMessage( + context.Background(), + receipt, + subnetAInfo, + pChainInfo, + nil, + network.GetSignatureAggregator(), + ) Expect(err).Should(BeNil()) // Issue a tx to update the validator's weight on the P-Chain diff --git a/tests/network/network.go b/tests/network/network.go index 06f072577..c6aeadfa5 100644 --- a/tests/network/network.go +++ b/tests/network/network.go @@ -91,7 +91,8 @@ func NewLocalNetwork( var subnets []*tmpnet.Subnet var bootstrapNodes []*tmpnet.Node for _, subnetSpec := range subnetSpecs { - // Create a single bootstrap node. This will be removed from the subnet validator set after it is converted, but will remain a primary network validator + // Create a single bootstrap node. This will be removed from the subnet validator set after it is converted, + // but will remain a primary network validator boostrapNodes := subnetEvmTestUtils.NewTmpnetNodes(1) // One bootstrap node per subnet // allNodes = append(allNodes, boostrapNodes...) bootstrapNodes = append(bootstrapNodes, boostrapNodes...) diff --git a/tests/utils/ictt.go b/tests/utils/ictt.go index aa25e9fb5..956c48b3b 100644 --- a/tests/utils/ictt.go +++ b/tests/utils/ictt.go @@ -378,7 +378,16 @@ func RegisterTokenRemoteOnHome( receipt := WaitForTransactionSuccess(ctx, remoteSubnet, sendRegisterTx.Hash()) // Relay the register message to the home - receipt = teleporter.RelayTeleporterMessage(ctx, receipt, remoteSubnet, homeSubnet, true, fundedKey, nil, signatureAggregator) + receipt = teleporter.RelayTeleporterMessage( + ctx, + receipt, + remoteSubnet, + homeSubnet, + true, + fundedKey, + nil, + signatureAggregator, + ) _, err = GetEventFromLogs( receipt.Logs, teleporter.TeleporterMessenger(homeSubnet).ParseMessageExecuted, diff --git a/tests/utils/teleporter.go b/tests/utils/teleporter.go index 3b942ff0f..34087135a 100644 --- a/tests/utils/teleporter.go +++ b/tests/utils/teleporter.go @@ -162,7 +162,14 @@ func (t TeleporterTestInfo) RelayTeleporterMessage( sendEvent, err := GetEventFromLogs(sourceReceipt.Logs, t.TeleporterMessenger(source).ParseSendCrossChainMessage) Expect(err).Should(BeNil()) - signedWarpMessage := ConstructSignedWarpMessage(ctx, sourceReceipt, source, destination, justification, signatureAggregator) + signedWarpMessage := ConstructSignedWarpMessage( + ctx, + sourceReceipt, + source, + destination, + justification, + signatureAggregator, + ) // Construct the transaction to send the Warp message to the destination chain signedTx := CreateReceiveCrossChainMessageTransaction( diff --git a/tests/utils/validator_manager.go b/tests/utils/validator_manager.go index 8bdbad2ce..8bd53fac9 100644 --- a/tests/utils/validator_manager.go +++ b/tests/utils/validator_manager.go @@ -179,7 +179,10 @@ func DeployAndInitializeValidatorManager( subnet, uint64(10), ) - erc20StakingManager, err := erc20tokenstakingmanager.NewERC20TokenStakingManager(validatorManagerAddress, subnet.RPCClient) + erc20StakingManager, err := erc20tokenstakingmanager.NewERC20TokenStakingManager( + validatorManagerAddress, + subnet.RPCClient, + ) Expect(err).Should(BeNil()) tx, err = erc20StakingManager.Initialize( opts, @@ -207,7 +210,10 @@ func DeployAndInitializeValidatorManager( subnet, uint64(10), ) - nativeStakingManager, err := nativetokenstakingmanager.NewNativeTokenStakingManager(validatorManagerAddress, subnet.RPCClient) + nativeStakingManager, err := nativetokenstakingmanager.NewNativeTokenStakingManager( + validatorManagerAddress, + subnet.RPCClient, + ) Expect(err).Should(BeNil()) tx, err = nativeStakingManager.Initialize( opts, From c1fc63c0b19be3d57923873e6f440cbdf2277d68 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Fri, 8 Nov 2024 21:17:36 -0600 Subject: [PATCH 16/34] parameterize initial subnet weights --- .../flows/validator-manager/erc20_token_staking.go | 3 ++- .../validator-manager/native_token_staking.go | 3 ++- tests/flows/validator-manager/poa_to_pos.go | 3 ++- tests/network/network.go | 14 ++++---------- tests/suites/teleporter/teleporter_suite_test.go | 14 +++++++++++--- 5 files changed, 21 insertions(+), 16 deletions(-) diff --git a/tests/flows/validator-manager/erc20_token_staking.go b/tests/flows/validator-manager/erc20_token_staking.go index 82d8549b8..4f7925105 100644 --- a/tests/flows/validator-manager/erc20_token_staking.go +++ b/tests/flows/validator-manager/erc20_token_staking.go @@ -7,6 +7,7 @@ import ( "time" "github.com/ava-labs/avalanchego/ids" + "github.com/ava-labs/avalanchego/utils/units" "github.com/ava-labs/subnet-evm/accounts/abi/bind" exampleerc20 "github.com/ava-labs/teleporter/abi-bindings/go/mocks/ExampleERC20" erc20tokenstakingmanager "github.com/ava-labs/teleporter/abi-bindings/go/validator-manager/ERC20TokenStakingManager" @@ -51,7 +52,7 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { ctx, subnetAInfo, utils.ERC20TokenStakingManager, - 2, + []uint64{units.Schmeckle, 1000 * units.Schmeckle}, // Choose weights to avoid validator churn limits fundedKey, false, ) diff --git a/tests/flows/validator-manager/native_token_staking.go b/tests/flows/validator-manager/native_token_staking.go index 102ebb046..8470edbae 100644 --- a/tests/flows/validator-manager/native_token_staking.go +++ b/tests/flows/validator-manager/native_token_staking.go @@ -7,6 +7,7 @@ import ( "time" "github.com/ava-labs/avalanchego/ids" + "github.com/ava-labs/avalanchego/utils/units" "github.com/ava-labs/subnet-evm/accounts/abi/bind" nativetokenstakingmanager "github.com/ava-labs/teleporter/abi-bindings/go/validator-manager/NativeTokenStakingManager" iposvalidatormanager "github.com/ava-labs/teleporter/abi-bindings/go/validator-manager/interfaces/IPoSValidatorManager" @@ -50,7 +51,7 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { ctx, subnetAInfo, utils.NativeTokenStakingManager, - 2, + []uint64{units.Schmeckle, 1000 * units.Schmeckle}, // Choose weights to avoid validator churn limits fundedKey, false, ) diff --git a/tests/flows/validator-manager/poa_to_pos.go b/tests/flows/validator-manager/poa_to_pos.go index 409741f02..c7026a404 100644 --- a/tests/flows/validator-manager/poa_to_pos.go +++ b/tests/flows/validator-manager/poa_to_pos.go @@ -6,6 +6,7 @@ import ( "time" "github.com/ava-labs/avalanchego/ids" + "github.com/ava-labs/avalanchego/utils/units" "github.com/ava-labs/subnet-evm/accounts/abi/bind" nativetokenstakingmanager "github.com/ava-labs/teleporter/abi-bindings/go/validator-manager/NativeTokenStakingManager" poavalidatormanager "github.com/ava-labs/teleporter/abi-bindings/go/validator-manager/PoAValidatorManager" @@ -71,7 +72,7 @@ func PoAMigrationToPoS(network *localnetwork.LocalNetwork) { ctx, subnetAInfo, utils.PoAValidatorManager, - 2, + []uint64{units.Schmeckle, 1000 * units.Schmeckle}, // Choose weights to avoid validator churn limits ownerKey, true, ) diff --git a/tests/network/network.go b/tests/network/network.go index c6aeadfa5..58ad696c5 100644 --- a/tests/network/network.go +++ b/tests/network/network.go @@ -189,7 +189,7 @@ func (n *LocalNetwork) ConvertSubnet( ctx context.Context, subnet interfaces.SubnetTestInfo, managerType utils.ValidatorManagerConcreteType, - numInitialNodes int, + weights []uint64, senderKey *ecdsa.PrivateKey, proxy bool, ) ([]utils.Node, []ids.ID, *proxyadmin.ProxyAdmin) { @@ -207,7 +207,7 @@ func (n *LocalNetwork) ConvertSubnet( ) n.validatorManagers[subnet.SubnetID] = vdrManagerAddress - tmpnetNodes := n.GetExtraNodes(numInitialNodes) + tmpnetNodes := n.GetExtraNodes(len(weights)) sort.Slice(tmpnetNodes, func(i, j int) bool { return string(tmpnetNodes[i].NodeID.Bytes()) < string(tmpnetNodes[j].NodeID.Bytes()) }) @@ -218,22 +218,16 @@ func (n *LocalNetwork) ConvertSubnet( Expect(err).Should(BeNil()) vdrs := make([]*txs.ConvertSubnetValidator, len(tmpnetNodes)) for i, node := range tmpnetNodes { - weight := units.Schmeckle - if i == len(tmpnetNodes)-1 { - // Give one validator a higher weight so churn limits aren't violated - weight = 1000 * weight - } - signer, err := node.GetProofOfPossession() Expect(err).Should(BeNil()) nodes = append(nodes, utils.Node{ NodeID: node.NodeID, NodePoP: signer, - Weight: weight, + Weight: weights[i], }) vdrs[i] = &txs.ConvertSubnetValidator{ NodeID: node.NodeID.Bytes(), - Weight: weight, + Weight: weights[i], Balance: units.Avax * 100, Signer: *signer, RemainingBalanceOwner: warpMessage.PChainOwner{ diff --git a/tests/suites/teleporter/teleporter_suite_test.go b/tests/suites/teleporter/teleporter_suite_test.go index 30c917570..d36b382ce 100644 --- a/tests/suites/teleporter/teleporter_suite_test.go +++ b/tests/suites/teleporter/teleporter_suite_test.go @@ -9,6 +9,7 @@ import ( "testing" "time" + "github.com/ava-labs/avalanchego/utils/units" teleporterFlows "github.com/ava-labs/teleporter/tests/flows/teleporter" registryFlows "github.com/ava-labs/teleporter/tests/flows/teleporter/registry" localnetwork "github.com/ava-labs/teleporter/tests/network" @@ -71,7 +72,7 @@ var _ = ginkgo.BeforeSuite(func() { TeleporterContractAddress: teleporterContractAddress, TeleporterDeployedBytecode: teleporterDeployedBytecode, TeleporterDeployerAddress: teleporterDeployerAddress, - NodeCount: 2, + NodeCount: 5, }, { Name: "B", @@ -79,7 +80,7 @@ var _ = ginkgo.BeforeSuite(func() { TeleporterContractAddress: teleporterContractAddress, TeleporterDeployedBytecode: teleporterDeployedBytecode, TeleporterDeployerAddress: teleporterDeployerAddress, - NodeCount: 2, + NodeCount: 5, }, }, 2, @@ -105,7 +106,14 @@ var _ = ginkgo.BeforeSuite(func() { } for _, subnet := range LocalNetworkInstance.GetSubnetsInfo() { - LocalNetworkInstance.ConvertSubnet(ctx, subnet, utils.PoAValidatorManager, 2, fundedKey, false) + // Choose weights such that we can test validator churn + LocalNetworkInstance.ConvertSubnet( + ctx, + subnet, + utils.PoAValidatorManager, + []uint64{units.Schmeckle, units.Schmeckle, units.Schmeckle, units.Schmeckle, units.Schmeckle}, + fundedKey, + false) } log.Info("Set up ginkgo before suite") From f53242c19ed122387c582e73bd294fc6ad93e301 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Fri, 8 Nov 2024 21:17:59 -0600 Subject: [PATCH 17/34] wait to allow churn period to roll over --- tests/flows/teleporter/validator_churn.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/flows/teleporter/validator_churn.go b/tests/flows/teleporter/validator_churn.go index a823e0a65..a043e32b0 100644 --- a/tests/flows/teleporter/validator_churn.go +++ b/tests/flows/teleporter/validator_churn.go @@ -106,6 +106,8 @@ func ValidatorChurn(network *localnetwork.LocalNetwork, teleporter utils.Telepor network.GetPChainWallet(), network.GetNetworkID(), ) + // Sleep to ensure the validator manager uses a new churn tracking period + time.Sleep(5 * time.Second) } // Refresh the subnet info From f7629d2555e8bab6bce6ccc60441965356a5c3f6 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Tue, 12 Nov 2024 13:12:48 -0600 Subject: [PATCH 18/34] remove bootstrap vdrs from subnet --- go.mod | 32 +++++++++- go.sum | 64 +++++++++++++++++-- .../registry/teleporter_registry.go | 3 - tests/network/network.go | 17 +++-- 4 files changed, 97 insertions(+), 19 deletions(-) diff --git a/go.mod b/go.mod index 58eb982f6..aef2d58a7 100644 --- a/go.mod +++ b/go.mod @@ -3,12 +3,12 @@ module github.com/ava-labs/teleporter go 1.22.8 require ( - github.com/ava-labs/avalanchego v1.12.0-initial-poc.6 - github.com/supranational/blst v0.3.11 // indirect + github.com/ava-labs/avalanchego v1.12.0-initial-poc.8 + github.com/supranational/blst v0.3.13 // indirect ) require ( - github.com/ava-labs/awm-relayer v1.4.1-0.20241010161724-2db445c994d6 + github.com/ava-labs/awm-relayer v1.4.1-0.20241112172851-472c76dde821 github.com/ava-labs/subnet-evm v0.6.11 github.com/ethereum/go-ethereum v1.13.14 github.com/onsi/ginkgo/v2 v2.21.0 @@ -48,6 +48,7 @@ require ( github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect github.com/dlclark/regexp2 v1.7.0 // indirect github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127 // indirect + github.com/emicklei/go-restful/v3 v3.11.0 // indirect github.com/ethereum/c-kzg-4844 v0.4.0 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 // indirect @@ -57,12 +58,18 @@ require ( github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.3.0 // indirect + github.com/go-openapi/jsonpointer v0.19.6 // indirect + github.com/go-openapi/jsonreference v0.20.2 // indirect + github.com/go-openapi/swag v0.22.3 // indirect github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect github.com/google/btree v1.1.2 // indirect + github.com/google/gnostic-models v0.6.8 // indirect github.com/google/go-cmp v0.6.0 // indirect + github.com/google/gofuzz v1.2.0 // indirect github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db // indirect github.com/google/renameio/v2 v2.0.0 // indirect github.com/google/uuid v1.6.0 // indirect @@ -82,18 +89,25 @@ require ( github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jackpal/gateway v1.0.6 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.17.9 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/magiconair/properties v1.8.7 // indirect + github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.17 // indirect github.com/mattn/go-runewidth v0.0.13 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/pointerstructure v1.2.0 // indirect github.com/mmcloughlin/addchain v0.4.0 // indirect + github.com/moby/spdystream v0.2.0 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/pelletier/go-toml/v2 v2.0.8 // indirect @@ -136,6 +150,7 @@ require ( golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/net v0.30.0 // indirect + golang.org/x/oauth2 v0.22.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/term v0.25.0 // indirect @@ -145,8 +160,19 @@ require ( google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect google.golang.org/grpc v1.67.1 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect + k8s.io/api v0.29.0 // indirect + k8s.io/apimachinery v0.29.0 // indirect + k8s.io/client-go v0.29.0 // indirect + k8s.io/klog/v2 v2.110.1 // indirect + k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect + k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect rsc.io/tmplfunc v0.0.3 // indirect + sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect + sigs.k8s.io/yaml v1.3.0 // indirect ) diff --git a/go.sum b/go.sum index f8f83a7bb..3dcb0749d 100644 --- a/go.sum +++ b/go.sum @@ -56,10 +56,14 @@ 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.12.0-initial-poc.6 h1:7Ijm0POq/NGX6jQG08BlOPfuHi9JYtDy4HylNAjel2A= -github.com/ava-labs/avalanchego v1.12.0-initial-poc.6/go.mod h1:gYlTU42Q4b29hzhUN22yclym5qwB3Si0jh4+LTn7DZM= +github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= +github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= +github.com/ava-labs/avalanchego v1.12.0-initial-poc.8 h1:UuCN1CYPZgf2FGGaO4XURVPWHjbv2U++VkarrADeT64= +github.com/ava-labs/avalanchego v1.12.0-initial-poc.8/go.mod h1:86tO6F1FT8emclUwdQ2WCwAtAerqjm5A4IbV6XxNUyM= github.com/ava-labs/awm-relayer v1.4.1-0.20241010161724-2db445c994d6 h1:WdFWoZ8clWfTPp3cKyWYTsveMKW/0SQzWk8U1aCcdnw= github.com/ava-labs/awm-relayer v1.4.1-0.20241010161724-2db445c994d6/go.mod h1:6eqh3V1Og40gXmZUOP6tCrlmMEcVuj9l737yYh1s8uw= +github.com/ava-labs/awm-relayer v1.4.1-0.20241112172851-472c76dde821 h1:0T6NvMMTI/Wg8mINllGe331BzylMIWLVi3my6SunOek= +github.com/ava-labs/awm-relayer v1.4.1-0.20241112172851-472c76dde821/go.mod h1:BhcOTNDB8JH5dAP77TOSxPwXYX/cOO4XlqKzmKX/DGQ= github.com/ava-labs/coreth v0.13.8 h1:f14X3KgwHl9LwzfxlN6S4bbn5VA2rhEsNnHaRLSTo/8= github.com/ava-labs/coreth v0.13.8/go.mod h1:t3BSv/eQv0AlDPMfEDCMMoD/jq1RkUsbFzQAFg5qBcE= github.com/ava-labs/subnet-evm v0.6.11 h1:XgIAn9ihPyGjrBFD2rXg2H76HFl6htliHabN0fjciaQ= @@ -165,6 +169,8 @@ github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA github.com/dop251/goja_nodejs v0.0.0-20211022123610-8dd9abb0616d/go.mod h1:DngW8aVqWbuLRMHItjPUyqdj+HWPvnQe8V8y1nDpIbM= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM= +github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= +github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -206,6 +212,7 @@ github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9 github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= @@ -214,6 +221,12 @@ github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AE github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= +github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= +github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= +github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= +github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= +github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= +github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-sourcemap/sourcemap v2.1.3+incompatible h1:W1iEw64niKVGogNgBN3ePyLFfuisuzeidWPMPWmECqU= github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= @@ -270,6 +283,8 @@ github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Z github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= +github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= +github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -280,10 +295,13 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -317,6 +335,7 @@ github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB7 github.com/gorilla/rpc v1.2.0 h1:WvvdC2lNeT1SP32zrIce5l0ECBfbAlmrmSBsuc57wfk= github.com/gorilla/rpc v1.2.0/go.mod h1:V4h9r+4sF5HnzqbwIez0fKSpANP0zlYd3qR7p36jkTQ= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= @@ -362,9 +381,13 @@ github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7Bd github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= @@ -401,6 +424,8 @@ github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2 github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= @@ -430,15 +455,22 @@ github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8oh github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= +github.com/moby/spdystream v0.2.0 h1:cjW1zVyyoiM0T7b6UoySUFqzXMoqRckQtXwGPiBhOM8= +github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus= +github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= @@ -546,13 +578,14 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= -github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4= -github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= +github.com/supranational/blst v0.3.13 h1:AYeSxdOMacwu7FBmpfloBz5pbFXDmJL33RuwnKtmTjk= +github.com/supranational/blst v0.3.13/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a h1:1ur3QoCqvE5fl+nylMaIr9PVV1w343YRDtsy+Rwu7XI= github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= @@ -735,6 +768,8 @@ golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA= +golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1014,6 +1049,8 @@ gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= +gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.51.1/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= @@ -1025,6 +1062,7 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWD gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= @@ -1040,8 +1078,26 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +k8s.io/api v0.29.0 h1:NiCdQMY1QOp1H8lfRyeEf8eOwV6+0xA6XEE44ohDX2A= +k8s.io/api v0.29.0/go.mod h1:sdVmXoz2Bo/cb77Pxi71IPTSErEW32xa4aXwKH7gfBA= +k8s.io/apimachinery v0.29.0 h1:+ACVktwyicPz0oc6MTMLwa2Pw3ouLAfAon1wPLtG48o= +k8s.io/apimachinery v0.29.0/go.mod h1:eVBxQ/cwiJxH58eK/jd/vAk4mrxmVlnpBH5J2GbMeis= +k8s.io/client-go v0.29.0 h1:KmlDtFcrdUzOYrBhXHgKw5ycWzc3ryPX5mQe0SkG3y8= +k8s.io/client-go v0.29.0/go.mod h1:yLkXH4HKMAywcrD82KMSmfYg2DlE8mepPR4JGSo5n38= +k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0= +k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo= +k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780= +k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA= +k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= +k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= +sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= +sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= diff --git a/tests/flows/teleporter/registry/teleporter_registry.go b/tests/flows/teleporter/registry/teleporter_registry.go index 1251fb820..85d252737 100644 --- a/tests/flows/teleporter/registry/teleporter_registry.go +++ b/tests/flows/teleporter/registry/teleporter_registry.go @@ -7,7 +7,6 @@ import ( localnetwork "github.com/ava-labs/teleporter/tests/network" "github.com/ava-labs/teleporter/tests/utils" "github.com/ethereum/go-ethereum/common" - "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) @@ -16,8 +15,6 @@ const ( ) func TeleporterRegistry(network *localnetwork.LocalNetwork, teleporter utils.TeleporterTestInfo) { - ginkgo.Skip("Skipping test until Avalanchego supports restarting sov nodes") - // Deploy dApp on both chains that use Teleporter Registry // Deploy version 2 of Teleporter to both chains // Construct AddProtocolVersion txs for both chains diff --git a/tests/network/network.go b/tests/network/network.go index 58ad696c5..9e5b3fbed 100644 --- a/tests/network/network.go +++ b/tests/network/network.go @@ -195,7 +195,7 @@ func (n *LocalNetwork) ConvertSubnet( ) ([]utils.Node, []ids.ID, *proxyadmin.ProxyAdmin) { cChainInfo := n.GetPrimaryNetworkInfo() pClient := platformvm.NewClient(cChainInfo.NodeURIs[0]) - _, err := pClient.GetCurrentValidators(ctx, subnet.SubnetID, nil) + currentValidators, err := pClient.GetCurrentValidators(ctx, subnet.SubnetID, nil) Expect(err).Should(BeNil()) vdrManagerAddress, proxyAdmin := utils.DeployAndInitializeValidatorManager( @@ -265,13 +265,12 @@ func (n *LocalNetwork) ConvertSubnet( nodes, ) - // Remove the bootstrap node as a subnet validator - // TODO: This is not currently supported by the poc tag - // for _, vdr := range currentValidators { - // tx, err := pChainWallet.IssueRemoveSubnetValidatorTx(vdr.NodeID, subnet.SubnetID) - // Expect(err).Should(BeNil()) - // utils.WaitForTransactionSuccess(ctx, subnet, common.BytesToHash(tx.TxID[:])) - // } + // Remove the bootstrap nodes as subnet validators + for _, vdr := range currentValidators { + _, err := pChainWallet.IssueRemoveSubnetValidatorTx(vdr.NodeID, subnet.SubnetID) + Expect(err).Should(BeNil()) + } + return nodes, validationIDs, proxyAdmin } @@ -519,7 +518,7 @@ func (n *LocalNetwork) SetChainConfigs(chainConfigs map[string]string) { } // Restart the network to apply the new chain configs - ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), time.Duration(60*len(n.Network.Nodes))*time.Second) defer cancel() err = n.Network.Restart(ctx, os.Stdout) Expect(err).Should(BeNil()) From 8e4025d3f823747796588fce325fb2e7f405549f Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Tue, 12 Nov 2024 13:15:44 -0600 Subject: [PATCH 19/34] go mod tidy --- go.sum | 2 -- 1 file changed, 2 deletions(-) diff --git a/go.sum b/go.sum index 3dcb0749d..758f1df2c 100644 --- a/go.sum +++ b/go.sum @@ -60,8 +60,6 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPd github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/ava-labs/avalanchego v1.12.0-initial-poc.8 h1:UuCN1CYPZgf2FGGaO4XURVPWHjbv2U++VkarrADeT64= github.com/ava-labs/avalanchego v1.12.0-initial-poc.8/go.mod h1:86tO6F1FT8emclUwdQ2WCwAtAerqjm5A4IbV6XxNUyM= -github.com/ava-labs/awm-relayer v1.4.1-0.20241010161724-2db445c994d6 h1:WdFWoZ8clWfTPp3cKyWYTsveMKW/0SQzWk8U1aCcdnw= -github.com/ava-labs/awm-relayer v1.4.1-0.20241010161724-2db445c994d6/go.mod h1:6eqh3V1Og40gXmZUOP6tCrlmMEcVuj9l737yYh1s8uw= github.com/ava-labs/awm-relayer v1.4.1-0.20241112172851-472c76dde821 h1:0T6NvMMTI/Wg8mINllGe331BzylMIWLVi3my6SunOek= github.com/ava-labs/awm-relayer v1.4.1-0.20241112172851-472c76dde821/go.mod h1:BhcOTNDB8JH5dAP77TOSxPwXYX/cOO4XlqKzmKX/DGQ= github.com/ava-labs/coreth v0.13.8 h1:f14X3KgwHl9LwzfxlN6S4bbn5VA2rhEsNnHaRLSTo/8= From 9c783f5b391da1eef79e7ba2b5849f82fb52b455 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Tue, 12 Nov 2024 15:00:19 -0600 Subject: [PATCH 20/34] cleanup --- tests/network/network.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/network/network.go b/tests/network/network.go index 9e5b3fbed..75ed2be9e 100644 --- a/tests/network/network.go +++ b/tests/network/network.go @@ -77,9 +77,6 @@ func NewLocalNetwork( // Create extra nodes to be used to add more validators later extraNodes := subnetEvmTestUtils.NewTmpnetNodes(extraNodeCount) - // var allNodes []*tmpnet.Node - // allNodes = append(allNodes, extraNodes...) // to be appended w/ subnet validators - fundedKey, err := hex.DecodeString(fundedKeyStr) Expect(err).Should(BeNil()) globalFundedKey, err := secp256k1.ToPrivateKey(fundedKey) @@ -94,12 +91,10 @@ func NewLocalNetwork( // Create a single bootstrap node. This will be removed from the subnet validator set after it is converted, // but will remain a primary network validator boostrapNodes := subnetEvmTestUtils.NewTmpnetNodes(1) // One bootstrap node per subnet - // allNodes = append(allNodes, boostrapNodes...) bootstrapNodes = append(bootstrapNodes, boostrapNodes...) // Create validators to specify as the initial vdr set in the subnet conversion, and store them as extra nodes initialVdrNodes := subnetEvmTestUtils.NewTmpnetNodes(subnetSpec.NodeCount) - // allNodes = append(allNodes, initialVdrNodes...) extraNodes = append(extraNodes, initialVdrNodes...) subnet := subnetEvmTestUtils.NewTmpnetSubnet( @@ -323,7 +318,6 @@ func (n *LocalNetwork) GetSignatureAggregator() *aggregator.SignatureAggregator } func (n *LocalNetwork) GetExtraNodes(count int) []*tmpnet.Node { - Expect(count > 0).Should(BeTrue(), "can't add 0 validators") Expect(len(n.extraNodes) >= count).Should( BeTrue(), "not enough extra nodes to use", From 19f10475dc5cc5cdce3c2b2e8a5a2e68d3a3cc14 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Wed, 13 Nov 2024 12:38:27 -0600 Subject: [PATCH 21/34] remove unused method --- tests/network/network.go | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/tests/network/network.go b/tests/network/network.go index 75ed2be9e..57605d32d 100644 --- a/tests/network/network.go +++ b/tests/network/network.go @@ -438,44 +438,6 @@ func (n *LocalNetwork) TearDownNetwork() { Expect(n.Network.Stop(context.Background())).Should(BeNil()) } -// Restarts the nodes with the given nodeIDs. If nodeIDs is empty, restarts all nodes. -func (n *LocalNetwork) RestartNodes(ctx context.Context, nodeIDs []ids.NodeID) { - log.Info("Restarting nodes", "nodeIDs", nodeIDs) - var nodes []*tmpnet.Node - if len(nodeIDs) == 0 { - nodes = n.Network.Nodes - } else { - for _, nodeID := range nodeIDs { - for _, node := range n.Network.Nodes { - if node.NodeID == nodeID { - nodes = append(nodes, node) - } - } - } - } - - for _, node := range nodes { - ctx, cancel := context.WithCancel(ctx) - defer cancel() - err := node.SaveAPIPort() - Expect(err).Should(BeNil()) - - err = node.Stop(ctx) - Expect(err).Should(BeNil()) - - err = n.Network.StartNode(ctx, os.Stdout, node) - Expect(err).Should(BeNil()) - } - - log.Info("Waiting for all nodes to report healthy") - ctx, cancel := context.WithTimeout(ctx, 30*time.Second) - defer cancel() - for _, node := range nodes { - err := tmpnet.WaitForHealthy(ctx, node) - Expect(err).Should(BeNil()) - } -} - func (n *LocalNetwork) SetChainConfigs(chainConfigs map[string]string) { for chainIDStr, chainConfig := range chainConfigs { if chainIDStr == utils.CChainPathSpecifier { From 5b3a79c17d19462e370cd51dccb7e9174666adea Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Wed, 13 Nov 2024 15:51:59 -0600 Subject: [PATCH 22/34] parameterize number of primary network validators --- tests/network/network.go | 13 +++++++------ tests/suites/governance/governance_suite_test.go | 1 + tests/suites/ictt/ictt_suite_test.go | 1 + tests/suites/teleporter/teleporter_suite_test.go | 1 + .../validator_manager_suite_test.go | 1 + 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/network/network.go b/tests/network/network.go index 57605d32d..bb83ad8fd 100644 --- a/tests/network/network.go +++ b/tests/network/network.go @@ -70,9 +70,11 @@ func NewLocalNetwork( name string, warpGenesisTemplateFile string, subnetSpecs []SubnetSpec, + numPrimaryNetworkValidators int, extraNodeCount int, // for use by tests, eg to add new subnet validators ) *LocalNetwork { - var err error + // There must be at least one primary network validator per subnet + Expect(numPrimaryNetworkValidators).Should(BeNumerically(">=", len(subnetSpecs))) // Create extra nodes to be used to add more validators later extraNodes := subnetEvmTestUtils.NewTmpnetNodes(extraNodeCount) @@ -86,12 +88,11 @@ func NewLocalNetwork( Expect(err).Should(BeNil()) var subnets []*tmpnet.Subnet - var bootstrapNodes []*tmpnet.Node - for _, subnetSpec := range subnetSpecs { + bootstrapNodes := subnetEvmTestUtils.NewTmpnetNodes(numPrimaryNetworkValidators) + for i, subnetSpec := range subnetSpecs { // Create a single bootstrap node. This will be removed from the subnet validator set after it is converted, // but will remain a primary network validator - boostrapNodes := subnetEvmTestUtils.NewTmpnetNodes(1) // One bootstrap node per subnet - bootstrapNodes = append(bootstrapNodes, boostrapNodes...) + initialSubnetBootstrapper := bootstrapNodes[i] // One bootstrap node per subnet // Create validators to specify as the initial vdr set in the subnet conversion, and store them as extra nodes initialVdrNodes := subnetEvmTestUtils.NewTmpnetNodes(subnetSpec.NodeCount) @@ -107,7 +108,7 @@ func NewLocalNetwork( subnetSpec.TeleporterDeployerAddress, ), utils.WarpEnabledChainConfig, - bootstrapNodes..., + initialSubnetBootstrapper, ) subnet.OwningKey = globalFundedKey subnets = append(subnets, subnet) diff --git a/tests/suites/governance/governance_suite_test.go b/tests/suites/governance/governance_suite_test.go index dc94a2cde..06a909d5e 100644 --- a/tests/suites/governance/governance_suite_test.go +++ b/tests/suites/governance/governance_suite_test.go @@ -53,6 +53,7 @@ var _ = ginkgo.BeforeSuite(func() { }, }, 2, + 2, ) log.Info("Started local network") }) diff --git a/tests/suites/ictt/ictt_suite_test.go b/tests/suites/ictt/ictt_suite_test.go index d984c9877..a21b6fc83 100644 --- a/tests/suites/ictt/ictt_suite_test.go +++ b/tests/suites/ictt/ictt_suite_test.go @@ -84,6 +84,7 @@ var _ = ginkgo.BeforeSuite(func() { }, }, 2, + 2, ) TeleporterInfo = utils.NewTeleporterTestInfo(LocalNetworkInstance.GetAllSubnetsInfo()) log.Info("Started local network") diff --git a/tests/suites/teleporter/teleporter_suite_test.go b/tests/suites/teleporter/teleporter_suite_test.go index d36b382ce..bf37d4a96 100644 --- a/tests/suites/teleporter/teleporter_suite_test.go +++ b/tests/suites/teleporter/teleporter_suite_test.go @@ -84,6 +84,7 @@ var _ = ginkgo.BeforeSuite(func() { }, }, 2, + 2, ) TeleporterInfo = utils.NewTeleporterTestInfo(LocalNetworkInstance.GetAllSubnetsInfo()) log.Info("Started local network") diff --git a/tests/suites/validator-manager/validator_manager_suite_test.go b/tests/suites/validator-manager/validator_manager_suite_test.go index ccbd2f103..4e0d251fc 100644 --- a/tests/suites/validator-manager/validator_manager_suite_test.go +++ b/tests/suites/validator-manager/validator_manager_suite_test.go @@ -53,6 +53,7 @@ var _ = ginkgo.BeforeEach(func() { }, }, 2, + 2, ) log.Info("Started local network") }) From fdd3e578a5074f4079473e90a35e729cad63ec64 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Wed, 13 Nov 2024 15:53:52 -0600 Subject: [PATCH 23/34] depend on local relayer --- go.mod | 3 +++ go.sum | 2 -- tests/utils/chain.go | 17 +++++++++-------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index aef2d58a7..486794379 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,9 @@ module github.com/ava-labs/teleporter go 1.22.8 +// TODONOW: remove this +replace github.com/ava-labs/awm-relayer => /Users/cameron.schultz/awm-relayer + require ( github.com/ava-labs/avalanchego v1.12.0-initial-poc.8 github.com/supranational/blst v0.3.13 // indirect diff --git a/go.sum b/go.sum index 758f1df2c..5303f4d84 100644 --- a/go.sum +++ b/go.sum @@ -60,8 +60,6 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPd github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/ava-labs/avalanchego v1.12.0-initial-poc.8 h1:UuCN1CYPZgf2FGGaO4XURVPWHjbv2U++VkarrADeT64= github.com/ava-labs/avalanchego v1.12.0-initial-poc.8/go.mod h1:86tO6F1FT8emclUwdQ2WCwAtAerqjm5A4IbV6XxNUyM= -github.com/ava-labs/awm-relayer v1.4.1-0.20241112172851-472c76dde821 h1:0T6NvMMTI/Wg8mINllGe331BzylMIWLVi3my6SunOek= -github.com/ava-labs/awm-relayer v1.4.1-0.20241112172851-472c76dde821/go.mod h1:BhcOTNDB8JH5dAP77TOSxPwXYX/cOO4XlqKzmKX/DGQ= github.com/ava-labs/coreth v0.13.8 h1:f14X3KgwHl9LwzfxlN6S4bbn5VA2rhEsNnHaRLSTo/8= github.com/ava-labs/coreth v0.13.8/go.mod h1:t3BSv/eQv0AlDPMfEDCMMoD/jq1RkUsbFzQAFg5qBcE= github.com/ava-labs/subnet-evm v0.6.11 h1:XgIAn9ihPyGjrBFD2rXg2H76HFl6htliHabN0fjciaQ= diff --git a/tests/utils/chain.go b/tests/utils/chain.go index 713014596..16f01e843 100644 --- a/tests/utils/chain.go +++ b/tests/utils/chain.go @@ -556,27 +556,28 @@ func NewSignatureAggregator(apiUri string, subnets []ids.ID) *aggregator.Signatu trackedSubnets := set.NewSet[ids.ID](len(subnets)) trackedSubnets.Add(subnets...) registry := prometheus.NewRegistry() + messageCreator, err := message.NewCreator( + logging.NoLog{}, + registry, + constants.DefaultNetworkCompressionType, + constants.DefaultNetworkMaximumInboundTimeout, + ) + Expect(err).Should(BeNil()) + appRequestNetwork, err := peers.NewNetwork( logging.Info, registry, trackedSubnets, + messageCreator, &cfg, ) Expect(err).Should(BeNil()) - messageCreator, err := message.NewCreator( - logging.NoLog{}, - registry, - constants.DefaultNetworkCompressionType, - constants.DefaultNetworkMaximumInboundTimeout, - ) - Expect(err).Should(BeNil()) agg, err := aggregator.NewSignatureAggregator( appRequestNetwork, logging.NoLog{}, 1024, metrics.NewSignatureAggregatorMetrics(prometheus.NewRegistry()), - messageCreator, // Setting the etnaTime to a minute ago so that the post-etna code path is used in the test time.Now().Add(-1*time.Minute), ) From e632c55b748ac84e97ced12109b57d65c7d71d2a Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Wed, 13 Nov 2024 16:23:50 -0600 Subject: [PATCH 24/34] remove local dep --- go.mod | 5 +---- go.sum | 2 ++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 486794379..2bd6a6417 100644 --- a/go.mod +++ b/go.mod @@ -2,16 +2,13 @@ module github.com/ava-labs/teleporter go 1.22.8 -// TODONOW: remove this -replace github.com/ava-labs/awm-relayer => /Users/cameron.schultz/awm-relayer - require ( github.com/ava-labs/avalanchego v1.12.0-initial-poc.8 github.com/supranational/blst v0.3.13 // indirect ) require ( - github.com/ava-labs/awm-relayer v1.4.1-0.20241112172851-472c76dde821 + github.com/ava-labs/awm-relayer v1.4.1-0.20241113220127-99c58e925a75 github.com/ava-labs/subnet-evm v0.6.11 github.com/ethereum/go-ethereum v1.13.14 github.com/onsi/ginkgo/v2 v2.21.0 diff --git a/go.sum b/go.sum index 5303f4d84..2b3e73806 100644 --- a/go.sum +++ b/go.sum @@ -60,6 +60,8 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPd github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/ava-labs/avalanchego v1.12.0-initial-poc.8 h1:UuCN1CYPZgf2FGGaO4XURVPWHjbv2U++VkarrADeT64= github.com/ava-labs/avalanchego v1.12.0-initial-poc.8/go.mod h1:86tO6F1FT8emclUwdQ2WCwAtAerqjm5A4IbV6XxNUyM= +github.com/ava-labs/awm-relayer v1.4.1-0.20241113220127-99c58e925a75 h1:NHB3Br/TCFYZocy/DpQ1a/gx39JYcs4maWZ0fqgPazs= +github.com/ava-labs/awm-relayer v1.4.1-0.20241113220127-99c58e925a75/go.mod h1:OoI7lXzWjq6jAxnroOg588s7meyTl+ezVYIMjsP23BM= github.com/ava-labs/coreth v0.13.8 h1:f14X3KgwHl9LwzfxlN6S4bbn5VA2rhEsNnHaRLSTo/8= github.com/ava-labs/coreth v0.13.8/go.mod h1:t3BSv/eQv0AlDPMfEDCMMoD/jq1RkUsbFzQAFg5qBcE= github.com/ava-labs/subnet-evm v0.6.11 h1:XgIAn9ihPyGjrBFD2rXg2H76HFl6htliHabN0fjciaQ= From ea2c4d52e0ca7cbf7a30715f5900de8513f200aa Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Fri, 15 Nov 2024 15:06:59 -0600 Subject: [PATCH 25/34] wip --- go.mod | 2 + tests/network/network.go | 27 ++- .../teleporter/teleporter_suite_test.go | 163 +++++++++--------- tests/utils/chain.go | 3 +- 4 files changed, 103 insertions(+), 92 deletions(-) diff --git a/go.mod b/go.mod index 2bd6a6417..7d7938bde 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,8 @@ module github.com/ava-labs/teleporter go 1.22.8 +replace github.com/ava-labs/awm-relayer => /Users/cameron.schultz/awm-relayer + require ( github.com/ava-labs/avalanchego v1.12.0-initial-poc.8 github.com/supranational/blst v0.3.13 // indirect diff --git a/tests/network/network.go b/tests/network/network.go index bb83ad8fd..59870badb 100644 --- a/tests/network/network.go +++ b/tests/network/network.go @@ -6,6 +6,7 @@ import ( "encoding/base64" "encoding/hex" "encoding/json" + "fmt" goLog "log" "os" "sort" @@ -44,7 +45,7 @@ type LocalNetwork struct { tmpnet.Network extraNodes []*tmpnet.Node // to add as more subnet validators in the tests - primaryNetworkValidators []ids.NodeID + primaryNetworkValidators []*tmpnet.Node globalFundedKey *secp256k1.PrivateKey validatorManagers map[ids.ID]common.Address } @@ -165,9 +166,11 @@ func NewLocalNetwork( } // All nodes are specified as bootstrap validators - var primaryNetworkValidators []ids.NodeID + var primaryNetworkValidators []*tmpnet.Node + fmt.Println("Primary Network Validators") for _, node := range network.Nodes { - primaryNetworkValidators = append(primaryNetworkValidators, node.NodeID) + fmt.Println(node.NodeID, node.URI) + primaryNetworkValidators = append(primaryNetworkValidators, node) } localNetwork := &LocalNetwork{ @@ -265,6 +268,12 @@ func (n *LocalNetwork) ConvertSubnet( for _, vdr := range currentValidators { _, err := pChainWallet.IssueRemoveSubnetValidatorTx(vdr.NodeID, subnet.SubnetID) Expect(err).Should(BeNil()) + for _, node := range n.Network.Nodes { + if node.NodeID == vdr.NodeID { + fmt.Println("Restarting bootstrap node", node.NodeID) + n.Network.RestartNode(ctx, os.Stdout, node) + } + } } return nodes, validationIDs, proxyAdmin @@ -328,13 +337,14 @@ func (n *LocalNetwork) GetExtraNodes(count int) []*tmpnet.Node { return nodes } +func (n *LocalNetwork) GetPrimaryNetworkValidators() []*tmpnet.Node { + return n.primaryNetworkValidators +} + func (n *LocalNetwork) GetPrimaryNetworkInfo() interfaces.SubnetTestInfo { var nodeURIs []string - for _, nodeID := range n.primaryNetworkValidators { - uri, err := n.Network.GetURIForNodeID(nodeID) - Expect(err).Should(BeNil()) - - nodeURIs = append(nodeURIs, uri) + for _, node := range n.primaryNetworkValidators { + nodeURIs = append(nodeURIs, node.URI) } infoClient := info.NewClient(nodeURIs[0]) cChainBlockchainID, err := infoClient.GetBlockchainID(context.Background(), "C") @@ -492,7 +502,6 @@ func (n *LocalNetwork) Dir() string { func (n *LocalNetwork) GetPChainWallet() pwallet.Wallet { // Create the P-Chain wallet to issue transactions kc := secp256k1fx.NewKeychain(n.globalFundedKey) - n.GetSubnetsInfo() var subnetIDs []ids.ID for _, subnet := range n.GetSubnetsInfo() { subnetIDs = append(subnetIDs, subnet.SubnetID) diff --git a/tests/suites/teleporter/teleporter_suite_test.go b/tests/suites/teleporter/teleporter_suite_test.go index bf37d4a96..aa34ab891 100644 --- a/tests/suites/teleporter/teleporter_suite_test.go +++ b/tests/suites/teleporter/teleporter_suite_test.go @@ -11,8 +11,7 @@ import ( "github.com/ava-labs/avalanchego/utils/units" teleporterFlows "github.com/ava-labs/teleporter/tests/flows/teleporter" - registryFlows "github.com/ava-labs/teleporter/tests/flows/teleporter/registry" - localnetwork "github.com/ava-labs/teleporter/tests/network" + "github.com/ava-labs/teleporter/tests/network" "github.com/ava-labs/teleporter/tests/utils" deploymentUtils "github.com/ava-labs/teleporter/utils/deployment-utils" "github.com/ethereum/go-ethereum/log" @@ -30,7 +29,7 @@ const ( ) var ( - LocalNetworkInstance *localnetwork.LocalNetwork + LocalNetworkInstance *network.LocalNetwork TeleporterInfo utils.TeleporterTestInfo ) @@ -61,11 +60,11 @@ var _ = ginkgo.BeforeSuite(func() { ctx, cancel := context.WithTimeout(context.Background(), 120*2*time.Second) defer cancel() - LocalNetworkInstance = localnetwork.NewLocalNetwork( + LocalNetworkInstance = network.NewLocalNetwork( ctx, "teleporter-test-local-network", warpGenesisTemplateFile, - []localnetwork.SubnetSpec{ + []network.SubnetSpec{ { Name: "A", EVMChainID: 12345, @@ -132,81 +131,81 @@ var _ = ginkgo.Describe("[Teleporter integration tests]", func() { func() { teleporterFlows.BasicSendReceive(LocalNetworkInstance, TeleporterInfo) }) - ginkgo.It("Deliver to the wrong chain", - ginkgo.Label(teleporterMessengerLabel), - func() { - teleporterFlows.DeliverToWrongChain(LocalNetworkInstance, TeleporterInfo) - }) - ginkgo.It("Deliver to non-existent contract", - ginkgo.Label(teleporterMessengerLabel), - func() { - teleporterFlows.DeliverToNonExistentContract(LocalNetworkInstance, TeleporterInfo) - }) - ginkgo.It("Retry successful execution", - ginkgo.Label(teleporterMessengerLabel), - func() { - teleporterFlows.RetrySuccessfulExecution(LocalNetworkInstance, TeleporterInfo) - }) - ginkgo.It("Unallowed relayer", - ginkgo.Label(teleporterMessengerLabel), - func() { - teleporterFlows.UnallowedRelayer(LocalNetworkInstance, TeleporterInfo) - }) - ginkgo.It("Relay message twice", - ginkgo.Label(teleporterMessengerLabel), - func() { - teleporterFlows.RelayMessageTwice(LocalNetworkInstance, TeleporterInfo) - }) - ginkgo.It("Add additional fee amount", - ginkgo.Label(teleporterMessengerLabel), - func() { - teleporterFlows.AddFeeAmount(LocalNetworkInstance, TeleporterInfo) - }) - ginkgo.It("Send specific receipts", - ginkgo.Label(teleporterMessengerLabel), - func() { - teleporterFlows.SendSpecificReceipts(LocalNetworkInstance, TeleporterInfo) - }) - ginkgo.It("Insufficient gas", - ginkgo.Label(teleporterMessengerLabel), - func() { - teleporterFlows.InsufficientGas(LocalNetworkInstance, TeleporterInfo) - }) - ginkgo.It("Resubmit altered message", - ginkgo.Label(teleporterMessengerLabel), - func() { - teleporterFlows.ResubmitAlteredMessage(LocalNetworkInstance, TeleporterInfo) - }) - ginkgo.It("Calculate Teleporter message IDs", - ginkgo.Label(utilsLabel), - func() { - teleporterFlows.CalculateMessageID(LocalNetworkInstance, TeleporterInfo) - }) - ginkgo.It("Relayer modifies message", - ginkgo.Label(teleporterMessengerLabel), - func() { - teleporterFlows.RelayerModifiesMessage(LocalNetworkInstance, TeleporterInfo) - }) - ginkgo.It("Validator churn", - ginkgo.Label(teleporterMessengerLabel), - func() { - teleporterFlows.ValidatorChurn(LocalNetworkInstance, TeleporterInfo) - }) - - // Teleporter Registry tests - ginkgo.It("Teleporter registry", - ginkgo.Label(upgradabilityLabel), - func() { - registryFlows.TeleporterRegistry(LocalNetworkInstance, TeleporterInfo) - }) - ginkgo.It("Check upgrade access", - ginkgo.Label(upgradabilityLabel), - func() { - registryFlows.CheckUpgradeAccess(LocalNetworkInstance, TeleporterInfo) - }) - ginkgo.It("Pause and Unpause Teleporter", - ginkgo.Label(upgradabilityLabel), - func() { - registryFlows.PauseTeleporter(LocalNetworkInstance, TeleporterInfo) - }) + // ginkgo.It("Deliver to the wrong chain", + // ginkgo.Label(teleporterMessengerLabel), + // func() { + // teleporterFlows.DeliverToWrongChain(LocalNetworkInstance, TeleporterInfo) + // }) + // ginkgo.It("Deliver to non-existent contract", + // ginkgo.Label(teleporterMessengerLabel), + // func() { + // teleporterFlows.DeliverToNonExistentContract(LocalNetworkInstance, TeleporterInfo) + // }) + // ginkgo.It("Retry successful execution", + // ginkgo.Label(teleporterMessengerLabel), + // func() { + // teleporterFlows.RetrySuccessfulExecution(LocalNetworkInstance, TeleporterInfo) + // }) + // ginkgo.It("Unallowed relayer", + // ginkgo.Label(teleporterMessengerLabel), + // func() { + // teleporterFlows.UnallowedRelayer(LocalNetworkInstance, TeleporterInfo) + // }) + // ginkgo.It("Relay message twice", + // ginkgo.Label(teleporterMessengerLabel), + // func() { + // teleporterFlows.RelayMessageTwice(LocalNetworkInstance, TeleporterInfo) + // }) + // ginkgo.It("Add additional fee amount", + // ginkgo.Label(teleporterMessengerLabel), + // func() { + // teleporterFlows.AddFeeAmount(LocalNetworkInstance, TeleporterInfo) + // }) + // ginkgo.It("Send specific receipts", + // ginkgo.Label(teleporterMessengerLabel), + // func() { + // teleporterFlows.SendSpecificReceipts(LocalNetworkInstance, TeleporterInfo) + // }) + // ginkgo.It("Insufficient gas", + // ginkgo.Label(teleporterMessengerLabel), + // func() { + // teleporterFlows.InsufficientGas(LocalNetworkInstance, TeleporterInfo) + // }) + // ginkgo.It("Resubmit altered message", + // ginkgo.Label(teleporterMessengerLabel), + // func() { + // teleporterFlows.ResubmitAlteredMessage(LocalNetworkInstance, TeleporterInfo) + // }) + // ginkgo.It("Calculate Teleporter message IDs", + // ginkgo.Label(utilsLabel), + // func() { + // teleporterFlows.CalculateMessageID(LocalNetworkInstance, TeleporterInfo) + // }) + // ginkgo.It("Relayer modifies message", + // ginkgo.Label(teleporterMessengerLabel), + // func() { + // teleporterFlows.RelayerModifiesMessage(LocalNetworkInstance, TeleporterInfo) + // }) + // ginkgo.It("Validator churn", + // ginkgo.Label(teleporterMessengerLabel), + // func() { + // teleporterFlows.ValidatorChurn(LocalNetworkInstance, TeleporterInfo) + // }) + + // // Teleporter Registry tests + // ginkgo.It("Teleporter registry", + // ginkgo.Label(upgradabilityLabel), + // func() { + // registryFlows.TeleporterRegistry(LocalNetworkInstance, TeleporterInfo) + // }) + // ginkgo.It("Check upgrade access", + // ginkgo.Label(upgradabilityLabel), + // func() { + // registryFlows.CheckUpgradeAccess(LocalNetworkInstance, TeleporterInfo) + // }) + // ginkgo.It("Pause and Unpause Teleporter", + // ginkgo.Label(upgradabilityLabel), + // func() { + // registryFlows.PauseTeleporter(LocalNetworkInstance, TeleporterInfo) + // }) }) diff --git a/tests/utils/chain.go b/tests/utils/chain.go index 16f01e843..eab21084e 100644 --- a/tests/utils/chain.go +++ b/tests/utils/chain.go @@ -565,10 +565,11 @@ func NewSignatureAggregator(apiUri string, subnets []ids.ID) *aggregator.Signatu Expect(err).Should(BeNil()) appRequestNetwork, err := peers.NewNetwork( - logging.Info, + logging.Off, registry, trackedSubnets, messageCreator, + nil, &cfg, ) Expect(err).Should(BeNil()) From 106a220b2b5720072cc9dc2fd24be3caec21c015 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Tue, 19 Nov 2024 18:12:21 -0600 Subject: [PATCH 26/34] wip --- go.mod | 20 ++++---- go.sum | 36 +++++++------- .../validator-manager/erc20_token_staking.go | 4 +- .../validator-manager/native_token_staking.go | 4 +- tests/network/network.go | 29 +++++------ tests/utils/chain.go | 8 +++- tests/utils/validator_manager.go | 48 +++++++++---------- 7 files changed, 77 insertions(+), 72 deletions(-) diff --git a/go.mod b/go.mod index 7d7938bde..4793b8b86 100644 --- a/go.mod +++ b/go.mod @@ -5,13 +5,13 @@ go 1.22.8 replace github.com/ava-labs/awm-relayer => /Users/cameron.schultz/awm-relayer require ( - github.com/ava-labs/avalanchego v1.12.0-initial-poc.8 + github.com/ava-labs/avalanchego v1.12.0-fuji github.com/supranational/blst v0.3.13 // indirect ) require ( - github.com/ava-labs/awm-relayer v1.4.1-0.20241113220127-99c58e925a75 - github.com/ava-labs/subnet-evm v0.6.11 + github.com/ava-labs/awm-relayer v0.0.0-00010101000000-000000000000 + github.com/ava-labs/subnet-evm v0.6.12 github.com/ethereum/go-ethereum v1.13.14 github.com/onsi/ginkgo/v2 v2.21.0 github.com/onsi/gomega v1.35.1 @@ -28,7 +28,7 @@ require ( github.com/DataDog/zstd v1.5.2 // indirect github.com/NYTimes/gziphandler v1.1.1 // indirect github.com/VictoriaMetrics/fastcache v1.12.1 // indirect - github.com/ava-labs/coreth v0.13.8 // indirect + github.com/ava-labs/coreth v0.13.9-rc.1 // 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 @@ -146,22 +146,22 @@ require ( go.opentelemetry.io/otel/sdk v1.22.0 // indirect go.opentelemetry.io/otel/trace v1.22.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect - go.uber.org/mock v0.4.0 // indirect + go.uber.org/mock v0.5.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/net v0.30.0 // indirect - golang.org/x/oauth2 v0.22.0 // indirect - golang.org/x/sync v0.8.0 // indirect + golang.org/x/oauth2 v0.23.0 // indirect + golang.org/x/sync v0.9.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect golang.org/x/time v0.3.0 // indirect gonum.org/v1/gonum v0.11.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect - google.golang.org/grpc v1.67.1 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect + google.golang.org/grpc v1.68.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect diff --git a/go.sum b/go.sum index 2b3e73806..a4a705560 100644 --- a/go.sum +++ b/go.sum @@ -58,14 +58,14 @@ github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= -github.com/ava-labs/avalanchego v1.12.0-initial-poc.8 h1:UuCN1CYPZgf2FGGaO4XURVPWHjbv2U++VkarrADeT64= -github.com/ava-labs/avalanchego v1.12.0-initial-poc.8/go.mod h1:86tO6F1FT8emclUwdQ2WCwAtAerqjm5A4IbV6XxNUyM= -github.com/ava-labs/awm-relayer v1.4.1-0.20241113220127-99c58e925a75 h1:NHB3Br/TCFYZocy/DpQ1a/gx39JYcs4maWZ0fqgPazs= -github.com/ava-labs/awm-relayer v1.4.1-0.20241113220127-99c58e925a75/go.mod h1:OoI7lXzWjq6jAxnroOg588s7meyTl+ezVYIMjsP23BM= -github.com/ava-labs/coreth v0.13.8 h1:f14X3KgwHl9LwzfxlN6S4bbn5VA2rhEsNnHaRLSTo/8= -github.com/ava-labs/coreth v0.13.8/go.mod h1:t3BSv/eQv0AlDPMfEDCMMoD/jq1RkUsbFzQAFg5qBcE= +github.com/ava-labs/avalanchego v1.12.0-fuji h1:o/GbXrqW9CAXu2jX/a1dZtvFiiSVCWomJZyxF4hCQOA= +github.com/ava-labs/avalanchego v1.12.0-fuji/go.mod h1:yhD5dpZyStIVbxQ550EDi5w5SL7DQ/xGE6TIxosb7U0= +github.com/ava-labs/coreth v0.13.9-rc.1 h1:qIICpC/OZGYUP37QnLgIqqwGmxnLwLpZaUlqJNI85vU= +github.com/ava-labs/coreth v0.13.9-rc.1/go.mod h1:7aMsRIo/3GBE44qWZMjnfqdqfcfZ5yShTTm2LObLaYo= github.com/ava-labs/subnet-evm v0.6.11 h1:XgIAn9ihPyGjrBFD2rXg2H76HFl6htliHabN0fjciaQ= github.com/ava-labs/subnet-evm v0.6.11/go.mod h1:fP46lzBtiniRfpNH+Qu9BFvSsa02YGkAobxinZ78gDU= +github.com/ava-labs/subnet-evm v0.6.12 h1:jL3FmjdFcNfS0qwbehwN6DkAg9y7zexB1riiGBxRsM0= +github.com/ava-labs/subnet-evm v0.6.12/go.mod h1:vffwL4UqAh7ibpWjveUuUhamm3a9w75q92bG5vXdX5k= 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= @@ -649,8 +649,8 @@ go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lI go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= -go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= @@ -766,8 +766,8 @@ golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA= -golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= +golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -780,8 +780,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= -golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= +golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1000,10 +1000,10 @@ google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 h1:wKguEg1hsxI2/L3hUYrpo1RVi48K+uTyzKqprwLXsb8= -google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 h1:hjSy6tcFQZ171igDaN5QHOw2n6vx40juYbC/x67CEhc= +google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:qpvKtACPCQhAdu3PyQgV4l3LMXZEtft7y8QcarRsp9I= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= @@ -1022,8 +1022,8 @@ google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= -google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= +google.golang.org/grpc v1.68.0 h1:aHQeeJbo8zAkAa3pRzrVjZlbz6uSfeOXlJNQM0RAbz0= +google.golang.org/grpc v1.68.0/go.mod h1:fmSPC5AsjSBCK54MyHRx48kpOti1/jRfOlwEWywNjWA= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/tests/flows/validator-manager/erc20_token_staking.go b/tests/flows/validator-manager/erc20_token_staking.go index 4f7925105..5f71bc5cd 100644 --- a/tests/flows/validator-manager/erc20_token_staking.go +++ b/tests/flows/validator-manager/erc20_token_staking.go @@ -155,7 +155,7 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { ) // Issue a tx to update the validator's weight on the P-Chain - network.GetPChainWallet().IssueSetSubnetValidatorWeightTx(signedWarpMessage.Bytes()) + network.GetPChainWallet().IssueSetL1ValidatorWeightTx(signedWarpMessage.Bytes()) utils.PChainProposerVMWorkaround(network.GetPChainWallet()) utils.AdvanceProposerVM(ctx, subnetAInfo, fundedKey, 5) @@ -223,7 +223,7 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { Expect(err).Should(BeNil()) // Issue a tx to update the validator's weight on the P-Chain - network.GetPChainWallet().IssueSetSubnetValidatorWeightTx(signedWarpMessage.Bytes()) + network.GetPChainWallet().IssueSetL1ValidatorWeightTx(signedWarpMessage.Bytes()) utils.PChainProposerVMWorkaround(network.GetPChainWallet()) utils.AdvanceProposerVM(ctx, subnetAInfo, fundedKey, 5) diff --git a/tests/flows/validator-manager/native_token_staking.go b/tests/flows/validator-manager/native_token_staking.go index 8470edbae..9e77eefe3 100644 --- a/tests/flows/validator-manager/native_token_staking.go +++ b/tests/flows/validator-manager/native_token_staking.go @@ -149,7 +149,7 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { ) // Issue a tx to update the validator's weight on the P-Chain - network.GetPChainWallet().IssueSetSubnetValidatorWeightTx(signedWarpMessage.Bytes()) + network.GetPChainWallet().IssueSetL1ValidatorWeightTx(signedWarpMessage.Bytes()) utils.PChainProposerVMWorkaround(network.GetPChainWallet()) utils.AdvanceProposerVM(ctx, subnetAInfo, fundedKey, 5) @@ -216,7 +216,7 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { Expect(err).Should(BeNil()) // Issue a tx to update the validator's weight on the P-Chain - network.GetPChainWallet().IssueSetSubnetValidatorWeightTx(signedWarpMessage.Bytes()) + network.GetPChainWallet().IssueSetL1ValidatorWeightTx(signedWarpMessage.Bytes()) utils.PChainProposerVMWorkaround(network.GetPChainWallet()) utils.AdvanceProposerVM(ctx, subnetAInfo, fundedKey, 5) diff --git a/tests/network/network.go b/tests/network/network.go index 59870badb..3912938bf 100644 --- a/tests/network/network.go +++ b/tests/network/network.go @@ -3,7 +3,6 @@ package network import ( "context" "crypto/ecdsa" - "encoding/base64" "encoding/hex" "encoding/json" "fmt" @@ -17,7 +16,6 @@ import ( "github.com/ava-labs/avalanchego/genesis" "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/tests/fixture/tmpnet" - "github.com/ava-labs/avalanchego/upgrade" "github.com/ava-labs/avalanchego/utils/crypto/secp256k1" "github.com/ava-labs/avalanchego/utils/formatting/address" "github.com/ava-labs/avalanchego/utils/units" @@ -123,15 +121,15 @@ func NewLocalNetwork( Expect(network).ShouldNot(BeNil()) // Activate Etna - upgrades := upgrade.Default - upgrades.EtnaTime = time.Now().Add(-1 * time.Minute) - upgradeJSON, err := json.Marshal(upgrades) - Expect(err).Should(BeNil()) + // upgrades := upgrade.Default + // upgrades.EtnaTime = time.Now().Add(-1 * time.Minute) + // upgradeJSON, err := json.Marshal(upgrades) + // Expect(err).Should(BeNil()) - upgradeBase64 := base64.StdEncoding.EncodeToString(upgradeJSON) - network.DefaultFlags.SetDefaults(tmpnet.FlagsMap{ - config.UpgradeFileContentKey: upgradeBase64, - }) + // upgradeBase64 := base64.StdEncoding.EncodeToString(upgradeJSON) + // network.DefaultFlags.SetDefaults(tmpnet.FlagsMap{ + // config.UpgradeFileContentKey: upgradeBase64, + // }) avalancheGoBuildPath, ok := os.LookupEnv("AVALANCHEGO_BUILD_PATH") Expect(ok).Should(Equal(true)) @@ -192,6 +190,7 @@ func (n *LocalNetwork) ConvertSubnet( senderKey *ecdsa.PrivateKey, proxy bool, ) ([]utils.Node, []ids.ID, *proxyadmin.ProxyAdmin) { + goLog.Println("Converting subnet", subnet.SubnetID) cChainInfo := n.GetPrimaryNetworkInfo() pClient := platformvm.NewClient(cChainInfo.NodeURIs[0]) currentValidators, err := pClient.GetCurrentValidators(ctx, subnet.SubnetID, nil) @@ -215,7 +214,7 @@ func (n *LocalNetwork) ConvertSubnet( // Construct the convert subnet info destAddr, err := address.ParseToID(utils.DefaultPChainAddress) Expect(err).Should(BeNil()) - vdrs := make([]*txs.ConvertSubnetValidator, len(tmpnetNodes)) + vdrs := make([]*txs.ConvertSubnetToL1Validator, len(tmpnetNodes)) for i, node := range tmpnetNodes { signer, err := node.GetProofOfPossession() Expect(err).Should(BeNil()) @@ -224,7 +223,7 @@ func (n *LocalNetwork) ConvertSubnet( NodePoP: signer, Weight: weights[i], }) - vdrs[i] = &txs.ConvertSubnetValidator{ + vdrs[i] = &txs.ConvertSubnetToL1Validator{ NodeID: node.NodeID.Bytes(), Weight: weights[i], Balance: units.Avax * 100, @@ -240,7 +239,7 @@ func (n *LocalNetwork) ConvertSubnet( } } pChainWallet := n.GetPChainWallet() - _, err = pChainWallet.IssueConvertSubnetTx( + _, err = pChainWallet.IssueConvertSubnetToL1Tx( subnet.SubnetID, subnet.BlockchainID, vdrManagerAddress[:], @@ -253,6 +252,7 @@ func (n *LocalNetwork) ConvertSubnet( utils.PChainProposerVMWorkaround(pChainWallet) utils.AdvanceProposerVM(ctx, subnet, senderKey, 5) + aggregator := n.GetSignatureAggregator() validationIDs := utils.InitializeValidatorSet( ctx, senderKey, @@ -260,9 +260,10 @@ func (n *LocalNetwork) ConvertSubnet( utils.GetPChainInfo(cChainInfo), vdrManagerAddress, n.GetNetworkID(), - n.GetSignatureAggregator(), + aggregator, nodes, ) + aggregator.Shutdown() // Remove the bootstrap nodes as subnet validators for _, vdr := range currentValidators { diff --git a/tests/utils/chain.go b/tests/utils/chain.go index eab21084e..5507f1cf1 100644 --- a/tests/utils/chain.go +++ b/tests/utils/chain.go @@ -565,7 +565,7 @@ func NewSignatureAggregator(apiUri string, subnets []ids.ID) *aggregator.Signatu Expect(err).Should(BeNil()) appRequestNetwork, err := peers.NewNetwork( - logging.Off, + logging.Verbo, registry, trackedSubnets, messageCreator, @@ -576,7 +576,11 @@ func NewSignatureAggregator(apiUri string, subnets []ids.ID) *aggregator.Signatu agg, err := aggregator.NewSignatureAggregator( appRequestNetwork, - logging.NoLog{}, + logging.NewLogger("dbg-sig-agg", logging.NewWrappedCore( + logging.Verbo, + os.Stdout, + logging.JSON.ConsoleEncoder(), + )), 1024, metrics.NewSignatureAggregatorMetrics(prometheus.NewRegistry()), // Setting the etnaTime to a minute ago so that the post-etna code path is used in the test diff --git a/tests/utils/validator_manager.go b/tests/utils/validator_manager.go index 8bd53fac9..15061dfb1 100644 --- a/tests/utils/validator_manager.go +++ b/tests/utils/validator_manager.go @@ -273,11 +273,11 @@ func InitializeValidatorSet( signatureAggregator *aggregator.SignatureAggregator, nodes []Node, ) []ids.ID { - log.Println("Initializing validator set") - initialValidators := make([]warpMessage.SubnetConversionValidatorData, len(nodes)) + log.Println("Initializing validator set", "subnet", subnetInfo.SubnetID) + initialValidators := make([]warpMessage.SubnetToL1ConverstionValidatorData, len(nodes)) initialValidatorsABI := make([]ivalidatormanager.InitialValidator, len(nodes)) for i, node := range nodes { - initialValidators[i] = warpMessage.SubnetConversionValidatorData{ + initialValidators[i] = warpMessage.SubnetToL1ConverstionValidatorData{ NodeID: node.NodeID.Bytes(), BLSPublicKey: node.NodePoP.PublicKey, Weight: nodes[i].Weight, @@ -289,7 +289,7 @@ func InitializeValidatorSet( } } - subnetConversionData := warpMessage.SubnetConversionData{ + subnetConversionData := warpMessage.SubnetToL1ConversionData{ SubnetID: subnetInfo.SubnetID, ManagerChainID: subnetInfo.BlockchainID, ManagerAddress: validatorManagerAddress[:], @@ -301,7 +301,7 @@ func InitializeValidatorSet( ValidatorManagerAddress: validatorManagerAddress, InitialValidators: initialValidatorsABI, } - subnetConversionID, err := warpMessage.SubnetConversionID(subnetConversionData) + subnetConversionID, err := warpMessage.SubnetToL1ConversionID(subnetConversionData) Expect(err).Should(BeNil()) subnetConversionSignedMessage := ConstructSubnetConversionMessage( subnetConversionID, @@ -553,7 +553,7 @@ func InitializeAndCompleteNativeValidatorRegistration( // (Sending to the P-Chain will be skipped for now) signedWarpMessage := ConstructSignedWarpMessage(ctx, receipt, subnetInfo, pChainInfo, nil, signatureAggregator) - _, err = pchainWallet.IssueRegisterSubnetValidatorTx( + _, err = pchainWallet.IssueRegisterL1ValidatorTx( 100*units.Avax, node.NodePoP.ProofOfPossession, signedWarpMessage.Bytes(), @@ -631,7 +631,7 @@ func InitializeAndCompleteERC20ValidatorRegistration( // Gather subnet-evm Warp signatures for the RegisterSubnetValidatorMessage & relay to the P-Chain signedWarpMessage := ConstructSignedWarpMessage(ctx, receipt, subnetInfo, pChainInfo, nil, signatureAggregator) - _, err = pchainWallet.IssueRegisterSubnetValidatorTx( + _, err = pchainWallet.IssueRegisterL1ValidatorTx( 100*units.Avax, node.NodePoP.ProofOfPossession, signedWarpMessage.Bytes(), @@ -699,7 +699,7 @@ func InitializeAndCompletePoAValidatorRegistration( // Gather subnet-evm Warp signatures for the RegisterSubnetValidatorMessage & relay to the P-Chain signedWarpMessage := ConstructSignedWarpMessage(ctx, receipt, subnetInfo, pChainInfo, nil, signatureAggregator) - _, err := pchainWallet.IssueRegisterSubnetValidatorTx( + _, err := pchainWallet.IssueRegisterL1ValidatorTx( 100*units.Avax, node.NodePoP.ProofOfPossession, signedWarpMessage.Bytes(), @@ -989,7 +989,7 @@ func InitializeAndCompleteEndInitialPoSValidation( Expect(err).Should(BeNil()) // Deliver the Warp message to the P-Chain - pchainWallet.IssueSetSubnetValidatorWeightTx(signedWarpMessage.Bytes()) + pchainWallet.IssueSetL1ValidatorWeightTx(signedWarpMessage.Bytes()) PChainProposerVMWorkaround(pchainWallet) AdvanceProposerVM(ctx, subnetInfo, fundedKey, 5) @@ -1066,7 +1066,7 @@ func InitializeAndCompleteEndPoSValidation( Expect(err).Should(BeNil()) // Deliver the Warp message to the P-Chain - pchainWallet.IssueSetSubnetValidatorWeightTx(signedWarpMessage.Bytes()) + pchainWallet.IssueSetL1ValidatorWeightTx(signedWarpMessage.Bytes()) PChainProposerVMWorkaround(pchainWallet) AdvanceProposerVM(ctx, subnetInfo, fundedKey, 5) @@ -1145,7 +1145,7 @@ func InitializeAndCompleteEndInitialPoAValidation( Expect(err).Should(BeNil()) // Deliver the Warp message to the P-Chain - pchainWallet.IssueSetSubnetValidatorWeightTx(signedWarpMessage.Bytes()) + pchainWallet.IssueSetL1ValidatorWeightTx(signedWarpMessage.Bytes()) PChainProposerVMWorkaround(pchainWallet) AdvanceProposerVM(ctx, subnetInfo, fundedKey, 5) @@ -1259,9 +1259,9 @@ func ConstructSubnetValidatorRegistrationMessageForInitialValidator( networkID uint32, signatureAggregator *aggregator.SignatureAggregator, ) *avalancheWarp.Message { - justification := platformvm.SubnetValidatorRegistrationJustification{ - Preimage: &platformvm.SubnetValidatorRegistrationJustification_ConvertSubnetTxData{ - ConvertSubnetTxData: &platformvm.SubnetIDIndex{ + justification := platformvm.L1ValidatorRegistrationJustification{ + Preimage: &platformvm.L1ValidatorRegistrationJustification_ConvertSubnetToL1TxData{ + ConvertSubnetToL1TxData: &platformvm.SubnetIDIndex{ SubnetId: subnet.SubnetID[:], Index: index, }, @@ -1270,7 +1270,7 @@ func ConstructSubnetValidatorRegistrationMessageForInitialValidator( justificationBytes, err := proto.Marshal(&justification) Expect(err).Should(BeNil()) - registrationPayload, err := warpMessage.NewSubnetValidatorRegistration(validationID, valid) + registrationPayload, err := warpMessage.NewL1ValidatorRegistration(validationID, valid) Expect(err).Should(BeNil()) registrationAddressedCall, err := warpPayload.NewAddressedCall(nil, registrationPayload.Bytes()) Expect(err).Should(BeNil()) @@ -1302,7 +1302,7 @@ func ConstructSubnetValidatorRegistrationMessage( networkID uint32, signatureAggregator *aggregator.SignatureAggregator, ) *avalancheWarp.Message { - msg, err := warpMessage.NewRegisterSubnetValidator( + msg, err := warpMessage.NewRegisterL1Validator( subnet.SubnetID, node.NodeID, node.NodePoP.PublicKey, @@ -1312,15 +1312,15 @@ func ConstructSubnetValidatorRegistrationMessage( node.Weight, ) Expect(err).Should(BeNil()) - justification := platformvm.SubnetValidatorRegistrationJustification{ - Preimage: &platformvm.SubnetValidatorRegistrationJustification_RegisterSubnetValidatorMessage{ - RegisterSubnetValidatorMessage: msg.Bytes(), + justification := platformvm.L1ValidatorRegistrationJustification{ + Preimage: &platformvm.L1ValidatorRegistrationJustification_RegisterL1ValidatorMessage{ + RegisterL1ValidatorMessage: msg.Bytes(), }, } justificationBytes, err := proto.Marshal(&justification) Expect(err).Should(BeNil()) - registrationPayload, err := warpMessage.NewSubnetValidatorRegistration(validationID, valid) + registrationPayload, err := warpMessage.NewL1ValidatorRegistration(validationID, valid) Expect(err).Should(BeNil()) registrationAddressedCall, err := warpPayload.NewAddressedCall(nil, registrationPayload.Bytes()) Expect(err).Should(BeNil()) @@ -1351,7 +1351,7 @@ func ConstructSubnetValidatorWeightUpdateMessage( signatureAggregator *aggregator.SignatureAggregator, networkID uint32, ) *avalancheWarp.Message { - payload, err := warpMessage.NewSubnetValidatorWeight(validationID, nonce, weight) + payload, err := warpMessage.NewL1ValidatorWeight(validationID, nonce, weight) Expect(err).Should(BeNil()) updateAddressedCall, err := warpPayload.NewAddressedCall(nil, payload.Bytes()) Expect(err).Should(BeNil()) @@ -1379,7 +1379,7 @@ func ConstructSubnetConversionMessage( networkID uint32, signatureAggregator *aggregator.SignatureAggregator, ) *avalancheWarp.Message { - subnetConversionPayload, err := warpMessage.NewSubnetConversion(subnetConversionID) + subnetConversionPayload, err := warpMessage.NewSubnetToL1Conversion(subnetConversionID) Expect(err).Should(BeNil()) subnetConversionAddressedCall, err := warpPayload.NewAddressedCall( nil, @@ -1422,7 +1422,7 @@ func ValidateRegisterSubnetValidatorMessage( var payloadInterface warpMessage.Payload ver, err := warpMessage.Codec.Unmarshal(msg.Payload, &payloadInterface) Expect(err).Should(BeNil()) - payload, ok := payloadInterface.(*warpMessage.RegisterSubnetValidator) + payload, ok := payloadInterface.(*warpMessage.RegisterL1Validator) Expect(ok).Should(BeTrue()) Expect(ver).Should(Equal(uint16(warpMessage.CodecVersion))) @@ -1444,7 +1444,7 @@ func ValidateSubnetValidatorWeightMessage( var payloadInterface warpMessage.Payload ver, err := warpMessage.Codec.Unmarshal(msg.Payload, &payloadInterface) Expect(err).Should(BeNil()) - payload, ok := payloadInterface.(*warpMessage.SubnetValidatorWeight) + payload, ok := payloadInterface.(*warpMessage.L1ValidatorWeight) Expect(ok).Should(BeTrue()) Expect(ver).Should(Equal(uint16(warpMessage.CodecVersion))) From d0fa5179a6ac31c0479bfcea2c202409056a0af2 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Thu, 21 Nov 2024 10:59:37 -0600 Subject: [PATCH 27/34] p2p tests passing --- go.sum | 2 - tests/network/network.go | 5 +- .../teleporter/teleporter_suite_test.go | 157 +++++++++--------- .../validator_manager_suite_test.go | 2 +- tests/utils/chain.go | 7 +- 5 files changed, 88 insertions(+), 85 deletions(-) diff --git a/go.sum b/go.sum index a4a705560..8b6c84b17 100644 --- a/go.sum +++ b/go.sum @@ -62,8 +62,6 @@ github.com/ava-labs/avalanchego v1.12.0-fuji h1:o/GbXrqW9CAXu2jX/a1dZtvFiiSVCWom github.com/ava-labs/avalanchego v1.12.0-fuji/go.mod h1:yhD5dpZyStIVbxQ550EDi5w5SL7DQ/xGE6TIxosb7U0= github.com/ava-labs/coreth v0.13.9-rc.1 h1:qIICpC/OZGYUP37QnLgIqqwGmxnLwLpZaUlqJNI85vU= github.com/ava-labs/coreth v0.13.9-rc.1/go.mod h1:7aMsRIo/3GBE44qWZMjnfqdqfcfZ5yShTTm2LObLaYo= -github.com/ava-labs/subnet-evm v0.6.11 h1:XgIAn9ihPyGjrBFD2rXg2H76HFl6htliHabN0fjciaQ= -github.com/ava-labs/subnet-evm v0.6.11/go.mod h1:fP46lzBtiniRfpNH+Qu9BFvSsa02YGkAobxinZ78gDU= github.com/ava-labs/subnet-evm v0.6.12 h1:jL3FmjdFcNfS0qwbehwN6DkAg9y7zexB1riiGBxRsM0= github.com/ava-labs/subnet-evm v0.6.12/go.mod h1:vffwL4UqAh7ibpWjveUuUhamm3a9w75q92bG5vXdX5k= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= diff --git a/tests/network/network.go b/tests/network/network.go index 3912938bf..cb341c999 100644 --- a/tests/network/network.go +++ b/tests/network/network.go @@ -276,6 +276,8 @@ func (n *LocalNetwork) ConvertSubnet( } } } + utils.PChainProposerVMWorkaround(pChainWallet) + utils.AdvanceProposerVM(ctx, subnet, senderKey, 5) return nodes, validationIDs, proxyAdmin } @@ -298,7 +300,8 @@ func (n *LocalNetwork) AddSubnetValidators( // Add the node to the network n.Network.Nodes = append(n.Network.Nodes, node) } - n.Network.StartNodes(context.Background(), os.Stdout, nodes...) + err := n.Network.StartNodes(context.Background(), os.Stdout, nodes...) + Expect(err).Should(BeNil()) // Update the tmpnet Subnet struct for _, tmpnetSubnet := range n.Network.Subnets { diff --git a/tests/suites/teleporter/teleporter_suite_test.go b/tests/suites/teleporter/teleporter_suite_test.go index aa34ab891..52d6662b9 100644 --- a/tests/suites/teleporter/teleporter_suite_test.go +++ b/tests/suites/teleporter/teleporter_suite_test.go @@ -11,6 +11,7 @@ import ( "github.com/ava-labs/avalanchego/utils/units" teleporterFlows "github.com/ava-labs/teleporter/tests/flows/teleporter" + registryFlows "github.com/ava-labs/teleporter/tests/flows/teleporter/registry" "github.com/ava-labs/teleporter/tests/network" "github.com/ava-labs/teleporter/tests/utils" deploymentUtils "github.com/ava-labs/teleporter/utils/deployment-utils" @@ -57,7 +58,7 @@ var _ = ginkgo.BeforeSuite(func() { Expect(err).Should(BeNil()) // Create the local network instance - ctx, cancel := context.WithTimeout(context.Background(), 120*2*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), 240*2*time.Second) defer cancel() LocalNetworkInstance = network.NewLocalNetwork( @@ -131,81 +132,81 @@ var _ = ginkgo.Describe("[Teleporter integration tests]", func() { func() { teleporterFlows.BasicSendReceive(LocalNetworkInstance, TeleporterInfo) }) - // ginkgo.It("Deliver to the wrong chain", - // ginkgo.Label(teleporterMessengerLabel), - // func() { - // teleporterFlows.DeliverToWrongChain(LocalNetworkInstance, TeleporterInfo) - // }) - // ginkgo.It("Deliver to non-existent contract", - // ginkgo.Label(teleporterMessengerLabel), - // func() { - // teleporterFlows.DeliverToNonExistentContract(LocalNetworkInstance, TeleporterInfo) - // }) - // ginkgo.It("Retry successful execution", - // ginkgo.Label(teleporterMessengerLabel), - // func() { - // teleporterFlows.RetrySuccessfulExecution(LocalNetworkInstance, TeleporterInfo) - // }) - // ginkgo.It("Unallowed relayer", - // ginkgo.Label(teleporterMessengerLabel), - // func() { - // teleporterFlows.UnallowedRelayer(LocalNetworkInstance, TeleporterInfo) - // }) - // ginkgo.It("Relay message twice", - // ginkgo.Label(teleporterMessengerLabel), - // func() { - // teleporterFlows.RelayMessageTwice(LocalNetworkInstance, TeleporterInfo) - // }) - // ginkgo.It("Add additional fee amount", - // ginkgo.Label(teleporterMessengerLabel), - // func() { - // teleporterFlows.AddFeeAmount(LocalNetworkInstance, TeleporterInfo) - // }) - // ginkgo.It("Send specific receipts", - // ginkgo.Label(teleporterMessengerLabel), - // func() { - // teleporterFlows.SendSpecificReceipts(LocalNetworkInstance, TeleporterInfo) - // }) - // ginkgo.It("Insufficient gas", - // ginkgo.Label(teleporterMessengerLabel), - // func() { - // teleporterFlows.InsufficientGas(LocalNetworkInstance, TeleporterInfo) - // }) - // ginkgo.It("Resubmit altered message", - // ginkgo.Label(teleporterMessengerLabel), - // func() { - // teleporterFlows.ResubmitAlteredMessage(LocalNetworkInstance, TeleporterInfo) - // }) - // ginkgo.It("Calculate Teleporter message IDs", - // ginkgo.Label(utilsLabel), - // func() { - // teleporterFlows.CalculateMessageID(LocalNetworkInstance, TeleporterInfo) - // }) - // ginkgo.It("Relayer modifies message", - // ginkgo.Label(teleporterMessengerLabel), - // func() { - // teleporterFlows.RelayerModifiesMessage(LocalNetworkInstance, TeleporterInfo) - // }) - // ginkgo.It("Validator churn", - // ginkgo.Label(teleporterMessengerLabel), - // func() { - // teleporterFlows.ValidatorChurn(LocalNetworkInstance, TeleporterInfo) - // }) - - // // Teleporter Registry tests - // ginkgo.It("Teleporter registry", - // ginkgo.Label(upgradabilityLabel), - // func() { - // registryFlows.TeleporterRegistry(LocalNetworkInstance, TeleporterInfo) - // }) - // ginkgo.It("Check upgrade access", - // ginkgo.Label(upgradabilityLabel), - // func() { - // registryFlows.CheckUpgradeAccess(LocalNetworkInstance, TeleporterInfo) - // }) - // ginkgo.It("Pause and Unpause Teleporter", - // ginkgo.Label(upgradabilityLabel), - // func() { - // registryFlows.PauseTeleporter(LocalNetworkInstance, TeleporterInfo) - // }) + ginkgo.It("Deliver to the wrong chain", + ginkgo.Label(teleporterMessengerLabel), + func() { + teleporterFlows.DeliverToWrongChain(LocalNetworkInstance, TeleporterInfo) + }) + ginkgo.It("Deliver to non-existent contract", + ginkgo.Label(teleporterMessengerLabel), + func() { + teleporterFlows.DeliverToNonExistentContract(LocalNetworkInstance, TeleporterInfo) + }) + ginkgo.It("Retry successful execution", + ginkgo.Label(teleporterMessengerLabel), + func() { + teleporterFlows.RetrySuccessfulExecution(LocalNetworkInstance, TeleporterInfo) + }) + ginkgo.It("Unallowed relayer", + ginkgo.Label(teleporterMessengerLabel), + func() { + teleporterFlows.UnallowedRelayer(LocalNetworkInstance, TeleporterInfo) + }) + ginkgo.It("Relay message twice", + ginkgo.Label(teleporterMessengerLabel), + func() { + teleporterFlows.RelayMessageTwice(LocalNetworkInstance, TeleporterInfo) + }) + ginkgo.It("Add additional fee amount", + ginkgo.Label(teleporterMessengerLabel), + func() { + teleporterFlows.AddFeeAmount(LocalNetworkInstance, TeleporterInfo) + }) + ginkgo.It("Send specific receipts", + ginkgo.Label(teleporterMessengerLabel), + func() { + teleporterFlows.SendSpecificReceipts(LocalNetworkInstance, TeleporterInfo) + }) + ginkgo.It("Insufficient gas", + ginkgo.Label(teleporterMessengerLabel), + func() { + teleporterFlows.InsufficientGas(LocalNetworkInstance, TeleporterInfo) + }) + ginkgo.It("Resubmit altered message", + ginkgo.Label(teleporterMessengerLabel), + func() { + teleporterFlows.ResubmitAlteredMessage(LocalNetworkInstance, TeleporterInfo) + }) + ginkgo.It("Calculate Teleporter message IDs", + ginkgo.Label(utilsLabel), + func() { + teleporterFlows.CalculateMessageID(LocalNetworkInstance, TeleporterInfo) + }) + ginkgo.It("Relayer modifies message", + ginkgo.Label(teleporterMessengerLabel), + func() { + teleporterFlows.RelayerModifiesMessage(LocalNetworkInstance, TeleporterInfo) + }) + ginkgo.It("Validator churn", + ginkgo.Label(teleporterMessengerLabel), + func() { + teleporterFlows.ValidatorChurn(LocalNetworkInstance, TeleporterInfo) + }) + + // Teleporter Registry tests + ginkgo.It("Teleporter registry", + ginkgo.Label(upgradabilityLabel), + func() { + registryFlows.TeleporterRegistry(LocalNetworkInstance, TeleporterInfo) + }) + ginkgo.It("Check upgrade access", + ginkgo.Label(upgradabilityLabel), + func() { + registryFlows.CheckUpgradeAccess(LocalNetworkInstance, TeleporterInfo) + }) + ginkgo.It("Pause and Unpause Teleporter", + ginkgo.Label(upgradabilityLabel), + func() { + registryFlows.PauseTeleporter(LocalNetworkInstance, TeleporterInfo) + }) }) diff --git a/tests/suites/validator-manager/validator_manager_suite_test.go b/tests/suites/validator-manager/validator_manager_suite_test.go index 4e0d251fc..65d6126f0 100644 --- a/tests/suites/validator-manager/validator_manager_suite_test.go +++ b/tests/suites/validator-manager/validator_manager_suite_test.go @@ -34,7 +34,7 @@ func TestValidatorManager(t *testing.T) { // Define the before and after suite functions. var _ = ginkgo.BeforeEach(func() { // Create the local network instance - ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), 240*time.Second) defer cancel() LocalNetworkInstance = localnetwork.NewLocalNetwork( ctx, diff --git a/tests/utils/chain.go b/tests/utils/chain.go index 5507f1cf1..cf581031f 100644 --- a/tests/utils/chain.go +++ b/tests/utils/chain.go @@ -540,9 +540,8 @@ func InstantiateGenesisTemplate( return subnetGenesisFile.Name() } -// // Aggregator utils -// +var instance = 0 func NewSignatureAggregator(apiUri string, subnets []ids.ID) *aggregator.SignatureAggregator { cfg := sigAggConfig.Config{ @@ -565,6 +564,7 @@ func NewSignatureAggregator(apiUri string, subnets []ids.ID) *aggregator.Signatu Expect(err).Should(BeNil()) appRequestNetwork, err := peers.NewNetwork( + "test-aggregator", logging.Verbo, registry, trackedSubnets, @@ -576,7 +576,7 @@ func NewSignatureAggregator(apiUri string, subnets []ids.ID) *aggregator.Signatu agg, err := aggregator.NewSignatureAggregator( appRequestNetwork, - logging.NewLogger("dbg-sig-agg", logging.NewWrappedCore( + logging.NewLogger(fmt.Sprintf("dbg-sig-agg-%d", instance), logging.NewWrappedCore( logging.Verbo, os.Stdout, logging.JSON.ConsoleEncoder(), @@ -587,6 +587,7 @@ func NewSignatureAggregator(apiUri string, subnets []ids.ID) *aggregator.Signatu time.Now().Add(-1*time.Minute), ) Expect(err).Should(BeNil()) + instance++ return agg } From 4dab87e62280a29ce3524312808430c072a4f980 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Thu, 21 Nov 2024 11:13:21 -0600 Subject: [PATCH 28/34] cleanup --- tests/flows/governance/validator_set_sig.go | 5 ++++- tests/flows/ictt/erc20_home_erc20_remote.go | 9 +++++--- .../ictt/erc20_home_erc20_remote_multihop.go | 13 ++++++----- .../erc20_home_erc20_remote_send_and_call.go | 11 ++++++---- tests/flows/ictt/erc20_home_native_remote.go | 9 +++++--- .../ictt/erc20_home_native_remote_multihop.go | 15 ++++++++----- tests/flows/ictt/native_home_erc20_remote.go | 9 +++++--- .../ictt/native_home_erc20_remote_multihop.go | 11 ++++++---- tests/flows/ictt/native_home_native_remote.go | 9 +++++--- .../native_home_native_remote_multihop.go | 15 ++++++++----- .../ictt/registration_and_collateral_check.go | 7 ++++-- .../ictt/transparent_proxy_upgradeability.go | 9 +++++--- tests/flows/teleporter/basic_send_receive.go | 9 +++++--- .../deliver_to_nonexistent_contract.go | 6 ++++- .../teleporter/deliver_to_wrong_chain.go | 5 ++++- tests/flows/teleporter/insufficient_gas.go | 5 ++++- .../teleporter/registry/pause_teleporter.go | 7 ++++-- .../registry/teleporter_registry.go | 17 ++++++++------ tests/flows/teleporter/relay_message_twice.go | 7 ++++-- .../teleporter/relayer_modifies_message.go | 5 ++++- .../teleporter/resubmit_altered_message.go | 5 ++++- .../teleporter/retry_successful_execution.go | 5 ++++- .../teleporter/send_specific_receipts.go | 13 ++++++----- tests/flows/teleporter/unallowed_relayer.go | 5 ++++- tests/flows/teleporter/validator_churn.go | 9 +++++--- .../validator-manager/erc20_token_staking.go | 10 +++++++-- .../validator-manager/native_token_staking.go | 10 +++++++-- tests/network/network.go | 22 +++---------------- tests/utils/chain.go | 9 +------- 29 files changed, 168 insertions(+), 103 deletions(-) diff --git a/tests/flows/governance/validator_set_sig.go b/tests/flows/governance/validator_set_sig.go index 9ff4f3e99..4a8457907 100644 --- a/tests/flows/governance/validator_set_sig.go +++ b/tests/flows/governance/validator_set_sig.go @@ -145,6 +145,9 @@ func ValidatorSetSig(network *localnetwork.LocalNetwork) { // Test Case 1: validatorChain (subnetB) != targetChain (subnetA) // ************************************************************************************************ + aggregator := network.GetSignatureAggregator() + defer aggregator.Shutdown() + // Execute the ValidatorSetSig executeCall and wait for acceptance receipt := utils.ExecuteValidatorSetSigCallAndVerify( ctx, @@ -153,7 +156,7 @@ func ValidatorSetSig(network *localnetwork.LocalNetwork) { validatorSetSigContractAddress, fundedKey, &offchainMessages[0], - network.GetSignatureAggregator(), + aggregator, true, ) diff --git a/tests/flows/ictt/erc20_home_erc20_remote.go b/tests/flows/ictt/erc20_home_erc20_remote.go index 9f996b60b..cfdfc7021 100644 --- a/tests/flows/ictt/erc20_home_erc20_remote.go +++ b/tests/flows/ictt/erc20_home_erc20_remote.go @@ -71,6 +71,9 @@ func ERC20TokenHomeERC20TokenRemote(network *localnetwork.LocalNetwork, teleport tokenDecimals, ) + aggregator := network.GetSignatureAggregator() + defer aggregator.Shutdown() + utils.RegisterERC20TokenRemoteOnHome( ctx, teleporter, @@ -79,7 +82,7 @@ func ERC20TokenHomeERC20TokenRemote(network *localnetwork.LocalNetwork, teleport subnetAInfo, erc20TokenRemoteAddress, fundedKey, - network.GetSignatureAggregator(), + aggregator, ) // Generate new recipient to receive transferred tokens @@ -119,7 +122,7 @@ func ERC20TokenHomeERC20TokenRemote(network *localnetwork.LocalNetwork, teleport true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) utils.CheckERC20TokenRemoteWithdrawal( @@ -172,7 +175,7 @@ func ERC20TokenHomeERC20TokenRemote(network *localnetwork.LocalNetwork, teleport true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) utils.CheckERC20TokenHomeWithdrawal( diff --git a/tests/flows/ictt/erc20_home_erc20_remote_multihop.go b/tests/flows/ictt/erc20_home_erc20_remote_multihop.go index 4cfa4abea..8f19fb77c 100644 --- a/tests/flows/ictt/erc20_home_erc20_remote_multihop.go +++ b/tests/flows/ictt/erc20_home_erc20_remote_multihop.go @@ -86,6 +86,9 @@ func ERC20TokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, tokenDecimals, ) + aggregator := network.GetSignatureAggregator() + defer aggregator.Shutdown() + // Register both ERC20TokenRemote instances on the ERC20TokenHome utils.RegisterERC20TokenRemoteOnHome( ctx, @@ -95,7 +98,7 @@ func ERC20TokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, subnetAInfo, erc20TokenRemoteAddressA, fundedKey, - network.GetSignatureAggregator(), + aggregator, ) utils.RegisterERC20TokenRemoteOnHome( ctx, @@ -105,7 +108,7 @@ func ERC20TokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, subnetBInfo, erc20TokenRemoteAddressB, fundedKey, - network.GetSignatureAggregator(), + aggregator, ) // Generate new recipient to receive transferred tokens @@ -145,7 +148,7 @@ func ERC20TokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) utils.CheckERC20TokenRemoteWithdrawal( @@ -179,7 +182,7 @@ func ERC20TokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, cChainInfo, transferredAmount, secondaryFeeAmount, - network.GetSignatureAggregator(), + aggregator, ) // Multi-hop transfer back to Subnet A @@ -200,6 +203,6 @@ func ERC20TokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, cChainInfo, transferredAmount, secondaryFeeAmount, - network.GetSignatureAggregator(), + aggregator, ) } diff --git a/tests/flows/ictt/erc20_home_erc20_remote_send_and_call.go b/tests/flows/ictt/erc20_home_erc20_remote_send_and_call.go index d76eb4907..ab6c8c78d 100644 --- a/tests/flows/ictt/erc20_home_erc20_remote_send_and_call.go +++ b/tests/flows/ictt/erc20_home_erc20_remote_send_and_call.go @@ -87,6 +87,9 @@ func ERC20TokenHomeERC20TokenRemoteSendAndCall( tokenDecimals, ) + aggregator := network.GetSignatureAggregator() + defer aggregator.Shutdown() + utils.RegisterERC20TokenRemoteOnHome( ctx, teleporter, @@ -95,7 +98,7 @@ func ERC20TokenHomeERC20TokenRemoteSendAndCall( subnetAInfo, erc20TokenRemoteAddress, fundedKey, - network.GetSignatureAggregator(), + aggregator, ) // Generate new recipient to receive transferred tokens @@ -147,7 +150,7 @@ func ERC20TokenHomeERC20TokenRemoteSendAndCall( true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) event, err := utils.GetEventFromLogs(receipt.Logs, erc20TokenRemote.ParseCallSucceeded) @@ -199,7 +202,7 @@ func ERC20TokenHomeERC20TokenRemoteSendAndCall( true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) utils.CheckERC20TokenRemoteWithdrawal( @@ -258,7 +261,7 @@ func ERC20TokenHomeERC20TokenRemoteSendAndCall( true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) homeEvent, err := utils.GetEventFromLogs(receipt.Logs, erc20TokenHome.ParseCallSucceeded) diff --git a/tests/flows/ictt/erc20_home_native_remote.go b/tests/flows/ictt/erc20_home_native_remote.go index 00b4f9e98..ea2cfa19e 100644 --- a/tests/flows/ictt/erc20_home_native_remote.go +++ b/tests/flows/ictt/erc20_home_native_remote.go @@ -74,6 +74,9 @@ func ERC20TokenHomeNativeTokenRemote(network *localnetwork.LocalNetwork, telepor burnedFeesReportingRewardPercentage, ) + aggregator := network.GetSignatureAggregator() + defer aggregator.Shutdown() + collateralAmount := utils.RegisterTokenRemoteOnHome( ctx, teleporter, @@ -85,7 +88,7 @@ func ERC20TokenHomeNativeTokenRemote(network *localnetwork.LocalNetwork, telepor utils.GetTokenMultiplier(decimalsShift), multiplyOnRemote, fundedKey, - network.GetSignatureAggregator(), + aggregator, ) utils.AddCollateralToERC20TokenHome( @@ -138,7 +141,7 @@ func ERC20TokenHomeNativeTokenRemote(network *localnetwork.LocalNetwork, telepor true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) // Verify the recipient received the tokens @@ -174,7 +177,7 @@ func ERC20TokenHomeNativeTokenRemote(network *localnetwork.LocalNetwork, telepor true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) // Check that the recipient received the tokens diff --git a/tests/flows/ictt/erc20_home_native_remote_multihop.go b/tests/flows/ictt/erc20_home_native_remote_multihop.go index 03e340c0d..60c06ba35 100644 --- a/tests/flows/ictt/erc20_home_native_remote_multihop.go +++ b/tests/flows/ictt/erc20_home_native_remote_multihop.go @@ -78,6 +78,9 @@ func ERC20TokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork, burnedFeesReportingRewardPercentage, ) + aggregator := network.GetSignatureAggregator() + defer aggregator.Shutdown() + // Register both NativeTokenDestinations on the ERC20TokenHome collateralAmountA := utils.RegisterTokenRemoteOnHome( ctx, @@ -90,7 +93,7 @@ func ERC20TokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork, utils.GetTokenMultiplier(decimalsShift), multiplyOnRemote, fundedKey, - network.GetSignatureAggregator(), + aggregator, ) collateralAmountB := utils.RegisterTokenRemoteOnHome( @@ -104,7 +107,7 @@ func ERC20TokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork, utils.GetTokenMultiplier(decimalsShift), multiplyOnRemote, fundedKey, - network.GetSignatureAggregator(), + aggregator, ) // Add collateral for both NativeTokenDestinations @@ -171,7 +174,7 @@ func ERC20TokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork, true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) // Verify the recipient received the tokens @@ -208,7 +211,7 @@ func ERC20TokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork, true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) // Verify the recipient received the tokens @@ -232,7 +235,7 @@ func ERC20TokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork, cChainInfo, amountToSend, big.NewInt(0), - network.GetSignatureAggregator(), + aggregator, ) // Multi-hop transfer back to Subnet A @@ -251,6 +254,6 @@ func ERC20TokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork, cChainInfo, amountToSend, secondaryFeeAmount, - network.GetSignatureAggregator(), + aggregator, ) } diff --git a/tests/flows/ictt/native_home_erc20_remote.go b/tests/flows/ictt/native_home_erc20_remote.go index c52d5c268..ccad64974 100644 --- a/tests/flows/ictt/native_home_erc20_remote.go +++ b/tests/flows/ictt/native_home_erc20_remote.go @@ -67,6 +67,9 @@ func NativeTokenHomeERC20TokenRemote(network *localnetwork.LocalNetwork, telepor tokenDecimals, ) + aggregator := network.GetSignatureAggregator() + defer aggregator.Shutdown() + utils.RegisterERC20TokenRemoteOnHome( ctx, teleporter, @@ -75,7 +78,7 @@ func NativeTokenHomeERC20TokenRemote(network *localnetwork.LocalNetwork, telepor subnetAInfo, erc20TokenRemoteAddress, fundedKey, - network.GetSignatureAggregator(), + aggregator, ) // Generate new recipient to receive transferred tokens @@ -116,7 +119,7 @@ func NativeTokenHomeERC20TokenRemote(network *localnetwork.LocalNetwork, telepor true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) utils.CheckERC20TokenRemoteWithdrawal( @@ -169,7 +172,7 @@ func NativeTokenHomeERC20TokenRemote(network *localnetwork.LocalNetwork, telepor true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) // Check that the recipient received the tokens diff --git a/tests/flows/ictt/native_home_erc20_remote_multihop.go b/tests/flows/ictt/native_home_erc20_remote_multihop.go index b8220b7bc..ff957ed04 100644 --- a/tests/flows/ictt/native_home_erc20_remote_multihop.go +++ b/tests/flows/ictt/native_home_erc20_remote_multihop.go @@ -81,6 +81,9 @@ func NativeTokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, tokenDecimals, ) + aggregator := network.GetSignatureAggregator() + defer aggregator.Shutdown() + // Register both ERC20Destinations on the NativeTokenHome utils.RegisterERC20TokenRemoteOnHome( ctx, @@ -90,7 +93,7 @@ func NativeTokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, subnetAInfo, erc20TokenRemoteAddressA, fundedKey, - network.GetSignatureAggregator(), + aggregator, ) utils.RegisterERC20TokenRemoteOnHome( @@ -101,7 +104,7 @@ func NativeTokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, subnetBInfo, erc20TokenRemoteAddressB, fundedKey, - network.GetSignatureAggregator(), + aggregator, ) // Generate new recipient to receive transferred tokens @@ -142,7 +145,7 @@ func NativeTokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) utils.CheckERC20TokenRemoteWithdrawal( @@ -175,6 +178,6 @@ func NativeTokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, cChainInfo, transferredAmount, secondaryFeeAmount, - network.GetSignatureAggregator(), + aggregator, ) } diff --git a/tests/flows/ictt/native_home_native_remote.go b/tests/flows/ictt/native_home_native_remote.go index 37e426b6b..346dbc70b 100644 --- a/tests/flows/ictt/native_home_native_remote.go +++ b/tests/flows/ictt/native_home_native_remote.go @@ -57,6 +57,9 @@ func NativeTokenHomeNativeDestination(network *localnetwork.LocalNetwork, telepo burnedFeesReportingRewardPercentage, ) + aggregator := network.GetSignatureAggregator() + defer aggregator.Shutdown() + // Register the NativeTokenRemote on the NativeTokenHome collateralAmount := utils.RegisterTokenRemoteOnHome( ctx, @@ -69,7 +72,7 @@ func NativeTokenHomeNativeDestination(network *localnetwork.LocalNetwork, telepo big.NewInt(1), multiplyOnRemote, fundedKey, - network.GetSignatureAggregator(), + aggregator, ) utils.AddCollateralToNativeTokenHome( @@ -121,7 +124,7 @@ func NativeTokenHomeNativeDestination(network *localnetwork.LocalNetwork, telepo true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) utils.CheckBalance( @@ -164,7 +167,7 @@ func NativeTokenHomeNativeDestination(network *localnetwork.LocalNetwork, telepo true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) // Check that the recipient received the tokens diff --git a/tests/flows/ictt/native_home_native_remote_multihop.go b/tests/flows/ictt/native_home_native_remote_multihop.go index 4569fd727..897568157 100644 --- a/tests/flows/ictt/native_home_native_remote_multihop.go +++ b/tests/flows/ictt/native_home_native_remote_multihop.go @@ -77,6 +77,9 @@ func NativeTokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork burnedFeesReportingRewardPercentage, ) + aggregator := network.GetSignatureAggregator() + defer aggregator.Shutdown() + // Register both NativeTokenDestinations on the NativeTokenHome collateralAmountA := utils.RegisterTokenRemoteOnHome( ctx, @@ -89,7 +92,7 @@ func NativeTokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork utils.GetTokenMultiplier(decimalsShift), multiplyOnRemote, fundedKey, - network.GetSignatureAggregator(), + aggregator, ) collateralAmountB := utils.RegisterTokenRemoteOnHome( @@ -103,7 +106,7 @@ func NativeTokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork utils.GetTokenMultiplier(decimalsShift), multiplyOnRemote, fundedKey, - network.GetSignatureAggregator(), + aggregator, ) // Add collateral for both NativeTokenDestinations @@ -167,7 +170,7 @@ func NativeTokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) // Verify the recipient received the tokens @@ -203,7 +206,7 @@ func NativeTokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) // Verify the recipient received the tokens @@ -227,7 +230,7 @@ func NativeTokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork cChainInfo, amountToSendA, big.NewInt(0), - network.GetSignatureAggregator(), + aggregator, ) // Again, send half of the received amount to account for gas expenses @@ -249,6 +252,6 @@ func NativeTokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork cChainInfo, amountToSendB, secondaryFeeAmount, - network.GetSignatureAggregator(), + aggregator, ) } diff --git a/tests/flows/ictt/registration_and_collateral_check.go b/tests/flows/ictt/registration_and_collateral_check.go index 442db7fe5..03cd89ea1 100644 --- a/tests/flows/ictt/registration_and_collateral_check.go +++ b/tests/flows/ictt/registration_and_collateral_check.go @@ -98,6 +98,9 @@ func RegistrationAndCollateralCheck(network *localnetwork.LocalNetwork, teleport Expect(err).Should(BeNil()) utils.ExpectBigEqual(balance, initialBalance) + aggregator := network.GetSignatureAggregator() + defer aggregator.Shutdown() + // Register the NativeTokenRemote to the ERC20TokenHome collateralNeeded := utils.RegisterTokenRemoteOnHome( ctx, @@ -110,7 +113,7 @@ func RegistrationAndCollateralCheck(network *localnetwork.LocalNetwork, teleport utils.GetTokenMultiplier(decimalsShift), multiplyOnRemote, fundedKey, - network.GetSignatureAggregator(), + aggregator, ) // Try sending again and expect failure since remote is not collateralized @@ -190,7 +193,7 @@ func RegistrationAndCollateralCheck(network *localnetwork.LocalNetwork, teleport true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) // Verify the recipient received the tokens diff --git a/tests/flows/ictt/transparent_proxy_upgradeability.go b/tests/flows/ictt/transparent_proxy_upgradeability.go index 7dc99ee4e..71e6abc9a 100644 --- a/tests/flows/ictt/transparent_proxy_upgradeability.go +++ b/tests/flows/ictt/transparent_proxy_upgradeability.go @@ -97,6 +97,9 @@ func TransparentUpgradeableProxy(network *localnetwork.LocalNetwork, teleporter tokenDecimals, ) + aggregator := network.GetSignatureAggregator() + defer aggregator.Shutdown() + utils.RegisterERC20TokenRemoteOnHome( ctx, teleporter, @@ -105,7 +108,7 @@ func TransparentUpgradeableProxy(network *localnetwork.LocalNetwork, teleporter subnetAInfo, erc20TokenRemoteAddress, fundedKey, - network.GetSignatureAggregator(), + aggregator, ) // Send a transfer from primary network to Subnet A @@ -145,7 +148,7 @@ func TransparentUpgradeableProxy(network *localnetwork.LocalNetwork, teleporter true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) utils.CheckERC20TokenRemoteWithdrawal( @@ -211,7 +214,7 @@ func TransparentUpgradeableProxy(network *localnetwork.LocalNetwork, teleporter true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) // Check that the transfer was successful, and expected balances are correct diff --git a/tests/flows/teleporter/basic_send_receive.go b/tests/flows/teleporter/basic_send_receive.go index e01577982..97da8c397 100644 --- a/tests/flows/teleporter/basic_send_receive.go +++ b/tests/flows/teleporter/basic_send_receive.go @@ -22,10 +22,13 @@ func BasicSendReceive(network *localnetwork.LocalNetwork, teleporter utils.Telep // Send a transaction to Subnet A to issue a Warp Message from the Teleporter contract to Subnet B ctx := context.Background() + aggregator := network.GetSignatureAggregator() + defer aggregator.Shutdown() + // Clear the receipt queue from Subnet B -> Subnet A to have a clean slate for the test flow. // This is only done if the test non-external networks because external networks may have // an arbitrarily high number of receipts to be cleared from a given queue from unrelated messages. - teleporter.ClearReceiptQueue(ctx, fundedKey, subnetBInfo, subnetAInfo, network.GetSignatureAggregator()) + teleporter.ClearReceiptQueue(ctx, fundedKey, subnetBInfo, subnetAInfo, aggregator) feeAmount := big.NewInt(1) feeTokenAddress, feeToken := utils.DeployExampleERC20( @@ -74,7 +77,7 @@ func BasicSendReceive(network *localnetwork.LocalNetwork, teleporter utils.Telep true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) receiveEvent, err := utils.GetEventFromLogs( deliveryReceipt.Logs, @@ -109,7 +112,7 @@ func BasicSendReceive(network *localnetwork.LocalNetwork, teleporter utils.Telep true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) Expect(utils.CheckReceiptReceived( diff --git a/tests/flows/teleporter/deliver_to_nonexistent_contract.go b/tests/flows/teleporter/deliver_to_nonexistent_contract.go index 2257ba1d6..664310596 100644 --- a/tests/flows/teleporter/deliver_to_nonexistent_contract.go +++ b/tests/flows/teleporter/deliver_to_nonexistent_contract.go @@ -87,6 +87,10 @@ func DeliverToNonExistentContract(network *localnetwork.LocalNetwork, teleporter // // Relay the message to the destination // + + aggregator := network.GetSignatureAggregator() + defer aggregator.Shutdown() + log.Info("Relaying the message to the destination") receipt = teleporter.RelayTeleporterMessage( ctx, @@ -96,7 +100,7 @@ func DeliverToNonExistentContract(network *localnetwork.LocalNetwork, teleporter true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) receiveEvent, err := utils.GetEventFromLogs(receipt.Logs, teleporter.TeleporterMessenger(subnetAInfo).ParseReceiveCrossChainMessage) diff --git a/tests/flows/teleporter/deliver_to_wrong_chain.go b/tests/flows/teleporter/deliver_to_wrong_chain.go index 22345242b..7a76b5cc9 100644 --- a/tests/flows/teleporter/deliver_to_wrong_chain.go +++ b/tests/flows/teleporter/deliver_to_wrong_chain.go @@ -57,6 +57,9 @@ func DeliverToWrongChain(network *localnetwork.LocalNetwork, teleporter utils.Te fundedKey, ) + aggregator := network.GetSignatureAggregator() + defer aggregator.Shutdown() + teleporter.RelayTeleporterMessage( ctx, receipt, @@ -65,7 +68,7 @@ func DeliverToWrongChain(network *localnetwork.LocalNetwork, teleporter utils.Te false, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) // diff --git a/tests/flows/teleporter/insufficient_gas.go b/tests/flows/teleporter/insufficient_gas.go index 1b593b145..a71c21d7d 100644 --- a/tests/flows/teleporter/insufficient_gas.go +++ b/tests/flows/teleporter/insufficient_gas.go @@ -55,6 +55,9 @@ func InsufficientGas(network *localnetwork.LocalNetwork, teleporter utils.Telepo messageID := event.MessageID + aggregator := network.GetSignatureAggregator() + defer aggregator.Shutdown() + // Relay message from SubnetA to SubnetB receipt = teleporter.RelayTeleporterMessage( ctx, @@ -64,7 +67,7 @@ func InsufficientGas(network *localnetwork.LocalNetwork, teleporter utils.Telepo true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) // Check Teleporter message received on the destination diff --git a/tests/flows/teleporter/registry/pause_teleporter.go b/tests/flows/teleporter/registry/pause_teleporter.go index 84b713d90..f1815dcf1 100644 --- a/tests/flows/teleporter/registry/pause_teleporter.go +++ b/tests/flows/teleporter/registry/pause_teleporter.go @@ -50,6 +50,9 @@ func PauseTeleporter(network *localnetwork.LocalNetwork, teleporter utils.Telepo Expect(err).Should(BeNil()) Expect(isPaused).Should(BeTrue()) + aggregator := network.GetSignatureAggregator() + defer aggregator.Shutdown() + // Send a message from subnet A to subnet B, which should fail teleporter.SendExampleCrossChainMessageAndVerify( ctx, @@ -60,7 +63,7 @@ func PauseTeleporter(network *localnetwork.LocalNetwork, teleporter utils.Telepo testMessengerB, fundedKey, "message_1", - network.GetSignatureAggregator(), + aggregator, false, ) @@ -87,7 +90,7 @@ func PauseTeleporter(network *localnetwork.LocalNetwork, teleporter utils.Telepo testMessengerB, fundedKey, "message_2", - network.GetSignatureAggregator(), + aggregator, true, ) } diff --git a/tests/flows/teleporter/registry/teleporter_registry.go b/tests/flows/teleporter/registry/teleporter_registry.go index 85d252737..ad81e4980 100644 --- a/tests/flows/teleporter/registry/teleporter_registry.go +++ b/tests/flows/teleporter/registry/teleporter_registry.go @@ -87,6 +87,9 @@ func TeleporterRegistry(network *localnetwork.LocalNetwork, teleporter utils.Tel // Restart nodes with new chain config network.SetChainConfigs(chainConfigs) + aggregator := network.GetSignatureAggregator() + defer aggregator.Shutdown() + // Call addProtocolVersion on subnetB to register the new Teleporter version teleporter.AddProtocolVersionAndWaitForAcceptance( ctx, @@ -94,7 +97,7 @@ func TeleporterRegistry(network *localnetwork.LocalNetwork, teleporter utils.Tel newTeleporterAddress, fundedKey, offchainMessageB, - network.GetSignatureAggregator(), + aggregator, ) // Send a message using old Teleporter version to test messenger using new Teleporter version. @@ -108,7 +111,7 @@ func TeleporterRegistry(network *localnetwork.LocalNetwork, teleporter utils.Tel testMessengerB, fundedKey, "message_1", - network.GetSignatureAggregator(), + aggregator, true, ) @@ -145,7 +148,7 @@ func TeleporterRegistry(network *localnetwork.LocalNetwork, teleporter utils.Tel testMessengerB, fundedKey, "message_2", - network.GetSignatureAggregator(), + aggregator, false, ) @@ -164,7 +167,7 @@ func TeleporterRegistry(network *localnetwork.LocalNetwork, teleporter utils.Tel testMessengerC, fundedKey, "message_3", - network.GetSignatureAggregator(), + aggregator, false, ) @@ -175,7 +178,7 @@ func TeleporterRegistry(network *localnetwork.LocalNetwork, teleporter utils.Tel newTeleporterAddress, fundedKey, offchainMessageC, - network.GetSignatureAggregator(), + aggregator, ) // Send a message from A->B, which previously failed, but now using the new Teleporter version. @@ -189,7 +192,7 @@ func TeleporterRegistry(network *localnetwork.LocalNetwork, teleporter utils.Tel testMessengerC, fundedKey, "message_4", - network.GetSignatureAggregator(), + aggregator, true, ) @@ -201,7 +204,7 @@ func TeleporterRegistry(network *localnetwork.LocalNetwork, teleporter utils.Tel newTeleporterAddress, fundedKey, offchainMessageA, - network.GetSignatureAggregator(), + aggregator, ) latestVersionA, err := teleporter.TeleporterRegistry(subnetAInfo).LatestVersion(&bind.CallOpts{}) diff --git a/tests/flows/teleporter/relay_message_twice.go b/tests/flows/teleporter/relay_message_twice.go index 61e19f568..72677411e 100644 --- a/tests/flows/teleporter/relay_message_twice.go +++ b/tests/flows/teleporter/relay_message_twice.go @@ -49,6 +49,9 @@ func RelayMessageTwice(network *localnetwork.LocalNetwork, teleporter utils.Tele fundedKey, ) + aggregator := network.GetSignatureAggregator() + defer aggregator.Shutdown() + // // Relay the message to the destination // @@ -60,7 +63,7 @@ func RelayMessageTwice(network *localnetwork.LocalNetwork, teleporter utils.Tele true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) // @@ -85,6 +88,6 @@ func RelayMessageTwice(network *localnetwork.LocalNetwork, teleporter utils.Tele false, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) } diff --git a/tests/flows/teleporter/relayer_modifies_message.go b/tests/flows/teleporter/relayer_modifies_message.go index 366c142f1..fe4441a97 100644 --- a/tests/flows/teleporter/relayer_modifies_message.go +++ b/tests/flows/teleporter/relayer_modifies_message.go @@ -78,13 +78,16 @@ func relayAlteredMessage( ) Expect(err).Should(BeNil()) + aggregator := network.GetSignatureAggregator() + defer aggregator.Shutdown() + signedWarpMessage := utils.ConstructSignedWarpMessage( ctx, sourceReceipt, source, destination, nil, - network.GetSignatureAggregator(), + aggregator, ) // Construct the transaction to send the Warp message to the destination chain diff --git a/tests/flows/teleporter/resubmit_altered_message.go b/tests/flows/teleporter/resubmit_altered_message.go index 869d27273..37f621661 100644 --- a/tests/flows/teleporter/resubmit_altered_message.go +++ b/tests/flows/teleporter/resubmit_altered_message.go @@ -36,6 +36,9 @@ func ResubmitAlteredMessage(network *localnetwork.LocalNetwork, teleporter utils receipt, messageID := utils.SendCrossChainMessageAndWaitForAcceptance( ctx, teleporter.TeleporterMessenger(subnetAInfo), subnetAInfo, subnetBInfo, sendCrossChainMessageInput, fundedKey) + aggregator := network.GetSignatureAggregator() + defer aggregator.Shutdown() + // Relay the message to the destination receipt = teleporter.RelayTeleporterMessage( ctx, @@ -45,7 +48,7 @@ func ResubmitAlteredMessage(network *localnetwork.LocalNetwork, teleporter utils true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) log.Info("Checking the message was received on the destination") diff --git a/tests/flows/teleporter/retry_successful_execution.go b/tests/flows/teleporter/retry_successful_execution.go index 067ac9adf..b7e2743b4 100644 --- a/tests/flows/teleporter/retry_successful_execution.go +++ b/tests/flows/teleporter/retry_successful_execution.go @@ -65,6 +65,9 @@ func RetrySuccessfulExecution(network *localnetwork.LocalNetwork, teleporter uti teleporterMessageID := event.MessageID + aggregator := network.GetSignatureAggregator() + defer aggregator.Shutdown() + // // Relay the message to the destination // @@ -76,7 +79,7 @@ func RetrySuccessfulExecution(network *localnetwork.LocalNetwork, teleporter uti true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) receiveEvent, err := utils.GetEventFromLogs(receipt.Logs, teleporter.TeleporterMessenger(subnetBInfo).ParseReceiveCrossChainMessage) diff --git a/tests/flows/teleporter/send_specific_receipts.go b/tests/flows/teleporter/send_specific_receipts.go index 588a4b6a9..f7c8a05c0 100644 --- a/tests/flows/teleporter/send_specific_receipts.go +++ b/tests/flows/teleporter/send_specific_receipts.go @@ -27,8 +27,11 @@ func SendSpecificReceipts(network *localnetwork.LocalNetwork, teleporter utils.T _, fundedKey := network.GetFundedAccountInfo() ctx := context.Background() + aggregator := network.GetSignatureAggregator() + defer aggregator.Shutdown() + // Clear the receipt queue from Subnet B -> Subnet A to have a clean slate for the test flow. - teleporter.ClearReceiptQueue(ctx, fundedKey, subnetBInfo, subnetAInfo, network.GetSignatureAggregator()) + teleporter.ClearReceiptQueue(ctx, fundedKey, subnetBInfo, subnetAInfo, aggregator) // Use mock token as the fee token mockTokenAddress, mockToken := utils.DeployExampleERC20( @@ -74,7 +77,7 @@ func SendSpecificReceipts(network *localnetwork.LocalNetwork, teleporter utils.T true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) receiveEvent1, err := utils.GetEventFromLogs( deliveryReceipt1.Logs, @@ -102,7 +105,7 @@ func SendSpecificReceipts(network *localnetwork.LocalNetwork, teleporter utils.T true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) receiveEvent2, err := utils.GetEventFromLogs( deliveryReceipt2.Logs, @@ -141,7 +144,7 @@ func SendSpecificReceipts(network *localnetwork.LocalNetwork, teleporter utils.T true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) // Check that the message back to Subnet A was delivered @@ -195,7 +198,7 @@ func SendSpecificReceipts(network *localnetwork.LocalNetwork, teleporter utils.T true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) // Check delivered delivered, err = subnetATeleporterMessenger.MessageReceived( diff --git a/tests/flows/teleporter/unallowed_relayer.go b/tests/flows/teleporter/unallowed_relayer.go index 47ae8c8f9..983b5fabc 100644 --- a/tests/flows/teleporter/unallowed_relayer.go +++ b/tests/flows/teleporter/unallowed_relayer.go @@ -46,6 +46,9 @@ func UnallowedRelayer(network *localnetwork.LocalNetwork, teleporter utils.Telep ctx, teleporter.TeleporterMessenger(subnetAInfo), subnetAInfo, subnetBInfo, sendCrossChainMessageInput, fundedKey, ) + aggregator := network.GetSignatureAggregator() + defer aggregator.Shutdown() + // // Relay the message to the destination // @@ -57,7 +60,7 @@ func UnallowedRelayer(network *localnetwork.LocalNetwork, teleporter utils.Telep false, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) // diff --git a/tests/flows/teleporter/validator_churn.go b/tests/flows/teleporter/validator_churn.go index a043e32b0..8ccbe20b6 100644 --- a/tests/flows/teleporter/validator_churn.go +++ b/tests/flows/teleporter/validator_churn.go @@ -58,6 +58,9 @@ func ValidatorChurn(network *localnetwork.LocalNetwork, teleporter utils.Telepor Expect(err).Should(BeNil()) sentTeleporterMessage := sendEvent.Message + aggregator := network.GetSignatureAggregator() + defer aggregator.Shutdown() + // Construct the signed warp message signedWarpMessage := utils.ConstructSignedWarpMessage( ctx, @@ -65,7 +68,7 @@ func ValidatorChurn(network *localnetwork.LocalNetwork, teleporter utils.Telepor subnetAInfo, subnetBInfo, nil, - network.GetSignatureAggregator(), + aggregator, ) // @@ -94,7 +97,7 @@ func ValidatorChurn(network *localnetwork.LocalNetwork, teleporter utils.Telepor } utils.InitializeAndCompletePoAValidatorRegistration( addValidatorsCtx, - network.GetSignatureAggregator(), + aggregator, fundedKey, fundedKey, subnetAInfo, @@ -168,7 +171,7 @@ func ValidatorChurn(network *localnetwork.LocalNetwork, teleporter utils.Telepor true, fundedKey, nil, - network.GetSignatureAggregator(), + aggregator, ) // Verify the message was delivered diff --git a/tests/flows/validator-manager/erc20_token_staking.go b/tests/flows/validator-manager/erc20_token_staking.go index 5f71bc5cd..9adaf3955 100644 --- a/tests/flows/validator-manager/erc20_token_staking.go +++ b/tests/flows/validator-manager/erc20_token_staking.go @@ -144,6 +144,9 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { Expect(err).Should(BeNil()) delegationID = initRegistrationEvent.DelegationID + aggregator := network.GetSignatureAggregator() + defer aggregator.Shutdown() + // Gather subnet-evm Warp signatures for the SubnetValidatorWeightUpdateMessage & relay to the P-Chain signedWarpMessage := utils.ConstructSignedWarpMessage( context.Background(), @@ -151,7 +154,7 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { subnetAInfo, pChainInfo, nil, - network.GetSignatureAggregator(), + aggregator, ) // Issue a tx to update the validator's weight on the P-Chain @@ -210,6 +213,9 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { Expect(delegatorRemovalEvent.ValidationID[:]).Should(Equal(validationID[:])) Expect(delegatorRemovalEvent.DelegationID[:]).Should(Equal(delegationID[:])) + aggregator := network.GetSignatureAggregator() + defer aggregator.Shutdown() + // Gather subnet-evm Warp signatures for the SetSubnetValidatorWeightMessage & relay to the P-Chain // (Sending to the P-Chain will be skipped for now) signedWarpMessage := utils.ConstructSignedWarpMessage( @@ -218,7 +224,7 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { subnetAInfo, pChainInfo, nil, - network.GetSignatureAggregator(), + aggregator, ) Expect(err).Should(BeNil()) diff --git a/tests/flows/validator-manager/native_token_staking.go b/tests/flows/validator-manager/native_token_staking.go index 9e77eefe3..dba3c4a1c 100644 --- a/tests/flows/validator-manager/native_token_staking.go +++ b/tests/flows/validator-manager/native_token_staking.go @@ -138,6 +138,9 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { Expect(err).Should(BeNil()) delegationID = initRegistrationEvent.DelegationID + aggregator := network.GetSignatureAggregator() + defer aggregator.Shutdown() + // Gather subnet-evm Warp signatures for the SubnetValidatorWeightUpdateMessage & relay to the P-Chain signedWarpMessage := utils.ConstructSignedWarpMessage( context.Background(), @@ -145,7 +148,7 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { subnetAInfo, pChainInfo, nil, - network.GetSignatureAggregator(), + aggregator, ) // Issue a tx to update the validator's weight on the P-Chain @@ -203,6 +206,9 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { Expect(delegatorRemovalEvent.ValidationID[:]).Should(Equal(validationID[:])) Expect(delegatorRemovalEvent.DelegationID[:]).Should(Equal(delegationID[:])) + aggregator := network.GetSignatureAggregator() + defer aggregator.Shutdown() + // Gather subnet-evm Warp signatures for the SetSubnetValidatorWeightMessage & relay to the P-Chain // (Sending to the P-Chain will be skipped for now) signedWarpMessage := utils.ConstructSignedWarpMessage( @@ -211,7 +217,7 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { subnetAInfo, pChainInfo, nil, - network.GetSignatureAggregator(), + aggregator, ) Expect(err).Should(BeNil()) diff --git a/tests/network/network.go b/tests/network/network.go index cb341c999..d0c406c36 100644 --- a/tests/network/network.go +++ b/tests/network/network.go @@ -5,7 +5,6 @@ import ( "crypto/ecdsa" "encoding/hex" "encoding/json" - "fmt" goLog "log" "os" "sort" @@ -120,17 +119,6 @@ func NewLocalNetwork( ) Expect(network).ShouldNot(BeNil()) - // Activate Etna - // upgrades := upgrade.Default - // upgrades.EtnaTime = time.Now().Add(-1 * time.Minute) - // upgradeJSON, err := json.Marshal(upgrades) - // Expect(err).Should(BeNil()) - - // upgradeBase64 := base64.StdEncoding.EncodeToString(upgradeJSON) - // network.DefaultFlags.SetDefaults(tmpnet.FlagsMap{ - // config.UpgradeFileContentKey: upgradeBase64, - // }) - avalancheGoBuildPath, ok := os.LookupEnv("AVALANCHEGO_BUILD_PATH") Expect(ok).Should(Equal(true)) @@ -165,11 +153,7 @@ func NewLocalNetwork( // All nodes are specified as bootstrap validators var primaryNetworkValidators []*tmpnet.Node - fmt.Println("Primary Network Validators") - for _, node := range network.Nodes { - fmt.Println(node.NodeID, node.URI) - primaryNetworkValidators = append(primaryNetworkValidators, node) - } + primaryNetworkValidators = append(primaryNetworkValidators, network.Nodes...) localNetwork := &LocalNetwork{ Network: *network, @@ -253,6 +237,7 @@ func (n *LocalNetwork) ConvertSubnet( utils.AdvanceProposerVM(ctx, subnet, senderKey, 5) aggregator := n.GetSignatureAggregator() + defer aggregator.Shutdown() validationIDs := utils.InitializeValidatorSet( ctx, senderKey, @@ -263,7 +248,6 @@ func (n *LocalNetwork) ConvertSubnet( aggregator, nodes, ) - aggregator.Shutdown() // Remove the bootstrap nodes as subnet validators for _, vdr := range currentValidators { @@ -271,7 +255,7 @@ func (n *LocalNetwork) ConvertSubnet( Expect(err).Should(BeNil()) for _, node := range n.Network.Nodes { if node.NodeID == vdr.NodeID { - fmt.Println("Restarting bootstrap node", node.NodeID) + goLog.Println("Restarting bootstrap node", node.NodeID) n.Network.RestartNode(ctx, os.Stdout, node) } } diff --git a/tests/utils/chain.go b/tests/utils/chain.go index cf581031f..636addc5d 100644 --- a/tests/utils/chain.go +++ b/tests/utils/chain.go @@ -541,8 +541,6 @@ func InstantiateGenesisTemplate( } // Aggregator utils -var instance = 0 - func NewSignatureAggregator(apiUri string, subnets []ids.ID) *aggregator.SignatureAggregator { cfg := sigAggConfig.Config{ PChainAPI: &relayerConfig.APIConfig{ @@ -576,18 +574,13 @@ func NewSignatureAggregator(apiUri string, subnets []ids.ID) *aggregator.Signatu agg, err := aggregator.NewSignatureAggregator( appRequestNetwork, - logging.NewLogger(fmt.Sprintf("dbg-sig-agg-%d", instance), logging.NewWrappedCore( - logging.Verbo, - os.Stdout, - logging.JSON.ConsoleEncoder(), - )), + logging.NoLog{}, 1024, metrics.NewSignatureAggregatorMetrics(prometheus.NewRegistry()), // Setting the etnaTime to a minute ago so that the post-etna code path is used in the test time.Now().Add(-1*time.Minute), ) Expect(err).Should(BeNil()) - instance++ return agg } From c3e06c89a2bad6824a9c9b2ce3f0ab63af61b847 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Thu, 21 Nov 2024 12:24:16 -0600 Subject: [PATCH 29/34] awm-relayer compat --- tests/utils/chain.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/utils/chain.go b/tests/utils/chain.go index 636addc5d..a859939cb 100644 --- a/tests/utils/chain.go +++ b/tests/utils/chain.go @@ -562,11 +562,9 @@ func NewSignatureAggregator(apiUri string, subnets []ids.ID) *aggregator.Signatu Expect(err).Should(BeNil()) appRequestNetwork, err := peers.NewNetwork( - "test-aggregator", - logging.Verbo, + logging.Error, registry, trackedSubnets, - messageCreator, nil, &cfg, ) @@ -575,6 +573,7 @@ func NewSignatureAggregator(apiUri string, subnets []ids.ID) *aggregator.Signatu agg, err := aggregator.NewSignatureAggregator( appRequestNetwork, logging.NoLog{}, + messageCreator, 1024, metrics.NewSignatureAggregatorMetrics(prometheus.NewRegistry()), // Setting the etnaTime to a minute ago so that the post-etna code path is used in the test From 452b448d6c6ec0096e068da6d95480cefa420322 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Thu, 21 Nov 2024 14:47:07 -0600 Subject: [PATCH 30/34] revert local awm-relayer dependent changes --- go.mod | 22 ++++---- go.sum | 38 +++++++------ tests/flows/governance/validator_set_sig.go | 5 +- tests/flows/ictt/erc20_home_erc20_remote.go | 9 +-- .../ictt/erc20_home_erc20_remote_multihop.go | 13 ++--- .../erc20_home_erc20_remote_send_and_call.go | 11 ++-- tests/flows/ictt/erc20_home_native_remote.go | 9 +-- .../ictt/erc20_home_native_remote_multihop.go | 15 ++--- tests/flows/ictt/native_home_erc20_remote.go | 9 +-- .../ictt/native_home_erc20_remote_multihop.go | 11 ++-- tests/flows/ictt/native_home_native_remote.go | 9 +-- .../native_home_native_remote_multihop.go | 15 ++--- .../ictt/registration_and_collateral_check.go | 7 +-- .../ictt/transparent_proxy_upgradeability.go | 9 +-- tests/flows/teleporter/basic_send_receive.go | 9 +-- .../deliver_to_nonexistent_contract.go | 6 +- .../teleporter/deliver_to_wrong_chain.go | 5 +- tests/flows/teleporter/insufficient_gas.go | 5 +- .../teleporter/registry/pause_teleporter.go | 7 +-- .../registry/teleporter_registry.go | 17 +++--- tests/flows/teleporter/relay_message_twice.go | 7 +-- .../teleporter/relayer_modifies_message.go | 5 +- .../teleporter/resubmit_altered_message.go | 5 +- .../teleporter/retry_successful_execution.go | 5 +- .../teleporter/send_specific_receipts.go | 13 ++--- tests/flows/teleporter/unallowed_relayer.go | 5 +- tests/flows/teleporter/validator_churn.go | 9 +-- .../validator-manager/erc20_token_staking.go | 14 ++--- .../validator-manager/native_token_staking.go | 14 ++--- tests/network/network.go | 55 ++++++++++--------- .../teleporter/teleporter_suite_test.go | 10 ++-- .../validator_manager_suite_test.go | 2 +- tests/utils/chain.go | 23 ++++---- tests/utils/validator_manager.go | 48 ++++++++-------- 34 files changed, 181 insertions(+), 265 deletions(-) diff --git a/go.mod b/go.mod index 4793b8b86..aef2d58a7 100644 --- a/go.mod +++ b/go.mod @@ -2,16 +2,14 @@ module github.com/ava-labs/teleporter go 1.22.8 -replace github.com/ava-labs/awm-relayer => /Users/cameron.schultz/awm-relayer - require ( - github.com/ava-labs/avalanchego v1.12.0-fuji + github.com/ava-labs/avalanchego v1.12.0-initial-poc.8 github.com/supranational/blst v0.3.13 // indirect ) require ( - github.com/ava-labs/awm-relayer v0.0.0-00010101000000-000000000000 - github.com/ava-labs/subnet-evm v0.6.12 + github.com/ava-labs/awm-relayer v1.4.1-0.20241112172851-472c76dde821 + github.com/ava-labs/subnet-evm v0.6.11 github.com/ethereum/go-ethereum v1.13.14 github.com/onsi/ginkgo/v2 v2.21.0 github.com/onsi/gomega v1.35.1 @@ -28,7 +26,7 @@ require ( github.com/DataDog/zstd v1.5.2 // indirect github.com/NYTimes/gziphandler v1.1.1 // indirect github.com/VictoriaMetrics/fastcache v1.12.1 // indirect - github.com/ava-labs/coreth v0.13.9-rc.1 // indirect + github.com/ava-labs/coreth v0.13.8 // 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 @@ -146,22 +144,22 @@ require ( go.opentelemetry.io/otel/sdk v1.22.0 // indirect go.opentelemetry.io/otel/trace v1.22.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect - go.uber.org/mock v0.5.0 // indirect + go.uber.org/mock v0.4.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/net v0.30.0 // indirect - golang.org/x/oauth2 v0.23.0 // indirect - golang.org/x/sync v0.9.0 // indirect + golang.org/x/oauth2 v0.22.0 // indirect + golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/term v0.25.0 // indirect golang.org/x/text v0.19.0 // indirect golang.org/x/time v0.3.0 // indirect gonum.org/v1/gonum v0.11.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect - google.golang.org/grpc v1.68.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect + google.golang.org/grpc v1.67.1 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect diff --git a/go.sum b/go.sum index 8b6c84b17..758f1df2c 100644 --- a/go.sum +++ b/go.sum @@ -58,12 +58,14 @@ github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= -github.com/ava-labs/avalanchego v1.12.0-fuji h1:o/GbXrqW9CAXu2jX/a1dZtvFiiSVCWomJZyxF4hCQOA= -github.com/ava-labs/avalanchego v1.12.0-fuji/go.mod h1:yhD5dpZyStIVbxQ550EDi5w5SL7DQ/xGE6TIxosb7U0= -github.com/ava-labs/coreth v0.13.9-rc.1 h1:qIICpC/OZGYUP37QnLgIqqwGmxnLwLpZaUlqJNI85vU= -github.com/ava-labs/coreth v0.13.9-rc.1/go.mod h1:7aMsRIo/3GBE44qWZMjnfqdqfcfZ5yShTTm2LObLaYo= -github.com/ava-labs/subnet-evm v0.6.12 h1:jL3FmjdFcNfS0qwbehwN6DkAg9y7zexB1riiGBxRsM0= -github.com/ava-labs/subnet-evm v0.6.12/go.mod h1:vffwL4UqAh7ibpWjveUuUhamm3a9w75q92bG5vXdX5k= +github.com/ava-labs/avalanchego v1.12.0-initial-poc.8 h1:UuCN1CYPZgf2FGGaO4XURVPWHjbv2U++VkarrADeT64= +github.com/ava-labs/avalanchego v1.12.0-initial-poc.8/go.mod h1:86tO6F1FT8emclUwdQ2WCwAtAerqjm5A4IbV6XxNUyM= +github.com/ava-labs/awm-relayer v1.4.1-0.20241112172851-472c76dde821 h1:0T6NvMMTI/Wg8mINllGe331BzylMIWLVi3my6SunOek= +github.com/ava-labs/awm-relayer v1.4.1-0.20241112172851-472c76dde821/go.mod h1:BhcOTNDB8JH5dAP77TOSxPwXYX/cOO4XlqKzmKX/DGQ= +github.com/ava-labs/coreth v0.13.8 h1:f14X3KgwHl9LwzfxlN6S4bbn5VA2rhEsNnHaRLSTo/8= +github.com/ava-labs/coreth v0.13.8/go.mod h1:t3BSv/eQv0AlDPMfEDCMMoD/jq1RkUsbFzQAFg5qBcE= +github.com/ava-labs/subnet-evm v0.6.11 h1:XgIAn9ihPyGjrBFD2rXg2H76HFl6htliHabN0fjciaQ= +github.com/ava-labs/subnet-evm v0.6.11/go.mod h1:fP46lzBtiniRfpNH+Qu9BFvSsa02YGkAobxinZ78gDU= 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= @@ -647,8 +649,8 @@ go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lI go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= -go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= @@ -764,8 +766,8 @@ golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= -golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA= +golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -778,8 +780,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= -golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -998,10 +1000,10 @@ google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 h1:hjSy6tcFQZ171igDaN5QHOw2n6vx40juYbC/x67CEhc= -google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:qpvKtACPCQhAdu3PyQgV4l3LMXZEtft7y8QcarRsp9I= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 h1:wKguEg1hsxI2/L3hUYrpo1RVi48K+uTyzKqprwLXsb8= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= @@ -1020,8 +1022,8 @@ google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.68.0 h1:aHQeeJbo8zAkAa3pRzrVjZlbz6uSfeOXlJNQM0RAbz0= -google.golang.org/grpc v1.68.0/go.mod h1:fmSPC5AsjSBCK54MyHRx48kpOti1/jRfOlwEWywNjWA= +google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= +google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/tests/flows/governance/validator_set_sig.go b/tests/flows/governance/validator_set_sig.go index 4a8457907..9ff4f3e99 100644 --- a/tests/flows/governance/validator_set_sig.go +++ b/tests/flows/governance/validator_set_sig.go @@ -145,9 +145,6 @@ func ValidatorSetSig(network *localnetwork.LocalNetwork) { // Test Case 1: validatorChain (subnetB) != targetChain (subnetA) // ************************************************************************************************ - aggregator := network.GetSignatureAggregator() - defer aggregator.Shutdown() - // Execute the ValidatorSetSig executeCall and wait for acceptance receipt := utils.ExecuteValidatorSetSigCallAndVerify( ctx, @@ -156,7 +153,7 @@ func ValidatorSetSig(network *localnetwork.LocalNetwork) { validatorSetSigContractAddress, fundedKey, &offchainMessages[0], - aggregator, + network.GetSignatureAggregator(), true, ) diff --git a/tests/flows/ictt/erc20_home_erc20_remote.go b/tests/flows/ictt/erc20_home_erc20_remote.go index cfdfc7021..9f996b60b 100644 --- a/tests/flows/ictt/erc20_home_erc20_remote.go +++ b/tests/flows/ictt/erc20_home_erc20_remote.go @@ -71,9 +71,6 @@ func ERC20TokenHomeERC20TokenRemote(network *localnetwork.LocalNetwork, teleport tokenDecimals, ) - aggregator := network.GetSignatureAggregator() - defer aggregator.Shutdown() - utils.RegisterERC20TokenRemoteOnHome( ctx, teleporter, @@ -82,7 +79,7 @@ func ERC20TokenHomeERC20TokenRemote(network *localnetwork.LocalNetwork, teleport subnetAInfo, erc20TokenRemoteAddress, fundedKey, - aggregator, + network.GetSignatureAggregator(), ) // Generate new recipient to receive transferred tokens @@ -122,7 +119,7 @@ func ERC20TokenHomeERC20TokenRemote(network *localnetwork.LocalNetwork, teleport true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) utils.CheckERC20TokenRemoteWithdrawal( @@ -175,7 +172,7 @@ func ERC20TokenHomeERC20TokenRemote(network *localnetwork.LocalNetwork, teleport true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) utils.CheckERC20TokenHomeWithdrawal( diff --git a/tests/flows/ictt/erc20_home_erc20_remote_multihop.go b/tests/flows/ictt/erc20_home_erc20_remote_multihop.go index 8f19fb77c..4cfa4abea 100644 --- a/tests/flows/ictt/erc20_home_erc20_remote_multihop.go +++ b/tests/flows/ictt/erc20_home_erc20_remote_multihop.go @@ -86,9 +86,6 @@ func ERC20TokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, tokenDecimals, ) - aggregator := network.GetSignatureAggregator() - defer aggregator.Shutdown() - // Register both ERC20TokenRemote instances on the ERC20TokenHome utils.RegisterERC20TokenRemoteOnHome( ctx, @@ -98,7 +95,7 @@ func ERC20TokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, subnetAInfo, erc20TokenRemoteAddressA, fundedKey, - aggregator, + network.GetSignatureAggregator(), ) utils.RegisterERC20TokenRemoteOnHome( ctx, @@ -108,7 +105,7 @@ func ERC20TokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, subnetBInfo, erc20TokenRemoteAddressB, fundedKey, - aggregator, + network.GetSignatureAggregator(), ) // Generate new recipient to receive transferred tokens @@ -148,7 +145,7 @@ func ERC20TokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) utils.CheckERC20TokenRemoteWithdrawal( @@ -182,7 +179,7 @@ func ERC20TokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, cChainInfo, transferredAmount, secondaryFeeAmount, - aggregator, + network.GetSignatureAggregator(), ) // Multi-hop transfer back to Subnet A @@ -203,6 +200,6 @@ func ERC20TokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, cChainInfo, transferredAmount, secondaryFeeAmount, - aggregator, + network.GetSignatureAggregator(), ) } diff --git a/tests/flows/ictt/erc20_home_erc20_remote_send_and_call.go b/tests/flows/ictt/erc20_home_erc20_remote_send_and_call.go index ab6c8c78d..d76eb4907 100644 --- a/tests/flows/ictt/erc20_home_erc20_remote_send_and_call.go +++ b/tests/flows/ictt/erc20_home_erc20_remote_send_and_call.go @@ -87,9 +87,6 @@ func ERC20TokenHomeERC20TokenRemoteSendAndCall( tokenDecimals, ) - aggregator := network.GetSignatureAggregator() - defer aggregator.Shutdown() - utils.RegisterERC20TokenRemoteOnHome( ctx, teleporter, @@ -98,7 +95,7 @@ func ERC20TokenHomeERC20TokenRemoteSendAndCall( subnetAInfo, erc20TokenRemoteAddress, fundedKey, - aggregator, + network.GetSignatureAggregator(), ) // Generate new recipient to receive transferred tokens @@ -150,7 +147,7 @@ func ERC20TokenHomeERC20TokenRemoteSendAndCall( true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) event, err := utils.GetEventFromLogs(receipt.Logs, erc20TokenRemote.ParseCallSucceeded) @@ -202,7 +199,7 @@ func ERC20TokenHomeERC20TokenRemoteSendAndCall( true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) utils.CheckERC20TokenRemoteWithdrawal( @@ -261,7 +258,7 @@ func ERC20TokenHomeERC20TokenRemoteSendAndCall( true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) homeEvent, err := utils.GetEventFromLogs(receipt.Logs, erc20TokenHome.ParseCallSucceeded) diff --git a/tests/flows/ictt/erc20_home_native_remote.go b/tests/flows/ictt/erc20_home_native_remote.go index ea2cfa19e..00b4f9e98 100644 --- a/tests/flows/ictt/erc20_home_native_remote.go +++ b/tests/flows/ictt/erc20_home_native_remote.go @@ -74,9 +74,6 @@ func ERC20TokenHomeNativeTokenRemote(network *localnetwork.LocalNetwork, telepor burnedFeesReportingRewardPercentage, ) - aggregator := network.GetSignatureAggregator() - defer aggregator.Shutdown() - collateralAmount := utils.RegisterTokenRemoteOnHome( ctx, teleporter, @@ -88,7 +85,7 @@ func ERC20TokenHomeNativeTokenRemote(network *localnetwork.LocalNetwork, telepor utils.GetTokenMultiplier(decimalsShift), multiplyOnRemote, fundedKey, - aggregator, + network.GetSignatureAggregator(), ) utils.AddCollateralToERC20TokenHome( @@ -141,7 +138,7 @@ func ERC20TokenHomeNativeTokenRemote(network *localnetwork.LocalNetwork, telepor true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) // Verify the recipient received the tokens @@ -177,7 +174,7 @@ func ERC20TokenHomeNativeTokenRemote(network *localnetwork.LocalNetwork, telepor true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) // Check that the recipient received the tokens diff --git a/tests/flows/ictt/erc20_home_native_remote_multihop.go b/tests/flows/ictt/erc20_home_native_remote_multihop.go index 60c06ba35..03e340c0d 100644 --- a/tests/flows/ictt/erc20_home_native_remote_multihop.go +++ b/tests/flows/ictt/erc20_home_native_remote_multihop.go @@ -78,9 +78,6 @@ func ERC20TokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork, burnedFeesReportingRewardPercentage, ) - aggregator := network.GetSignatureAggregator() - defer aggregator.Shutdown() - // Register both NativeTokenDestinations on the ERC20TokenHome collateralAmountA := utils.RegisterTokenRemoteOnHome( ctx, @@ -93,7 +90,7 @@ func ERC20TokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork, utils.GetTokenMultiplier(decimalsShift), multiplyOnRemote, fundedKey, - aggregator, + network.GetSignatureAggregator(), ) collateralAmountB := utils.RegisterTokenRemoteOnHome( @@ -107,7 +104,7 @@ func ERC20TokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork, utils.GetTokenMultiplier(decimalsShift), multiplyOnRemote, fundedKey, - aggregator, + network.GetSignatureAggregator(), ) // Add collateral for both NativeTokenDestinations @@ -174,7 +171,7 @@ func ERC20TokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork, true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) // Verify the recipient received the tokens @@ -211,7 +208,7 @@ func ERC20TokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork, true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) // Verify the recipient received the tokens @@ -235,7 +232,7 @@ func ERC20TokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork, cChainInfo, amountToSend, big.NewInt(0), - aggregator, + network.GetSignatureAggregator(), ) // Multi-hop transfer back to Subnet A @@ -254,6 +251,6 @@ func ERC20TokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork, cChainInfo, amountToSend, secondaryFeeAmount, - aggregator, + network.GetSignatureAggregator(), ) } diff --git a/tests/flows/ictt/native_home_erc20_remote.go b/tests/flows/ictt/native_home_erc20_remote.go index ccad64974..c52d5c268 100644 --- a/tests/flows/ictt/native_home_erc20_remote.go +++ b/tests/flows/ictt/native_home_erc20_remote.go @@ -67,9 +67,6 @@ func NativeTokenHomeERC20TokenRemote(network *localnetwork.LocalNetwork, telepor tokenDecimals, ) - aggregator := network.GetSignatureAggregator() - defer aggregator.Shutdown() - utils.RegisterERC20TokenRemoteOnHome( ctx, teleporter, @@ -78,7 +75,7 @@ func NativeTokenHomeERC20TokenRemote(network *localnetwork.LocalNetwork, telepor subnetAInfo, erc20TokenRemoteAddress, fundedKey, - aggregator, + network.GetSignatureAggregator(), ) // Generate new recipient to receive transferred tokens @@ -119,7 +116,7 @@ func NativeTokenHomeERC20TokenRemote(network *localnetwork.LocalNetwork, telepor true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) utils.CheckERC20TokenRemoteWithdrawal( @@ -172,7 +169,7 @@ func NativeTokenHomeERC20TokenRemote(network *localnetwork.LocalNetwork, telepor true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) // Check that the recipient received the tokens diff --git a/tests/flows/ictt/native_home_erc20_remote_multihop.go b/tests/flows/ictt/native_home_erc20_remote_multihop.go index ff957ed04..b8220b7bc 100644 --- a/tests/flows/ictt/native_home_erc20_remote_multihop.go +++ b/tests/flows/ictt/native_home_erc20_remote_multihop.go @@ -81,9 +81,6 @@ func NativeTokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, tokenDecimals, ) - aggregator := network.GetSignatureAggregator() - defer aggregator.Shutdown() - // Register both ERC20Destinations on the NativeTokenHome utils.RegisterERC20TokenRemoteOnHome( ctx, @@ -93,7 +90,7 @@ func NativeTokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, subnetAInfo, erc20TokenRemoteAddressA, fundedKey, - aggregator, + network.GetSignatureAggregator(), ) utils.RegisterERC20TokenRemoteOnHome( @@ -104,7 +101,7 @@ func NativeTokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, subnetBInfo, erc20TokenRemoteAddressB, fundedKey, - aggregator, + network.GetSignatureAggregator(), ) // Generate new recipient to receive transferred tokens @@ -145,7 +142,7 @@ func NativeTokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) utils.CheckERC20TokenRemoteWithdrawal( @@ -178,6 +175,6 @@ func NativeTokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork, cChainInfo, transferredAmount, secondaryFeeAmount, - aggregator, + network.GetSignatureAggregator(), ) } diff --git a/tests/flows/ictt/native_home_native_remote.go b/tests/flows/ictt/native_home_native_remote.go index 346dbc70b..37e426b6b 100644 --- a/tests/flows/ictt/native_home_native_remote.go +++ b/tests/flows/ictt/native_home_native_remote.go @@ -57,9 +57,6 @@ func NativeTokenHomeNativeDestination(network *localnetwork.LocalNetwork, telepo burnedFeesReportingRewardPercentage, ) - aggregator := network.GetSignatureAggregator() - defer aggregator.Shutdown() - // Register the NativeTokenRemote on the NativeTokenHome collateralAmount := utils.RegisterTokenRemoteOnHome( ctx, @@ -72,7 +69,7 @@ func NativeTokenHomeNativeDestination(network *localnetwork.LocalNetwork, telepo big.NewInt(1), multiplyOnRemote, fundedKey, - aggregator, + network.GetSignatureAggregator(), ) utils.AddCollateralToNativeTokenHome( @@ -124,7 +121,7 @@ func NativeTokenHomeNativeDestination(network *localnetwork.LocalNetwork, telepo true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) utils.CheckBalance( @@ -167,7 +164,7 @@ func NativeTokenHomeNativeDestination(network *localnetwork.LocalNetwork, telepo true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) // Check that the recipient received the tokens diff --git a/tests/flows/ictt/native_home_native_remote_multihop.go b/tests/flows/ictt/native_home_native_remote_multihop.go index 897568157..4569fd727 100644 --- a/tests/flows/ictt/native_home_native_remote_multihop.go +++ b/tests/flows/ictt/native_home_native_remote_multihop.go @@ -77,9 +77,6 @@ func NativeTokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork burnedFeesReportingRewardPercentage, ) - aggregator := network.GetSignatureAggregator() - defer aggregator.Shutdown() - // Register both NativeTokenDestinations on the NativeTokenHome collateralAmountA := utils.RegisterTokenRemoteOnHome( ctx, @@ -92,7 +89,7 @@ func NativeTokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork utils.GetTokenMultiplier(decimalsShift), multiplyOnRemote, fundedKey, - aggregator, + network.GetSignatureAggregator(), ) collateralAmountB := utils.RegisterTokenRemoteOnHome( @@ -106,7 +103,7 @@ func NativeTokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork utils.GetTokenMultiplier(decimalsShift), multiplyOnRemote, fundedKey, - aggregator, + network.GetSignatureAggregator(), ) // Add collateral for both NativeTokenDestinations @@ -170,7 +167,7 @@ func NativeTokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) // Verify the recipient received the tokens @@ -206,7 +203,7 @@ func NativeTokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) // Verify the recipient received the tokens @@ -230,7 +227,7 @@ func NativeTokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork cChainInfo, amountToSendA, big.NewInt(0), - aggregator, + network.GetSignatureAggregator(), ) // Again, send half of the received amount to account for gas expenses @@ -252,6 +249,6 @@ func NativeTokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork cChainInfo, amountToSendB, secondaryFeeAmount, - aggregator, + network.GetSignatureAggregator(), ) } diff --git a/tests/flows/ictt/registration_and_collateral_check.go b/tests/flows/ictt/registration_and_collateral_check.go index 03cd89ea1..442db7fe5 100644 --- a/tests/flows/ictt/registration_and_collateral_check.go +++ b/tests/flows/ictt/registration_and_collateral_check.go @@ -98,9 +98,6 @@ func RegistrationAndCollateralCheck(network *localnetwork.LocalNetwork, teleport Expect(err).Should(BeNil()) utils.ExpectBigEqual(balance, initialBalance) - aggregator := network.GetSignatureAggregator() - defer aggregator.Shutdown() - // Register the NativeTokenRemote to the ERC20TokenHome collateralNeeded := utils.RegisterTokenRemoteOnHome( ctx, @@ -113,7 +110,7 @@ func RegistrationAndCollateralCheck(network *localnetwork.LocalNetwork, teleport utils.GetTokenMultiplier(decimalsShift), multiplyOnRemote, fundedKey, - aggregator, + network.GetSignatureAggregator(), ) // Try sending again and expect failure since remote is not collateralized @@ -193,7 +190,7 @@ func RegistrationAndCollateralCheck(network *localnetwork.LocalNetwork, teleport true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) // Verify the recipient received the tokens diff --git a/tests/flows/ictt/transparent_proxy_upgradeability.go b/tests/flows/ictt/transparent_proxy_upgradeability.go index 71e6abc9a..7dc99ee4e 100644 --- a/tests/flows/ictt/transparent_proxy_upgradeability.go +++ b/tests/flows/ictt/transparent_proxy_upgradeability.go @@ -97,9 +97,6 @@ func TransparentUpgradeableProxy(network *localnetwork.LocalNetwork, teleporter tokenDecimals, ) - aggregator := network.GetSignatureAggregator() - defer aggregator.Shutdown() - utils.RegisterERC20TokenRemoteOnHome( ctx, teleporter, @@ -108,7 +105,7 @@ func TransparentUpgradeableProxy(network *localnetwork.LocalNetwork, teleporter subnetAInfo, erc20TokenRemoteAddress, fundedKey, - aggregator, + network.GetSignatureAggregator(), ) // Send a transfer from primary network to Subnet A @@ -148,7 +145,7 @@ func TransparentUpgradeableProxy(network *localnetwork.LocalNetwork, teleporter true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) utils.CheckERC20TokenRemoteWithdrawal( @@ -214,7 +211,7 @@ func TransparentUpgradeableProxy(network *localnetwork.LocalNetwork, teleporter true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) // Check that the transfer was successful, and expected balances are correct diff --git a/tests/flows/teleporter/basic_send_receive.go b/tests/flows/teleporter/basic_send_receive.go index 97da8c397..e01577982 100644 --- a/tests/flows/teleporter/basic_send_receive.go +++ b/tests/flows/teleporter/basic_send_receive.go @@ -22,13 +22,10 @@ func BasicSendReceive(network *localnetwork.LocalNetwork, teleporter utils.Telep // Send a transaction to Subnet A to issue a Warp Message from the Teleporter contract to Subnet B ctx := context.Background() - aggregator := network.GetSignatureAggregator() - defer aggregator.Shutdown() - // Clear the receipt queue from Subnet B -> Subnet A to have a clean slate for the test flow. // This is only done if the test non-external networks because external networks may have // an arbitrarily high number of receipts to be cleared from a given queue from unrelated messages. - teleporter.ClearReceiptQueue(ctx, fundedKey, subnetBInfo, subnetAInfo, aggregator) + teleporter.ClearReceiptQueue(ctx, fundedKey, subnetBInfo, subnetAInfo, network.GetSignatureAggregator()) feeAmount := big.NewInt(1) feeTokenAddress, feeToken := utils.DeployExampleERC20( @@ -77,7 +74,7 @@ func BasicSendReceive(network *localnetwork.LocalNetwork, teleporter utils.Telep true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) receiveEvent, err := utils.GetEventFromLogs( deliveryReceipt.Logs, @@ -112,7 +109,7 @@ func BasicSendReceive(network *localnetwork.LocalNetwork, teleporter utils.Telep true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) Expect(utils.CheckReceiptReceived( diff --git a/tests/flows/teleporter/deliver_to_nonexistent_contract.go b/tests/flows/teleporter/deliver_to_nonexistent_contract.go index 664310596..2257ba1d6 100644 --- a/tests/flows/teleporter/deliver_to_nonexistent_contract.go +++ b/tests/flows/teleporter/deliver_to_nonexistent_contract.go @@ -87,10 +87,6 @@ func DeliverToNonExistentContract(network *localnetwork.LocalNetwork, teleporter // // Relay the message to the destination // - - aggregator := network.GetSignatureAggregator() - defer aggregator.Shutdown() - log.Info("Relaying the message to the destination") receipt = teleporter.RelayTeleporterMessage( ctx, @@ -100,7 +96,7 @@ func DeliverToNonExistentContract(network *localnetwork.LocalNetwork, teleporter true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) receiveEvent, err := utils.GetEventFromLogs(receipt.Logs, teleporter.TeleporterMessenger(subnetAInfo).ParseReceiveCrossChainMessage) diff --git a/tests/flows/teleporter/deliver_to_wrong_chain.go b/tests/flows/teleporter/deliver_to_wrong_chain.go index 7a76b5cc9..22345242b 100644 --- a/tests/flows/teleporter/deliver_to_wrong_chain.go +++ b/tests/flows/teleporter/deliver_to_wrong_chain.go @@ -57,9 +57,6 @@ func DeliverToWrongChain(network *localnetwork.LocalNetwork, teleporter utils.Te fundedKey, ) - aggregator := network.GetSignatureAggregator() - defer aggregator.Shutdown() - teleporter.RelayTeleporterMessage( ctx, receipt, @@ -68,7 +65,7 @@ func DeliverToWrongChain(network *localnetwork.LocalNetwork, teleporter utils.Te false, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) // diff --git a/tests/flows/teleporter/insufficient_gas.go b/tests/flows/teleporter/insufficient_gas.go index a71c21d7d..1b593b145 100644 --- a/tests/flows/teleporter/insufficient_gas.go +++ b/tests/flows/teleporter/insufficient_gas.go @@ -55,9 +55,6 @@ func InsufficientGas(network *localnetwork.LocalNetwork, teleporter utils.Telepo messageID := event.MessageID - aggregator := network.GetSignatureAggregator() - defer aggregator.Shutdown() - // Relay message from SubnetA to SubnetB receipt = teleporter.RelayTeleporterMessage( ctx, @@ -67,7 +64,7 @@ func InsufficientGas(network *localnetwork.LocalNetwork, teleporter utils.Telepo true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) // Check Teleporter message received on the destination diff --git a/tests/flows/teleporter/registry/pause_teleporter.go b/tests/flows/teleporter/registry/pause_teleporter.go index f1815dcf1..84b713d90 100644 --- a/tests/flows/teleporter/registry/pause_teleporter.go +++ b/tests/flows/teleporter/registry/pause_teleporter.go @@ -50,9 +50,6 @@ func PauseTeleporter(network *localnetwork.LocalNetwork, teleporter utils.Telepo Expect(err).Should(BeNil()) Expect(isPaused).Should(BeTrue()) - aggregator := network.GetSignatureAggregator() - defer aggregator.Shutdown() - // Send a message from subnet A to subnet B, which should fail teleporter.SendExampleCrossChainMessageAndVerify( ctx, @@ -63,7 +60,7 @@ func PauseTeleporter(network *localnetwork.LocalNetwork, teleporter utils.Telepo testMessengerB, fundedKey, "message_1", - aggregator, + network.GetSignatureAggregator(), false, ) @@ -90,7 +87,7 @@ func PauseTeleporter(network *localnetwork.LocalNetwork, teleporter utils.Telepo testMessengerB, fundedKey, "message_2", - aggregator, + network.GetSignatureAggregator(), true, ) } diff --git a/tests/flows/teleporter/registry/teleporter_registry.go b/tests/flows/teleporter/registry/teleporter_registry.go index ad81e4980..85d252737 100644 --- a/tests/flows/teleporter/registry/teleporter_registry.go +++ b/tests/flows/teleporter/registry/teleporter_registry.go @@ -87,9 +87,6 @@ func TeleporterRegistry(network *localnetwork.LocalNetwork, teleporter utils.Tel // Restart nodes with new chain config network.SetChainConfigs(chainConfigs) - aggregator := network.GetSignatureAggregator() - defer aggregator.Shutdown() - // Call addProtocolVersion on subnetB to register the new Teleporter version teleporter.AddProtocolVersionAndWaitForAcceptance( ctx, @@ -97,7 +94,7 @@ func TeleporterRegistry(network *localnetwork.LocalNetwork, teleporter utils.Tel newTeleporterAddress, fundedKey, offchainMessageB, - aggregator, + network.GetSignatureAggregator(), ) // Send a message using old Teleporter version to test messenger using new Teleporter version. @@ -111,7 +108,7 @@ func TeleporterRegistry(network *localnetwork.LocalNetwork, teleporter utils.Tel testMessengerB, fundedKey, "message_1", - aggregator, + network.GetSignatureAggregator(), true, ) @@ -148,7 +145,7 @@ func TeleporterRegistry(network *localnetwork.LocalNetwork, teleporter utils.Tel testMessengerB, fundedKey, "message_2", - aggregator, + network.GetSignatureAggregator(), false, ) @@ -167,7 +164,7 @@ func TeleporterRegistry(network *localnetwork.LocalNetwork, teleporter utils.Tel testMessengerC, fundedKey, "message_3", - aggregator, + network.GetSignatureAggregator(), false, ) @@ -178,7 +175,7 @@ func TeleporterRegistry(network *localnetwork.LocalNetwork, teleporter utils.Tel newTeleporterAddress, fundedKey, offchainMessageC, - aggregator, + network.GetSignatureAggregator(), ) // Send a message from A->B, which previously failed, but now using the new Teleporter version. @@ -192,7 +189,7 @@ func TeleporterRegistry(network *localnetwork.LocalNetwork, teleporter utils.Tel testMessengerC, fundedKey, "message_4", - aggregator, + network.GetSignatureAggregator(), true, ) @@ -204,7 +201,7 @@ func TeleporterRegistry(network *localnetwork.LocalNetwork, teleporter utils.Tel newTeleporterAddress, fundedKey, offchainMessageA, - aggregator, + network.GetSignatureAggregator(), ) latestVersionA, err := teleporter.TeleporterRegistry(subnetAInfo).LatestVersion(&bind.CallOpts{}) diff --git a/tests/flows/teleporter/relay_message_twice.go b/tests/flows/teleporter/relay_message_twice.go index 72677411e..61e19f568 100644 --- a/tests/flows/teleporter/relay_message_twice.go +++ b/tests/flows/teleporter/relay_message_twice.go @@ -49,9 +49,6 @@ func RelayMessageTwice(network *localnetwork.LocalNetwork, teleporter utils.Tele fundedKey, ) - aggregator := network.GetSignatureAggregator() - defer aggregator.Shutdown() - // // Relay the message to the destination // @@ -63,7 +60,7 @@ func RelayMessageTwice(network *localnetwork.LocalNetwork, teleporter utils.Tele true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) // @@ -88,6 +85,6 @@ func RelayMessageTwice(network *localnetwork.LocalNetwork, teleporter utils.Tele false, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) } diff --git a/tests/flows/teleporter/relayer_modifies_message.go b/tests/flows/teleporter/relayer_modifies_message.go index fe4441a97..366c142f1 100644 --- a/tests/flows/teleporter/relayer_modifies_message.go +++ b/tests/flows/teleporter/relayer_modifies_message.go @@ -78,16 +78,13 @@ func relayAlteredMessage( ) Expect(err).Should(BeNil()) - aggregator := network.GetSignatureAggregator() - defer aggregator.Shutdown() - signedWarpMessage := utils.ConstructSignedWarpMessage( ctx, sourceReceipt, source, destination, nil, - aggregator, + network.GetSignatureAggregator(), ) // Construct the transaction to send the Warp message to the destination chain diff --git a/tests/flows/teleporter/resubmit_altered_message.go b/tests/flows/teleporter/resubmit_altered_message.go index 37f621661..869d27273 100644 --- a/tests/flows/teleporter/resubmit_altered_message.go +++ b/tests/flows/teleporter/resubmit_altered_message.go @@ -36,9 +36,6 @@ func ResubmitAlteredMessage(network *localnetwork.LocalNetwork, teleporter utils receipt, messageID := utils.SendCrossChainMessageAndWaitForAcceptance( ctx, teleporter.TeleporterMessenger(subnetAInfo), subnetAInfo, subnetBInfo, sendCrossChainMessageInput, fundedKey) - aggregator := network.GetSignatureAggregator() - defer aggregator.Shutdown() - // Relay the message to the destination receipt = teleporter.RelayTeleporterMessage( ctx, @@ -48,7 +45,7 @@ func ResubmitAlteredMessage(network *localnetwork.LocalNetwork, teleporter utils true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) log.Info("Checking the message was received on the destination") diff --git a/tests/flows/teleporter/retry_successful_execution.go b/tests/flows/teleporter/retry_successful_execution.go index b7e2743b4..067ac9adf 100644 --- a/tests/flows/teleporter/retry_successful_execution.go +++ b/tests/flows/teleporter/retry_successful_execution.go @@ -65,9 +65,6 @@ func RetrySuccessfulExecution(network *localnetwork.LocalNetwork, teleporter uti teleporterMessageID := event.MessageID - aggregator := network.GetSignatureAggregator() - defer aggregator.Shutdown() - // // Relay the message to the destination // @@ -79,7 +76,7 @@ func RetrySuccessfulExecution(network *localnetwork.LocalNetwork, teleporter uti true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) receiveEvent, err := utils.GetEventFromLogs(receipt.Logs, teleporter.TeleporterMessenger(subnetBInfo).ParseReceiveCrossChainMessage) diff --git a/tests/flows/teleporter/send_specific_receipts.go b/tests/flows/teleporter/send_specific_receipts.go index f7c8a05c0..588a4b6a9 100644 --- a/tests/flows/teleporter/send_specific_receipts.go +++ b/tests/flows/teleporter/send_specific_receipts.go @@ -27,11 +27,8 @@ func SendSpecificReceipts(network *localnetwork.LocalNetwork, teleporter utils.T _, fundedKey := network.GetFundedAccountInfo() ctx := context.Background() - aggregator := network.GetSignatureAggregator() - defer aggregator.Shutdown() - // Clear the receipt queue from Subnet B -> Subnet A to have a clean slate for the test flow. - teleporter.ClearReceiptQueue(ctx, fundedKey, subnetBInfo, subnetAInfo, aggregator) + teleporter.ClearReceiptQueue(ctx, fundedKey, subnetBInfo, subnetAInfo, network.GetSignatureAggregator()) // Use mock token as the fee token mockTokenAddress, mockToken := utils.DeployExampleERC20( @@ -77,7 +74,7 @@ func SendSpecificReceipts(network *localnetwork.LocalNetwork, teleporter utils.T true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) receiveEvent1, err := utils.GetEventFromLogs( deliveryReceipt1.Logs, @@ -105,7 +102,7 @@ func SendSpecificReceipts(network *localnetwork.LocalNetwork, teleporter utils.T true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) receiveEvent2, err := utils.GetEventFromLogs( deliveryReceipt2.Logs, @@ -144,7 +141,7 @@ func SendSpecificReceipts(network *localnetwork.LocalNetwork, teleporter utils.T true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) // Check that the message back to Subnet A was delivered @@ -198,7 +195,7 @@ func SendSpecificReceipts(network *localnetwork.LocalNetwork, teleporter utils.T true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) // Check delivered delivered, err = subnetATeleporterMessenger.MessageReceived( diff --git a/tests/flows/teleporter/unallowed_relayer.go b/tests/flows/teleporter/unallowed_relayer.go index 983b5fabc..47ae8c8f9 100644 --- a/tests/flows/teleporter/unallowed_relayer.go +++ b/tests/flows/teleporter/unallowed_relayer.go @@ -46,9 +46,6 @@ func UnallowedRelayer(network *localnetwork.LocalNetwork, teleporter utils.Telep ctx, teleporter.TeleporterMessenger(subnetAInfo), subnetAInfo, subnetBInfo, sendCrossChainMessageInput, fundedKey, ) - aggregator := network.GetSignatureAggregator() - defer aggregator.Shutdown() - // // Relay the message to the destination // @@ -60,7 +57,7 @@ func UnallowedRelayer(network *localnetwork.LocalNetwork, teleporter utils.Telep false, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) // diff --git a/tests/flows/teleporter/validator_churn.go b/tests/flows/teleporter/validator_churn.go index 8ccbe20b6..a043e32b0 100644 --- a/tests/flows/teleporter/validator_churn.go +++ b/tests/flows/teleporter/validator_churn.go @@ -58,9 +58,6 @@ func ValidatorChurn(network *localnetwork.LocalNetwork, teleporter utils.Telepor Expect(err).Should(BeNil()) sentTeleporterMessage := sendEvent.Message - aggregator := network.GetSignatureAggregator() - defer aggregator.Shutdown() - // Construct the signed warp message signedWarpMessage := utils.ConstructSignedWarpMessage( ctx, @@ -68,7 +65,7 @@ func ValidatorChurn(network *localnetwork.LocalNetwork, teleporter utils.Telepor subnetAInfo, subnetBInfo, nil, - aggregator, + network.GetSignatureAggregator(), ) // @@ -97,7 +94,7 @@ func ValidatorChurn(network *localnetwork.LocalNetwork, teleporter utils.Telepor } utils.InitializeAndCompletePoAValidatorRegistration( addValidatorsCtx, - aggregator, + network.GetSignatureAggregator(), fundedKey, fundedKey, subnetAInfo, @@ -171,7 +168,7 @@ func ValidatorChurn(network *localnetwork.LocalNetwork, teleporter utils.Telepor true, fundedKey, nil, - aggregator, + network.GetSignatureAggregator(), ) // Verify the message was delivered diff --git a/tests/flows/validator-manager/erc20_token_staking.go b/tests/flows/validator-manager/erc20_token_staking.go index 9adaf3955..4f7925105 100644 --- a/tests/flows/validator-manager/erc20_token_staking.go +++ b/tests/flows/validator-manager/erc20_token_staking.go @@ -144,9 +144,6 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { Expect(err).Should(BeNil()) delegationID = initRegistrationEvent.DelegationID - aggregator := network.GetSignatureAggregator() - defer aggregator.Shutdown() - // Gather subnet-evm Warp signatures for the SubnetValidatorWeightUpdateMessage & relay to the P-Chain signedWarpMessage := utils.ConstructSignedWarpMessage( context.Background(), @@ -154,11 +151,11 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { subnetAInfo, pChainInfo, nil, - aggregator, + network.GetSignatureAggregator(), ) // Issue a tx to update the validator's weight on the P-Chain - network.GetPChainWallet().IssueSetL1ValidatorWeightTx(signedWarpMessage.Bytes()) + network.GetPChainWallet().IssueSetSubnetValidatorWeightTx(signedWarpMessage.Bytes()) utils.PChainProposerVMWorkaround(network.GetPChainWallet()) utils.AdvanceProposerVM(ctx, subnetAInfo, fundedKey, 5) @@ -213,9 +210,6 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { Expect(delegatorRemovalEvent.ValidationID[:]).Should(Equal(validationID[:])) Expect(delegatorRemovalEvent.DelegationID[:]).Should(Equal(delegationID[:])) - aggregator := network.GetSignatureAggregator() - defer aggregator.Shutdown() - // Gather subnet-evm Warp signatures for the SetSubnetValidatorWeightMessage & relay to the P-Chain // (Sending to the P-Chain will be skipped for now) signedWarpMessage := utils.ConstructSignedWarpMessage( @@ -224,12 +218,12 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { subnetAInfo, pChainInfo, nil, - aggregator, + network.GetSignatureAggregator(), ) Expect(err).Should(BeNil()) // Issue a tx to update the validator's weight on the P-Chain - network.GetPChainWallet().IssueSetL1ValidatorWeightTx(signedWarpMessage.Bytes()) + network.GetPChainWallet().IssueSetSubnetValidatorWeightTx(signedWarpMessage.Bytes()) utils.PChainProposerVMWorkaround(network.GetPChainWallet()) utils.AdvanceProposerVM(ctx, subnetAInfo, fundedKey, 5) diff --git a/tests/flows/validator-manager/native_token_staking.go b/tests/flows/validator-manager/native_token_staking.go index dba3c4a1c..8470edbae 100644 --- a/tests/flows/validator-manager/native_token_staking.go +++ b/tests/flows/validator-manager/native_token_staking.go @@ -138,9 +138,6 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { Expect(err).Should(BeNil()) delegationID = initRegistrationEvent.DelegationID - aggregator := network.GetSignatureAggregator() - defer aggregator.Shutdown() - // Gather subnet-evm Warp signatures for the SubnetValidatorWeightUpdateMessage & relay to the P-Chain signedWarpMessage := utils.ConstructSignedWarpMessage( context.Background(), @@ -148,11 +145,11 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { subnetAInfo, pChainInfo, nil, - aggregator, + network.GetSignatureAggregator(), ) // Issue a tx to update the validator's weight on the P-Chain - network.GetPChainWallet().IssueSetL1ValidatorWeightTx(signedWarpMessage.Bytes()) + network.GetPChainWallet().IssueSetSubnetValidatorWeightTx(signedWarpMessage.Bytes()) utils.PChainProposerVMWorkaround(network.GetPChainWallet()) utils.AdvanceProposerVM(ctx, subnetAInfo, fundedKey, 5) @@ -206,9 +203,6 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { Expect(delegatorRemovalEvent.ValidationID[:]).Should(Equal(validationID[:])) Expect(delegatorRemovalEvent.DelegationID[:]).Should(Equal(delegationID[:])) - aggregator := network.GetSignatureAggregator() - defer aggregator.Shutdown() - // Gather subnet-evm Warp signatures for the SetSubnetValidatorWeightMessage & relay to the P-Chain // (Sending to the P-Chain will be skipped for now) signedWarpMessage := utils.ConstructSignedWarpMessage( @@ -217,12 +211,12 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { subnetAInfo, pChainInfo, nil, - aggregator, + network.GetSignatureAggregator(), ) Expect(err).Should(BeNil()) // Issue a tx to update the validator's weight on the P-Chain - network.GetPChainWallet().IssueSetL1ValidatorWeightTx(signedWarpMessage.Bytes()) + network.GetPChainWallet().IssueSetSubnetValidatorWeightTx(signedWarpMessage.Bytes()) utils.PChainProposerVMWorkaround(network.GetPChainWallet()) utils.AdvanceProposerVM(ctx, subnetAInfo, fundedKey, 5) diff --git a/tests/network/network.go b/tests/network/network.go index d0c406c36..bb83ad8fd 100644 --- a/tests/network/network.go +++ b/tests/network/network.go @@ -3,6 +3,7 @@ package network import ( "context" "crypto/ecdsa" + "encoding/base64" "encoding/hex" "encoding/json" goLog "log" @@ -15,6 +16,7 @@ import ( "github.com/ava-labs/avalanchego/genesis" "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/tests/fixture/tmpnet" + "github.com/ava-labs/avalanchego/upgrade" "github.com/ava-labs/avalanchego/utils/crypto/secp256k1" "github.com/ava-labs/avalanchego/utils/formatting/address" "github.com/ava-labs/avalanchego/utils/units" @@ -42,7 +44,7 @@ type LocalNetwork struct { tmpnet.Network extraNodes []*tmpnet.Node // to add as more subnet validators in the tests - primaryNetworkValidators []*tmpnet.Node + primaryNetworkValidators []ids.NodeID globalFundedKey *secp256k1.PrivateKey validatorManagers map[ids.ID]common.Address } @@ -119,6 +121,17 @@ func NewLocalNetwork( ) Expect(network).ShouldNot(BeNil()) + // Activate Etna + upgrades := upgrade.Default + upgrades.EtnaTime = time.Now().Add(-1 * time.Minute) + upgradeJSON, err := json.Marshal(upgrades) + Expect(err).Should(BeNil()) + + upgradeBase64 := base64.StdEncoding.EncodeToString(upgradeJSON) + network.DefaultFlags.SetDefaults(tmpnet.FlagsMap{ + config.UpgradeFileContentKey: upgradeBase64, + }) + avalancheGoBuildPath, ok := os.LookupEnv("AVALANCHEGO_BUILD_PATH") Expect(ok).Should(Equal(true)) @@ -152,8 +165,10 @@ func NewLocalNetwork( } // All nodes are specified as bootstrap validators - var primaryNetworkValidators []*tmpnet.Node - primaryNetworkValidators = append(primaryNetworkValidators, network.Nodes...) + var primaryNetworkValidators []ids.NodeID + for _, node := range network.Nodes { + primaryNetworkValidators = append(primaryNetworkValidators, node.NodeID) + } localNetwork := &LocalNetwork{ Network: *network, @@ -174,7 +189,6 @@ func (n *LocalNetwork) ConvertSubnet( senderKey *ecdsa.PrivateKey, proxy bool, ) ([]utils.Node, []ids.ID, *proxyadmin.ProxyAdmin) { - goLog.Println("Converting subnet", subnet.SubnetID) cChainInfo := n.GetPrimaryNetworkInfo() pClient := platformvm.NewClient(cChainInfo.NodeURIs[0]) currentValidators, err := pClient.GetCurrentValidators(ctx, subnet.SubnetID, nil) @@ -198,7 +212,7 @@ func (n *LocalNetwork) ConvertSubnet( // Construct the convert subnet info destAddr, err := address.ParseToID(utils.DefaultPChainAddress) Expect(err).Should(BeNil()) - vdrs := make([]*txs.ConvertSubnetToL1Validator, len(tmpnetNodes)) + vdrs := make([]*txs.ConvertSubnetValidator, len(tmpnetNodes)) for i, node := range tmpnetNodes { signer, err := node.GetProofOfPossession() Expect(err).Should(BeNil()) @@ -207,7 +221,7 @@ func (n *LocalNetwork) ConvertSubnet( NodePoP: signer, Weight: weights[i], }) - vdrs[i] = &txs.ConvertSubnetToL1Validator{ + vdrs[i] = &txs.ConvertSubnetValidator{ NodeID: node.NodeID.Bytes(), Weight: weights[i], Balance: units.Avax * 100, @@ -223,7 +237,7 @@ func (n *LocalNetwork) ConvertSubnet( } } pChainWallet := n.GetPChainWallet() - _, err = pChainWallet.IssueConvertSubnetToL1Tx( + _, err = pChainWallet.IssueConvertSubnetTx( subnet.SubnetID, subnet.BlockchainID, vdrManagerAddress[:], @@ -236,8 +250,6 @@ func (n *LocalNetwork) ConvertSubnet( utils.PChainProposerVMWorkaround(pChainWallet) utils.AdvanceProposerVM(ctx, subnet, senderKey, 5) - aggregator := n.GetSignatureAggregator() - defer aggregator.Shutdown() validationIDs := utils.InitializeValidatorSet( ctx, senderKey, @@ -245,7 +257,7 @@ func (n *LocalNetwork) ConvertSubnet( utils.GetPChainInfo(cChainInfo), vdrManagerAddress, n.GetNetworkID(), - aggregator, + n.GetSignatureAggregator(), nodes, ) @@ -253,15 +265,7 @@ func (n *LocalNetwork) ConvertSubnet( for _, vdr := range currentValidators { _, err := pChainWallet.IssueRemoveSubnetValidatorTx(vdr.NodeID, subnet.SubnetID) Expect(err).Should(BeNil()) - for _, node := range n.Network.Nodes { - if node.NodeID == vdr.NodeID { - goLog.Println("Restarting bootstrap node", node.NodeID) - n.Network.RestartNode(ctx, os.Stdout, node) - } - } } - utils.PChainProposerVMWorkaround(pChainWallet) - utils.AdvanceProposerVM(ctx, subnet, senderKey, 5) return nodes, validationIDs, proxyAdmin } @@ -284,8 +288,7 @@ func (n *LocalNetwork) AddSubnetValidators( // Add the node to the network n.Network.Nodes = append(n.Network.Nodes, node) } - err := n.Network.StartNodes(context.Background(), os.Stdout, nodes...) - Expect(err).Should(BeNil()) + n.Network.StartNodes(context.Background(), os.Stdout, nodes...) // Update the tmpnet Subnet struct for _, tmpnetSubnet := range n.Network.Subnets { @@ -325,14 +328,13 @@ func (n *LocalNetwork) GetExtraNodes(count int) []*tmpnet.Node { return nodes } -func (n *LocalNetwork) GetPrimaryNetworkValidators() []*tmpnet.Node { - return n.primaryNetworkValidators -} - func (n *LocalNetwork) GetPrimaryNetworkInfo() interfaces.SubnetTestInfo { var nodeURIs []string - for _, node := range n.primaryNetworkValidators { - nodeURIs = append(nodeURIs, node.URI) + for _, nodeID := range n.primaryNetworkValidators { + uri, err := n.Network.GetURIForNodeID(nodeID) + Expect(err).Should(BeNil()) + + nodeURIs = append(nodeURIs, uri) } infoClient := info.NewClient(nodeURIs[0]) cChainBlockchainID, err := infoClient.GetBlockchainID(context.Background(), "C") @@ -490,6 +492,7 @@ func (n *LocalNetwork) Dir() string { func (n *LocalNetwork) GetPChainWallet() pwallet.Wallet { // Create the P-Chain wallet to issue transactions kc := secp256k1fx.NewKeychain(n.globalFundedKey) + n.GetSubnetsInfo() var subnetIDs []ids.ID for _, subnet := range n.GetSubnetsInfo() { subnetIDs = append(subnetIDs, subnet.SubnetID) diff --git a/tests/suites/teleporter/teleporter_suite_test.go b/tests/suites/teleporter/teleporter_suite_test.go index 52d6662b9..bf37d4a96 100644 --- a/tests/suites/teleporter/teleporter_suite_test.go +++ b/tests/suites/teleporter/teleporter_suite_test.go @@ -12,7 +12,7 @@ import ( "github.com/ava-labs/avalanchego/utils/units" teleporterFlows "github.com/ava-labs/teleporter/tests/flows/teleporter" registryFlows "github.com/ava-labs/teleporter/tests/flows/teleporter/registry" - "github.com/ava-labs/teleporter/tests/network" + localnetwork "github.com/ava-labs/teleporter/tests/network" "github.com/ava-labs/teleporter/tests/utils" deploymentUtils "github.com/ava-labs/teleporter/utils/deployment-utils" "github.com/ethereum/go-ethereum/log" @@ -30,7 +30,7 @@ const ( ) var ( - LocalNetworkInstance *network.LocalNetwork + LocalNetworkInstance *localnetwork.LocalNetwork TeleporterInfo utils.TeleporterTestInfo ) @@ -58,14 +58,14 @@ var _ = ginkgo.BeforeSuite(func() { Expect(err).Should(BeNil()) // Create the local network instance - ctx, cancel := context.WithTimeout(context.Background(), 240*2*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), 120*2*time.Second) defer cancel() - LocalNetworkInstance = network.NewLocalNetwork( + LocalNetworkInstance = localnetwork.NewLocalNetwork( ctx, "teleporter-test-local-network", warpGenesisTemplateFile, - []network.SubnetSpec{ + []localnetwork.SubnetSpec{ { Name: "A", EVMChainID: 12345, diff --git a/tests/suites/validator-manager/validator_manager_suite_test.go b/tests/suites/validator-manager/validator_manager_suite_test.go index 65d6126f0..4e0d251fc 100644 --- a/tests/suites/validator-manager/validator_manager_suite_test.go +++ b/tests/suites/validator-manager/validator_manager_suite_test.go @@ -34,7 +34,7 @@ func TestValidatorManager(t *testing.T) { // Define the before and after suite functions. var _ = ginkgo.BeforeEach(func() { // Create the local network instance - ctx, cancel := context.WithTimeout(context.Background(), 240*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second) defer cancel() LocalNetworkInstance = localnetwork.NewLocalNetwork( ctx, diff --git a/tests/utils/chain.go b/tests/utils/chain.go index a859939cb..713014596 100644 --- a/tests/utils/chain.go +++ b/tests/utils/chain.go @@ -540,7 +540,10 @@ func InstantiateGenesisTemplate( return subnetGenesisFile.Name() } +// // Aggregator utils +// + func NewSignatureAggregator(apiUri string, subnets []ids.ID) *aggregator.SignatureAggregator { cfg := sigAggConfig.Config{ PChainAPI: &relayerConfig.APIConfig{ @@ -553,29 +556,27 @@ func NewSignatureAggregator(apiUri string, subnets []ids.ID) *aggregator.Signatu trackedSubnets := set.NewSet[ids.ID](len(subnets)) trackedSubnets.Add(subnets...) registry := prometheus.NewRegistry() - messageCreator, err := message.NewCreator( - logging.NoLog{}, - registry, - constants.DefaultNetworkCompressionType, - constants.DefaultNetworkMaximumInboundTimeout, - ) - Expect(err).Should(BeNil()) - appRequestNetwork, err := peers.NewNetwork( - logging.Error, + logging.Info, registry, trackedSubnets, - nil, &cfg, ) Expect(err).Should(BeNil()) + messageCreator, err := message.NewCreator( + logging.NoLog{}, + registry, + constants.DefaultNetworkCompressionType, + constants.DefaultNetworkMaximumInboundTimeout, + ) + Expect(err).Should(BeNil()) agg, err := aggregator.NewSignatureAggregator( appRequestNetwork, logging.NoLog{}, - messageCreator, 1024, metrics.NewSignatureAggregatorMetrics(prometheus.NewRegistry()), + messageCreator, // Setting the etnaTime to a minute ago so that the post-etna code path is used in the test time.Now().Add(-1*time.Minute), ) diff --git a/tests/utils/validator_manager.go b/tests/utils/validator_manager.go index 15061dfb1..8bd53fac9 100644 --- a/tests/utils/validator_manager.go +++ b/tests/utils/validator_manager.go @@ -273,11 +273,11 @@ func InitializeValidatorSet( signatureAggregator *aggregator.SignatureAggregator, nodes []Node, ) []ids.ID { - log.Println("Initializing validator set", "subnet", subnetInfo.SubnetID) - initialValidators := make([]warpMessage.SubnetToL1ConverstionValidatorData, len(nodes)) + log.Println("Initializing validator set") + initialValidators := make([]warpMessage.SubnetConversionValidatorData, len(nodes)) initialValidatorsABI := make([]ivalidatormanager.InitialValidator, len(nodes)) for i, node := range nodes { - initialValidators[i] = warpMessage.SubnetToL1ConverstionValidatorData{ + initialValidators[i] = warpMessage.SubnetConversionValidatorData{ NodeID: node.NodeID.Bytes(), BLSPublicKey: node.NodePoP.PublicKey, Weight: nodes[i].Weight, @@ -289,7 +289,7 @@ func InitializeValidatorSet( } } - subnetConversionData := warpMessage.SubnetToL1ConversionData{ + subnetConversionData := warpMessage.SubnetConversionData{ SubnetID: subnetInfo.SubnetID, ManagerChainID: subnetInfo.BlockchainID, ManagerAddress: validatorManagerAddress[:], @@ -301,7 +301,7 @@ func InitializeValidatorSet( ValidatorManagerAddress: validatorManagerAddress, InitialValidators: initialValidatorsABI, } - subnetConversionID, err := warpMessage.SubnetToL1ConversionID(subnetConversionData) + subnetConversionID, err := warpMessage.SubnetConversionID(subnetConversionData) Expect(err).Should(BeNil()) subnetConversionSignedMessage := ConstructSubnetConversionMessage( subnetConversionID, @@ -553,7 +553,7 @@ func InitializeAndCompleteNativeValidatorRegistration( // (Sending to the P-Chain will be skipped for now) signedWarpMessage := ConstructSignedWarpMessage(ctx, receipt, subnetInfo, pChainInfo, nil, signatureAggregator) - _, err = pchainWallet.IssueRegisterL1ValidatorTx( + _, err = pchainWallet.IssueRegisterSubnetValidatorTx( 100*units.Avax, node.NodePoP.ProofOfPossession, signedWarpMessage.Bytes(), @@ -631,7 +631,7 @@ func InitializeAndCompleteERC20ValidatorRegistration( // Gather subnet-evm Warp signatures for the RegisterSubnetValidatorMessage & relay to the P-Chain signedWarpMessage := ConstructSignedWarpMessage(ctx, receipt, subnetInfo, pChainInfo, nil, signatureAggregator) - _, err = pchainWallet.IssueRegisterL1ValidatorTx( + _, err = pchainWallet.IssueRegisterSubnetValidatorTx( 100*units.Avax, node.NodePoP.ProofOfPossession, signedWarpMessage.Bytes(), @@ -699,7 +699,7 @@ func InitializeAndCompletePoAValidatorRegistration( // Gather subnet-evm Warp signatures for the RegisterSubnetValidatorMessage & relay to the P-Chain signedWarpMessage := ConstructSignedWarpMessage(ctx, receipt, subnetInfo, pChainInfo, nil, signatureAggregator) - _, err := pchainWallet.IssueRegisterL1ValidatorTx( + _, err := pchainWallet.IssueRegisterSubnetValidatorTx( 100*units.Avax, node.NodePoP.ProofOfPossession, signedWarpMessage.Bytes(), @@ -989,7 +989,7 @@ func InitializeAndCompleteEndInitialPoSValidation( Expect(err).Should(BeNil()) // Deliver the Warp message to the P-Chain - pchainWallet.IssueSetL1ValidatorWeightTx(signedWarpMessage.Bytes()) + pchainWallet.IssueSetSubnetValidatorWeightTx(signedWarpMessage.Bytes()) PChainProposerVMWorkaround(pchainWallet) AdvanceProposerVM(ctx, subnetInfo, fundedKey, 5) @@ -1066,7 +1066,7 @@ func InitializeAndCompleteEndPoSValidation( Expect(err).Should(BeNil()) // Deliver the Warp message to the P-Chain - pchainWallet.IssueSetL1ValidatorWeightTx(signedWarpMessage.Bytes()) + pchainWallet.IssueSetSubnetValidatorWeightTx(signedWarpMessage.Bytes()) PChainProposerVMWorkaround(pchainWallet) AdvanceProposerVM(ctx, subnetInfo, fundedKey, 5) @@ -1145,7 +1145,7 @@ func InitializeAndCompleteEndInitialPoAValidation( Expect(err).Should(BeNil()) // Deliver the Warp message to the P-Chain - pchainWallet.IssueSetL1ValidatorWeightTx(signedWarpMessage.Bytes()) + pchainWallet.IssueSetSubnetValidatorWeightTx(signedWarpMessage.Bytes()) PChainProposerVMWorkaround(pchainWallet) AdvanceProposerVM(ctx, subnetInfo, fundedKey, 5) @@ -1259,9 +1259,9 @@ func ConstructSubnetValidatorRegistrationMessageForInitialValidator( networkID uint32, signatureAggregator *aggregator.SignatureAggregator, ) *avalancheWarp.Message { - justification := platformvm.L1ValidatorRegistrationJustification{ - Preimage: &platformvm.L1ValidatorRegistrationJustification_ConvertSubnetToL1TxData{ - ConvertSubnetToL1TxData: &platformvm.SubnetIDIndex{ + justification := platformvm.SubnetValidatorRegistrationJustification{ + Preimage: &platformvm.SubnetValidatorRegistrationJustification_ConvertSubnetTxData{ + ConvertSubnetTxData: &platformvm.SubnetIDIndex{ SubnetId: subnet.SubnetID[:], Index: index, }, @@ -1270,7 +1270,7 @@ func ConstructSubnetValidatorRegistrationMessageForInitialValidator( justificationBytes, err := proto.Marshal(&justification) Expect(err).Should(BeNil()) - registrationPayload, err := warpMessage.NewL1ValidatorRegistration(validationID, valid) + registrationPayload, err := warpMessage.NewSubnetValidatorRegistration(validationID, valid) Expect(err).Should(BeNil()) registrationAddressedCall, err := warpPayload.NewAddressedCall(nil, registrationPayload.Bytes()) Expect(err).Should(BeNil()) @@ -1302,7 +1302,7 @@ func ConstructSubnetValidatorRegistrationMessage( networkID uint32, signatureAggregator *aggregator.SignatureAggregator, ) *avalancheWarp.Message { - msg, err := warpMessage.NewRegisterL1Validator( + msg, err := warpMessage.NewRegisterSubnetValidator( subnet.SubnetID, node.NodeID, node.NodePoP.PublicKey, @@ -1312,15 +1312,15 @@ func ConstructSubnetValidatorRegistrationMessage( node.Weight, ) Expect(err).Should(BeNil()) - justification := platformvm.L1ValidatorRegistrationJustification{ - Preimage: &platformvm.L1ValidatorRegistrationJustification_RegisterL1ValidatorMessage{ - RegisterL1ValidatorMessage: msg.Bytes(), + justification := platformvm.SubnetValidatorRegistrationJustification{ + Preimage: &platformvm.SubnetValidatorRegistrationJustification_RegisterSubnetValidatorMessage{ + RegisterSubnetValidatorMessage: msg.Bytes(), }, } justificationBytes, err := proto.Marshal(&justification) Expect(err).Should(BeNil()) - registrationPayload, err := warpMessage.NewL1ValidatorRegistration(validationID, valid) + registrationPayload, err := warpMessage.NewSubnetValidatorRegistration(validationID, valid) Expect(err).Should(BeNil()) registrationAddressedCall, err := warpPayload.NewAddressedCall(nil, registrationPayload.Bytes()) Expect(err).Should(BeNil()) @@ -1351,7 +1351,7 @@ func ConstructSubnetValidatorWeightUpdateMessage( signatureAggregator *aggregator.SignatureAggregator, networkID uint32, ) *avalancheWarp.Message { - payload, err := warpMessage.NewL1ValidatorWeight(validationID, nonce, weight) + payload, err := warpMessage.NewSubnetValidatorWeight(validationID, nonce, weight) Expect(err).Should(BeNil()) updateAddressedCall, err := warpPayload.NewAddressedCall(nil, payload.Bytes()) Expect(err).Should(BeNil()) @@ -1379,7 +1379,7 @@ func ConstructSubnetConversionMessage( networkID uint32, signatureAggregator *aggregator.SignatureAggregator, ) *avalancheWarp.Message { - subnetConversionPayload, err := warpMessage.NewSubnetToL1Conversion(subnetConversionID) + subnetConversionPayload, err := warpMessage.NewSubnetConversion(subnetConversionID) Expect(err).Should(BeNil()) subnetConversionAddressedCall, err := warpPayload.NewAddressedCall( nil, @@ -1422,7 +1422,7 @@ func ValidateRegisterSubnetValidatorMessage( var payloadInterface warpMessage.Payload ver, err := warpMessage.Codec.Unmarshal(msg.Payload, &payloadInterface) Expect(err).Should(BeNil()) - payload, ok := payloadInterface.(*warpMessage.RegisterL1Validator) + payload, ok := payloadInterface.(*warpMessage.RegisterSubnetValidator) Expect(ok).Should(BeTrue()) Expect(ver).Should(Equal(uint16(warpMessage.CodecVersion))) @@ -1444,7 +1444,7 @@ func ValidateSubnetValidatorWeightMessage( var payloadInterface warpMessage.Payload ver, err := warpMessage.Codec.Unmarshal(msg.Payload, &payloadInterface) Expect(err).Should(BeNil()) - payload, ok := payloadInterface.(*warpMessage.L1ValidatorWeight) + payload, ok := payloadInterface.(*warpMessage.SubnetValidatorWeight) Expect(ok).Should(BeTrue()) Expect(ver).Should(Equal(uint16(warpMessage.CodecVersion))) From 5e57afc8718a1d0d881a0015ac2b3d0191085910 Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Thu, 21 Nov 2024 15:51:57 -0600 Subject: [PATCH 31/34] initialize with uptime chain --- tests/utils/validator_manager.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/utils/validator_manager.go b/tests/utils/validator_manager.go index 34c34f0aa..28540dd4b 100644 --- a/tests/utils/validator_manager.go +++ b/tests/utils/validator_manager.go @@ -200,6 +200,7 @@ func DeployAndInitializeValidatorManager( MaximumStakeMultiplier: DefaultMaxStakeMultiplier, WeightToValueFactor: big.NewInt(0).SetUint64(DefaultWeightToValueFactor), RewardCalculator: rewardCalculatorAddress, + UptimeBlockchainID: subnet.BlockchainID, }, erc20Address, ) @@ -231,6 +232,7 @@ func DeployAndInitializeValidatorManager( MaximumStakeMultiplier: DefaultMaxStakeMultiplier, WeightToValueFactor: big.NewInt(0).SetUint64(DefaultWeightToValueFactor), RewardCalculator: rewardCalculatorAddress, + UptimeBlockchainID: subnet.BlockchainID }, ) Expect(err).Should(BeNil()) From 1bd1eda4cd1c0da51dcac8930c8e7f463edf586a Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Thu, 21 Nov 2024 16:00:53 -0600 Subject: [PATCH 32/34] build fix --- tests/utils/validator_manager.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/utils/validator_manager.go b/tests/utils/validator_manager.go index 28540dd4b..11083535b 100644 --- a/tests/utils/validator_manager.go +++ b/tests/utils/validator_manager.go @@ -232,7 +232,7 @@ func DeployAndInitializeValidatorManager( MaximumStakeMultiplier: DefaultMaxStakeMultiplier, WeightToValueFactor: big.NewInt(0).SetUint64(DefaultWeightToValueFactor), RewardCalculator: rewardCalculatorAddress, - UptimeBlockchainID: subnet.BlockchainID + UptimeBlockchainID: subnet.BlockchainID, }, ) Expect(err).Should(BeNil()) From 226937a967e8947034f2704de6f168bcf48e2d2b Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Thu, 21 Nov 2024 16:35:52 -0600 Subject: [PATCH 33/34] bump to ava go v1.12.0-fuji --- go.mod | 8 ++-- go.sum | 16 +++---- .../validator-manager/erc20_token_staking.go | 4 +- .../validator-manager/native_token_staking.go | 4 +- tests/network/network.go | 6 +-- tests/utils/validator_manager.go | 46 +++++++++---------- 6 files changed, 42 insertions(+), 42 deletions(-) diff --git a/go.mod b/go.mod index 33e4cae11..75d2aaa6b 100644 --- a/go.mod +++ b/go.mod @@ -3,13 +3,13 @@ module github.com/ava-labs/teleporter go 1.22.8 require ( - github.com/ava-labs/avalanchego v1.12.0-initial-poc.9 + github.com/ava-labs/avalanchego v1.12.0-fuji github.com/supranational/blst v0.3.13 // indirect ) require ( - github.com/ava-labs/awm-relayer v1.4.1-0.20241114185359-5cd5a982832d - github.com/ava-labs/subnet-evm v0.6.12-rc.0 + github.com/ava-labs/awm-relayer v1.4.1-0.20241121212846-90ad76f595d6 + github.com/ava-labs/subnet-evm v0.6.12 github.com/ethereum/go-ethereum v1.13.14 github.com/onsi/ginkgo/v2 v2.22.0 github.com/onsi/gomega v1.35.1 @@ -26,7 +26,7 @@ require ( github.com/DataDog/zstd v1.5.2 // indirect github.com/NYTimes/gziphandler v1.1.1 // indirect github.com/VictoriaMetrics/fastcache v1.12.1 // indirect - github.com/ava-labs/coreth v0.13.8 // indirect + github.com/ava-labs/coreth v0.13.9-rc.1 // 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 442b696a7..5260ba812 100644 --- a/go.sum +++ b/go.sum @@ -58,14 +58,14 @@ github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= -github.com/ava-labs/avalanchego v1.12.0-initial-poc.9 h1:dQhb+KlPoud+AkRV3A0suKCTodlUSzflGcZElESeVKo= -github.com/ava-labs/avalanchego v1.12.0-initial-poc.9/go.mod h1:86tO6F1FT8emclUwdQ2WCwAtAerqjm5A4IbV6XxNUyM= -github.com/ava-labs/awm-relayer v1.4.1-0.20241114185359-5cd5a982832d h1:Sgn2uD8axkyafPty1iY2ZkPVmT2eVoYgJEAPxkYNYqw= -github.com/ava-labs/awm-relayer v1.4.1-0.20241114185359-5cd5a982832d/go.mod h1:xrZ8FX+mC0PBvUL9yTVqmvCIA9rYYfmdDDY9oTTI6n8= -github.com/ava-labs/coreth v0.13.8 h1:f14X3KgwHl9LwzfxlN6S4bbn5VA2rhEsNnHaRLSTo/8= -github.com/ava-labs/coreth v0.13.8/go.mod h1:t3BSv/eQv0AlDPMfEDCMMoD/jq1RkUsbFzQAFg5qBcE= -github.com/ava-labs/subnet-evm v0.6.12-rc.0 h1:I7s4QkUO8bjg+JB/KTwrmDH8Q2mQYVTKF8mFUSDqk+E= -github.com/ava-labs/subnet-evm v0.6.12-rc.0/go.mod h1:Pf122zopW1fELpOsw0PrdX4u6K/4VOWU2p5C3cHsYAs= +github.com/ava-labs/avalanchego v1.12.0-fuji h1:o/GbXrqW9CAXu2jX/a1dZtvFiiSVCWomJZyxF4hCQOA= +github.com/ava-labs/avalanchego v1.12.0-fuji/go.mod h1:yhD5dpZyStIVbxQ550EDi5w5SL7DQ/xGE6TIxosb7U0= +github.com/ava-labs/awm-relayer v1.4.1-0.20241121212846-90ad76f595d6 h1:diUjomjOuTFwk3Z2FUxA94PzLZy+6ONfZVuaRhDrtmA= +github.com/ava-labs/awm-relayer v1.4.1-0.20241121212846-90ad76f595d6/go.mod h1:mNQitNat92izhmMF0++6/REQQI3W+h0oRAnLl3bs/6I= +github.com/ava-labs/coreth v0.13.9-rc.1 h1:qIICpC/OZGYUP37QnLgIqqwGmxnLwLpZaUlqJNI85vU= +github.com/ava-labs/coreth v0.13.9-rc.1/go.mod h1:7aMsRIo/3GBE44qWZMjnfqdqfcfZ5yShTTm2LObLaYo= +github.com/ava-labs/subnet-evm v0.6.12 h1:jL3FmjdFcNfS0qwbehwN6DkAg9y7zexB1riiGBxRsM0= +github.com/ava-labs/subnet-evm v0.6.12/go.mod h1:vffwL4UqAh7ibpWjveUuUhamm3a9w75q92bG5vXdX5k= 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/tests/flows/validator-manager/erc20_token_staking.go b/tests/flows/validator-manager/erc20_token_staking.go index fe87a4556..fa7c33b54 100644 --- a/tests/flows/validator-manager/erc20_token_staking.go +++ b/tests/flows/validator-manager/erc20_token_staking.go @@ -156,7 +156,7 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { ) // Issue a tx to update the validator's weight on the P-Chain - network.GetPChainWallet().IssueSetSubnetValidatorWeightTx(signedWarpMessage.Bytes()) + network.GetPChainWallet().IssueSetL1ValidatorWeightTx(signedWarpMessage.Bytes()) utils.PChainProposerVMWorkaround(network.GetPChainWallet()) utils.AdvanceProposerVM(ctx, subnetAInfo, fundedKey, 5) @@ -224,7 +224,7 @@ func ERC20TokenStakingManager(network *localnetwork.LocalNetwork) { Expect(err).Should(BeNil()) // Issue a tx to update the validator's weight on the P-Chain - network.GetPChainWallet().IssueSetSubnetValidatorWeightTx(signedWarpMessage.Bytes()) + network.GetPChainWallet().IssueSetL1ValidatorWeightTx(signedWarpMessage.Bytes()) utils.PChainProposerVMWorkaround(network.GetPChainWallet()) utils.AdvanceProposerVM(ctx, subnetAInfo, fundedKey, 5) diff --git a/tests/flows/validator-manager/native_token_staking.go b/tests/flows/validator-manager/native_token_staking.go index 3f5a8b77c..593bc41a1 100644 --- a/tests/flows/validator-manager/native_token_staking.go +++ b/tests/flows/validator-manager/native_token_staking.go @@ -150,7 +150,7 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { ) // Issue a tx to update the validator's weight on the P-Chain - network.GetPChainWallet().IssueSetSubnetValidatorWeightTx(signedWarpMessage.Bytes()) + network.GetPChainWallet().IssueSetL1ValidatorWeightTx(signedWarpMessage.Bytes()) utils.PChainProposerVMWorkaround(network.GetPChainWallet()) utils.AdvanceProposerVM(ctx, subnetAInfo, fundedKey, 5) @@ -217,7 +217,7 @@ func NativeTokenStakingManager(network *localnetwork.LocalNetwork) { Expect(err).Should(BeNil()) // Issue a tx to update the validator's weight on the P-Chain - network.GetPChainWallet().IssueSetSubnetValidatorWeightTx(signedWarpMessage.Bytes()) + network.GetPChainWallet().IssueSetL1ValidatorWeightTx(signedWarpMessage.Bytes()) utils.PChainProposerVMWorkaround(network.GetPChainWallet()) utils.AdvanceProposerVM(ctx, subnetAInfo, fundedKey, 5) diff --git a/tests/network/network.go b/tests/network/network.go index bb83ad8fd..8dde526d2 100644 --- a/tests/network/network.go +++ b/tests/network/network.go @@ -212,7 +212,7 @@ func (n *LocalNetwork) ConvertSubnet( // Construct the convert subnet info destAddr, err := address.ParseToID(utils.DefaultPChainAddress) Expect(err).Should(BeNil()) - vdrs := make([]*txs.ConvertSubnetValidator, len(tmpnetNodes)) + vdrs := make([]*txs.ConvertSubnetToL1Validator, len(tmpnetNodes)) for i, node := range tmpnetNodes { signer, err := node.GetProofOfPossession() Expect(err).Should(BeNil()) @@ -221,7 +221,7 @@ func (n *LocalNetwork) ConvertSubnet( NodePoP: signer, Weight: weights[i], }) - vdrs[i] = &txs.ConvertSubnetValidator{ + vdrs[i] = &txs.ConvertSubnetToL1Validator{ NodeID: node.NodeID.Bytes(), Weight: weights[i], Balance: units.Avax * 100, @@ -237,7 +237,7 @@ func (n *LocalNetwork) ConvertSubnet( } } pChainWallet := n.GetPChainWallet() - _, err = pChainWallet.IssueConvertSubnetTx( + _, err = pChainWallet.IssueConvertSubnetToL1Tx( subnet.SubnetID, subnet.BlockchainID, vdrManagerAddress[:], diff --git a/tests/utils/validator_manager.go b/tests/utils/validator_manager.go index 11083535b..eb2dfe6fd 100644 --- a/tests/utils/validator_manager.go +++ b/tests/utils/validator_manager.go @@ -277,10 +277,10 @@ func InitializeValidatorSet( nodes []Node, ) []ids.ID { log.Println("Initializing validator set") - initialValidators := make([]warpMessage.SubnetConversionValidatorData, len(nodes)) + initialValidators := make([]warpMessage.SubnetToL1ConverstionValidatorData, len(nodes)) initialValidatorsABI := make([]ivalidatormanager.InitialValidator, len(nodes)) for i, node := range nodes { - initialValidators[i] = warpMessage.SubnetConversionValidatorData{ + initialValidators[i] = warpMessage.SubnetToL1ConverstionValidatorData{ NodeID: node.NodeID.Bytes(), BLSPublicKey: node.NodePoP.PublicKey, Weight: nodes[i].Weight, @@ -292,7 +292,7 @@ func InitializeValidatorSet( } } - subnetConversionData := warpMessage.SubnetConversionData{ + subnetConversionData := warpMessage.SubnetToL1ConversionData{ SubnetID: subnetInfo.SubnetID, ManagerChainID: subnetInfo.BlockchainID, ManagerAddress: validatorManagerAddress[:], @@ -304,7 +304,7 @@ func InitializeValidatorSet( ValidatorManagerAddress: validatorManagerAddress, InitialValidators: initialValidatorsABI, } - subnetConversionID, err := warpMessage.SubnetConversionID(subnetConversionData) + subnetConversionID, err := warpMessage.SubnetToL1ConversionID(subnetConversionData) Expect(err).Should(BeNil()) subnetConversionSignedMessage := ConstructSubnetConversionMessage( subnetConversionID, @@ -556,7 +556,7 @@ func InitializeAndCompleteNativeValidatorRegistration( // (Sending to the P-Chain will be skipped for now) signedWarpMessage := ConstructSignedWarpMessage(ctx, receipt, subnetInfo, pChainInfo, nil, signatureAggregator) - _, err = pchainWallet.IssueRegisterSubnetValidatorTx( + _, err = pchainWallet.IssueRegisterL1ValidatorTx( 100*units.Avax, node.NodePoP.ProofOfPossession, signedWarpMessage.Bytes(), @@ -634,7 +634,7 @@ func InitializeAndCompleteERC20ValidatorRegistration( // Gather subnet-evm Warp signatures for the RegisterSubnetValidatorMessage & relay to the P-Chain signedWarpMessage := ConstructSignedWarpMessage(ctx, receipt, subnetInfo, pChainInfo, nil, signatureAggregator) - _, err = pchainWallet.IssueRegisterSubnetValidatorTx( + _, err = pchainWallet.IssueRegisterL1ValidatorTx( 100*units.Avax, node.NodePoP.ProofOfPossession, signedWarpMessage.Bytes(), @@ -702,7 +702,7 @@ func InitializeAndCompletePoAValidatorRegistration( // Gather subnet-evm Warp signatures for the RegisterSubnetValidatorMessage & relay to the P-Chain signedWarpMessage := ConstructSignedWarpMessage(ctx, receipt, subnetInfo, pChainInfo, nil, signatureAggregator) - _, err := pchainWallet.IssueRegisterSubnetValidatorTx( + _, err := pchainWallet.IssueRegisterL1ValidatorTx( 100*units.Avax, node.NodePoP.ProofOfPossession, signedWarpMessage.Bytes(), @@ -1084,7 +1084,7 @@ func InitializeAndCompleteEndInitialPoSValidation( Expect(err).Should(BeNil()) // Deliver the Warp message to the P-Chain - pchainWallet.IssueSetSubnetValidatorWeightTx(signedWarpMessage.Bytes()) + pchainWallet.IssueSetL1ValidatorWeightTx(signedWarpMessage.Bytes()) PChainProposerVMWorkaround(pchainWallet) AdvanceProposerVM(ctx, subnetInfo, fundedKey, 5) @@ -1180,7 +1180,7 @@ func InitializeAndCompleteEndPoSValidation( Expect(err).Should(BeNil()) // Deliver the Warp message to the P-Chain - pchainWallet.IssueSetSubnetValidatorWeightTx(signedWarpMessage.Bytes()) + pchainWallet.IssueSetL1ValidatorWeightTx(signedWarpMessage.Bytes()) PChainProposerVMWorkaround(pchainWallet) AdvanceProposerVM(ctx, subnetInfo, fundedKey, 5) @@ -1259,7 +1259,7 @@ func InitializeAndCompleteEndInitialPoAValidation( Expect(err).Should(BeNil()) // Deliver the Warp message to the P-Chain - pchainWallet.IssueSetSubnetValidatorWeightTx(signedWarpMessage.Bytes()) + pchainWallet.IssueSetL1ValidatorWeightTx(signedWarpMessage.Bytes()) PChainProposerVMWorkaround(pchainWallet) AdvanceProposerVM(ctx, subnetInfo, fundedKey, 5) @@ -1373,9 +1373,9 @@ func ConstructSubnetValidatorRegistrationMessageForInitialValidator( networkID uint32, signatureAggregator *aggregator.SignatureAggregator, ) *avalancheWarp.Message { - justification := platformvm.SubnetValidatorRegistrationJustification{ - Preimage: &platformvm.SubnetValidatorRegistrationJustification_ConvertSubnetTxData{ - ConvertSubnetTxData: &platformvm.SubnetIDIndex{ + justification := platformvm.L1ValidatorRegistrationJustification{ + Preimage: &platformvm.L1ValidatorRegistrationJustification_ConvertSubnetToL1TxData{ + ConvertSubnetToL1TxData: &platformvm.SubnetIDIndex{ SubnetId: subnet.SubnetID[:], Index: index, }, @@ -1384,7 +1384,7 @@ func ConstructSubnetValidatorRegistrationMessageForInitialValidator( justificationBytes, err := proto.Marshal(&justification) Expect(err).Should(BeNil()) - registrationPayload, err := warpMessage.NewSubnetValidatorRegistration(validationID, valid) + registrationPayload, err := warpMessage.NewL1ValidatorRegistration(validationID, valid) Expect(err).Should(BeNil()) registrationAddressedCall, err := warpPayload.NewAddressedCall(nil, registrationPayload.Bytes()) Expect(err).Should(BeNil()) @@ -1416,7 +1416,7 @@ func ConstructSubnetValidatorRegistrationMessage( networkID uint32, signatureAggregator *aggregator.SignatureAggregator, ) *avalancheWarp.Message { - msg, err := warpMessage.NewRegisterSubnetValidator( + msg, err := warpMessage.NewRegisterL1Validator( subnet.SubnetID, node.NodeID, node.NodePoP.PublicKey, @@ -1426,15 +1426,15 @@ func ConstructSubnetValidatorRegistrationMessage( node.Weight, ) Expect(err).Should(BeNil()) - justification := platformvm.SubnetValidatorRegistrationJustification{ - Preimage: &platformvm.SubnetValidatorRegistrationJustification_RegisterSubnetValidatorMessage{ - RegisterSubnetValidatorMessage: msg.Bytes(), + justification := platformvm.L1ValidatorRegistrationJustification{ + Preimage: &platformvm.L1ValidatorRegistrationJustification_RegisterL1ValidatorMessage{ + RegisterL1ValidatorMessage: msg.Bytes(), }, } justificationBytes, err := proto.Marshal(&justification) Expect(err).Should(BeNil()) - registrationPayload, err := warpMessage.NewSubnetValidatorRegistration(validationID, valid) + registrationPayload, err := warpMessage.NewL1ValidatorRegistration(validationID, valid) Expect(err).Should(BeNil()) registrationAddressedCall, err := warpPayload.NewAddressedCall(nil, registrationPayload.Bytes()) Expect(err).Should(BeNil()) @@ -1465,7 +1465,7 @@ func ConstructSubnetValidatorWeightUpdateMessage( signatureAggregator *aggregator.SignatureAggregator, networkID uint32, ) *avalancheWarp.Message { - payload, err := warpMessage.NewSubnetValidatorWeight(validationID, nonce, weight) + payload, err := warpMessage.NewL1ValidatorWeight(validationID, nonce, weight) Expect(err).Should(BeNil()) updateAddressedCall, err := warpPayload.NewAddressedCall(nil, payload.Bytes()) Expect(err).Should(BeNil()) @@ -1493,7 +1493,7 @@ func ConstructSubnetConversionMessage( networkID uint32, signatureAggregator *aggregator.SignatureAggregator, ) *avalancheWarp.Message { - subnetConversionPayload, err := warpMessage.NewSubnetConversion(subnetConversionID) + subnetConversionPayload, err := warpMessage.NewSubnetToL1Conversion(subnetConversionID) Expect(err).Should(BeNil()) subnetConversionAddressedCall, err := warpPayload.NewAddressedCall( nil, @@ -1536,7 +1536,7 @@ func ValidateRegisterSubnetValidatorMessage( var payloadInterface warpMessage.Payload ver, err := warpMessage.Codec.Unmarshal(msg.Payload, &payloadInterface) Expect(err).Should(BeNil()) - payload, ok := payloadInterface.(*warpMessage.RegisterSubnetValidator) + payload, ok := payloadInterface.(*warpMessage.RegisterL1Validator) Expect(ok).Should(BeTrue()) Expect(ver).Should(Equal(uint16(warpMessage.CodecVersion))) @@ -1558,7 +1558,7 @@ func ValidateSubnetValidatorWeightMessage( var payloadInterface warpMessage.Payload ver, err := warpMessage.Codec.Unmarshal(msg.Payload, &payloadInterface) Expect(err).Should(BeNil()) - payload, ok := payloadInterface.(*warpMessage.SubnetValidatorWeight) + payload, ok := payloadInterface.(*warpMessage.L1ValidatorWeight) Expect(ok).Should(BeTrue()) Expect(ver).Should(Equal(uint16(warpMessage.CodecVersion))) From 47ee41021f2bc128582ead72f3bd792d65c34d9e Mon Sep 17 00:00:00 2001 From: cam-schultz Date: Thu, 21 Nov 2024 17:25:56 -0600 Subject: [PATCH 34/34] feedback --- tests/flows/teleporter/validator_churn.go | 9 ++++++--- tests/network/network.go | 1 - 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/flows/teleporter/validator_churn.go b/tests/flows/teleporter/validator_churn.go index a043e32b0..b0af5f88d 100644 --- a/tests/flows/teleporter/validator_churn.go +++ b/tests/flows/teleporter/validator_churn.go @@ -17,7 +17,10 @@ import ( . "github.com/onsi/gomega" ) -const newNodeCount = 2 +const ( + newNodeCount = 2 + sleepPeriodSeconds = 5 +) func ValidatorChurn(network *localnetwork.LocalNetwork, teleporter utils.TeleporterTestInfo) { subnetAInfo, subnetBInfo := network.GetTwoSubnets() @@ -73,7 +76,7 @@ func ValidatorChurn(network *localnetwork.LocalNetwork, teleporter utils.Telepor // // Add new nodes to the validator set - addValidatorsCtx, cancel := context.WithTimeout(ctx, 90*newNodeCount*time.Second) + addValidatorsCtx, cancel := context.WithTimeout(ctx, (90+sleepPeriodSeconds)*newNodeCount*time.Second) defer cancel() newNodes := network.GetExtraNodes(newNodeCount) validatorManagerAddress := network.GetValidatorManager(subnetAInfo.SubnetID) @@ -107,7 +110,7 @@ func ValidatorChurn(network *localnetwork.LocalNetwork, teleporter utils.Telepor network.GetNetworkID(), ) // Sleep to ensure the validator manager uses a new churn tracking period - time.Sleep(5 * time.Second) + time.Sleep(sleepPeriodSeconds * time.Second) } // Refresh the subnet info diff --git a/tests/network/network.go b/tests/network/network.go index 8dde526d2..6e59d888d 100644 --- a/tests/network/network.go +++ b/tests/network/network.go @@ -492,7 +492,6 @@ func (n *LocalNetwork) Dir() string { func (n *LocalNetwork) GetPChainWallet() pwallet.Wallet { // Create the P-Chain wallet to issue transactions kc := secp256k1fx.NewKeychain(n.globalFundedKey) - n.GetSubnetsInfo() var subnetIDs []ids.ID for _, subnet := range n.GetSubnetsInfo() { subnetIDs = append(subnetIDs, subnet.SubnetID)