Skip to content

Commit

Permalink
Fix signer for gov proposal messages
Browse files Browse the repository at this point in the history
  • Loading branch information
bermuell committed Nov 23, 2023
1 parent d3f3d9f commit 9e40d23
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 126 deletions.
16 changes: 8 additions & 8 deletions proto/interchain_security/ccv/provider/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ service Msg {

// MsgUpdateParams is the Msg/UpdateParams request type
message MsgUpdateParams {
option (cosmos.msg.v1.signer) = "signer";
option (cosmos.msg.v1.signer) = "authority";

// signer is the address of the governance account.
string signer = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

// params defines the x/provider parameters to update.
Params params = 2 [(gogoproto.nullable) = false];
Expand Down Expand Up @@ -77,7 +77,7 @@ message MsgAssignConsumerKeyResponse {}
//
// Note: this replaces ConsumerAdditionProposal which is deprecated and will be removed soon
message MsgConsumerAddition {
option (cosmos.msg.v1.signer) = "signer";
option (cosmos.msg.v1.signer) = "authority";

// the proposed chain-id of the new consumer chain, must be different from all
// other consumer chain ids of the executing provider chain.
Expand Down Expand Up @@ -132,7 +132,7 @@ message MsgConsumerAddition {
string distribution_transmission_channel = 12;

// signer address
string signer = 13 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string authority = 13 [(cosmos_proto.scalar) = "cosmos.AddressString"];

Check failure on line 135 in proto/interchain_security/ccv/provider/v1/tx.proto

View workflow job for this annotation

GitHub Actions / break-check

Field "13" with name "authority" on message "MsgConsumerAddition" changed option "json_name" from "signer" to "authority".

Check failure on line 135 in proto/interchain_security/ccv/provider/v1/tx.proto

View workflow job for this annotation

GitHub Actions / break-check

Field "13" on message "MsgConsumerAddition" changed name from "signer" to "authority".
}

// MsgConsumerAdditionResponse defines response type for MsgConsumerAddition messages
Expand All @@ -146,7 +146,7 @@ message MsgConsumerAdditionResponse {}
//
// Note: this replaces ConsumerRemovalProposal which is deprecated and will be removed soon
message MsgConsumerRemoval {
option (cosmos.msg.v1.signer) = "signer";
option (cosmos.msg.v1.signer) = "authority";

// the chain-id of the consumer chain to be stopped
string chain_id = 1;
Expand All @@ -156,7 +156,7 @@ message MsgConsumerRemoval {
[ (gogoproto.stdtime) = true, (gogoproto.nullable) = false ];

// signer address
string signer = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string authority = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];

Check failure on line 159 in proto/interchain_security/ccv/provider/v1/tx.proto

View workflow job for this annotation

GitHub Actions / break-check

Field "3" with name "authority" on message "MsgConsumerRemoval" changed option "json_name" from "signer" to "authority".

Check failure on line 159 in proto/interchain_security/ccv/provider/v1/tx.proto

View workflow job for this annotation

GitHub Actions / break-check

Field "3" on message "MsgConsumerRemoval" changed name from "signer" to "authority".
}

// MsgConsumerRemovalResponse defines response type for MsgConsumerRemoval messages
Expand All @@ -167,14 +167,14 @@ message MsgConsumerRemovalResponse {}
//
// Note: this replaces ChangeRewardDenomsProposal which is deprecated and will be removed soon
message MsgChangeRewardDenoms {
option (cosmos.msg.v1.signer) = "signer";
option (cosmos.msg.v1.signer) = "authority";

// the list of consumer reward denoms to add
repeated string denoms_to_add = 1;
// the list of consumer reward denoms to remove
repeated string denoms_to_remove = 2;
// signer address
string signer = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string authority = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];

Check failure on line 177 in proto/interchain_security/ccv/provider/v1/tx.proto

View workflow job for this annotation

GitHub Actions / break-check

Field "3" with name "authority" on message "MsgChangeRewardDenoms" changed option "json_name" from "signer" to "authority".

Check failure on line 177 in proto/interchain_security/ccv/provider/v1/tx.proto

View workflow job for this annotation

GitHub Actions / break-check

Field "3" on message "MsgChangeRewardDenoms" changed name from "signer" to "authority".

}

Expand Down
16 changes: 8 additions & 8 deletions x/ccv/provider/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ var _ types.MsgServer = msgServer{}

// UpdateParams updates the params.
func (k msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) {
if k.GetAuthority() != msg.Signer {
return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Signer)
if k.GetAuthority() != msg.Authority {
return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority)
}

ctx := sdk.UnwrapSDKContext(goCtx)
Expand Down Expand Up @@ -126,8 +126,8 @@ func (k msgServer) AssignConsumerKey(goCtx context.Context, msg *types.MsgAssign

// ConsumerAddition defines a rpc handler method for MsgConsumerAddition
func (k msgServer) ConsumerAddition(goCtx context.Context, msg *types.MsgConsumerAddition) (*types.MsgConsumerAdditionResponse, error) {
if k.GetAuthority() != msg.Signer {
return nil, errorsmod.Wrapf(types.ErrUnauthorized, "expected %s, got %s", k.GetAuthority(), msg.Signer)
if k.GetAuthority() != msg.Authority {
return nil, errorsmod.Wrapf(types.ErrUnauthorized, "expected %s, got %s", k.GetAuthority(), msg.Authority)
}

ctx := sdk.UnwrapSDKContext(goCtx)
Expand All @@ -142,8 +142,8 @@ func (k msgServer) ConsumerAddition(goCtx context.Context, msg *types.MsgConsume
func (k msgServer) ConsumerRemoval(
goCtx context.Context,
msg *types.MsgConsumerRemoval) (*types.MsgConsumerRemovalResponse, error) {
if k.GetAuthority() != msg.Signer {
return nil, errorsmod.Wrapf(types.ErrUnauthorized, "expected %s, got %s", k.GetAuthority(), msg.Signer)
if k.GetAuthority() != msg.Authority {
return nil, errorsmod.Wrapf(types.ErrUnauthorized, "expected %s, got %s", k.GetAuthority(), msg.Authority)
}

ctx := sdk.UnwrapSDKContext(goCtx)
Expand All @@ -157,8 +157,8 @@ func (k msgServer) ConsumerRemoval(

// ChangeRewardDenoms defines a rpc handler method for MsgChangeRewardDenoms
func (k msgServer) ChangeRewardDenoms(goCtx context.Context, msg *types.MsgChangeRewardDenoms) (*types.MsgChangeRewardDenomsResponse, error) {
if k.GetAuthority() != msg.Signer {
return nil, errorsmod.Wrapf(types.ErrUnauthorized, "expected %s, got %s", k.GetAuthority(), msg.Signer)
if k.GetAuthority() != msg.Authority {
return nil, errorsmod.Wrapf(types.ErrUnauthorized, "expected %s, got %s", k.GetAuthority(), msg.Authority)
}

sdkCtx := sdk.UnwrapSDKContext(goCtx)
Expand Down
2 changes: 1 addition & 1 deletion x/ccv/provider/types/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func ParseConsumerKeyFromJson(jsonStr string) (pkType, key string, err error) {
// If the validator address is not same as delegator's, then the validator must
// sign the msg as well.
func (msg *MsgConsumerAddition) GetSigners() []sdk.AccAddress {
valAddr, err := sdk.ValAddressFromBech32(msg.Signer)
valAddr, err := sdk.ValAddressFromBech32(msg.Authority)
if err != nil {
// same behavior as in cosmos-sdk
panic(err)
Expand Down
Loading

0 comments on commit 9e40d23

Please sign in to comment.