diff --git a/tests/e2e/action_rapid_test.go b/tests/e2e/action_rapid_test.go index dffa0286a8..64bd78a5a7 100644 --- a/tests/e2e/action_rapid_test.go +++ b/tests/e2e/action_rapid_test.go @@ -56,10 +56,6 @@ func MarshalAndUnmarshalAction(action interface{}) error { // include generators for all actions that are mentioned in main.go/runStep. func GetActionGen() *rapid.Generator[any] { return rapid.OneOf( - GetStartSovereignChainActionGen().AsAny(), - GetSubmitLegacyUpgradeProposalActionGen().AsAny(), - GetWaitUntilBlockActionGen().AsAny(), - GetChangeoverChainActionGen().AsAny(), GetSendTokensActionGen().AsAny(), GetStartChainActionGen().AsAny(), GetSubmitTextProposalActionGen().AsAny(), @@ -154,47 +150,6 @@ func GetCreateIbcClientsActionGen() *rapid.Generator[CreateIbcClientsAction] { }) } -func GetStartSovereignChainActionGen() *rapid.Generator[StartSovereignChainAction] { - return rapid.Custom(func(t *rapid.T) StartSovereignChainAction { - return StartSovereignChainAction{ - Chain: GetChainIDGen().Draw(t, "Chain"), - Validators: GetStartChainValidatorsGen().Draw(t, "Validators"), - GenesisChanges: rapid.String().Draw(t, "GenesisChanges"), - } - }) -} - -func GetSubmitLegacyUpgradeProposalActionGen() *rapid.Generator[UpgradeProposalAction] { - return rapid.Custom(func(t *rapid.T) UpgradeProposalAction { - return UpgradeProposalAction{ - ChainID: GetChainIDGen().Draw(t, "ChainID"), - UpgradeTitle: rapid.String().Draw(t, "UpgradeTitle"), - Proposer: GetValidatorIDGen().Draw(t, "Proposer"), - UpgradeHeight: rapid.Uint64().Draw(t, "UpgradeHeight"), - } - }) -} - -func GetWaitUntilBlockActionGen() *rapid.Generator[WaitUntilBlockAction] { - return rapid.Custom(func(t *rapid.T) WaitUntilBlockAction { - return WaitUntilBlockAction{ - Chain: GetChainIDGen().Draw(t, "Chain"), - Block: rapid.Uint().Draw(t, "Block"), - } - }) -} - -func GetChangeoverChainActionGen() *rapid.Generator[ChangeoverChainAction] { - return rapid.Custom(func(t *rapid.T) ChangeoverChainAction { - return ChangeoverChainAction{ - SovereignChain: GetChainIDGen().Draw(t, "SovereignChain"), - ProviderChain: GetChainIDGen().Draw(t, "ProviderChain"), - Validators: GetStartChainValidatorsGen().Draw(t, "Validators"), - GenesisChanges: rapid.String().Draw(t, "GenesisChanges"), - } - }) -} - func GetSendTokensActionGen() *rapid.Generator[SendTokensAction] { return rapid.Custom(func(t *rapid.T) SendTokensAction { return SendTokensAction{ diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index 588a1c5d56..7aefcf7460 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -38,12 +38,10 @@ type ( StartChainAction = e2e.StartChainAction StartChainValidator = e2e.StartChainValidator StartConsumerChainAction = e2e.StartConsumerChainAction - StartSovereignChainAction = e2e.StartSovereignChainAction SubmitConsumerAdditionProposalAction = e2e.SubmitConsumerAdditionProposalAction SubmitConsumerRemovalProposalAction = e2e.SubmitConsumerRemovalProposalAction DelegateTokensAction = e2e.DelegateTokensAction UnbondTokensAction = e2e.UnbondTokensAction - ChangeoverChainAction = e2e.ChangeoverChainAction ) type SendTokensAction struct { @@ -1100,111 +1098,6 @@ func (tr *Chain) transformConsumerGenesis(targetVersion string, genesis []byte) return result } -func (tr Chain) changeoverChain( - action e2e.ChangeoverChainAction, - verbose bool, -) { - consumerGenesis := ".app_state.ccvconsumer = " + tr.getConsumerGenesis(action.ProviderChain, action.SovereignChain) - - consumerGenesisChanges := tr.testConfig.ChainConfigs[action.SovereignChain].GenesisChanges - if consumerGenesisChanges != "" { - consumerGenesis = consumerGenesis + " | " + consumerGenesisChanges - } - if action.GenesisChanges != "" { - consumerGenesis = consumerGenesis + " | " + action.GenesisChanges - } - - tr.startChangeover(e2e.ChangeoverChainAction{ - Validators: action.Validators, - GenesisChanges: consumerGenesis, - }, verbose) -} - -func (tr Chain) startChangeover( - action e2e.ChangeoverChainAction, - verbose bool, -) { - chainConfig := tr.testConfig.ChainConfigs[ChainID("sover")] - type jsonValAttrs struct { - Mnemonic string `json:"mnemonic"` - Allocation string `json:"allocation"` - Stake string `json:"stake"` - ValId string `json:"val_id"` - PrivValidatorKey string `json:"priv_validator_key"` - NodeKey string `json:"node_key"` - IpSuffix string `json:"ip_suffix"` - - ConsumerMnemonic string `json:"consumer_mnemonic"` - ConsumerPrivValidatorKey string `json:"consumer_priv_validator_key"` - StartWithConsumerKey bool `json:"start_with_consumer_key"` - } - - var validators []jsonValAttrs - for _, val := range action.Validators { - validators = append(validators, jsonValAttrs{ - Mnemonic: tr.testConfig.ValidatorConfigs[val.Id].Mnemonic, - NodeKey: tr.testConfig.ValidatorConfigs[val.Id].NodeKey, - ValId: fmt.Sprint(val.Id), - PrivValidatorKey: tr.testConfig.ValidatorConfigs[val.Id].PrivValidatorKey, - Allocation: fmt.Sprint(val.Allocation) + "stake", - Stake: fmt.Sprint(val.Stake) + "stake", - IpSuffix: tr.testConfig.ValidatorConfigs[val.Id].IpSuffix, - - ConsumerMnemonic: tr.testConfig.ValidatorConfigs[val.Id].ConsumerMnemonic, - ConsumerPrivValidatorKey: tr.testConfig.ValidatorConfigs[val.Id].ConsumerPrivValidatorKey, - // if true node will be started with consumer key for each consumer chain - StartWithConsumerKey: tr.testConfig.ValidatorConfigs[val.Id].UseConsumerKey, - }) - } - - vals, err := json.Marshal(validators) - if err != nil { - log.Fatal(err) - } - - // Concat genesis changes defined in chain config, with any custom genesis changes for this chain instantiation - var genesisChanges string - if action.GenesisChanges != "" { - genesisChanges = chainConfig.GenesisChanges + " | " + action.GenesisChanges - } else { - genesisChanges = chainConfig.GenesisChanges - } - - isConsumer := true - changeoverScript := tr.target.GetTestScriptPath(isConsumer, "start-changeover.sh") - cmd := tr.target.ExecCommand( - "/bin/bash", - changeoverScript, chainConfig.UpgradeBinary, string(vals), - "sover", chainConfig.IpPrefix, genesisChanges, - tr.testConfig.TendermintConfigOverride, - ) - - cmdReader, err := cmd.StdoutPipe() - if err != nil { - log.Fatal(err) - } - cmd.Stderr = cmd.Stdout - - if err := cmd.Start(); err != nil { - log.Fatal(err) - } - - scanner := bufio.NewScanner(cmdReader) - - for scanner.Scan() { - out := scanner.Text() - if verbose { - fmt.Println("startChangeover: " + out) - } - if out == done { - break - } - } - if err := scanner.Err(); err != nil { - log.Fatal("startChangeover died", err) - } -} - type AddChainToRelayerAction struct { Chain ChainID Validator ValidatorID diff --git a/tests/e2e/actions_sovereign_chain.go b/tests/e2e/actions_sovereign_chain.go deleted file mode 100644 index a9d9f861e0..0000000000 --- a/tests/e2e/actions_sovereign_chain.go +++ /dev/null @@ -1,198 +0,0 @@ -package main - -import ( - "bufio" - "encoding/json" - "fmt" - "log" - "time" - - e2e "github.com/cosmos/interchain-security/v6/tests/e2e/testlib" -) - -// calls a simplified startup script (start-sovereign.sh) and runs a validator node -// upgrades are simpler with a single validator node since only one node needs to be upgraded -func (tr Chain) startSovereignChain( - action e2e.StartSovereignChainAction, - verbose bool, -) { - chainConfig := tr.testConfig.ChainConfigs["sover"] - type jsonValAttrs struct { - Mnemonic string `json:"mnemonic"` - Allocation string `json:"allocation"` - Stake string `json:"stake"` - ValId string `json:"val_id"` - PrivValidatorKey string `json:"priv_validator_key"` - NodeKey string `json:"node_key"` - IpSuffix string `json:"ip_suffix"` - - ConsumerMnemonic string `json:"consumer_mnemonic"` - ConsumerPrivValidatorKey string `json:"consumer_priv_validator_key"` - StartWithConsumerKey bool `json:"start_with_consumer_key"` - } - - var validators []jsonValAttrs - for _, val := range action.Validators { - validators = append(validators, jsonValAttrs{ - Mnemonic: tr.testConfig.ValidatorConfigs[val.Id].Mnemonic, - NodeKey: tr.testConfig.ValidatorConfigs[val.Id].NodeKey, - ValId: fmt.Sprint(val.Id), - PrivValidatorKey: tr.testConfig.ValidatorConfigs[val.Id].PrivValidatorKey, - Allocation: fmt.Sprint(val.Allocation) + "stake", - Stake: fmt.Sprint(val.Stake) + "stake", - IpSuffix: tr.testConfig.ValidatorConfigs[val.Id].IpSuffix, - - ConsumerMnemonic: tr.testConfig.ValidatorConfigs[val.Id].ConsumerMnemonic, - ConsumerPrivValidatorKey: tr.testConfig.ValidatorConfigs[val.Id].ConsumerPrivValidatorKey, - // if true node will be started with consumer key for each consumer chain - StartWithConsumerKey: tr.testConfig.ValidatorConfigs[val.Id].UseConsumerKey, - }) - } - - vals, err := json.Marshal(validators) - if err != nil { - log.Fatal(err) - } - - // Concat genesis changes defined in chain config, with any custom genesis changes for this chain instantiation - var genesisChanges string - if action.GenesisChanges != "" { - genesisChanges = chainConfig.GenesisChanges + " | " + action.GenesisChanges - } else { - genesisChanges = chainConfig.GenesisChanges - } - - isConsumer := chainConfig.BinaryName != "interchain-security-pd" - testScriptPath := tr.target.GetTestScriptPath(isConsumer, "start-sovereign.sh") - cmd := tr.target.ExecCommand("/bin/bash", testScriptPath, chainConfig.BinaryName, string(vals), - string(chainConfig.ChainId), chainConfig.IpPrefix, genesisChanges, - tr.testConfig.TendermintConfigOverride) - - cmdReader, err := cmd.StdoutPipe() - if err != nil { - log.Fatal(err) - } - cmd.Stderr = cmd.Stdout - - if err := cmd.Start(); err != nil { - log.Fatal(err) - } - - scanner := bufio.NewScanner(cmdReader) - - for scanner.Scan() { - out := scanner.Text() - if verbose { - fmt.Println("startSovereignChain: " + out) - } - if out == done { - break - } - } - if err := scanner.Err(); err != nil { - log.Fatal(err) - } - tr.addChainToRelayer(AddChainToRelayerAction{ - Chain: action.Chain, - Validator: action.Validators[0].Id, - }, verbose) -} - -type UpgradeProposalAction struct { - ChainID ChainID - UpgradeTitle string - Proposer ValidatorID - UpgradeHeight uint64 - Expedited bool -} - -func (tr *Chain) submitUpgradeProposal(action UpgradeProposalAction, verbose bool) { - // Get authority address - binary := tr.testConfig.ChainConfigs[ChainID("sover")].BinaryName - cmd := tr.target.ExecCommand(binary, - "query", "upgrade", "authority", - "--node", tr.getValidatorNode(ChainID("sover"), action.Proposer), - "-o", "json") - bz, err := cmd.CombinedOutput() - if err != nil { - log.Fatalf("failed running command '%s': %v", cmd, err) - } - - var authority struct { - Address string `json:"address"` - } - err = json.Unmarshal(bz, &authority) - if err != nil { - log.Fatalf("Failed getting authority: err=%v, data=%s", err, string(bz)) - } - - // Upgrade Proposal Content - metadata := "ipfs://CID" - deposit := "10000000stake" - summary := "my summary" - proposalJson := fmt.Sprintf(` -{ - "messages": [ - { - "@type": "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", - "authority": "%s", - "plan": { - "name": "sovereign-changeover", - "height": "%d", - "info": "my upgrade info", - "upgraded_client_state": null - } - } - ], - "metadata": "%s", - "title": "%s", - "summary": "%s", - "deposit": "%s", - "expedited": %t -}`, authority.Address, action.UpgradeHeight, metadata, action.UpgradeTitle, summary, deposit, action.Expedited) - - //#nosec G204 -- bypass unsafe quoting warning (no production code) - proposalPath := "/temp-proposal.json" - bz, err = tr.target.ExecCommand( - "/bin/bash", "-c", fmt.Sprintf(`echo '%s' > %s`, proposalJson, proposalPath), - ).CombinedOutput() - if err != nil { - log.Fatal(err, "\n", string(bz)) - } - - // Submit Proposal - cmd = tr.target.ExecCommand(binary, - "tx", "gov", "submit-proposal", proposalPath, - "--gas", "900000", - "--from", "validator"+string(action.Proposer), - "--keyring-backend", "test", - "--chain-id", string(tr.testConfig.ChainConfigs[ChainID("sover")].ChainId), - "--home", tr.getValidatorHome(ChainID("sover"), action.Proposer), - "--node", tr.getValidatorNode(ChainID("sover"), action.Proposer), - "-y") - - if verbose { - fmt.Println("Submit proposal:", cmd.String()) - } - - bz, err = cmd.CombinedOutput() - if err != nil { - log.Fatal(err, "\n", string(bz)) - } - if verbose { - log.Println("Response to submit-proposal: ", string(bz)) - } - - tr.waitBlocks(action.ChainID, 1, 15*time.Second) -} - -type WaitUntilBlockAction struct { - Block uint - Chain ChainID -} - -func (tr *Chain) waitUntilBlockOnChain(action WaitUntilBlockAction) { - fmt.Println("waitUntilBlockOnChain is waiting for block:", action.Block) - tr.waitUntilBlock(action.Chain, action.Block, 120*time.Second) - fmt.Println("waitUntilBlockOnChain done waiting for block:", action.Block) -} diff --git a/tests/e2e/json_utils.go b/tests/e2e/json_utils.go index be82e9f45a..c25944a866 100644 --- a/tests/e2e/json_utils.go +++ b/tests/e2e/json_utils.go @@ -216,30 +216,6 @@ func UnmarshalMapToActionType(rawAction json.RawMessage, actionTypeString string if err == nil { return a, nil } - case "main.LegacyUpgradeProposalAction": - var a UpgradeProposalAction - err := json.Unmarshal(rawAction, &a) - if err == nil { - return a, nil - } - case "main.WaitUntilBlockAction": - var a WaitUntilBlockAction - err := json.Unmarshal(rawAction, &a) - if err == nil { - return a, nil - } - case "main.ChangeoverChainAction": - var a ChangeoverChainAction - err := json.Unmarshal(rawAction, &a) - if err == nil { - return a, nil - } - case "main.StartSovereignChainAction": - var a StartSovereignChainAction - err := json.Unmarshal(rawAction, &a) - if err == nil { - return a, nil - } case "main.LightClientEquivocationAttackAction": var a LightClientEquivocationAttackAction err := json.Unmarshal(rawAction, &a) diff --git a/tests/e2e/main.go b/tests/e2e/main.go index bc060ae905..0f935e0ee1 100644 --- a/tests/e2e/main.go +++ b/tests/e2e/main.go @@ -103,12 +103,6 @@ var stepChoices = map[string]StepChoice{ description: "happy path tests", testConfig: DefaultTestCfg, }, - "changeover": { - name: "changeover", - steps: changeoverSteps, - description: "changeover tests", - testConfig: ChangeoverTestCfg, - }, "democracy-reward": { name: "democracy-reward", steps: democracyRegisteredDenomSteps, diff --git a/tests/e2e/steps.go b/tests/e2e/steps.go index b9b635452f..a776d41bd8 100644 --- a/tests/e2e/steps.go +++ b/tests/e2e/steps.go @@ -107,21 +107,6 @@ var multipleConsumers = concatSteps( stepsMultiConsumerDoubleSign("consu", "densu"), // double sign on one of the chains ) -var changeoverSteps = concatSteps( - // start sovereign chain and test delegation operation - - stepRunSovereignChain(), - stepStartProviderChain(), - stepsSovereignTransferChan(), - - // the chain will halt once upgrade height is reached - // after upgrade height is reached, the chain will become a consumer - stepsUpgradeChain(), - stepsChangeoverToConsumer("sover"), - - stepsPostChangeoverDelegate("sover"), -) - var consumerMisbehaviourSteps = concatSteps( // start provider and consumer chain stepsStartChainsForConsumerMisbehaviour("consu"), diff --git a/tests/e2e/steps_sovereign_changeover.go b/tests/e2e/steps_sovereign_changeover.go deleted file mode 100644 index 23d595b8d4..0000000000 --- a/tests/e2e/steps_sovereign_changeover.go +++ /dev/null @@ -1,371 +0,0 @@ -package main - -import ( - 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 -// the transfer channel is maintained during the changeover process, meaning that -// the consumer chain will be able to send rewards to the provider chain using the old channel -// as opposed to creating a new transfer channel which happens for new consumers -func stepsSovereignTransferChan() []Step { - return []Step{ - { - Action: CreateIbcClientsAction{ - ChainA: ChainID("sover"), - ChainB: ChainID("provi"), - }, - State: State{}, - }, - { - // this will create channel-0 connection end on both chain - Action: AddIbcChannelAction{ - ChainA: ChainID("sover"), - ChainB: ChainID("provi"), - ConnectionA: 0, - PortA: "transfer", - PortB: "transfer", - Order: "unordered", - Version: "ics20-1", - }, - State: State{}, - }, - } -} - -// steps to convert sovereign to consumer chain -func stepsChangeoverToConsumer(consumerName string) []Step { - s := []Step{ - { - Action: SubmitConsumerAdditionProposalAction{ - PreCCV: true, - Chain: ChainID("provi"), - From: ValidatorID("alice"), - Deposit: 10000001, - ConsumerChain: ChainID(consumerName), - // chain-0 is the transfer channelID that gets created in stepsSovereignTransferChan - // the consumer chain will use this channel to send rewards to the provider chain - // there is no need to create a new channel for rewards distribution - DistributionChannel: "channel-0", - SpawnTime: 0, - InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 111}, // 1 block after upgrade !important - TopN: 100, - }, - State: State{ - ChainID("provi"): ChainState{ - ValBalances: &map[ValidatorID]uint{ - ValidatorID("alice"): 9489999999, - ValidatorID("bob"): 9500000000, - }, - Proposals: &map[uint]Proposal{ - 1: ConsumerAdditionProposal{ - Deposit: 10000001, - Chain: ChainID(consumerName), - SpawnTime: 0, - InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 111}, - Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(), - }, - }, - }, - }, - }, - { - Action: VoteGovProposalAction{ - Chain: ChainID("provi"), - From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob"), ValidatorID("carol")}, - Vote: []string{"yes", "yes", "yes"}, - PropNumber: 1, - }, - State: State{ - ChainID("provi"): ChainState{ - Proposals: &map[uint]Proposal{ - 1: ConsumerAdditionProposal{ - Deposit: 10000001, - Chain: ChainID(consumerName), - SpawnTime: 0, - InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 111}, - Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(), - }, - }, - ValBalances: &map[ValidatorID]uint{ - ValidatorID("alice"): 9500000000, - ValidatorID("bob"): 9500000000, - }, - }, - }, - }, - { - Action: ChangeoverChainAction{ - SovereignChain: ChainID(consumerName), - ProviderChain: ChainID("provi"), - Validators: []StartChainValidator{ - {Id: ValidatorID("alice"), Stake: 500000000, Allocation: 10000000000}, - {Id: ValidatorID("bob"), Stake: 500000000, Allocation: 10000000000}, - {Id: ValidatorID("carol"), Stake: 500000000, Allocation: 10000000000}, - }, - }, - State: State{ - ChainID("provi"): ChainState{ - ValPowers: &map[ValidatorID]uint{ - ValidatorID("alice"): 500, - ValidatorID("bob"): 500, - ValidatorID("carol"): 500, - }, - }, - ChainID(consumerName): ChainState{ - ValPowers: &map[ValidatorID]uint{ - // uses val powers from consumer - ValidatorID("alice"): 500, - ValidatorID("bob"): 500, - ValidatorID("carol"): 500, - }, - }, - }, - }, - { - Action: AddIbcConnectionAction{ - ChainA: ChainID(consumerName), - ChainB: ChainID("provi"), - ClientA: 1, - ClientB: 1, - }, - State: State{}, - }, - { - Action: AddIbcChannelAction{ - ChainA: ChainID(consumerName), - ChainB: ChainID("provi"), - ConnectionA: 1, - PortA: "consumer", - PortB: "provider", - Order: "ordered", - }, - State: State{}, - }, - } - - return s -} - -// start sovereign chain with a single validator so it is easier to manage -// when the chain is converted to a consumer chain the validators from the -// consumer chain will be used -// validatoralice is the only validator on the sovereign chain that is in both -// sovereign validator set and consumer validator set -func stepRunSovereignChain() []Step { - return []Step{ - { - Action: StartSovereignChainAction{ - Chain: ChainID("sover"), - Validators: []StartChainValidator{ - {Id: ValidatorID("alice"), Stake: 500000000, Allocation: 10000000000}, - }, - }, - State: State{ - ChainID("sover"): ChainState{ - ValBalances: &map[ValidatorID]uint{ - ValidatorID("alice"): 9500000000, - }, - }, - }, - }, - { - Action: DelegateTokensAction{ - Chain: ChainID("sover"), - From: ValidatorID("alice"), - To: ValidatorID("alice"), - Amount: 11000000, - }, - State: State{ - ChainID("sover"): ChainState{ - ValPowers: &map[ValidatorID]uint{ - ValidatorID("alice"): 511, - ValidatorID("bob"): 0, // does not exist on pre-ccv sover - ValidatorID("carol"): 0, // does not exist on pre-ccv sover - }, - }, - }, - }, - } -} - -// TODO: use args instead of hardcoding -func stepsUpgradeChain() []Step { - return []Step{ - { - Action: UpgradeProposalAction{ - ChainID: ChainID("sover"), - UpgradeTitle: "sovereign-changeover", - Proposer: ValidatorID("alice"), - UpgradeHeight: 110, - Expedited: false, - }, - State: State{ - ChainID("sover"): ChainState{ - Proposals: &map[uint]Proposal{ - 1: UpgradeProposal{ - Title: "sovereign-changeover", - UpgradeHeight: 110, - Type: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", - Deposit: 10000000, - Status: gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD.String(), - }, - }, - }, - }, - }, - { - Action: VoteGovProposalAction{ - Chain: ChainID("sover"), - From: []ValidatorID{ValidatorID("alice")}, - Vote: []string{"yes"}, - PropNumber: 1, - }, - State: State{ - ChainID("sover"): ChainState{ - Proposals: &map[uint]Proposal{ - 1: UpgradeProposal{ - Deposit: 10000000, - UpgradeHeight: 110, - Title: "sovereign-changeover", - Type: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", - Status: gov.ProposalStatus_PROPOSAL_STATUS_PASSED.String(), - }, - }, - }, - }, - }, - { - Action: WaitUntilBlockAction{ - Chain: ChainID("sover"), - Block: 110, - }, - State: State{}, - }, - } -} - -// stepsPostChangeoverDelegate tests basic delegation and resulting validator power changes after changeover -// we cannot use stepsDelegate and stepsUnbond because they make assumptions about which connection to use -// here we need to use connection-1, and in tests with new consumers connection-0 is used because the chain is new (has no IBC states prior to launch) -func stepsPostChangeoverDelegate(consumerName string) []Step { - return []Step{ - { - Action: SendTokensAction{ - Chain: ChainID(consumerName), - From: ValidatorID("alice"), - To: ValidatorID("bob"), - Amount: 100, - }, - State: State{ - ChainID(consumerName): ChainState{ - // Tx should not go through, ICS channel is not setup until first VSC packet has been relayed to consumer - ValBalances: &map[ValidatorID]uint{ - ValidatorID("bob"): 0, - }, - }, - }, - }, - { - Action: DelegateTokensAction{ - Chain: ChainID("provi"), - From: ValidatorID("alice"), - To: ValidatorID("alice"), - Amount: 11000000, - }, - State: State{ - ChainID("provi"): ChainState{ - ValPowers: &map[ValidatorID]uint{ - ValidatorID("alice"): 511, - ValidatorID("bob"): 500, - ValidatorID("carol"): 500, - }, - }, - ChainID(consumerName): ChainState{ - ValPowers: &map[ValidatorID]uint{ - ValidatorID("alice"): 500, - ValidatorID("bob"): 500, - ValidatorID("carol"): 500, - }, - }, - }, - }, - { - Action: RelayPacketsAction{ - ChainA: ChainID("provi"), - ChainB: ChainID(consumerName), - Port: "provider", - Channel: 1, - }, - State: State{ - ChainID(consumerName): ChainState{ - ValPowers: &map[ValidatorID]uint{ - ValidatorID("alice"): 511, - ValidatorID("bob"): 500, - ValidatorID("carol"): 500, - }, - }, - }, - }, - { - Action: SendTokensAction{ - Chain: ChainID(consumerName), - From: ValidatorID("alice"), - To: ValidatorID("bob"), - Amount: 100, - }, - State: State{ - ChainID(consumerName): ChainState{ - // Tx should go through, ICS channel is setup - ValBalances: &map[ValidatorID]uint{ - ValidatorID("bob"): 100, - }, - }, - }, - }, - { - Action: UnbondTokensAction{ - Chain: ChainID("provi"), - UnbondFrom: ValidatorID("alice"), - Sender: ValidatorID("alice"), - Amount: 1000000, - }, - State: State{ - ChainID("provi"): ChainState{ - ValPowers: &map[ValidatorID]uint{ - ValidatorID("alice"): 510, - ValidatorID("bob"): 500, - ValidatorID("carol"): 500, - }, - }, - ChainID(consumerName): ChainState{ - ValPowers: &map[ValidatorID]uint{ - // Voting power on consumer should not be affected yet - ValidatorID("alice"): 511, - ValidatorID("bob"): 500, - ValidatorID("carol"): 500, - }, - }, - }, - }, - { - Action: RelayPacketsAction{ - ChainA: ChainID("provi"), - ChainB: ChainID(consumerName), - Port: "provider", - Channel: 1, - }, - State: State{ - ChainID(consumerName): ChainState{ - ValPowers: &map[ValidatorID]uint{ - ValidatorID("alice"): 510, - ValidatorID("bob"): 500, - ValidatorID("carol"): 500, - }, - }, - }, - }, - } -} diff --git a/tests/e2e/test_driver.go b/tests/e2e/test_driver.go index 3b918912ae..d3ed0be9e4 100644 --- a/tests/e2e/test_driver.go +++ b/tests/e2e/test_driver.go @@ -297,18 +297,6 @@ func (td *DefaultDriver) runAction(action interface{}) error { case StartChainAction: target := td.getTargetDriver(action.Chain) target.StartChain(action, td.verbose) - case StartSovereignChainAction: - target := td.getTargetDriver(action.Chain) - target.startSovereignChain(action, td.verbose) - case UpgradeProposalAction: - target := td.getTargetDriver(ChainID("sover")) - target.submitUpgradeProposal(action, td.verbose) - case WaitUntilBlockAction: - target := td.getTargetDriver(action.Chain) - target.waitUntilBlockOnChain(action) - case e2e.ChangeoverChainAction: - target := td.getTargetDriver("") - target.changeoverChain(action, td.verbose) case SendTokensAction: target := td.getTargetDriver(action.Chain) target.sendTokens(action, td.verbose) diff --git a/tests/e2e/testlib/types.go b/tests/e2e/testlib/types.go index f5fce3df09..6a290a2483 100644 --- a/tests/e2e/testlib/types.go +++ b/tests/e2e/testlib/types.go @@ -76,20 +76,6 @@ type StartConsumerChainAction struct { GenesisChanges string } -type ChangeoverChainAction struct { - SovereignChain ChainID - ProviderChain ChainID - Validators []StartChainValidator - GenesisChanges string -} - -type StartSovereignChainAction struct { - Chain ChainID - Validators []StartChainValidator - // Genesis changes specific to this action, appended to genesis changes defined in chain config - GenesisChanges string -} - type DelegateTokensAction struct { Chain ChainID From ValidatorID diff --git a/tests/e2e/testnet-scripts/sovereign-genesis.json b/tests/e2e/testnet-scripts/sovereign-genesis.json deleted file mode 100644 index bf7c881b1d..0000000000 --- a/tests/e2e/testnet-scripts/sovereign-genesis.json +++ /dev/null @@ -1,315 +0,0 @@ -{ - "genesis_time": "2023-06-22T15:55:00.982713586Z", - "chain_id": "sover", - "initial_height": "1", - "consensus_params": { - "block": { - "max_bytes": "22020096", - "max_gas": "-1" - }, - "evidence": { - "max_age_num_blocks": "100000", - "max_age_duration": "172800000000000", - "max_bytes": "1048576" - }, - "validator": { - "pub_key_types": [ - "ed25519" - ] - }, - "version": { - "app": "0" - } - }, - "app_hash": "", - "app_state": { - "07-tendermint": null, - "auth": { - "params": { - "max_memo_characters": "256", - "tx_sig_limit": "7", - "tx_size_cost_per_byte": "10", - "sig_verify_cost_ed25519": "590", - "sig_verify_cost_secp256k1": "1000" - }, - "accounts": [ - { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "address": "consumer19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddtz33vu", - "pub_key": null, - "account_number": "0", - "sequence": "0" - } - ] - }, - "authz": { - "authorization": [] - }, - "bank": { - "params": { - "send_enabled": [], - "default_send_enabled": true - }, - "balances": [ - { - "address": "consumer19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddtz33vu", - "coins": [ - { - "denom": "stake", - "amount": "10000000000" - } - ] - } - ], - "supply": [ - { - "denom": "stake", - "amount": "10000000000" - } - ], - "denom_metadata": [], - "send_enabled": [] - }, - "capability": { - "index": "1", - "owners": [] - }, - "crisis": { - "constant_fee": { - "denom": "stake", - "amount": "1000" - } - }, - "distribution": { - "params": { - "community_tax": "0.020000000000000000", - "base_proposer_reward": "0.000000000000000000", - "bonus_proposer_reward": "0.000000000000000000", - "withdraw_addr_enabled": true - }, - "fee_pool": { - "community_pool": [] - }, - "delegator_withdraw_infos": [], - "previous_proposer": "", - "outstanding_rewards": [], - "validator_accumulated_commissions": [], - "validator_historical_rewards": [], - "validator_current_rewards": [], - "delegator_starting_infos": [], - "validator_slash_events": [] - }, - "evidence": { - "evidence": [] - }, - "feegrant": { - "allowances": [] - }, - "genutil": { - "gen_txs": [ - { - "body": { - "messages": [ - { - "@type": "/cosmos.staking.v1beta1.MsgCreateValidator", - "description": { - "moniker": "validatoralice", - "identity": "", - "website": "", - "security_contact": "", - "details": "" - }, - "commission": { - "rate": "0.100000000000000000", - "max_rate": "0.200000000000000000", - "max_change_rate": "0.010000000000000000" - }, - "min_self_delegation": "1", - "delegator_address": "consumer19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddtz33vu", - "validator_address": "consumervaloper19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddy6jwzg", - "pubkey": { - "@type": "/cosmos.crypto.ed25519.PubKey", - "key": "RrclQz9bIhkIy/gfL485g3PYMeiIku4qeo495787X10=" - }, - "value": { - "denom": "stake", - "amount": "500000000" - } - } - ], - "memo": "8339e14baab81c2a2350e261962263397a8d7fb0@7.7.7.254:26656", - "timeout_height": "0", - "extension_options": [], - "non_critical_extension_options": [] - }, - "auth_info": { - "signer_infos": [ - { - "public_key": { - "@type": "/cosmos.crypto.secp256k1.PubKey", - "key": "AsFC8tmbGGQSHthsVStbsQ13/+Yza9IT8KCSXXEN7y9f" - }, - "mode_info": { - "single": { - "mode": "SIGN_MODE_DIRECT" - } - }, - "sequence": "0" - } - ], - "fee": { - "amount": [], - "gas_limit": "200000", - "payer": "", - "granter": "" - }, - "tip": null - }, - "signatures": [ - "AZROMEeaBL9cDOWQJYYdAG3KDl+w37SK0XP88ecS+WwQQLj8rXuEKNDl1PXpZR0AFIJ8coSwhFEtbpV44j6uVQ==" - ] - } - ] - }, - "gov": { - "starting_proposal_id": "1", - "deposits": [], - "votes": [], - "proposals": [], - "deposit_params": null, - "voting_params": null, - "tally_params": null, - "params": { - "min_deposit": [ - { - "denom": "stake", - "amount": "10000000" - } - ], - "max_deposit_period": "172800s", - "voting_period": "20s", - "quorum": "0.334000000000000000", - "threshold": "0.500000000000000000", - "veto_threshold": "0.334000000000000000", - "min_initial_deposit_ratio": "0.000000000000000000", - "proposal_cancel_ratio": "0.500000000000000000", - "proposal_cancel_dest": "", - "expedited_voting_period": "10s", - "expedited_threshold": "0.667000000000000000", - "expedited_min_deposit": [ - { - "denom": "stake", - "amount": "50000000" - } - ], - "burn_vote_quorum": false, - "burn_proposal_deposit_prevote": false, - "burn_vote_veto": true, - "min_deposit_ratio": "0.010000000000000000" - } - }, - "ibc": { - "client_genesis": { - "clients": [], - "clients_consensus": [], - "clients_metadata": [], - "params": { - "allowed_clients": [ - "06-solomachine", - "07-tendermint", - "09-localhost" - ] - }, - "create_localhost": false, - "next_client_sequence": "0" - }, - "connection_genesis": { - "connections": [], - "client_connection_paths": [], - "next_connection_sequence": "0", - "params": { - "max_expected_time_per_block": "30000000000" - } - }, - "channel_genesis": { - "channels": [], - "acknowledgements": [], - "commitments": [], - "receipts": [], - "send_sequences": [], - "recv_sequences": [], - "ack_sequences": [], - "next_channel_sequence": "0", - "params": { - "upgrade_timeout": { - "height": { - "revision_number": "0", - "revision_height": "0" - }, - "timestamp": "600000000000" - } - } - } - }, - "mint": { - "minter": { - "inflation": "0.130000000000000000", - "annual_provisions": "0.000000000000000000" - }, - "params": { - "mint_denom": "stake", - "inflation_rate_change": "0.130000000000000000", - "inflation_max": "0.200000000000000000", - "inflation_min": "0.070000000000000000", - "goal_bonded": "0.670000000000000000", - "blocks_per_year": "6311520" - } - }, - "params": null, - "provider": { - "params": { - "slash_meter_replenish_fraction": "1.0", - "slash_meter_replenish_period": "3s" - } - }, - "slashing": { - "params": { - "signed_blocks_window": "10", - "min_signed_per_window": "0.500000000000000000", - "downtime_jail_duration": "60s", - "slash_fraction_double_sign": "0.050000000000000000", - "slash_fraction_downtime": "0.010000000000000000" - }, - "signing_infos": [], - "missed_blocks": [] - }, - "staking": { - "params": { - "unbonding_time": "1814400s", - "max_validators": 100, - "max_entries": 7, - "historical_entries": 10000, - "bond_denom": "stake", - "min_commission_rate": "0.000000000000000000" - }, - "last_total_power": "0", - "last_validator_powers": [], - "validators": [], - "delegations": [], - "unbonding_delegations": [], - "redelegations": [], - "exported": false - }, - "transfer": { - "port_id": "transfer", - "denom_traces": [], - "params": { - "send_enabled": true, - "receive_enabled": true - }, - "total_escrowed": [] - }, - "upgrade": {}, - "vesting": {} - } -} \ No newline at end of file diff --git a/tests/e2e/testnet-scripts/start-changeover.sh b/tests/e2e/testnet-scripts/start-changeover.sh deleted file mode 100644 index 6a134ac4dc..0000000000 --- a/tests/e2e/testnet-scripts/start-changeover.sh +++ /dev/null @@ -1,189 +0,0 @@ -#!/bin/bash -set -eux - -# The gaiad binary -BIN=$1 - -# JSON array of validator information -# [{ -# mnemonic: "crackle snap pop ... etc", -# allocation: "10000000000stake,10000000000footoken", -# stake: "5000000000stake", -# val_id: "alice", -# ip_suffix: "1", -# priv_validator_key: "{\"address\": \"3566F464673B2F069758DAE86FC25D04017BB147\",\"pub_key\": {\"type\": \"tendermint/PubKeyEd25519\",\"value\": \"XrLjKdc4mB2gfqplvnoySjSJq2E90RynUwaO3WhJutk=\"},\"priv_key\": {\"type\": \"tendermint/PrivKeyEd25519\",\"value\": \"czGSLs/Ocau8aJ5J5zQHMxf3d7NR0xjMECN6YGTIWqtesuMp1ziYHaB+qmW+ejJKNImrYT3RHKdTBo7daEm62Q==\"}}" -# node_key: "{\"priv_key\":{\"type\":\"tendermint/PrivKeyEd25519\",\"value\":\"alIHj6hXnzpLAadgb7+E2eeecwxoNdzuZrfhMX36EaD5/LgzL0ZUoVp7AK3np0K5T35JWLLv0jJKmeRIhG0GjA==\"}}" -# }, ... ] -VALIDATORS=$2 - -# The chain ID -CHAIN_ID=$3 - -# This is the first 3 fields of the IP addresses which will be used internally by the validators of this blockchain -# Recommended to use something starting with 7, since it is squatted by the DoD and is unroutable on the internet -# For example: "7.7.7" -CHAIN_IP_PREFIX=$4 - -# A transformation to apply to the genesis file, as a jq string -GENESIS_TRANSFORM=$5 - -# A sed string modifying the tendermint config -TENDERMINT_CONFIG_TRANSFORM=$6 - - -# CREATE VALIDATORS AND DO GENESIS CEREMONY -# !!!!!!!!!!!!!! IMPORTANT !!!!!!!!!!!!!!!! # -# data dir from the sovereign chain is copied to other nodes (namely bob and carol) -# alice simply performs a chain upgrade -echo "killing nodes" -pkill -f "^"interchain-security-sd &> /dev/null || true - -# Get number of nodes from length of validators array -NODES=$(echo "$VALIDATORS" | jq '. | length') - -for i in $(seq 0 $(($NODES - 1))); -do - VAL_ID=$(echo "$VALIDATORS" | jq -r ".[$i].val_id") - mkdir -p /$CHAIN_ID/validator$VAL_ID/.sovereign/config - # apply genesis changes to existing genesis -> this creates the changeover genesis file with initial validator set - jq "$GENESIS_TRANSFORM" /sover/validatoralice/config/genesis.json > /$CHAIN_ID/validator$VAL_ID/.sovereign/config/genesis.json -done - -# SETUP NETWORK NAMESPACES, see: https://adil.medium.com/container-networking-under-the-hood-network-namespaces-6b2b8fe8dc2a - -# Create virtual bridge device (acts like a switch) -ip link add name virtual-bridge type bridge || true - -for i in $(seq 0 $(($NODES - 1))); -do - # first validator is already setup - if [[ "$i" -ne 0 ]]; then - VAL_ID=$(echo "$VALIDATORS" | jq -r ".[$i].val_id") - VAL_IP_SUFFIX=$(echo "$VALIDATORS" | jq -r ".[$i].ip_suffix") - NET_NAMESPACE_NAME="$CHAIN_ID-$VAL_ID" - IP_ADDR="$CHAIN_IP_PREFIX.$VAL_IP_SUFFIX/24" - - # Create network namespace - ip netns add $NET_NAMESPACE_NAME - # Create virtual ethernet device to connect with bridge - ip link add $NET_NAMESPACE_NAME-in type veth peer name $NET_NAMESPACE_NAME-out - # Connect input end of virtual ethernet device to namespace - ip link set $NET_NAMESPACE_NAME-in netns $NET_NAMESPACE_NAME - # Assign ip address to namespace - ip netns exec $NET_NAMESPACE_NAME ip addr add $IP_ADDR dev $NET_NAMESPACE_NAME-in - # Connect output end of virtual ethernet device to bridge - ip link set $NET_NAMESPACE_NAME-out master virtual-bridge - fi -done - -# Enable bridge interface -ip link set virtual-bridge up - -for i in $(seq 0 $(($NODES - 1))); -do - # first validator is already setup - if [[ "$i" -ne 0 ]]; then - VAL_ID=$(echo "$VALIDATORS" | jq -r ".[$i].val_id") - NET_NAMESPACE_NAME="$CHAIN_ID-$VAL_ID" - - # Enable in/out interfaces for the namespace - ip link set $NET_NAMESPACE_NAME-out up - ip netns exec $NET_NAMESPACE_NAME ip link set dev $NET_NAMESPACE_NAME-in up - # Enable loopback device - ip netns exec $NET_NAMESPACE_NAME ip link set dev lo up - fi -done - -# Assign IP for bridge, to route between default network namespace and bridge -# BRIDGE_IP="$CHAIN_IP_PREFIX.254/24" -# ip addr add $BRIDGE_IP dev virtual-bridge - - -# HANDLE VALIDATOR HOMES, COPY OLD DATA FOLDER -for i in $(seq 0 $(($NODES - 1))); -do - # first validator is already setup - if [[ "$i" -ne 0 ]]; then - VAL_ID=$(echo "$VALIDATORS" | jq -r ".[$i].val_id") - echo "$VALIDATORS" | jq -r ".[$i].mnemonic" | $BIN keys add validator$VAL_ID \ - --home /$CHAIN_ID/validator$VAL_ID \ - --keyring-backend test \ - --recover > /dev/null - - # Copy in the genesis.json - cp /sover/validatoralice/config/genesis.json /$CHAIN_ID/validator$VAL_ID/config/genesis.json - cp -r /sover/validatoralice/data /$CHAIN_ID/validator$VAL_ID/ - - # Copy in validator state file - # echo '{"height": "0","round": 0,"step": 0}' > /$CHAIN_ID/validator$VAL_ID/data/priv_validator_state.json - - - PRIV_VALIDATOR_KEY=$(echo "$VALIDATORS" | jq -r ".[$i].priv_validator_key") - if [[ "$PRIV_VALIDATOR_KEY" ]]; then - echo "$PRIV_VALIDATOR_KEY" > /$CHAIN_ID/validator$VAL_ID/config/priv_validator_key.json - fi - - NODE_KEY=$(echo "$VALIDATORS" | jq -r ".[$i].node_key") - if [[ "$NODE_KEY" ]]; then - echo "$NODE_KEY" > /$CHAIN_ID/validator$VAL_ID/config/node_key.json - fi - - # Modify tendermint configs of validator - if [ "$TENDERMINT_CONFIG_TRANSFORM" != "" ] ; then - #'s/foo/bar/;s/abc/def/' - sed -i "$TENDERMINT_CONFIG_TRANSFORM" $CHAIN_ID/validator$VAL_ID/config/config.toml - fi - fi -done - - -# START VALIDATOR NODES -> this will perform the sovereign upgrade and start the chain -# ALICE is a validator on the sovereign and also the validator on the consumer chain -# BOB, CAROL are not validators on the sovereign, they will become validator once the chain switches to the consumer chain -echo "Starting validator nodes..." -for i in $(seq 0 $(($NODES - 1))); -do - VAL_ID=$(echo "$VALIDATORS" | jq -r ".[$i].val_id") - VAL_IP_SUFFIX=$(echo "$VALIDATORS" | jq -r ".[$i].ip_suffix") - NET_NAMESPACE_NAME="$CHAIN_ID-$VAL_ID" - - GAIA_HOME="--home /$CHAIN_ID/validator$VAL_ID" - RPC_ADDRESS="--rpc.laddr tcp://$CHAIN_IP_PREFIX.$VAL_IP_SUFFIX:26658" - GRPC_ADDRESS="--grpc.address $CHAIN_IP_PREFIX.$VAL_IP_SUFFIX:9091" - LISTEN_ADDRESS="--address tcp://$CHAIN_IP_PREFIX.$VAL_IP_SUFFIX:26655" - P2P_ADDRESS="--p2p.laddr tcp://$CHAIN_IP_PREFIX.$VAL_IP_SUFFIX:26656" - # LOG_LEVEL="--log_level trace" # switch to trace to see panic messages and rich and all debug msgs - LOG_LEVEL="--log_level info" - ENABLE_WEBGRPC="--grpc-web.enable=false" - - PERSISTENT_PEERS="" - - for j in $(seq 0 $(($NODES - 1))); - do - if [ $i -ne $j ]; then - PEER_VAL_ID=$(echo "$VALIDATORS" | jq -r ".[$j].val_id") - PEER_VAL_IP_SUFFIX=$(echo "$VALIDATORS" | jq -r ".[$j].ip_suffix") - NODE_ID=$($BIN tendermint show-node-id --home /$CHAIN_ID/validator$PEER_VAL_ID) - ADDRESS="$NODE_ID@$CHAIN_IP_PREFIX.$PEER_VAL_IP_SUFFIX:26656" - # (jq -r '.body.memo' /$CHAIN_ID/validator$j/config/gentx/*) # Getting the address from the gentx should also work - PERSISTENT_PEERS="$PERSISTENT_PEERS,$ADDRESS" - fi - done - - # Remove leading comma and concat to flag - PERSISTENT_PEERS="--p2p.persistent_peers ${PERSISTENT_PEERS:1}" - - ARGS="$GAIA_HOME $LISTEN_ADDRESS $RPC_ADDRESS $GRPC_ADDRESS $LOG_LEVEL $P2P_ADDRESS $ENABLE_WEBGRPC $PERSISTENT_PEERS" - ip netns exec $NET_NAMESPACE_NAME $BIN $ARGS start &> /$CHAIN_ID/validator$VAL_ID/logs & -done - -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 --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!!!!!!!!" - -read -p "Press Return to Close..." diff --git a/tests/e2e/testnet-scripts/start-sovereign.sh b/tests/e2e/testnet-scripts/start-sovereign.sh deleted file mode 100644 index 54e14dfcf3..0000000000 --- a/tests/e2e/testnet-scripts/start-sovereign.sh +++ /dev/null @@ -1,133 +0,0 @@ -#!/bin/bash -set -eux - -# The gaiad binary -BIN=$1 - -# JSON array of validator information -# [{ -# mnemonic: "crackle snap pop ... etc", -# allocation: "10000000000stake,10000000000footoken", -# stake: "5000000000stake", -# val_id: "alice", -# ip_suffix: "1", -# priv_validator_key: "{\"address\": \"3566F464673B2F069758DAE86FC25D04017BB147\",\"pub_key\": {\"type\": \"tendermint/PubKeyEd25519\",\"value\": \"XrLjKdc4mB2gfqplvnoySjSJq2E90RynUwaO3WhJutk=\"},\"priv_key\": {\"type\": \"tendermint/PrivKeyEd25519\",\"value\": \"czGSLs/Ocau8aJ5J5zQHMxf3d7NR0xjMECN6YGTIWqtesuMp1ziYHaB+qmW+ejJKNImrYT3RHKdTBo7daEm62Q==\"}}" -# node_key: "{\"priv_key\":{\"type\":\"tendermint/PrivKeyEd25519\",\"value\":\"alIHj6hXnzpLAadgb7+E2eeecwxoNdzuZrfhMX36EaD5/LgzL0ZUoVp7AK3np0K5T35JWLLv0jJKmeRIhG0GjA==\"}}" -# }, ... ] -VALIDATORS=$2 - -# The chain ID -CHAIN_ID=$3 - -# This is the first 3 fields of the IP addresses which will be used internally by the validators of this blockchain -# Recommended to use something starting with 7, since it is squatted by the DoD and is unroutable on the internet -# For example: "7.7.7" -CHAIN_IP_PREFIX=$4 - -# A transformation to apply to the genesis file, as a jq string -GENESIS_TRANSFORM=$5 - -# A sed string modifying the tendermint config -TENDERMINT_CONFIG_TRANSFORM=$6 - -# SETUP NETWORK NAMESPACES, see: https://adil.medium.com/container-networking-under-the-hood-network-namespaces-6b2b8fe8dc2a - -# Create virtual bridge device (acts like a switch) -ip link add name virtual-bridge type bridge || true - -# used globally in the whole script -VAL_ID=$(echo "$VALIDATORS" | jq -r ".[0].val_id") -VAL_IP_SUFFIX=$(echo "$VALIDATORS" | jq -r ".[0].ip_suffix") -NET_NAMESPACE_NAME="$CHAIN_ID-$VAL_ID" -IP_ADDR="$CHAIN_IP_PREFIX.$VAL_IP_SUFFIX/24" - -# Create network namespace -ip netns add $NET_NAMESPACE_NAME -# Create virtual ethernet device to connect with bridge -ip link add $NET_NAMESPACE_NAME-in type veth peer name $NET_NAMESPACE_NAME-out -# Connect input end of virtual ethernet device to namespace -ip link set $NET_NAMESPACE_NAME-in netns $NET_NAMESPACE_NAME -# Assign ip address to namespace -ip netns exec $NET_NAMESPACE_NAME ip addr add $IP_ADDR dev $NET_NAMESPACE_NAME-in -# Connect output end of virtual ethernet device to bridge -ip link set $NET_NAMESPACE_NAME-out master virtual-bridge - -# Enable bridge interface -ip link set virtual-bridge up - -NET_NAMESPACE_NAME="$CHAIN_ID-$VAL_ID" -# Enable in/out interfaces for the namespace -ip link set $NET_NAMESPACE_NAME-out up -ip netns exec $NET_NAMESPACE_NAME ip link set dev $NET_NAMESPACE_NAME-in up -# Enable loopback device -ip netns exec $NET_NAMESPACE_NAME ip link set dev lo up - -# Assign IP for bridge, to route between default network namespace and bridge -BRIDGE_IP="$CHAIN_IP_PREFIX.254/24" -ip addr add $BRIDGE_IP dev virtual-bridge - -# first we start a genesis.json with the first validator -# the first validator will also collect the gentx's once generated -echo "$VALIDATORS" | jq -r ".[0].mnemonic" | $BIN init --home /$CHAIN_ID/validator$VAL_ID --chain-id=$CHAIN_ID validator$VAL_ID --recover > /dev/null - -# !!!!!!!!! IMPORTANT !!!!!!!!! # -# move the sovereign genesis to the correct validator home dir -cp /testnet-scripts/sovereign-genesis.json /$CHAIN_ID/validator$VAL_ID/config/genesis.json - -# Apply jq transformations to genesis file -jq "$GENESIS_TRANSFORM" /$CHAIN_ID/validator$VAL_ID/config/genesis.json > /$CHAIN_ID/edited-genesis.json -mv /$CHAIN_ID/edited-genesis.json /$CHAIN_ID/genesis.json -cp /$CHAIN_ID/genesis.json /$CHAIN_ID/validator$VAL_ID/config/genesis.json - - - -# SETUP LOCAL VALIDATOR STATE -echo '{"height": "0","round": 0,"step": 0}' > /$CHAIN_ID/validator$VAL_ID/data/priv_validator_state.json - -PRIV_VALIDATOR_KEY=$(echo "$VALIDATORS" | jq -r ".[0].priv_validator_key") -if [[ "$PRIV_VALIDATOR_KEY" ]]; then - echo "$PRIV_VALIDATOR_KEY" > /$CHAIN_ID/validator$VAL_ID/config/priv_validator_key.json -fi - -NODE_KEY=$(echo "$VALIDATORS" | jq -r ".[0].node_key") -if [[ "$NODE_KEY" ]]; then - echo "$NODE_KEY" > /$CHAIN_ID/validator$VAL_ID/config/node_key.json -fi - -echo "$VALIDATORS" | jq -r ".[0].mnemonic" | $BIN keys add validator$VAL_ID \ ---home /$CHAIN_ID/validator$VAL_ID \ ---keyring-backend test \ ---recover > /dev/null - -# Modify tendermint configs of validator -if [ "$TENDERMINT_CONFIG_TRANSFORM" != "" ] ; then - #'s/foo/bar/;s/abc/def/' - sed -i "$TENDERMINT_CONFIG_TRANSFORM" $CHAIN_ID/validator$VAL_ID/config/config.toml -fi - - -# START VALIDATOR NODE -VAL_IP_SUFFIX=$(echo "$VALIDATORS" | jq -r ".[0].ip_suffix") -NET_NAMESPACE_NAME="$CHAIN_ID-$VAL_ID" - -GAIA_HOME="--home /$CHAIN_ID/validator$VAL_ID" -RPC_ADDRESS="--rpc.laddr tcp://$CHAIN_IP_PREFIX.$VAL_IP_SUFFIX:26658" -GRPC_ADDRESS="--grpc.address $CHAIN_IP_PREFIX.$VAL_IP_SUFFIX:9091" -LISTEN_ADDRESS="--address tcp://$CHAIN_IP_PREFIX.$VAL_IP_SUFFIX:26655" -P2P_ADDRESS="--p2p.laddr tcp://$CHAIN_IP_PREFIX.$VAL_IP_SUFFIX:26656" -# LOG_LEVEL="--log_level trace" # switch to trace to see panic messages and rich and all debug msgs -LOG_LEVEL="--log_level info" -ENABLE_WEBGRPC="--grpc-web.enable=false" - -ARGS="$GAIA_HOME $LISTEN_ADDRESS $RPC_ADDRESS $GRPC_ADDRESS $LOG_LEVEL $P2P_ADDRESS $ENABLE_WEBGRPC" -ip netns exec $NET_NAMESPACE_NAME $BIN $ARGS start &> /$CHAIN_ID/validator$VAL_ID/logs & - - -# poll for chain start -set +e -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!!!!!!!!" - -read -p "Press Return to Close..." \ No newline at end of file diff --git a/tests/e2e/trace_handlers_test.go b/tests/e2e/trace_handlers_test.go index fe15656545..77e5d83814 100644 --- a/tests/e2e/trace_handlers_test.go +++ b/tests/e2e/trace_handlers_test.go @@ -51,7 +51,6 @@ func TestWriterThenParser(t *testing.T) { "multipleConsumers": {multipleConsumers}, "shorthappy": {shortHappyPathSteps}, "democracyRewardsSteps": {democracyRegisteredDenomSteps}, - "changeover": {changeoverSteps}, } dir, err := os.MkdirTemp("", "example") @@ -82,7 +81,6 @@ func TestWriteExamples(t *testing.T) { "multipleConsumers": {multipleConsumers}, "shorthappy": {shortHappyPathSteps}, "democracyRewardsSteps": {democracyRegisteredDenomSteps}, - "changeover": {changeoverSteps}, "consumer-misbehaviour": {consumerMisbehaviourSteps}, "consumer-double-sign": {consumerDoubleSignSteps}, } diff --git a/tests/e2e/tracehandler_testdata/changeover.json b/tests/e2e/tracehandler_testdata/changeover.json deleted file mode 100644 index af1f68a91a..0000000000 --- a/tests/e2e/tracehandler_testdata/changeover.json +++ /dev/null @@ -1,659 +0,0 @@ -[ - { - "ActionType": "main.StartSovereignChainAction", - "Action": { - "Chain": "sover", - "Validators": [ - { - "Id": "alice", - "Allocation": 10000000000, - "Stake": 500000000 - } - ], - "GenesisChanges": "" - }, - "State": { - "sover": { - "ValBalances": { - "alice": 9500000000 - }, - "ProposedConsumerChains": null, - "ValPowers": null, - "StakedTokens": null, - "IBCTransferParams": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerPendingPacketQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "ClientsFrozenHeights": null, - "HasToValidate": null, - "Proposals": null - } - } - }, - { - "ActionType": "main.DelegateTokensAction", - "Action": { - "Chain": "sover", - "From": "alice", - "To": "alice", - "Amount": 11000000 - }, - "State": { - "sover": { - "ValBalances": null, - "ProposedConsumerChains": null, - "ValPowers": { - "alice": 511, - "bob": 0, - "carol": 0 - }, - "StakedTokens": null, - "IBCTransferParams": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerPendingPacketQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "ClientsFrozenHeights": null, - "HasToValidate": null, - "Proposals": null - } - } - }, - { - "ActionType": "main.StartChainAction", - "Action": { - "Chain": "provi", - "Validators": [ - { - "Id": "bob", - "Allocation": 10000000000, - "Stake": 500000000 - }, - { - "Id": "alice", - "Allocation": 10000000000, - "Stake": 500000000 - }, - { - "Id": "carol", - "Allocation": 10000000000, - "Stake": 500000000 - } - ], - "GenesisChanges": "", - "IsConsumer": false - }, - "State": { - "provi": { - "ValBalances": { - "alice": 9500000000, - "bob": 9500000000, - "carol": 9500000000 - }, - "ProposedConsumerChains": null, - "ValPowers": null, - "StakedTokens": null, - "IBCTransferParams": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerPendingPacketQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "ClientsFrozenHeights": null, - "HasToValidate": null, - "Proposals": null - } - } - }, - { - "ActionType": "main.CreateIbcClientsAction", - "Action": { - "ChainA": "sover", - "ChainB": "provi" - }, - "State": {} - }, - { - "ActionType": "main.AddIbcChannelAction", - "Action": { - "ChainA": "sover", - "ChainB": "provi", - "ConnectionA": 0, - "PortA": "transfer", - "PortB": "transfer", - "Order": "unordered", - "Version": "ics20-1" - }, - "State": {} - }, - { - "ActionType": "main.LegacyUpgradeProposalAction", - "Action": { - "ChainID": "sover", - "UpgradeTitle": "sovereign-changeover", - "Proposer": "alice", - "UpgradeHeight": 110 - }, - "State": { - "sover": { - "ValBalances": null, - "ProposedConsumerChains": null, - "ValPowers": null, - "StakedTokens": null, - "IBCTransferParams": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerPendingPacketQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "ClientsFrozenHeights": null, - "HasToValidate": null, - "Proposals": { - "1": { - "RawProposal": { - "Title": "sovereign-changeover", - "Description": "", - "UpgradeHeight": 110, - "Type": "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", - "Deposit": 10000000, - "Status": "2" - }, - "Type": "e2e.UpgradeProposal" - } - } - } - } - }, - { - "ActionType": "main.VoteGovProposalAction", - "Action": { - "Chain": "sover", - "From": [ - "alice" - ], - "Vote": [ - "yes" - ], - "PropNumber": 1 - }, - "State": { - "sover": { - "ValBalances": null, - "ProposedConsumerChains": null, - "ValPowers": null, - "StakedTokens": null, - "IBCTransferParams": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerPendingPacketQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "ClientsFrozenHeights": null, - "HasToValidate": null, - "Proposals": { - "1": { - "RawProposal": { - "Title": "sovereign-changeover", - "Description": "", - "UpgradeHeight": 110, - "Type": "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", - "Deposit": 10000000, - "Status": "3" - }, - "Type": "e2e.UpgradeProposal" - } - } - } - } - }, - { - "ActionType": "main.WaitUntilBlockAction", - "Action": { - "Block": 110, - "Chain": "sover" - }, - "State": {} - }, - { - "ActionType": "main.SubmitConsumerAdditionProposalAction", - "Action": { - "PreCCV": true, - "Chain": "provi", - "From": "alice", - "Deposit": 10000001, - "ConsumerChain": "sover", - "SpawnTime": 0, - "InitialHeight": { - "revision_height": 111 - }, - "DistributionChannel": "channel-0", - "TopN": 100, - "ValidatorsPowerCap": 0, - "ValidatorSetCap": 0, - "Allowlist": null, - "Denylist": null - }, - "State": { - "provi": { - "ValBalances": { - "alice": 9489999999, - "bob": 9500000000 - }, - "ProposedConsumerChains": null, - "ValPowers": null, - "StakedTokens": null, - "IBCTransferParams": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerPendingPacketQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "ClientsFrozenHeights": null, - "HasToValidate": null, - "Proposals": { - "1": { - "RawProposal": { - "Deposit": 10000001, - "Chain": "sover", - "SpawnTime": 0, - "InitialHeight": { - "revision_height": 111 - }, - "Status": "2" - }, - "Type": "e2e.ConsumerAdditionProposal" - } - } - } - } - }, - { - "ActionType": "main.VoteGovProposalAction", - "Action": { - "Chain": "provi", - "From": [ - "alice", - "bob", - "carol" - ], - "Vote": [ - "yes", - "yes", - "yes" - ], - "PropNumber": 1 - }, - "State": { - "provi": { - "ValBalances": { - "alice": 9500000000, - "bob": 9500000000 - }, - "ProposedConsumerChains": null, - "ValPowers": null, - "StakedTokens": null, - "IBCTransferParams": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerPendingPacketQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "ClientsFrozenHeights": null, - "HasToValidate": null, - "Proposals": { - "1": { - "RawProposal": { - "Deposit": 10000001, - "Chain": "sover", - "SpawnTime": 0, - "InitialHeight": { - "revision_height": 111 - }, - "Status": "3" - }, - "Type": "e2e.ConsumerAdditionProposal" - } - } - } - } - }, - { - "ActionType": "main.ChangeoverChainAction", - "Action": { - "SovereignChain": "sover", - "ProviderChain": "provi", - "Validators": [ - { - "Id": "alice", - "Allocation": 10000000000, - "Stake": 500000000 - }, - { - "Id": "bob", - "Allocation": 10000000000, - "Stake": 500000000 - }, - { - "Id": "carol", - "Allocation": 10000000000, - "Stake": 500000000 - } - ], - "GenesisChanges": "" - }, - "State": { - "provi": { - "ValBalances": null, - "ProposedConsumerChains": null, - "ValPowers": { - "alice": 500, - "bob": 500, - "carol": 500 - }, - "StakedTokens": null, - "IBCTransferParams": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerPendingPacketQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "ClientsFrozenHeights": null, - "HasToValidate": null, - "Proposals": null - }, - "sover": { - "ValBalances": null, - "ProposedConsumerChains": null, - "ValPowers": { - "alice": 500, - "bob": 500, - "carol": 500 - }, - "StakedTokens": null, - "IBCTransferParams": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerPendingPacketQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "ClientsFrozenHeights": null, - "HasToValidate": null, - "Proposals": null - } - } - }, - { - "ActionType": "main.AddIbcConnectionAction", - "Action": { - "ChainA": "sover", - "ChainB": "provi", - "ClientA": 1, - "ClientB": 1 - }, - "State": {} - }, - { - "ActionType": "main.AddIbcChannelAction", - "Action": { - "ChainA": "sover", - "ChainB": "provi", - "ConnectionA": 1, - "PortA": "consumer", - "PortB": "provider", - "Order": "ordered", - "Version": "" - }, - "State": {} - }, - { - "ActionType": "main.SendTokensAction", - "Action": { - "Chain": "sover", - "From": "alice", - "To": "bob", - "Amount": 100 - }, - "State": { - "sover": { - "ValBalances": { - "bob": 0 - }, - "ProposedConsumerChains": null, - "ValPowers": null, - "StakedTokens": null, - "IBCTransferParams": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerPendingPacketQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "ClientsFrozenHeights": null, - "HasToValidate": null, - "Proposals": null - } - } - }, - { - "ActionType": "main.DelegateTokensAction", - "Action": { - "Chain": "provi", - "From": "alice", - "To": "alice", - "Amount": 11000000 - }, - "State": { - "provi": { - "ValBalances": null, - "ProposedConsumerChains": null, - "ValPowers": { - "alice": 511, - "bob": 500, - "carol": 500 - }, - "StakedTokens": null, - "IBCTransferParams": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerPendingPacketQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "ClientsFrozenHeights": null, - "HasToValidate": null, - "Proposals": null - }, - "sover": { - "ValBalances": null, - "ProposedConsumerChains": null, - "ValPowers": { - "alice": 500, - "bob": 500, - "carol": 500 - }, - "StakedTokens": null, - "IBCTransferParams": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerPendingPacketQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "ClientsFrozenHeights": null, - "HasToValidate": null, - "Proposals": null - } - } - }, - { - "ActionType": "main.RelayPacketsAction", - "Action": { - "ChainA": "provi", - "ChainB": "sover", - "Port": "provider", - "Channel": 1 - }, - "State": { - "sover": { - "ValBalances": null, - "ProposedConsumerChains": null, - "ValPowers": { - "alice": 511, - "bob": 500, - "carol": 500 - }, - "StakedTokens": null, - "IBCTransferParams": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerPendingPacketQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "ClientsFrozenHeights": null, - "HasToValidate": null, - "Proposals": null - } - } - }, - { - "ActionType": "main.SendTokensAction", - "Action": { - "Chain": "sover", - "From": "alice", - "To": "bob", - "Amount": 100 - }, - "State": { - "sover": { - "ValBalances": { - "bob": 100 - }, - "ProposedConsumerChains": null, - "ValPowers": null, - "StakedTokens": null, - "IBCTransferParams": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerPendingPacketQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "ClientsFrozenHeights": null, - "HasToValidate": null, - "Proposals": null - } - } - }, - { - "ActionType": "main.UnbondTokensAction", - "Action": { - "Chain": "provi", - "Sender": "alice", - "UnbondFrom": "alice", - "Amount": 1000000 - }, - "State": { - "provi": { - "ValBalances": null, - "ProposedConsumerChains": null, - "ValPowers": { - "alice": 510, - "bob": 500, - "carol": 500 - }, - "StakedTokens": null, - "IBCTransferParams": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerPendingPacketQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "ClientsFrozenHeights": null, - "HasToValidate": null, - "Proposals": null - }, - "sover": { - "ValBalances": null, - "ProposedConsumerChains": null, - "ValPowers": { - "alice": 511, - "bob": 500, - "carol": 500 - }, - "StakedTokens": null, - "IBCTransferParams": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerPendingPacketQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "ClientsFrozenHeights": null, - "HasToValidate": null, - "Proposals": null - } - } - }, - { - "ActionType": "main.RelayPacketsAction", - "Action": { - "ChainA": "provi", - "ChainB": "sover", - "Port": "provider", - "Channel": 1 - }, - "State": { - "sover": { - "ValBalances": null, - "ProposedConsumerChains": null, - "ValPowers": { - "alice": 510, - "bob": 500, - "carol": 500 - }, - "StakedTokens": null, - "IBCTransferParams": null, - "Params": null, - "Rewards": null, - "ConsumerChains": null, - "AssignedKeys": null, - "ProviderKeys": null, - "ConsumerPendingPacketQueueSize": null, - "RegisteredConsumerRewardDenoms": null, - "ClientsFrozenHeights": null, - "HasToValidate": null, - "Proposals": null - } - } - } -] \ No newline at end of file diff --git a/tests/e2e/v5/actions.go b/tests/e2e/v5/actions.go index 8dd3a5f1ce..fa206eddaa 100644 --- a/tests/e2e/v5/actions.go +++ b/tests/e2e/v5/actions.go @@ -43,10 +43,8 @@ type ( StartChainAction = e2e.StartChainAction StartChainValidator = e2e.StartChainValidator StartConsumerChainAction = e2e.StartConsumerChainAction - StartSovereignChainAction = e2e.StartSovereignChainAction SubmitConsumerRemovalProposalAction = e2e.SubmitConsumerRemovalProposalAction DelegateTokensAction = e2e.DelegateTokensAction - ChangeoverChainAction = e2e.ChangeoverChainAction UnbondTokensAction = e2e.UnbondTokensAction ) @@ -779,131 +777,6 @@ func (tr *Chain) transformConsumerGenesis(consumerChain ChainID, genesis []byte) return result } -func (tr Chain) changeoverChain( - action ChangeoverChainAction, - verbose bool, -) { - // sleep until the consumer chain genesis is ready on consumer - time.Sleep(5 * time.Second) - cmd := tr.Target.ExecCommand( - tr.TestConfig.ChainConfigs[action.ProviderChain].BinaryName, - - "query", "provider", "consumer-genesis", - string(tr.TestConfig.ChainConfigs[action.SovereignChain].ChainId), - - `--node`, tr.Target.GetQueryNode(action.ProviderChain), - `-o`, `json`, - ) - - if verbose { - log.Println("changeoverChain cmd: ", cmd.String()) - } - - bz, err := cmd.CombinedOutput() - if err != nil { - log.Fatal(err, "\n", string(bz)) - } - - consumerGenesis := ".app_state.ccvconsumer = " + string(bz) - consumerGenesisChanges := tr.TestConfig.ChainConfigs[action.SovereignChain].GenesisChanges - if consumerGenesisChanges != "" { - consumerGenesis = consumerGenesis + " | " + consumerGenesisChanges - } - if action.GenesisChanges != "" { - consumerGenesis = consumerGenesis + " | " + action.GenesisChanges - } - - tr.startChangeover(ChangeoverChainAction{ - Validators: action.Validators, - GenesisChanges: consumerGenesis, - }, verbose) -} - -func (tr Chain) startChangeover( - action ChangeoverChainAction, - verbose bool, -) { - chainConfig := tr.TestConfig.ChainConfigs[ChainID("sover")] - type jsonValAttrs struct { - Mnemonic string `json:"mnemonic"` - Allocation string `json:"allocation"` - Stake string `json:"stake"` - ValId string `json:"val_id"` - PrivValidatorKey string `json:"priv_validator_key"` - NodeKey string `json:"node_key"` - IpSuffix string `json:"ip_suffix"` - - ConsumerMnemonic string `json:"consumer_mnemonic"` - ConsumerPrivValidatorKey string `json:"consumer_priv_validator_key"` - StartWithConsumerKey bool `json:"start_with_consumer_key"` - } - - var validators []jsonValAttrs - for _, val := range action.Validators { - validators = append(validators, jsonValAttrs{ - Mnemonic: tr.TestConfig.ValidatorConfigs[val.Id].Mnemonic, - NodeKey: tr.TestConfig.ValidatorConfigs[val.Id].NodeKey, - ValId: fmt.Sprint(val.Id), - PrivValidatorKey: tr.TestConfig.ValidatorConfigs[val.Id].PrivValidatorKey, - Allocation: fmt.Sprint(val.Allocation) + "stake", - Stake: fmt.Sprint(val.Stake) + "stake", - IpSuffix: tr.TestConfig.ValidatorConfigs[val.Id].IpSuffix, - - ConsumerMnemonic: tr.TestConfig.ValidatorConfigs[val.Id].ConsumerMnemonic, - ConsumerPrivValidatorKey: tr.TestConfig.ValidatorConfigs[val.Id].ConsumerPrivValidatorKey, - // if true node will be started with consumer key for each consumer chain - StartWithConsumerKey: tr.TestConfig.ValidatorConfigs[val.Id].UseConsumerKey, - }) - } - - vals, err := json.Marshal(validators) - if err != nil { - log.Fatal(err) - } - - // Concat genesis changes defined in chain config, with any custom genesis changes for this chain instantiation - var genesisChanges string - if action.GenesisChanges != "" { - genesisChanges = chainConfig.GenesisChanges + " | " + action.GenesisChanges - } else { - genesisChanges = chainConfig.GenesisChanges - } - - isConsumer := true - changeoverScript := tr.Target.GetTestScriptPath(isConsumer, "start-changeover.sh") - cmd := tr.Target.ExecCommand( - "/bin/bash", - changeoverScript, chainConfig.UpgradeBinary, string(vals), - "sover", chainConfig.IpPrefix, genesisChanges, - tr.TestConfig.TendermintConfigOverride, - ) - - cmdReader, err := cmd.StdoutPipe() - if err != nil { - log.Fatal(err) - } - cmd.Stderr = cmd.Stdout - - if err := cmd.Start(); err != nil { - log.Fatal(err) - } - - scanner := bufio.NewScanner(cmdReader) - - for scanner.Scan() { - out := scanner.Text() - if verbose { - fmt.Println("startChangeover: " + out) - } - if out == done { - break - } - } - if err := scanner.Err(); err != nil { - log.Fatal("startChangeover died", err) - } -} - type AddChainToRelayerAction struct { Chain ChainID Validator ValidatorID