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

fix: auto-fill of gov address for provider 'draft-proposal' #1444

Merged
merged 1 commit into from
Nov 23, 2023
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
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 @@

// 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 @@
//
// 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 @@
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 @@
//
// 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 @@
[ (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 @@
//
// 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
Loading