From a356b4f552eeed4cb935c561debf46db1fa200f1 Mon Sep 17 00:00:00 2001 From: MSalopek Date: Mon, 6 Nov 2023 12:34:22 +0100 Subject: [PATCH] tests: enable v50 e2e tests (#1391) * deps:fix: bump versions; fix consumer module * e2e: enable running tests [tests not fully functional] * e2e: fix consumer; partially fix Dockerfile [hermes broken] * e2e: fix hermes config and docker --- Dockerfile | 4 +- app/consumer/app.go | 1 + cmd/interchain-security-cd/cmd/root.go | 10 +- .../ccv/provider/v1/tx.proto | 5 + tests/e2e/actions.go | 6 +- tests/e2e/config.go | 5 + tests/e2e/state.go | 46 +++++---- tests/e2e/steps_democracy.go | 8 +- tests/e2e/steps_reward_denom.go | 8 +- tests/e2e/steps_sovereign_changeover.go | 15 ++- tests/e2e/steps_start_chains.go | 7 +- tests/e2e/steps_stop_chain.go | 15 ++- tests/e2e/testnet-scripts/start-chain.sh | 4 +- tests/e2e/testnet-scripts/start-changeover.sh | 2 +- tests/e2e/testnet-scripts/start-sovereign.sh | 2 +- x/ccv/provider/client/cli/tx.go | 3 +- x/ccv/provider/handler_test.go | 2 +- x/ccv/provider/types/errors.go | 1 + x/ccv/provider/types/msg.go | 3 +- x/ccv/provider/types/tx.pb.go | 99 ++++++++++++++----- 20 files changed, 172 insertions(+), 74 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7c45187034..de183457d0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # syntax=docker/dockerfile:1 -FROM golang:1.20-alpine AS is-builder +FROM golang:1.21-alpine AS is-builder ENV PACKAGES curl make git libc-dev bash gcc linux-headers RUN apk add --no-cache $PACKAGES @@ -29,7 +29,7 @@ RUN go mod tidy RUN make install # Get Hermes build -FROM ghcr.io/informalsystems/hermes:1.4.1 AS hermes-builder +FROM --platform=linux/amd64 ghcr.io/informalsystems/hermes:v1.7.0 AS hermes-builder # Get CometMock FROM ghcr.io/informalsystems/cometmock:v0.37.x as cometmock-builder diff --git a/app/consumer/app.go b/app/consumer/app.go index 96ad57bc3a..f6f354c777 100644 --- a/app/consumer/app.go +++ b/app/consumer/app.go @@ -236,6 +236,7 @@ func New( paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey, feegrant.StoreKey, authzkeeper.StoreKey, + consensusparamtypes.StoreKey, ibcconsumertypes.StoreKey, ) tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) diff --git a/cmd/interchain-security-cd/cmd/root.go b/cmd/interchain-security-cd/cmd/root.go index dffb480cfa..9240816930 100644 --- a/cmd/interchain-security-cd/cmd/root.go +++ b/cmd/interchain-security-cd/cmd/root.go @@ -16,6 +16,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/keys" "github.com/cosmos/cosmos-sdk/client/pruning" "github.com/cosmos/cosmos-sdk/client/rpc" + "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/server" serverconfig "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" @@ -86,10 +87,15 @@ func NewRootCmd() *cobra.Command { } initRootCmd(rootCmd, encodingConfig) - if err := tempApp.AutoCliOpts().EnhanceRootCommand(rootCmd); err != nil { + // autocli opts + autoCliOpts := tempApp.AutoCliOpts() + initClientCtx, _ = config.ReadFromClientConfig(initClientCtx) + autoCliOpts.Keyring, _ = keyring.NewAutoCLIKeyring(initClientCtx.Keyring) + autoCliOpts.ClientCtx = initClientCtx + + if err := autoCliOpts.EnhanceRootCommand(rootCmd); err != nil { panic(err) } - return rootCmd } diff --git a/proto/interchain_security/ccv/provider/v1/tx.proto b/proto/interchain_security/ccv/provider/v1/tx.proto index 222f75d754..e75cab6308 100644 --- a/proto/interchain_security/ccv/provider/v1/tx.proto +++ b/proto/interchain_security/ccv/provider/v1/tx.proto @@ -20,6 +20,8 @@ service Msg { message MsgAssignConsumerKey { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "signer"; + // The chain id of the consumer chain to assign a consensus public key to string chain_id = 1; // The validator address on the provider @@ -28,6 +30,9 @@ message MsgAssignConsumerKey { // in json string format corresponding to proto-any, ex: // `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="}` string consumer_key = 3; + + // signer address + string signer = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } message MsgAssignConsumerKeyResponse {} diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index d7a8cef6fe..4f4b74a435 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -465,7 +465,7 @@ func (tr *TestRun) voteGovProposal( wg.Wait() // wait for inclusion in a block -> '--broadcast-mode block' is deprecated - tr.waitBlocks(action.chain, 1, 10*time.Second) + tr.waitBlocks(action.chain, 2, 10*time.Second) tr.WaitTime(time.Duration(tr.chainConfigs[action.chain].votingWaitTime) * time.Second) } @@ -659,7 +659,7 @@ rpc_addr = "%s" rpc_timeout = "10s" store_prefix = "ibc" trusting_period = "14days" -websocket_addr = "%s" +event_source = { mode = "push", url = "%s", batch_delay = "500ms" } [chains.gas_price] denom = "stake" @@ -1888,7 +1888,7 @@ func (tr TestRun) assignConsumerPubKey(action assignConsumerPubKeyAction, verbos tr.getValidatorNode(chainID("provi"), action.validator), gas, ) - + fmt.Println(assignKey) //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. cmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, diff --git a/tests/e2e/config.go b/tests/e2e/config.go index 373281162d..4e025f03e7 100644 --- a/tests/e2e/config.go +++ b/tests/e2e/config.go @@ -168,6 +168,7 @@ func SlashThrottleTestRun() TestRun { ipPrefix: "7.7.7", votingWaitTime: 20, genesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + + ".app_state.gov.params.expedited_voting_period = \"10s\" | " + // Custom slashing parameters for testing validator downtime functionality // See https://docs.cosmos.network/main/modules/slashing/04_begin_block.html#uptime-tracking ".app_state.slashing.params.signed_blocks_window = \"10\" | " + @@ -213,6 +214,7 @@ func DefaultTestRun() TestRun { ipPrefix: "7.7.7", votingWaitTime: 20, genesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + + ".app_state.gov.params.expedited_voting_period = \"10s\" | " + // Custom slashing parameters for testing validator downtime functionality // See https://docs.cosmos.network/main/modules/slashing/04_begin_block.html#uptime-tracking ".app_state.slashing.params.signed_blocks_window = \"10\" | " + @@ -270,6 +272,7 @@ func DemocracyTestRun(allowReward bool) TestRun { ipPrefix: "7.7.7", votingWaitTime: 20, genesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + + ".app_state.gov.params.expedited_voting_period = \"10s\" | " + // Custom slashing parameters for testing validator downtime functionality // See https://docs.cosmos.network/main/modules/slashing/04_begin_block.html#uptime-tracking ".app_state.slashing.params.signed_blocks_window = \"10\" | " + @@ -310,6 +313,7 @@ func MultiConsumerTestRun() TestRun { ipPrefix: "7.7.7", votingWaitTime: 20, genesisChanges: ".app_state.gov.params.voting_period = \"30s\" | " + + ".app_state.gov.params.expedited_voting_period = \"10s\" | " + // Custom slashing parameters for testing validator downtime functionality // See https://docs.cosmos.network/main/modules/slashing/04_begin_block.html#uptime-tracking ".app_state.slashing.params.signed_blocks_window = \"10\" | " + @@ -365,6 +369,7 @@ func ChangeoverTestRun() TestRun { ipPrefix: "7.7.7", votingWaitTime: 20, genesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + + ".app_state.gov.params.expedited_voting_period = \"10s\" | " + // Custom slashing parameters for testing validator downtime functionality // See https://docs.cosmos.network/main/modules/slashing/04_begin_block.html#uptime-tracking ".app_state.slashing.params.signed_blocks_window = \"10\" | " + diff --git a/tests/e2e/state.go b/tests/e2e/state.go index 62b630b3a0..57e4804cb7 100644 --- a/tests/e2e/state.go +++ b/tests/e2e/state.go @@ -384,14 +384,15 @@ func (tr TestRun) getProposal(chain chainID, proposal uint) Proposal { log.Fatal(err, "\n", string(bz)) } - propType := gjson.Get(string(bz), `messages.0.content.@type`).String() - deposit := gjson.Get(string(bz), `total_deposit.#(denom=="stake").amount`).Uint() - status := gjson.Get(string(bz), `status`).String() + propType := gjson.Get(string(bz), `proposal.messages.0.value.content.type`).String() + rawContent := gjson.Get(string(bz), `proposal.messages.0.value.content.value`) + deposit := gjson.Get(string(bz), `proposal.total_deposit.#(denom=="stake").amount`).Uint() + status := gjson.Get(string(bz), `proposal.status`).String() switch propType { case "/cosmos.gov.v1beta1.TextProposal": - title := gjson.Get(string(bz), `content.title`).String() - description := gjson.Get(string(bz), `content.description`).String() + title := rawContent.Get("title").String() + description := rawContent.Get("description").String() return TextProposal{ Deposit: uint(deposit), @@ -400,8 +401,8 @@ func (tr TestRun) getProposal(chain chainID, proposal uint) Proposal { Description: description, } case "/interchain_security.ccv.provider.v1.ConsumerAdditionProposal": - chainId := gjson.Get(string(bz), `messages.0.content.chain_id`).String() - spawnTime := gjson.Get(string(bz), `messages.0.content.spawn_time`).Time().Sub(tr.containerConfig.now) + chainId := rawContent.Get("chain_id").String() + spawnTime := rawContent.Get("spawn_time").Time().Sub(tr.containerConfig.now) var chain chainID for i, conf := range tr.chainConfigs { @@ -417,13 +418,13 @@ func (tr TestRun) getProposal(chain chainID, proposal uint) Proposal { Chain: chain, SpawnTime: int(spawnTime.Milliseconds()), InitialHeight: clienttypes.Height{ - RevisionNumber: gjson.Get(string(bz), `messages.0.content.initial_height.revision_number`).Uint(), - RevisionHeight: gjson.Get(string(bz), `messages.0.content.initial_height.revision_height`).Uint(), + RevisionNumber: rawContent.Get("initial_height.revision_number").Uint(), + RevisionHeight: rawContent.Get("initial_height.revision_height").Uint(), }, } case "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal": - height := gjson.Get(string(bz), `messages.0.content.plan.height`).Uint() - title := gjson.Get(string(bz), `messages.0.content.plan.name`).String() + height := rawContent.Get("plan.height").Uint() + title := rawContent.Get("plan.name").String() return UpgradeProposal{ Deposit: uint(deposit), Status: status, @@ -432,8 +433,8 @@ func (tr TestRun) getProposal(chain chainID, proposal uint) Proposal { Type: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", } case "/interchain_security.ccv.provider.v1.ConsumerRemovalProposal": - chainId := gjson.Get(string(bz), `messages.0.content.chain_id`).String() - stopTime := gjson.Get(string(bz), `messages.0.content.stop_time`).Time().Sub(tr.containerConfig.now) + chainId := rawContent.Get("chain_id").String() + stopTime := rawContent.Get("stop_time").Time().Sub(tr.containerConfig.now) var chain chainID for i, conf := range tr.chainConfigs { @@ -454,9 +455,9 @@ func (tr TestRun) getProposal(chain chainID, proposal uint) Proposal { return ParamsProposal{ Deposit: uint(deposit), Status: status, - Subspace: gjson.Get(string(bz), `messages.0.content.changes.0.subspace`).String(), - Key: gjson.Get(string(bz), `messages.0.content.changes.0.key`).String(), - Value: gjson.Get(string(bz), `messages.0.content.changes.0.value`).String(), + Subspace: rawContent.Get("changes.0.subspace").String(), + Key: rawContent.Get("changes.0.key").String(), + Value: rawContent.Get("changes.0.value").String(), } } @@ -466,7 +467,11 @@ func (tr TestRun) getProposal(chain chainID, proposal uint) Proposal { } type TmValidatorSetYaml struct { - Total string `yaml:"total"` + BlockHeight string `yaml:"block_height"` + Pagination struct { + NextKey string `yaml:"next_key"` + Total string `yaml:"total"` + } `yaml:"pagination"` Validators []struct { Address string `yaml:"address"` VotingPower string `yaml:"voting_power"` @@ -501,14 +506,15 @@ func (tr TestRun) getValPower(chain chainID, validator validatorID) uint { log.Fatalf("yaml.Unmarshal returned an error while unmarshalling validator set: %v, input: %s", err, string(bz)) } - total, err := strconv.Atoi(valset.Total) + total, err := strconv.Atoi(valset.Pagination.Total) if err != nil { - log.Fatalf("strconv.Atoi returned an error while coonverting total for validator set: %v, input: %s, validator set: %s", err, valset.Total, pretty.Sprint(valset)) + log.Fatalf("strconv.Atoi returned an error while coonverting total for validator set: %v, input: %s, validator set: %s", err, valset.Pagination.Total, pretty.Sprint(valset)) } + // this only works on small valsets -> otherwise pagination must be used if total != len(valset.Validators) { log.Fatalf("Total number of validators %v does not match number of validators in list %v. Probably a query pagination issue. Validator set: %v", - valset.Total, uint(len(valset.Validators)), pretty.Sprint(valset)) + valset.Pagination.Total, uint(len(valset.Validators)), pretty.Sprint(valset)) } for _, val := range valset.Validators { diff --git a/tests/e2e/steps_democracy.go b/tests/e2e/steps_democracy.go index 85e9e8cbd7..13957e8ed7 100644 --- a/tests/e2e/steps_democracy.go +++ b/tests/e2e/steps_democracy.go @@ -1,5 +1,11 @@ package main +import ( + "strconv" + + gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" +) + const consumerRewardDenom = "ibc/3C3D7B3BE4ECC85A0E5B52A3AEC3B7DFC2AA9CA47C37821E57020D6807043BE9" func stepsDemocracy(consumerName string) []Step { @@ -80,7 +86,7 @@ func stepsDemocracy(consumerName string) []Step { Proposals: &map[uint]Proposal{ 1: ParamsProposal{ Deposit: 10000001, - Status: "PROPOSAL_STATUS_VOTING_PERIOD", + Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), Subspace: "transfer", Key: "SendEnabled", Value: "true", diff --git a/tests/e2e/steps_reward_denom.go b/tests/e2e/steps_reward_denom.go index cc9934f3f8..2da8ad1438 100644 --- a/tests/e2e/steps_reward_denom.go +++ b/tests/e2e/steps_reward_denom.go @@ -1,5 +1,11 @@ package main +import ( + "strconv" + + gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" +) + func stepsRewardDenomConsumer(consumerName string) []Step { return []Step{ { @@ -78,7 +84,7 @@ func stepsRewardDenomConsumer(consumerName string) []Step { Proposals: &map[uint]Proposal{ 1: ParamsProposal{ Deposit: 10000001, - Status: "PROPOSAL_STATUS_VOTING_PERIOD", + Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), Subspace: "transfer", Key: "SendEnabled", Value: "true", diff --git a/tests/e2e/steps_sovereign_changeover.go b/tests/e2e/steps_sovereign_changeover.go index 8628197252..64022d708c 100644 --- a/tests/e2e/steps_sovereign_changeover.go +++ b/tests/e2e/steps_sovereign_changeover.go @@ -1,6 +1,11 @@ package main -import clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" +import ( + "strconv" + + gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" +) // this creates new clients on both chains and a connection (connection-0) between them // connection-0 is used to create a transfer channel between the chains @@ -61,7 +66,7 @@ func stepsChangeoverToConsumer(consumerName string) []Step { Chain: chainID(consumerName), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 111}, - Status: "PROPOSAL_STATUS_VOTING_PERIOD", + Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), }, }, }, @@ -82,7 +87,7 @@ func stepsChangeoverToConsumer(consumerName string) []Step { Chain: chainID(consumerName), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 111}, - Status: "PROPOSAL_STATUS_PASSED", + Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), }, }, ValBalances: &map[validatorID]uint{ @@ -206,7 +211,7 @@ func stepsUpgradeChain() []Step { UpgradeHeight: 110, Type: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", Deposit: 10000000, - Status: "PROPOSAL_STATUS_VOTING_PERIOD", + Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), }, }, }, @@ -227,7 +232,7 @@ func stepsUpgradeChain() []Step { UpgradeHeight: 110, Title: "sovereign-changeover", Type: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", - Status: "PROPOSAL_STATUS_PASSED", + Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), }, }, }, diff --git a/tests/e2e/steps_start_chains.go b/tests/e2e/steps_start_chains.go index 123ab44328..257c2ca710 100644 --- a/tests/e2e/steps_start_chains.go +++ b/tests/e2e/steps_start_chains.go @@ -1,6 +1,9 @@ package main import ( + "strconv" + + gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" ) @@ -51,7 +54,7 @@ func stepsStartConsumerChain(consumerName string, proposalIndex, chainIndex uint Chain: chainID(consumerName), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: "PROPOSAL_STATUS_VOTING_PERIOD", + Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), }, }, }, @@ -130,7 +133,7 @@ func stepsStartConsumerChain(consumerName string, proposalIndex, chainIndex uint Chain: chainID(consumerName), SpawnTime: 0, InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - Status: "PROPOSAL_STATUS_PASSED", + Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), }, }, ValBalances: &map[validatorID]uint{ diff --git a/tests/e2e/steps_stop_chain.go b/tests/e2e/steps_stop_chain.go index 9cef49a9ea..d7a300042a 100644 --- a/tests/e2e/steps_stop_chain.go +++ b/tests/e2e/steps_stop_chain.go @@ -1,6 +1,11 @@ package main -import "time" +import ( + "strconv" + "time" + + gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1" +) // start relayer so that all messages are relayed func stepsStartRelayer() []Step { @@ -33,7 +38,7 @@ func stepsStopChain(consumerName string, propNumber uint) []Step { Deposit: 10000001, Chain: chainID(consumerName), StopTime: 0, - Status: "PROPOSAL_STATUS_VOTING_PERIOD", + Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), }, }, ConsumerChains: &map[chainID]bool{"consu": true}, // consumer chain not yet removed @@ -54,7 +59,7 @@ func stepsStopChain(consumerName string, propNumber uint) []Step { Deposit: 10000001, Chain: chainID(consumerName), StopTime: 0, - Status: "PROPOSAL_STATUS_PASSED", + Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), }, }, ValBalances: &map[validatorID]uint{ @@ -91,7 +96,7 @@ func stepsConsumerRemovalPropNotPassing(consumerName string, propNumber uint) [] Deposit: 10000001, Chain: chainID(consumerName), StopTime: 0, - Status: "PROPOSAL_STATUS_VOTING_PERIOD", + Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), }, }, ConsumerChains: &map[chainID]bool{"consu": true}, // consumer chain not removed @@ -112,7 +117,7 @@ func stepsConsumerRemovalPropNotPassing(consumerName string, propNumber uint) [] Deposit: 10000001, Chain: chainID(consumerName), StopTime: 0, - Status: "PROPOSAL_STATUS_REJECTED", + Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_REJECTED)), }, }, ValBalances: &map[validatorID]uint{ diff --git a/tests/e2e/testnet-scripts/start-chain.sh b/tests/e2e/testnet-scripts/start-chain.sh index 88c8455e51..4c5a8c61ae 100644 --- a/tests/e2e/testnet-scripts/start-chain.sh +++ b/tests/e2e/testnet-scripts/start-chain.sh @@ -373,11 +373,11 @@ fi # poll for chain start if [[ "$USE_COMETMOCK" == "true" ]]; then set +e - until $BIN query block --node "tcp://$CHAIN_IP_PREFIX.$QUERY_IP_SUFFIX:26658"; do sleep 0.3 ; done + until $BIN query block --type=height 0 --node "tcp://$CHAIN_IP_PREFIX.$QUERY_IP_SUFFIX:26658"; do sleep 0.3 ; done set -e else set +e - until $BIN query block --node "tcp://$CHAIN_IP_PREFIX.$QUERY_IP_SUFFIX:26658" | grep -q -v '{"block_id":{"hash":"","parts":{"total":0,"hash": + until $BIN query block --type=height 0 --node "tcp://$CHAIN_IP_PREFIX.$QUERY_IP_SUFFIX:26658" | grep -q -v '{"block_id":{"hash":"","parts":{"total":0,"hash": ""}},"block":null}'; do sleep 0.3 ; done set -e fi diff --git a/tests/e2e/testnet-scripts/start-changeover.sh b/tests/e2e/testnet-scripts/start-changeover.sh index d28479a8e7..3bbd832a9d 100644 --- a/tests/e2e/testnet-scripts/start-changeover.sh +++ b/tests/e2e/testnet-scripts/start-changeover.sh @@ -179,7 +179,7 @@ QUERY_NODE_SUFFIX=$(echo "$VALIDATORS" | jq -r ".[0].ip_suffix") echo "NODE SUFFIX: $QUERY_NODE_SUFFIX" # poll for chain start set +e -until $BIN query block --node "tcp://$CHAIN_IP_PREFIX.$QUERY_NODE_SUFFIX:26658" | grep -q -v '{"block_id":{"hash":"","parts":{"total":0,"hash":""}},"block":null}'; do sleep 0.3 ; done +until $BIN query block query block --type=height 0 --node "tcp://$CHAIN_IP_PREFIX.$QUERY_NODE_SUFFIX:26658" | grep -q -v '{"block_id":{"hash":"","parts":{"total":0,"hash":""}},"block":null}'; do sleep 0.3 ; done set -e echo "done!!!!!!!!" diff --git a/tests/e2e/testnet-scripts/start-sovereign.sh b/tests/e2e/testnet-scripts/start-sovereign.sh index 9daed9a207..34adce39df 100644 --- a/tests/e2e/testnet-scripts/start-sovereign.sh +++ b/tests/e2e/testnet-scripts/start-sovereign.sh @@ -125,7 +125,7 @@ ip netns exec $NET_NAMESPACE_NAME $BIN $ARGS start &> /$CHAIN_ID/validator$VAL_I # poll for chain start set +e -until $BIN query block --node "tcp://$CHAIN_IP_PREFIX.$VAL_IP_SUFFIX:26658" | grep -q -v '{"block_id":{"hash":"","parts":{"total":0,"hash":""}},"block":null}'; do sleep 0.3 ; done +until $BIN query block --type=height 0 --node "tcp://$CHAIN_IP_PREFIX.$VAL_IP_SUFFIX:26658" | grep -q -v '{"block_id":{"hash":"","parts":{"total":0,"hash":""}},"block":null}'; do sleep 0.3 ; done set -e echo "done!!!!!!!!" diff --git a/x/ccv/provider/client/cli/tx.go b/x/ccv/provider/client/cli/tx.go index 0d37ef52a9..74ae6dd635 100644 --- a/x/ccv/provider/client/cli/tx.go +++ b/x/ccv/provider/client/cli/tx.go @@ -39,6 +39,7 @@ func NewAssignConsumerKeyCmd() *cobra.Command { return err } + signer := clientCtx.GetFromAddress().String() txf, err := tx.NewFactoryCLI(clientCtx, cmd.Flags()) if err != nil { return err @@ -47,7 +48,7 @@ func NewAssignConsumerKeyCmd() *cobra.Command { providerValAddr := clientCtx.GetFromAddress() - msg, err := types.NewMsgAssignConsumerKey(args[0], sdk.ValAddress(providerValAddr), args[1]) + msg, err := types.NewMsgAssignConsumerKey(args[0], sdk.ValAddress(providerValAddr), args[1], signer) if err != nil { return err } diff --git a/x/ccv/provider/handler_test.go b/x/ccv/provider/handler_test.go index 355a180bf7..797698b61f 100644 --- a/x/ccv/provider/handler_test.go +++ b/x/ccv/provider/handler_test.go @@ -109,7 +109,7 @@ func TestAssignConsensusKeyForConsumerChain(t *testing.T) { tc.setup(ctx, k, mocks) msg, err := providertypes.NewMsgAssignConsumerKey(tc.chainID, - providerCryptoId.SDKValOpAddress(), consumerKey, + providerCryptoId.SDKValOpAddress(), consumerKey, providerCryptoId.SDKStakingValidator().OperatorAddress, ) require.NoError(t, err) diff --git a/x/ccv/provider/types/errors.go b/x/ccv/provider/types/errors.go index e350fd6f38..5f29e78e69 100644 --- a/x/ccv/provider/types/errors.go +++ b/x/ccv/provider/types/errors.go @@ -22,4 +22,5 @@ var ( ErrInvalidConsumerRewardDenom = errorsmod.Register(ModuleName, 14, "invalid consumer reward denom") ErrInvalidDepositorAddress = errorsmod.Register(ModuleName, 15, "invalid depositor address") ErrNoUnbondingTime = errorsmod.Register(ModuleName, 16, "provider unbonding time not found") + ErrInvalidAddress = errorsmod.Register(ModuleName, 17, "invalid address") ) diff --git a/x/ccv/provider/types/msg.go b/x/ccv/provider/types/msg.go index 901aa03600..57eaf84133 100644 --- a/x/ccv/provider/types/msg.go +++ b/x/ccv/provider/types/msg.go @@ -17,12 +17,13 @@ var _ sdk.Msg = &MsgAssignConsumerKey{} // NewMsgAssignConsumerKey creates a new MsgAssignConsumerKey instance. // Delegator address and validator address are the same. func NewMsgAssignConsumerKey(chainID string, providerValidatorAddress sdk.ValAddress, - consumerConsensusPubKey string, + consumerConsensusPubKey, signer string, ) (*MsgAssignConsumerKey, error) { return &MsgAssignConsumerKey{ ChainId: chainID, ProviderAddr: providerValidatorAddress.String(), ConsumerKey: consumerConsensusPubKey, + Signer: signer, }, nil } diff --git a/x/ccv/provider/types/tx.pb.go b/x/ccv/provider/types/tx.pb.go index a0d6397884..9e7a62b26d 100644 --- a/x/ccv/provider/types/tx.pb.go +++ b/x/ccv/provider/types/tx.pb.go @@ -41,6 +41,8 @@ type MsgAssignConsumerKey struct { // in json string format corresponding to proto-any, ex: // `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Ui5Gf1+mtWUdH8u3xlmzdKID+F3PK0sfXZ73GZ6q6is="}` ConsumerKey string `protobuf:"bytes,3,opt,name=consumer_key,json=consumerKey,proto3" json:"consumer_key,omitempty"` + // signer address + Signer string `protobuf:"bytes,4,opt,name=signer,proto3" json:"signer,omitempty"` } func (m *MsgAssignConsumerKey) Reset() { *m = MsgAssignConsumerKey{} } @@ -122,32 +124,34 @@ func init() { } var fileDescriptor_43221a4391e9fbf4 = []byte{ - // 394 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0x3d, 0xab, 0x13, 0x41, - 0x14, 0xdd, 0x31, 0xa8, 0x71, 0x8c, 0x82, 0x4b, 0xc0, 0x64, 0x09, 0x1b, 0x5d, 0x1b, 0x11, 0xdd, - 0x21, 0xa6, 0x10, 0x03, 0x16, 0x89, 0x95, 0x48, 0x9a, 0x34, 0x82, 0xcd, 0xb2, 0x99, 0x1d, 0x27, - 0x83, 0xd9, 0x99, 0x65, 0xee, 0xec, 0x92, 0xed, 0x2c, 0x2d, 0xb5, 0xb2, 0xcd, 0x4f, 0xf0, 0x67, - 0x58, 0xa6, 0xb4, 0x12, 0x49, 0x0a, 0xad, 0xfd, 0x05, 0xb2, 0x5f, 0x2f, 0x3c, 0x5e, 0x8a, 0xc7, - 0xeb, 0xe6, 0xdc, 0x73, 0xef, 0x3d, 0x67, 0x38, 0x17, 0x3f, 0x15, 0xd2, 0x30, 0x4d, 0x57, 0xa1, - 0x90, 0x01, 0x30, 0x9a, 0x6a, 0x61, 0x72, 0x42, 0x69, 0x46, 0x12, 0xad, 0x32, 0x11, 0x31, 0x4d, - 0xb2, 0x11, 0x31, 0x1b, 0x3f, 0xd1, 0xca, 0x28, 0xfb, 0xd1, 0x89, 0x6e, 0x9f, 0xd2, 0xcc, 0x6f, - 0xba, 0xfd, 0x6c, 0xe4, 0x0c, 0xb8, 0x52, 0x7c, 0xcd, 0x48, 0x98, 0x08, 0x12, 0x4a, 0xa9, 0x4c, - 0x68, 0x84, 0x92, 0x50, 0xad, 0x70, 0xba, 0x5c, 0x71, 0x55, 0x3e, 0x49, 0xf1, 0xaa, 0xab, 0x7d, - 0xaa, 0x20, 0x56, 0x10, 0x54, 0x44, 0x05, 0x6a, 0xea, 0x7e, 0x85, 0x48, 0x0c, 0xbc, 0xf0, 0x12, - 0x03, 0x6f, 0x66, 0x6a, 0x9d, 0x12, 0x2d, 0xd3, 0x0f, 0x24, 0x94, 0x79, 0x45, 0x79, 0xdf, 0x10, - 0xee, 0xce, 0x81, 0x4f, 0x01, 0x04, 0x97, 0xaf, 0x95, 0x84, 0x34, 0x66, 0xfa, 0x2d, 0xcb, 0xed, - 0x3e, 0x6e, 0x57, 0xee, 0x45, 0xd4, 0x43, 0x0f, 0xd0, 0xe3, 0x5b, 0x8b, 0x9b, 0x25, 0x7e, 0x13, - 0xd9, 0x2f, 0xf0, 0x9d, 0xe6, 0x17, 0x41, 0x18, 0x45, 0xba, 0x77, 0xad, 0xe0, 0x67, 0xf6, 0xbf, - 0x5f, 0xc3, 0xbb, 0x79, 0x18, 0xaf, 0x27, 0x5e, 0x51, 0x65, 0x00, 0xde, 0xa2, 0xd3, 0x34, 0x4e, - 0xa3, 0x48, 0xdb, 0x0f, 0x71, 0x87, 0xd6, 0x12, 0xc1, 0x47, 0x96, 0xf7, 0x5a, 0xe5, 0xde, 0xdb, - 0xf4, 0x28, 0x3b, 0x69, 0x7f, 0xde, 0x0e, 0xad, 0xbf, 0xdb, 0xa1, 0xe5, 0xb9, 0x78, 0x70, 0xca, - 0xd8, 0x82, 0x41, 0xa2, 0x24, 0xb0, 0xe7, 0x5b, 0x84, 0x5b, 0x73, 0xe0, 0xf6, 0x57, 0x84, 0xef, - 0x5d, 0xb4, 0xff, 0xd2, 0xbf, 0x44, 0x00, 0xfe, 0x29, 0x01, 0x67, 0x7a, 0xe5, 0xd1, 0xc6, 0x9b, - 0x73, 0xfd, 0xd3, 0x9f, 0xef, 0x4f, 0xd0, 0xec, 0xdd, 0x8f, 0xbd, 0x8b, 0x76, 0x7b, 0x17, 0xfd, - 0xde, 0xbb, 0xe8, 0xcb, 0xc1, 0xb5, 0x76, 0x07, 0xd7, 0xfa, 0x79, 0x70, 0xad, 0xf7, 0xaf, 0xb8, - 0x30, 0xab, 0x74, 0xe9, 0x53, 0x15, 0xd7, 0x19, 0x92, 0xa3, 0xe8, 0xb3, 0xb3, 0xf3, 0xca, 0xc6, - 0x64, 0x73, 0xfe, 0xc6, 0x4c, 0x9e, 0x30, 0x58, 0xde, 0x28, 0xc3, 0x1b, 0xff, 0x0f, 0x00, 0x00, - 0xff, 0xff, 0x87, 0x60, 0x20, 0xb1, 0x94, 0x02, 0x00, 0x00, + // 431 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0x3f, 0x6f, 0xd4, 0x30, + 0x14, 0x8f, 0x29, 0x14, 0x30, 0x05, 0x89, 0x70, 0x12, 0x69, 0x54, 0xe5, 0x20, 0x2c, 0xa8, 0xa2, + 0x31, 0xa5, 0x03, 0xa2, 0x12, 0x43, 0xca, 0x84, 0x50, 0x97, 0x30, 0x20, 0xb1, 0x44, 0x39, 0xc7, + 0xb8, 0x16, 0x8d, 0x1d, 0xf9, 0x39, 0x51, 0xb3, 0x21, 0x26, 0x46, 0xf8, 0x06, 0xf7, 0x11, 0x3a, + 0xf0, 0x21, 0x18, 0x4f, 0x88, 0x81, 0x09, 0xa1, 0xbb, 0xe1, 0x98, 0xf9, 0x04, 0x28, 0x89, 0xc3, + 0x1f, 0x71, 0x03, 0x62, 0xf3, 0x7b, 0xef, 0xe7, 0xdf, 0x1f, 0xbd, 0x87, 0xef, 0x08, 0x69, 0x98, + 0xa6, 0x47, 0x99, 0x90, 0x29, 0x30, 0x5a, 0x69, 0x61, 0x1a, 0x42, 0x69, 0x4d, 0x4a, 0xad, 0x6a, + 0x91, 0x33, 0x4d, 0xea, 0x5d, 0x62, 0x4e, 0xa2, 0x52, 0x2b, 0xa3, 0xdc, 0x5b, 0x2b, 0xd0, 0x11, + 0xa5, 0x75, 0x34, 0xa0, 0xa3, 0x7a, 0xd7, 0xdf, 0xe2, 0x4a, 0xf1, 0x63, 0x46, 0xb2, 0x52, 0x90, + 0x4c, 0x4a, 0x65, 0x32, 0x23, 0x94, 0x84, 0x9e, 0xc2, 0x1f, 0x71, 0xc5, 0x55, 0xf7, 0x24, 0xed, + 0xcb, 0x76, 0x37, 0xa9, 0x82, 0x42, 0x41, 0xda, 0x0f, 0xfa, 0xc2, 0x8e, 0xae, 0xf7, 0x15, 0x29, + 0x80, 0xb7, 0x5e, 0x0a, 0xe0, 0xc3, 0x1f, 0xab, 0xd3, 0x55, 0x93, 0xea, 0x05, 0xc9, 0x64, 0xd3, + 0x8f, 0xc2, 0x4f, 0x08, 0x8f, 0x0e, 0x81, 0xc7, 0x00, 0x82, 0xcb, 0x47, 0x4a, 0x42, 0x55, 0x30, + 0xfd, 0x84, 0x35, 0xee, 0x26, 0xbe, 0xd0, 0xbb, 0x17, 0xb9, 0x87, 0x6e, 0xa0, 0xdb, 0x17, 0x93, + 0xf3, 0x5d, 0xfd, 0x38, 0x77, 0xef, 0xe3, 0xcb, 0x43, 0x8a, 0x34, 0xcb, 0x73, 0xed, 0x9d, 0x69, + 0xe7, 0x07, 0xee, 0xf7, 0x2f, 0xe3, 0x2b, 0x4d, 0x56, 0x1c, 0xef, 0x87, 0x6d, 0x97, 0x01, 0x84, + 0xc9, 0xc6, 0x00, 0x8c, 0xf3, 0x5c, 0xbb, 0x37, 0xf1, 0x06, 0xb5, 0x12, 0xe9, 0x4b, 0xd6, 0x78, + 0x6b, 0x1d, 0xef, 0x25, 0xfa, 0x9b, 0xec, 0x5d, 0xbc, 0xde, 0x3a, 0x61, 0xda, 0x3b, 0xdb, 0x91, + 0x7a, 0x1f, 0xdf, 0xef, 0x8c, 0x6c, 0xca, 0xb8, 0x67, 0x7d, 0x6a, 0xb4, 0x90, 0x3c, 0xb1, 0xb8, + 0xfd, 0x6b, 0x6f, 0xa6, 0x63, 0xe7, 0xdb, 0x74, 0xec, 0xbc, 0x5e, 0x9e, 0x6e, 0xdb, 0x66, 0x18, + 0xe0, 0xad, 0x55, 0xa9, 0x12, 0x06, 0xa5, 0x92, 0xc0, 0xee, 0x4d, 0x11, 0x5e, 0x3b, 0x04, 0xee, + 0xbe, 0x43, 0xf8, 0xea, 0xdf, 0xd9, 0x1f, 0x44, 0xff, 0xb0, 0xbd, 0x68, 0x95, 0x80, 0x1f, 0xff, + 0xf7, 0xd7, 0xc1, 0x9b, 0x7f, 0xee, 0xd5, 0xf2, 0x74, 0x1b, 0x1d, 0x3c, 0xfb, 0x30, 0x0f, 0xd0, + 0x6c, 0x1e, 0xa0, 0xaf, 0xf3, 0x00, 0xbd, 0x5d, 0x04, 0xce, 0x6c, 0x11, 0x38, 0x9f, 0x17, 0x81, + 0xf3, 0xfc, 0x21, 0x17, 0xe6, 0xa8, 0x9a, 0x44, 0x54, 0x15, 0xf6, 0x00, 0xc8, 0x2f, 0xd1, 0x9d, + 0x9f, 0xb7, 0x59, 0xef, 0x91, 0x93, 0x3f, 0x0f, 0xd4, 0x34, 0x25, 0x83, 0xc9, 0x7a, 0xb7, 0xf9, + 0xbd, 0x1f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x81, 0xdf, 0x33, 0x1e, 0xd1, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -250,6 +254,13 @@ func (m *MsgAssignConsumerKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x22 + } if len(m.ConsumerKey) > 0 { i -= len(m.ConsumerKey) copy(dAtA[i:], m.ConsumerKey) @@ -326,6 +337,10 @@ func (m *MsgAssignConsumerKey) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -469,6 +484,38 @@ func (m *MsgAssignConsumerKey) Unmarshal(dAtA []byte) error { } m.ConsumerKey = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:])