diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index 05abc088b5..c3b4a31e55 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -394,7 +394,7 @@ type SubmitConsumerAdditionProposalAction struct { func (tr Chain) UpdateConsumer(providerChain ChainID, validator ValidatorID, update types.MsgUpdateConsumer) { content, err := json.Marshal(update) if err != nil { - log.Fatal("failed marshalling MsgUpdate: ", err.Error()) + log.Fatal("failed marshalling MsgUpdateConsumer: ", err.Error()) } jsonFile := "/update_consumer.json" bz, err := tr.target.ExecCommand( diff --git a/tests/e2e/state.go b/tests/e2e/state.go index d614682bb2..25f574a2f6 100644 --- a/tests/e2e/state.go +++ b/tests/e2e/state.go @@ -25,6 +25,7 @@ type ( Rewards = e2e.Rewards TextProposal = e2e.TextProposal UpgradeProposal = e2e.UpgradeProposal + ConsumerUpdateProposal = e2e.ConsumerUpdateProposal ConsumerAdditionProposal = e2e.ConsumerAdditionProposal ConsumerRemovalProposal = e2e.ConsumerRemovalProposal ConsumerModificationProposal = e2e.ConsumerModificationProposal @@ -467,7 +468,6 @@ func (tr Commands) GetProposal(chain ChainID, proposal uint) Proposal { Description: description, } case "/interchain_security.ccv.provider.v1.MsgUpdateConsumer": - spawnTime := rawContent.Get("initialization_parameters.spawn_time").Time().Sub(tr.containerConfig.Now) consumerId := rawContent.Get("consumer_id").String() consumerChainId := ChainID("") for _, chainCfg := range tr.chainConfigs { @@ -475,17 +475,21 @@ func (tr Commands) GetProposal(chain ChainID, proposal uint) Proposal { consumerChainId = chainCfg.ChainId } } - return e2e.ConsumerAdditionProposal{ - Deposit: uint(deposit), - Chain: consumerChainId, - Status: status, - SpawnTime: int(spawnTime.Milliseconds()), - InitialHeight: clienttypes.Height{ + + updateProposal := e2e.ConsumerUpdateProposal{ + Deposit: uint(deposit), + Chain: consumerChainId, + Status: status, + } + if rawContent.Get("initialization_parameter").Exists() { + spawnTime := rawContent.Get("initialization_parameters.spawn_time").Time().Sub(tr.containerConfig.Now) + updateProposal.SpawnTime = int(spawnTime.Milliseconds()) + updateProposal.InitialHeight = clienttypes.Height{ RevisionNumber: rawContent.Get("initialization_parameters.initial_height.revision_number").Uint(), RevisionHeight: rawContent.Get("initialization_parameters.initial_height.revision_height").Uint(), - }, + } } - + return updateProposal case "/interchain_security.ccv.provider.v1.MsgConsumerAddition": chainId := rawContent.Get("chain_id").String() spawnTime := rawContent.Get("spawn_time").Time().Sub(tr.containerConfig.Now) diff --git a/tests/e2e/steps_partial_set_security.go b/tests/e2e/steps_partial_set_security.go index 614f093c57..9638e675f5 100644 --- a/tests/e2e/steps_partial_set_security.go +++ b/tests/e2e/steps_partial_set_security.go @@ -2031,14 +2031,13 @@ func stepsModifyChain() []Step { // 2. set the `ValidatorSetCap` to a maximum of 2 validators { Action: UpdateConsumerChainAction{ - Chain: ChainID("provi"), - From: ValidatorID("alice"), - ConsumerChain: ChainID("consu"), - SpawnTime: 0, - InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - TopN: 0, - ValidatorsPowerCap: 40, - ValidatorSetCap: 2, + Chain: ChainID("provi"), + From: ValidatorID("alice"), + ConsumerChain: ChainID("consu"), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + TopN: 0, + ValidatorSetCap: 2, }, State: State{}, }, @@ -2068,18 +2067,15 @@ func stepsModifyChain() []Step { }, }, }, - // 3. set an allowlist with 2 validators { Action: UpdateConsumerChainAction{ - Chain: ChainID("provi"), - From: ValidatorID("alice"), - ConsumerChain: ChainID("consu"), - SpawnTime: 0, - InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - TopN: 0, - ValidatorsPowerCap: 40, - ValidatorSetCap: 2, + Chain: ChainID("provi"), + From: ValidatorID("alice"), + ConsumerChain: ChainID("consu"), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + TopN: 0, Allowlist: []string{ "cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq", "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6", @@ -2111,22 +2107,15 @@ func stepsModifyChain() []Step { }, }, }, - // 4. set a denylist with 1 validator { Action: UpdateConsumerChainAction{ - Chain: ChainID("provi"), - From: ValidatorID("alice"), - ConsumerChain: ChainID("consu"), - SpawnTime: 0, - InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, - TopN: 0, - ValidatorsPowerCap: 40, - ValidatorSetCap: 2, - Allowlist: []string{ - "cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq", - "cosmosvalcons1ezyrq65s3gshhx5585w6mpusq3xsj3ayzf4uv6", - }, + Chain: ChainID("provi"), + From: ValidatorID("alice"), + ConsumerChain: ChainID("consu"), + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + TopN: 0, // only "alice" is denylisted (see `getDefaultValidators` in `tests/e2e/config.go`) Denylist: []string{"cosmosvalcons1qmq08eruchr5sf5s3rwz7djpr5a25f7xw4mceq"}, }, @@ -2156,49 +2145,59 @@ func stepsModifyChain() []Step { }, }, }, - // 5. modify the chain from Opt In to Top 100% - // PERMISSIONLESS: Opt-In ---> TopN IS NOT SUPPORTED AT THE CURRENT STATE OF WORK !!! - /* { - Action: SubmitConsumerModificationProposalAction{ - Chain: ChainID("provi"), - From: ValidatorID("alice"), - Deposit: 10000001, - ConsumerChain: ChainID("consu"), - TopN: 100, - }, - State: State{ - ChainID("provi"): ChainState{ - Proposals: &map[uint]Proposal{ - 6: ConsumerModificationProposal{ - Deposit: 10000001, - Chain: ChainID("consu"), - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), - }, - }, - }, - }, - }, - { - Action: VoteGovProposalAction{ - Chain: ChainID("provi"), - From: []ValidatorID{ValidatorID("alice"), ValidatorID("bob"), ValidatorID("carol")}, - Vote: []string{"yes", "yes", "yes"}, - PropNumber: 6, - }, - State: State{ - ChainID("provi"): ChainState{ - Proposals: &map[uint]Proposal{ - 6: ConsumerModificationProposal{ - Deposit: 10000001, - Chain: ChainID("consu"), - Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), - }, - }, - }, - }, - }, - */ + // -- Change the owner to governance authority + { + Action: UpdateConsumerChainAction{ + Chain: ChainID("provi"), + From: ValidatorID("alice"), + ConsumerChain: ChainID("consu"), + NewOwner: "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn", + SpawnTime: 0, + InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1}, + TopN: 0, + }, + State: State{}, + }, + { + Action: SubmitConsumerModificationProposalAction{ + Chain: ChainID("provi"), + From: ValidatorID("alice"), + Deposit: 10000001, + ConsumerChain: ChainID("consu"), + TopN: 100, + }, + State: State{ + ChainID("provi"): ChainState{ + Proposals: &map[uint]Proposal{ + 1: ConsumerUpdateProposal{ + Deposit: 10000001, + Chain: ChainID("consu"), + Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)), + }, + }, + }, + }, + }, + { + 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: ConsumerUpdateProposal{ + Deposit: 10000001, + Chain: ChainID("consu"), + Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)), + }, + }, + }, + }, + }, { Action: OptOutAction{ Chain: ChainID("consu"), diff --git a/tests/e2e/testlib/types.go b/tests/e2e/testlib/types.go index 8694e7185d..739a38f582 100644 --- a/tests/e2e/testlib/types.go +++ b/tests/e2e/testlib/types.go @@ -292,6 +292,14 @@ type ConsumerAdditionProposal struct { Status string } +type ConsumerUpdateProposal struct { + Deposit uint + Chain ChainID + SpawnTime int + InitialHeight clienttypes.Height + Status string +} + type UpgradeProposal struct { Title string Description string @@ -305,6 +313,8 @@ func (p UpgradeProposal) isProposal() {} func (p ConsumerAdditionProposal) isProposal() {} +func (p ConsumerUpdateProposal) isProposal() {} + type ConsumerRemovalProposal struct { Deposit uint Chain ChainID