Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: e2e fix PSS tests #1931

Merged
merged 2 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions proto/interchain_security/ccv/provider/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,23 @@ message MsgSubmitConsumerMisbehaviour {
option (gogoproto.goproto_getters) = false;

string submitter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// The Misbehaviour of the consumer chain wrapping
// two conflicting IBC headers
// The Misbehaviour of the consumer chain wrapping
// two conflicting IBC headers
ibc.lightclients.tendermint.v1.Misbehaviour misbehaviour = 2;
}

message MsgSubmitConsumerMisbehaviourResponse {}


// MsgSubmitConsumerDoubleVoting defines a message that reports
// MsgSubmitConsumerDoubleVoting defines a message that reports
// a double signing infraction observed on a consumer chain
message MsgSubmitConsumerDoubleVoting {
option (cosmos.msg.v1.signer) = "submitter";
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

string submitter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// The equivocation of the consumer chain wrapping
// The equivocation of the consumer chain wrapping
// an evidence of a validator that signed two conflicting votes
tendermint.types.DuplicateVoteEvidence duplicate_vote_evidence = 2;
// The light client header of the infraction block
Expand Down Expand Up @@ -228,9 +228,11 @@ message MsgChangeRewardDenoms {

// MsgChangeRewardDenomsResponse defines response type for MsgChangeRewardDenoms messages
message MsgChangeRewardDenomsResponse {}

message MsgOptIn {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
option (cosmos.msg.v1.signer) = "signer";
// the chain id of the consumer chain to opt in to
string chain_id = 1;
// the validator address on the provider
Expand All @@ -240,22 +242,29 @@ message MsgOptIn {
// This field is optional and can remain empty (i.e., `consumer_key = ""`). A validator can always change the
// consumer public key at a later stage by issuing a `MsgAssignConsumerKey` message.
string consumer_key = 3;
// signer address
string signer = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"];

}

message MsgOptInResponse {}

message MsgOptOut {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
option (cosmos.msg.v1.signer) = "signer";
// the chain id of the consumer chain to opt out from
string chain_id = 1;
// the validator address on the provider
string provider_addr = 2 [ (gogoproto.moretags) = "yaml:\"address\"" ];
// signer address
string signer = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];

}

message MsgOptOutResponse {}

// MsgSetConsumerCommissionRate allows validators to set
// MsgSetConsumerCommissionRate allows validators to set
// a per-consumer chain commission rate
message MsgSetConsumerCommissionRate {
option (gogoproto.equal) = false;
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/steps_consumer_misbehaviour.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func stepsStartChainsWithSoftOptOut(consumerName string) []Step {
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)),
},
},
},
Expand Down
31 changes: 18 additions & 13 deletions tests/e2e/steps_partial_set_security.go
Original file line number Diff line number Diff line change
@@ -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"
)

// stepsOptInChain starts a provider chain and an Opt-In chain and opts in and out validators
func stepsOptInChain() []Step {
Expand Down Expand Up @@ -42,7 +47,7 @@ func stepsOptInChain() []Step {
Chain: ChainID("consu"),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: "PROPOSAL_STATUS_VOTING_PERIOD",
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)),
},
},
HasToValidate: &map[ValidatorID][]ChainID{
Expand Down Expand Up @@ -101,7 +106,7 @@ func stepsOptInChain() []Step {
Chain: ChainID("consu"),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: "PROPOSAL_STATUS_PASSED",
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)),
},
},
},
Expand Down Expand Up @@ -563,7 +568,7 @@ func stepsTopNChain() []Step {
Chain: ChainID("consu"),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: "PROPOSAL_STATUS_VOTING_PERIOD",
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)),
},
},
},
Expand Down Expand Up @@ -596,7 +601,7 @@ func stepsTopNChain() []Step {
Chain: ChainID("consu"),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: "PROPOSAL_STATUS_PASSED",
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)),
},
},
},
Expand Down Expand Up @@ -1043,7 +1048,7 @@ func stepsValidatorSetCappedChain() []Step {
Chain: ChainID("consu"),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: "PROPOSAL_STATUS_VOTING_PERIOD",
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)),
},
},
HasToValidate: &map[ValidatorID][]ChainID{
Expand Down Expand Up @@ -1129,7 +1134,7 @@ func stepsValidatorSetCappedChain() []Step {
Chain: ChainID("consu"),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: "PROPOSAL_STATUS_PASSED",
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)),
},
},
},
Expand Down Expand Up @@ -1280,7 +1285,7 @@ func stepsValidatorsPowerCappedChain() []Step {
Chain: ChainID("consu"),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: "PROPOSAL_STATUS_VOTING_PERIOD",
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)),
},
},
HasToValidate: &map[ValidatorID][]ChainID{
Expand Down Expand Up @@ -1365,7 +1370,7 @@ func stepsValidatorsPowerCappedChain() []Step {
Chain: ChainID("consu"),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: "PROPOSAL_STATUS_PASSED",
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)),
},
},
},
Expand Down Expand Up @@ -1517,7 +1522,7 @@ func stepsValidatorsAllowlistedChain() []Step {
Chain: ChainID("consu"),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: "PROPOSAL_STATUS_VOTING_PERIOD",
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)),
},
},
HasToValidate: &map[ValidatorID][]ChainID{
Expand Down Expand Up @@ -1602,7 +1607,7 @@ func stepsValidatorsAllowlistedChain() []Step {
Chain: ChainID("consu"),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: "PROPOSAL_STATUS_PASSED",
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)),
},
},
},
Expand Down Expand Up @@ -1726,7 +1731,7 @@ func stepsValidatorsDenylistedChain() []Step {
Chain: ChainID("consu"),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: "PROPOSAL_STATUS_VOTING_PERIOD",
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD)),
},
},
HasToValidate: &map[ValidatorID][]ChainID{
Expand Down Expand Up @@ -1811,7 +1816,7 @@ func stepsValidatorsDenylistedChain() []Step {
Chain: ChainID("consu"),
SpawnTime: 0,
InitialHeight: clienttypes.Height{RevisionNumber: 0, RevisionHeight: 1},
Status: "PROPOSAL_STATUS_PASSED",
Status: strconv.Itoa(int(gov.ProposalStatus_PROPOSAL_STATUS_PASSED)),
},
},
},
Expand Down
7 changes: 5 additions & 2 deletions x/ccv/provider/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,9 @@ func NewOptInCmd() *cobra.Command {
} else {
consumerPubKey = ""
}
msg, err := types.NewMsgOptIn(args[0], sdk.ValAddress(providerValAddr), consumerPubKey)

signer := clientCtx.GetFromAddress().String()
msg, err := types.NewMsgOptIn(args[0], sdk.ValAddress(providerValAddr), consumerPubKey, signer)
if err != nil {
return err
}
Expand Down Expand Up @@ -274,7 +276,8 @@ func NewOptOutCmd() *cobra.Command {

providerValAddr := clientCtx.GetFromAddress()

msg, err := types.NewMsgOptOut(args[0], sdk.ValAddress(providerValAddr))
signer := clientCtx.GetFromAddress().String()
msg, err := types.NewMsgOptOut(args[0], sdk.ValAddress(providerValAddr), signer)
if err != nil {
return err
}
Expand Down
6 changes: 3 additions & 3 deletions x/ccv/provider/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ func NewHandler(k *keeper.Keeper) baseapp.MsgServiceHandler {
res, err := msgServer.SubmitConsumerDoubleVoting(ctx, msg)
return sdk.WrapServiceResult(ctx, res, err)
case *types.MsgOptIn:
res, err := msgServer.OptIn(sdk.WrapSDKContext(ctx), msg)
res, err := msgServer.OptIn(ctx, msg)
return sdk.WrapServiceResult(ctx, res, err)
case *types.MsgOptOut:
res, err := msgServer.OptOut(sdk.WrapSDKContext(ctx), msg)
res, err := msgServer.OptOut(ctx, msg)
return sdk.WrapServiceResult(ctx, res, err)
case *types.MsgSetConsumerCommissionRate:
res, err := msgServer.SetConsumerCommissionRate(sdk.WrapSDKContext(ctx), msg)
res, err := msgServer.SetConsumerCommissionRate(ctx, msg)
return sdk.WrapServiceResult(ctx, res, err)
default:
return nil, errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg)
Expand Down
6 changes: 4 additions & 2 deletions x/ccv/provider/types/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,11 +307,12 @@ func (msg *MsgConsumerRemoval) ValidateBasic() error {
}

// NewMsgOptIn creates a new NewMsgOptIn instance.
func NewMsgOptIn(chainID string, providerValidatorAddress sdk.ValAddress, consumerConsensusPubKey string) (*MsgOptIn, error) {
func NewMsgOptIn(chainID string, providerValidatorAddress sdk.ValAddress, consumerConsensusPubKey, signer string) (*MsgOptIn, error) {
return &MsgOptIn{
ChainId: chainID,
ProviderAddr: providerValidatorAddress.String(),
ConsumerKey: consumerConsensusPubKey,
Signer: signer,
}, nil
}

Expand Down Expand Up @@ -359,10 +360,11 @@ func (msg MsgOptIn) ValidateBasic() error {
}

// NewMsgOptOut creates a new NewMsgOptIn instance.
func NewMsgOptOut(chainID string, providerValidatorAddress sdk.ValAddress) (*MsgOptOut, error) {
func NewMsgOptOut(chainID string, providerValidatorAddress sdk.ValAddress, signer string) (*MsgOptOut, error) {
return &MsgOptOut{
ChainId: chainID,
ProviderAddr: providerValidatorAddress.String(),
Signer: signer,
}, nil
}

Expand Down
Loading
Loading