From f9ce4fdcc74acfe3d7ef19652491db582f072fee Mon Sep 17 00:00:00 2001 From: Charly Date: Tue, 22 Aug 2023 15:04:44 +0200 Subject: [PATCH 01/14] add protos and keeper function placeholder --- modules/core/02-client/keeper/keeper.go | 6 + modules/core/02-client/types/tx.pb.go | 553 ++++++++++++++++++++++-- modules/core/keeper/msg_server.go | 17 + proto/ibc/core/client/v1/tx.proto | 26 ++ 4 files changed, 555 insertions(+), 47 deletions(-) diff --git a/modules/core/02-client/keeper/keeper.go b/modules/core/02-client/keeper/keeper.go index 3588b117f8c..bc5b398b604 100644 --- a/modules/core/02-client/keeper/keeper.go +++ b/modules/core/02-client/keeper/keeper.go @@ -435,3 +435,9 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { bz := k.cdc.MustMarshal(¶ms) store.Set([]byte(types.ParamsKey), bz) } + +// ScheduleIBCClientUpgrade schedules an upgrade for the IBC client. +func (k Keeper) ScheduleIBCClientUpgrade(ctx sdk.Context, plan upgradetypes.Plan, upgradedClientState exported.ClientState) error { + // TODO: Add logic to store the upgraded client state. + return nil +} diff --git a/modules/core/02-client/types/tx.pb.go b/modules/core/02-client/types/tx.pb.go index b7bda73776a..447115a3a55 100644 --- a/modules/core/02-client/types/tx.pb.go +++ b/modules/core/02-client/types/tx.pb.go @@ -8,6 +8,7 @@ import ( fmt "fmt" types "github.com/cosmos/cosmos-sdk/codec/types" _ "github.com/cosmos/cosmos-sdk/types/msgservice" + types1 "github.com/cosmos/cosmos-sdk/x/upgrade/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -280,6 +281,113 @@ func (m *MsgUpgradeClientResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpgradeClientResponse proto.InternalMessageInfo +// MsgScheduleIBCClientUpgrade defines an sdk.Msg to schedule an upgrade of an IBC client using a v1 governance proposal +type MsgScheduleIBCClientUpgrade struct { + // authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + Plan types1.Plan `protobuf:"bytes,2,opt,name=plan,proto3" json:"plan"` + // An UpgradedClientState must be provided to perform an IBC breaking upgrade. + // This will make the chain commit to the correct upgraded (self) client state + // before the upgrade occurs, so that connecting chains can verify that the + // new upgraded client is valid by verifying a proof on the previous version + // of the chain. This will allow IBC connections to persist smoothly across + // planned chain upgrades. Correspondingly, the UpgradedClientState field has been + // deprecated in the Cosmos SDK to allow for this logic to exist solely in + // the 02-client module. + UpgradedClientState *types.Any `protobuf:"bytes,3,opt,name=upgraded_client_state,json=upgradedClientState,proto3" json:"upgraded_client_state,omitempty"` +} + +func (m *MsgScheduleIBCClientUpgrade) Reset() { *m = MsgScheduleIBCClientUpgrade{} } +func (m *MsgScheduleIBCClientUpgrade) String() string { return proto.CompactTextString(m) } +func (*MsgScheduleIBCClientUpgrade) ProtoMessage() {} +func (*MsgScheduleIBCClientUpgrade) Descriptor() ([]byte, []int) { + return fileDescriptor_cb5dc4651eb49a04, []int{6} +} +func (m *MsgScheduleIBCClientUpgrade) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgScheduleIBCClientUpgrade) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgScheduleIBCClientUpgrade.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgScheduleIBCClientUpgrade) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgScheduleIBCClientUpgrade.Merge(m, src) +} +func (m *MsgScheduleIBCClientUpgrade) XXX_Size() int { + return m.Size() +} +func (m *MsgScheduleIBCClientUpgrade) XXX_DiscardUnknown() { + xxx_messageInfo_MsgScheduleIBCClientUpgrade.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgScheduleIBCClientUpgrade proto.InternalMessageInfo + +func (m *MsgScheduleIBCClientUpgrade) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgScheduleIBCClientUpgrade) GetPlan() types1.Plan { + if m != nil { + return m.Plan + } + return types1.Plan{} +} + +func (m *MsgScheduleIBCClientUpgrade) GetUpgradedClientState() *types.Any { + if m != nil { + return m.UpgradedClientState + } + return nil +} + +// MsgScheduleIBCClientUpgradeResponse defines the Msg/ScheduleIBCClientUpgrade response type. +type MsgScheduleIBCClientUpgradeResponse struct { +} + +func (m *MsgScheduleIBCClientUpgradeResponse) Reset() { *m = MsgScheduleIBCClientUpgradeResponse{} } +func (m *MsgScheduleIBCClientUpgradeResponse) String() string { return proto.CompactTextString(m) } +func (*MsgScheduleIBCClientUpgradeResponse) ProtoMessage() {} +func (*MsgScheduleIBCClientUpgradeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_cb5dc4651eb49a04, []int{7} +} +func (m *MsgScheduleIBCClientUpgradeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgScheduleIBCClientUpgradeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgScheduleIBCClientUpgradeResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgScheduleIBCClientUpgradeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgScheduleIBCClientUpgradeResponse.Merge(m, src) +} +func (m *MsgScheduleIBCClientUpgradeResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgScheduleIBCClientUpgradeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgScheduleIBCClientUpgradeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgScheduleIBCClientUpgradeResponse proto.InternalMessageInfo + // MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for // light client misbehaviour. // This message has been deprecated. Use MsgUpdateClient instead. @@ -298,7 +406,7 @@ func (m *MsgSubmitMisbehaviour) Reset() { *m = MsgSubmitMisbehaviour{} } func (m *MsgSubmitMisbehaviour) String() string { return proto.CompactTextString(m) } func (*MsgSubmitMisbehaviour) ProtoMessage() {} func (*MsgSubmitMisbehaviour) Descriptor() ([]byte, []int) { - return fileDescriptor_cb5dc4651eb49a04, []int{6} + return fileDescriptor_cb5dc4651eb49a04, []int{8} } func (m *MsgSubmitMisbehaviour) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -336,7 +444,7 @@ func (m *MsgSubmitMisbehaviourResponse) Reset() { *m = MsgSubmitMisbehav func (m *MsgSubmitMisbehaviourResponse) String() string { return proto.CompactTextString(m) } func (*MsgSubmitMisbehaviourResponse) ProtoMessage() {} func (*MsgSubmitMisbehaviourResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_cb5dc4651eb49a04, []int{7} + return fileDescriptor_cb5dc4651eb49a04, []int{9} } func (m *MsgSubmitMisbehaviourResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -379,7 +487,7 @@ func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } func (*MsgUpdateParams) ProtoMessage() {} func (*MsgUpdateParams) Descriptor() ([]byte, []int) { - return fileDescriptor_cb5dc4651eb49a04, []int{8} + return fileDescriptor_cb5dc4651eb49a04, []int{10} } func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -416,7 +524,7 @@ func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } func (*MsgUpdateParamsResponse) ProtoMessage() {} func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_cb5dc4651eb49a04, []int{9} + return fileDescriptor_cb5dc4651eb49a04, []int{11} } func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -452,6 +560,8 @@ func init() { proto.RegisterType((*MsgUpdateClientResponse)(nil), "ibc.core.client.v1.MsgUpdateClientResponse") proto.RegisterType((*MsgUpgradeClient)(nil), "ibc.core.client.v1.MsgUpgradeClient") proto.RegisterType((*MsgUpgradeClientResponse)(nil), "ibc.core.client.v1.MsgUpgradeClientResponse") + proto.RegisterType((*MsgScheduleIBCClientUpgrade)(nil), "ibc.core.client.v1.MsgScheduleIBCClientUpgrade") + proto.RegisterType((*MsgScheduleIBCClientUpgradeResponse)(nil), "ibc.core.client.v1.MsgScheduleIBCClientUpgradeResponse") proto.RegisterType((*MsgSubmitMisbehaviour)(nil), "ibc.core.client.v1.MsgSubmitMisbehaviour") proto.RegisterType((*MsgSubmitMisbehaviourResponse)(nil), "ibc.core.client.v1.MsgSubmitMisbehaviourResponse") proto.RegisterType((*MsgUpdateParams)(nil), "ibc.core.client.v1.MsgUpdateParams") @@ -461,49 +571,56 @@ func init() { func init() { proto.RegisterFile("ibc/core/client/v1/tx.proto", fileDescriptor_cb5dc4651eb49a04) } var fileDescriptor_cb5dc4651eb49a04 = []byte{ - // 658 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x95, 0x3f, 0x6f, 0xd3, 0x4e, - 0x18, 0xc7, 0xe3, 0xfe, 0x89, 0x7e, 0xb9, 0xa6, 0xed, 0x8f, 0x53, 0xa1, 0xa9, 0x4b, 0x9d, 0x2a, - 0x30, 0x94, 0x42, 0xed, 0x26, 0x0c, 0x8d, 0x8a, 0x18, 0xda, 0x4e, 0x0c, 0x91, 0x90, 0x2b, 0x16, - 0x96, 0x60, 0x3b, 0x97, 0x8b, 0xa5, 0xd8, 0x67, 0xf9, 0xec, 0x88, 0x0c, 0x48, 0x88, 0x89, 0x11, - 0x24, 0x16, 0x36, 0x5e, 0x42, 0xc5, 0x7b, 0x40, 0xea, 0xd8, 0x91, 0x09, 0xa1, 0x64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0xe3, 0xf7, 0x11, 0x65, 0x77, 0xd5, 0x61, 0xe3, 0x80, 0x5f, 0x57, 0xde, 0xd0, 0x41, 0x54, 0x2f, - 0x86, 0x27, 0xed, 0xe9, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x70, 0x00, 0x5d, 0xdc, 0x49, 0x07, - 0x00, 0x00, + // 772 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x96, 0xcf, 0x4f, 0xdb, 0x4a, + 0x10, 0xc7, 0x63, 0x7e, 0x44, 0x2f, 0x4b, 0x80, 0xf7, 0xf6, 0x41, 0x09, 0x06, 0x12, 0x14, 0xa8, + 0x44, 0x69, 0xb1, 0x09, 0x95, 0x0a, 0xa2, 0xea, 0x01, 0x72, 0x29, 0x87, 0x48, 0x28, 0xa8, 0x97, + 0x5e, 0x52, 0xdb, 0x59, 0x36, 0x96, 0x62, 0xaf, 0xe5, 0xb5, 0xa3, 0xe6, 0x50, 0xa9, 0xaa, 0x7a, + 0xe8, 0xb1, 0x87, 0x1e, 0xda, 0x5b, 0xff, 0x04, 0xd4, 0xff, 0xa1, 0x12, 0x97, 0x4a, 0x1c, 0x7b, + 0xaa, 0x2a, 0x38, 0xf0, 0x6f, 0x54, 0xf6, 0xae, 0x1d, 0xdb, 0xc4, 0x26, 0xa8, 0x37, 0x7b, 0xe7, + 0x33, 0x3b, 0xdf, 0x99, 0xd9, 0x59, 0x2d, 0x58, 0xd2, 0x55, 0x4d, 0xd6, 0x88, 0x8d, 0x64, 0xad, + 0xab, 0x23, 0xd3, 0x91, 0x7b, 0x35, 0xd9, 0x79, 0x2d, 0x59, 0x36, 0x71, 0x08, 0x84, 0xba, 0xaa, + 0x49, 0x9e, 0x51, 0x62, 0x46, 0xa9, 0x57, 0x13, 0x17, 0x34, 0x42, 0x0d, 0x42, 0x65, 0x83, 0x62, + 0x8f, 0x35, 0x28, 0x66, 0xb0, 0xb8, 0xce, 0x0d, 0xae, 0x85, 0x6d, 0xa5, 0x8d, 0xe4, 0x5e, 0x4d, + 0x45, 0x8e, 0x52, 0x0b, 0xfe, 0x39, 0x35, 0x87, 0x09, 0x26, 0xfe, 0xa7, 0xec, 0x7d, 0xf1, 0xd5, + 0x45, 0x4c, 0x08, 0xee, 0x22, 0xd9, 0xff, 0x53, 0xdd, 0x53, 0x59, 0x31, 0xfb, 0xdc, 0x54, 0x19, + 0x22, 0x90, 0xab, 0xf1, 0x81, 0xea, 0x37, 0x01, 0xcc, 0x36, 0x28, 0xae, 0xdb, 0x48, 0x71, 0x50, + 0xdd, 0xb7, 0xc0, 0x5d, 0x50, 0x64, 0x4c, 0x8b, 0x3a, 0x8a, 0x83, 0x4a, 0xc2, 0xaa, 0xb0, 0x31, + 0xb5, 0x33, 0x27, 0xb1, 0x30, 0x52, 0x10, 0x46, 0x3a, 0x30, 0xfb, 0xcd, 0x29, 0x46, 0x9e, 0x78, + 0x20, 0x7c, 0x06, 0x66, 0x35, 0x62, 0x52, 0x64, 0x52, 0x97, 0x72, 0xdf, 0xb1, 0x0c, 0xdf, 0x99, + 0x10, 0x66, 0xee, 0xf7, 0x40, 0x9e, 0xea, 0xd8, 0x44, 0x76, 0x69, 0x7c, 0x55, 0xd8, 0x28, 0x34, + 0xf9, 0xdf, 0xfe, 0xec, 0x87, 0xaf, 0x95, 0xdc, 0xbb, 0xeb, 0xb3, 0x4d, 0xbe, 0x50, 0x5d, 0x04, + 0x0b, 0x09, 0xcd, 0x4d, 0x44, 0x2d, 0x6f, 0xb3, 0xea, 0x27, 0x96, 0xcf, 0x0b, 0xab, 0x3d, 0xc8, + 0x67, 0x09, 0x14, 0x78, 0x3e, 0x7a, 0xdb, 0x4f, 0xa6, 0xd0, 0xfc, 0x87, 0x2d, 0x1c, 0xb5, 0xe1, + 0x53, 0x30, 0xc3, 0x8d, 0x06, 0xa2, 0x54, 0xc1, 0xd9, 0x92, 0xa7, 0x19, 0xdb,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x3d, 0x9d, 0xb8, 0x76, 0xf6, 0xf9, 0xda, 0x03, 0x45, 0x23, 0x02, 0x67, 0x9e, + 0xaf, 0x18, 0x99, 0x3a, 0x0f, 0xff, 0x25, 0x9a, 0x55, 0x12, 0xaa, 0x15, 0xb0, 0x32, 0x54, 0x5a, + 0x28, 0xfe, 0x4d, 0x64, 0x90, 0x8f, 0x15, 0x5b, 0x31, 0xe8, 0x2d, 0x6d, 0xda, 0x03, 0x79, 0xcb, + 0xe7, 0xb8, 0x60, 0x51, 0xba, 0x79, 0x01, 0x4b, 0x6c, 0x27, 0xde, 0x26, 0xce, 0xef, 0xc3, 0x40, + 0x5e, 0xa4, 0xc4, 0xd1, 0x89, 0x65, 0x4e, 0x81, 0xb2, 0x9d, 0xcf, 0x93, 0x60, 0xbc, 0x41, 0x31, + 0x7c, 0x05, 0x8a, 0xb1, 0x7b, 0x73, 0x6d, 0x58, 0xc0, 0xc4, 0x45, 0x25, 0x3e, 0x1c, 0x01, 0x0a, + 0x22, 0x79, 0x11, 0x62, 0x37, 0x59, 0x5a, 0x84, 0x28, 0x94, 0x1a, 0x61, 0xd8, 0xed, 0x03, 0x35, + 0x30, 0x1d, 0x1f, 0xd9, 0xf5, 0x54, 0xef, 0x08, 0x25, 0x3e, 0x1a, 0x85, 0x0a, 0x83, 0xbc, 0x17, + 0x40, 0x29, 0x75, 0xf6, 0xe4, 0x94, 0xad, 0xd2, 0x1c, 0xc4, 0xdd, 0x3b, 0x3a, 0x84, 0x32, 0x6c, + 0x00, 0x87, 0x8c, 0xc2, 0x83, 0xb4, 0xed, 0x6e, 0xa0, 0x62, 0x6d, 0x64, 0x34, 0x8c, 0x79, 0x0a, + 0x60, 0xb4, 0xee, 0xfc, 0x20, 0x67, 0xf7, 0x91, 0x41, 0xb7, 0xf4, 0x31, 0x7e, 0x26, 0xc5, 0xc9, + 0xb7, 0xd7, 0x67, 0x9b, 0xc2, 0x61, 0xf3, 0xfc, 0xb2, 0x2c, 0x5c, 0x5c, 0x96, 0x85, 0xdf, 0x97, + 0x65, 0xe1, 0xe3, 0x55, 0x39, 0x77, 0x71, 0x55, 0xce, 0xfd, 0xbc, 0x2a, 0xe7, 0x5e, 0xee, 0x61, + 0xdd, 0xe9, 0xb8, 0xaa, 0xa4, 0x11, 0x43, 0xe6, 0x6f, 0x0d, 0x5d, 0xd5, 0xb6, 0x30, 0x91, 0x7b, + 0xbb, 0xb2, 0x41, 0xbc, 0xc2, 0x51, 0xf6, 0x52, 0xd8, 0xde, 0xd9, 0xe2, 0x8f, 0x05, 0xa7, 0x6f, + 0x21, 0xaa, 0xe6, 0xfd, 0x81, 0x7f, 0xfc, 0x27, 0x00, 0x00, 0xff, 0xff, 0xb4, 0xf0, 0x1e, 0xb7, + 0xed, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -524,6 +641,8 @@ type MsgClient interface { UpdateClient(ctx context.Context, in *MsgUpdateClient, opts ...grpc.CallOption) (*MsgUpdateClientResponse, error) // UpgradeClient defines a rpc handler method for MsgUpgradeClient. UpgradeClient(ctx context.Context, in *MsgUpgradeClient, opts ...grpc.CallOption) (*MsgUpgradeClientResponse, error) + // ScheduleIBCClientUpgrade defines a rpc handler method for MsgScheduleIBCClientUpgrade. + ScheduleIBCClientUpgrade(ctx context.Context, in *MsgScheduleIBCClientUpgrade, opts ...grpc.CallOption) (*MsgScheduleIBCClientUpgradeResponse, error) // SubmitMisbehaviour defines a rpc handler method for MsgSubmitMisbehaviour. SubmitMisbehaviour(ctx context.Context, in *MsgSubmitMisbehaviour, opts ...grpc.CallOption) (*MsgSubmitMisbehaviourResponse, error) // UpdateClientParams defines a rpc handler method for MsgUpdateParams. @@ -565,6 +684,15 @@ func (c *msgClient) UpgradeClient(ctx context.Context, in *MsgUpgradeClient, opt return out, nil } +func (c *msgClient) ScheduleIBCClientUpgrade(ctx context.Context, in *MsgScheduleIBCClientUpgrade, opts ...grpc.CallOption) (*MsgScheduleIBCClientUpgradeResponse, error) { + out := new(MsgScheduleIBCClientUpgradeResponse) + err := c.cc.Invoke(ctx, "/ibc.core.client.v1.Msg/ScheduleIBCClientUpgrade", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) SubmitMisbehaviour(ctx context.Context, in *MsgSubmitMisbehaviour, opts ...grpc.CallOption) (*MsgSubmitMisbehaviourResponse, error) { out := new(MsgSubmitMisbehaviourResponse) err := c.cc.Invoke(ctx, "/ibc.core.client.v1.Msg/SubmitMisbehaviour", in, out, opts...) @@ -591,6 +719,8 @@ type MsgServer interface { UpdateClient(context.Context, *MsgUpdateClient) (*MsgUpdateClientResponse, error) // UpgradeClient defines a rpc handler method for MsgUpgradeClient. UpgradeClient(context.Context, *MsgUpgradeClient) (*MsgUpgradeClientResponse, error) + // ScheduleIBCClientUpgrade defines a rpc handler method for MsgScheduleIBCClientUpgrade. + ScheduleIBCClientUpgrade(context.Context, *MsgScheduleIBCClientUpgrade) (*MsgScheduleIBCClientUpgradeResponse, error) // SubmitMisbehaviour defines a rpc handler method for MsgSubmitMisbehaviour. SubmitMisbehaviour(context.Context, *MsgSubmitMisbehaviour) (*MsgSubmitMisbehaviourResponse, error) // UpdateClientParams defines a rpc handler method for MsgUpdateParams. @@ -610,6 +740,9 @@ func (*UnimplementedMsgServer) UpdateClient(ctx context.Context, req *MsgUpdateC func (*UnimplementedMsgServer) UpgradeClient(ctx context.Context, req *MsgUpgradeClient) (*MsgUpgradeClientResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpgradeClient not implemented") } +func (*UnimplementedMsgServer) ScheduleIBCClientUpgrade(ctx context.Context, req *MsgScheduleIBCClientUpgrade) (*MsgScheduleIBCClientUpgradeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ScheduleIBCClientUpgrade not implemented") +} func (*UnimplementedMsgServer) SubmitMisbehaviour(ctx context.Context, req *MsgSubmitMisbehaviour) (*MsgSubmitMisbehaviourResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SubmitMisbehaviour not implemented") } @@ -675,6 +808,24 @@ func _Msg_UpgradeClient_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +func _Msg_ScheduleIBCClientUpgrade_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgScheduleIBCClientUpgrade) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ScheduleIBCClientUpgrade(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ibc.core.client.v1.Msg/ScheduleIBCClientUpgrade", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ScheduleIBCClientUpgrade(ctx, req.(*MsgScheduleIBCClientUpgrade)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_SubmitMisbehaviour_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgSubmitMisbehaviour) if err := dec(in); err != nil { @@ -727,6 +878,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpgradeClient", Handler: _Msg_UpgradeClient_Handler, }, + { + MethodName: "ScheduleIBCClientUpgrade", + Handler: _Msg_ScheduleIBCClientUpgrade_Handler, + }, { MethodName: "SubmitMisbehaviour", Handler: _Msg_SubmitMisbehaviour_Handler, @@ -987,6 +1142,81 @@ func (m *MsgUpgradeClientResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } +func (m *MsgScheduleIBCClientUpgrade) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgScheduleIBCClientUpgrade) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgScheduleIBCClientUpgrade) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.UpgradedClientState != nil { + { + size, err := m.UpgradedClientState.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + { + size, err := m.Plan.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgScheduleIBCClientUpgradeResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgScheduleIBCClientUpgradeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgScheduleIBCClientUpgradeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func (m *MsgSubmitMisbehaviour) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1235,6 +1465,34 @@ func (m *MsgUpgradeClientResponse) Size() (n int) { return n } +func (m *MsgScheduleIBCClientUpgrade) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Plan.Size() + n += 1 + l + sovTx(uint64(l)) + if m.UpgradedClientState != nil { + l = m.UpgradedClientState.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgScheduleIBCClientUpgradeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func (m *MsgSubmitMisbehaviour) Size() (n int) { if m == nil { return 0 @@ -2003,6 +2261,207 @@ func (m *MsgUpgradeClientResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgScheduleIBCClientUpgrade) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgScheduleIBCClientUpgrade: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgScheduleIBCClientUpgrade: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Plan", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Plan.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UpgradedClientState", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.UpgradedClientState == nil { + m.UpgradedClientState = &types.Any{} + } + if err := m.UpgradedClientState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgScheduleIBCClientUpgradeResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgScheduleIBCClientUpgradeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgScheduleIBCClientUpgradeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *MsgSubmitMisbehaviour) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index 02e41a0ab83..515304d6e55 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -709,6 +709,23 @@ func (k Keeper) UpdateClientParams(goCtx context.Context, msg *clienttypes.MsgUp return &clienttypes.MsgUpdateParamsResponse{}, nil } +// ScheduleIBCClientUpgrade defines a rpc handler method for MsgScheduleIBCClientUpgrade. +func (k Keeper) ScheduleIBCClientUpgrade(goCtx context.Context, msg *clienttypes.MsgScheduleIBCClientUpgrade) (*clienttypes.MsgScheduleIBCClientUpgradeResponse, error) { + if k.GetAuthority() != msg.Authority { + return nil, errorsmod.Wrapf(ibcerrors.ErrUnauthorized, "expected %s, got %s", k.GetAuthority(), msg.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + upgradedClientState, err := clienttypes.UnpackClientState(msg.UpgradedClientState) + if err != nil { + return nil, errorsmod.Wrapf(clienttypes.ErrInvalidClientType, "cannot unpack client state: %s", err) + } + + k.ClientKeeper.ScheduleIBCClientUpgrade(ctx, msg.Plan, upgradedClientState) + + return &clienttypes.MsgScheduleIBCClientUpgradeResponse{}, nil +} + // UpdateConnectionParams defines a rpc handler method for MsgUpdateParams for the 03-connection submodule. func (k Keeper) UpdateConnectionParams(goCtx context.Context, msg *connectiontypes.MsgUpdateParams) (*connectiontypes.MsgUpdateParamsResponse, error) { if k.GetAuthority() != msg.Authority { diff --git a/proto/ibc/core/client/v1/tx.proto b/proto/ibc/core/client/v1/tx.proto index 76efcc7e7b1..3e57204b707 100644 --- a/proto/ibc/core/client/v1/tx.proto +++ b/proto/ibc/core/client/v1/tx.proto @@ -5,6 +5,7 @@ package ibc.core.client.v1; option go_package = "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"; import "cosmos/msg/v1/msg.proto"; +import "cosmos/upgrade/v1beta1/upgrade.proto"; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; import "ibc/core/client/v1/client.proto"; @@ -22,6 +23,9 @@ service Msg { // UpgradeClient defines a rpc handler method for MsgUpgradeClient. rpc UpgradeClient(MsgUpgradeClient) returns (MsgUpgradeClientResponse); + // ScheduleIBCClientUpgrade defines a rpc handler method for MsgScheduleIBCClientUpgrade. + rpc ScheduleIBCClientUpgrade(MsgScheduleIBCClientUpgrade) returns (MsgScheduleIBCClientUpgradeResponse); + // SubmitMisbehaviour defines a rpc handler method for MsgSubmitMisbehaviour. rpc SubmitMisbehaviour(MsgSubmitMisbehaviour) returns (MsgSubmitMisbehaviourResponse); @@ -90,6 +94,28 @@ message MsgUpgradeClient { // MsgUpgradeClientResponse defines the Msg/UpgradeClient response type. message MsgUpgradeClientResponse {} +// MsgScheduleIBCClientUpgrade defines an sdk.Msg to schedule an upgrade of an IBC client using a v1 governance proposal +message MsgScheduleIBCClientUpgrade { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address of the governance account. + string authority = 1; + cosmos.upgrade.v1beta1.Plan plan = 2 [(gogoproto.nullable) = false]; + + // An UpgradedClientState must be provided to perform an IBC breaking upgrade. + // This will make the chain commit to the correct upgraded (self) client state + // before the upgrade occurs, so that connecting chains can verify that the + // new upgraded client is valid by verifying a proof on the previous version + // of the chain. This will allow IBC connections to persist smoothly across + // planned chain upgrades. Correspondingly, the UpgradedClientState field has been + // deprecated in the Cosmos SDK to allow for this logic to exist solely in + // the 02-client module. + google.protobuf.Any upgraded_client_state = 3; +} + +// MsgScheduleIBCClientUpgradeResponse defines the Msg/ScheduleIBCClientUpgrade response type. +message MsgScheduleIBCClientUpgradeResponse {} + // MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for // light client misbehaviour. // This message has been deprecated. Use MsgUpdateClient instead. From 52422781b0a2cb68bf1a4f293a328b539721374f Mon Sep 17 00:00:00 2001 From: Charly Date: Wed, 23 Aug 2023 14:47:24 +0200 Subject: [PATCH 02/14] add keeper functions/tests, msgs and tests --- modules/core/02-client/keeper/keeper.go | 21 ++- modules/core/02-client/keeper/keeper_test.go | 114 +++++++++++++ modules/core/02-client/types/codec.go | 1 + modules/core/02-client/types/msgs.go | 37 +++++ modules/core/02-client/types/msgs_test.go | 158 +++++++++++++++++++ modules/core/keeper/msg_server.go | 15 +- modules/core/keeper/msg_server_test.go | 5 + 7 files changed, 337 insertions(+), 14 deletions(-) diff --git a/modules/core/02-client/keeper/keeper.go b/modules/core/02-client/keeper/keeper.go index bc5b398b604..4dfb673ffc5 100644 --- a/modules/core/02-client/keeper/keeper.go +++ b/modules/core/02-client/keeper/keeper.go @@ -438,6 +438,25 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { // ScheduleIBCClientUpgrade schedules an upgrade for the IBC client. func (k Keeper) ScheduleIBCClientUpgrade(ctx sdk.Context, plan upgradetypes.Plan, upgradedClientState exported.ClientState) error { - // TODO: Add logic to store the upgraded client state. + // zero out any custom fields before setting + cs := upgradedClientState.ZeroCustomFields() + bz, err := types.MarshalClientState(k.cdc, cs) + if err != nil { + return errorsmod.Wrap(err, "could not marshal UpgradedClientState") + } + + if err := k.upgradeKeeper.ScheduleUpgrade(ctx, plan); err != nil { + return err + } + + // sets the new upgraded client last height committed on this chain at plan.Height, + // since the chain will panic at plan.Height and new chain will resume at plan.Height + if err = k.upgradeKeeper.SetUpgradedClient(ctx, plan.Height, bz); err != nil { + return err + } + + // emitting an event for handling client upgrade proposal + emitUpgradeClientProposalEvent(ctx, plan.Name, plan.Height) + return nil } diff --git a/modules/core/02-client/keeper/keeper_test.go b/modules/core/02-client/keeper/keeper_test.go index 9bb1a6704c7..b3bdbe91d47 100644 --- a/modules/core/02-client/keeper/keeper_test.go +++ b/modules/core/02-client/keeper/keeper_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "errors" "math/rand" "testing" "time" @@ -12,7 +13,9 @@ import ( "github.com/cosmos/cosmos-sdk/codec" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" tmbytes "github.com/cometbft/cometbft/libs/bytes" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" @@ -483,3 +486,114 @@ func (suite *KeeperTestSuite) TestUnsetParams() { suite.chainA.GetSimApp().IBCKeeper.ClientKeeper.GetParams(ctx) }) } + +// TestScheduleIBCClientUpgrade tests that an IBC client upgrade has been properly scheduled +func (suite *KeeperTestSuite) TestScheduleIBCClientUpgrade() { + var ( + upgradedClientState *ibctm.ClientState + oldPlan, plan upgradetypes.Plan + expError error + ) + + testCases := []struct { + name string + malleate func() + expPass bool + }{ + { + "valid upgrade proposal", + func() {}, + true, + }, + { + "valid upgrade proposal with previous IBC state", func() { + oldPlan = upgradetypes.Plan{ + Name: "upgrade IBC clients", + Height: 100, + } + }, true, + }, + { + "fail: scheduling upgrade with plan height 0", + func() { + plan.Height = 0 + expError = sdkerrors.ErrInvalidRequest + }, + false, + }, + } + + for _, tc := range testCases { + tc := tc + + suite.Run(tc.name, func() { + suite.SetupTest() // reset + oldPlan.Height = 0 // reset + + path := ibctesting.NewPath(suite.chainA, suite.chainB) + suite.coordinator.SetupClients(path) + upgradedClientState = suite.chainA.GetClientState(path.EndpointA.ClientID).ZeroCustomFields().(*ibctm.ClientState) + + // use height 1000 to distinguish from old plan + plan = upgradetypes.Plan{ + Name: "upgrade IBC clients", + Height: 1000, + } + + tc.malleate() + + // set the old plan if it is not empty + if oldPlan.Height != 0 { + // set upgrade plan in the upgrade store + store := suite.chainA.GetContext().KVStore(suite.chainA.GetSimApp().GetKey(upgradetypes.StoreKey)) + bz := suite.chainA.App.AppCodec().MustMarshal(&oldPlan) + store.Set(upgradetypes.PlanKey(), bz) + + bz, err := types.MarshalClientState(suite.chainA.App.AppCodec(), upgradedClientState) + suite.Require().NoError(err) + + suite.chainA.GetSimApp().UpgradeKeeper.SetUpgradedClient(suite.chainA.GetContext(), oldPlan.Height, bz) //nolint:errcheck + } + + err := suite.chainA.App.GetIBCKeeper().ClientKeeper.ScheduleIBCClientUpgrade(suite.chainA.GetContext(), plan, upgradedClientState) + + if tc.expPass { + suite.Require().NoError(err) + + // check that the correct plan is returned + storedPlan, found := suite.chainA.GetSimApp().UpgradeKeeper.GetUpgradePlan(suite.chainA.GetContext()) + suite.Require().True(found) + suite.Require().Equal(plan, storedPlan) + + // check that old upgraded client state is cleared + _, found = suite.chainA.GetSimApp().UpgradeKeeper.GetUpgradedClient(suite.chainA.GetContext(), oldPlan.Height) + suite.Require().False(found) + + // check that client state was set + storedClientState, found := suite.chainA.GetSimApp().UpgradeKeeper.GetUpgradedClient(suite.chainA.GetContext(), plan.Height) + suite.Require().True(found) + clientState, err := types.UnmarshalClientState(suite.chainA.App.AppCodec(), storedClientState) + suite.Require().NoError(err) + suite.Require().Equal(upgradedClientState, clientState) + } else { + suite.Require().True(errors.Is(err, expError)) + + // check that the new plan wasn't stored + storedPlan, found := suite.chainA.GetSimApp().UpgradeKeeper.GetUpgradePlan(suite.chainA.GetContext()) + if oldPlan.Height != 0 { + // NOTE: this is only true if the ScheduleUpgrade function + // returns an error before clearing the old plan + suite.Require().True(found) + suite.Require().Equal(oldPlan, storedPlan) + } else { + suite.Require().False(found) + suite.Require().Empty(storedPlan) + } + + // check that client state was not set + _, found = suite.chainA.GetSimApp().UpgradeKeeper.GetUpgradedClient(suite.chainA.GetContext(), plan.Height) + suite.Require().False(found) + } + }) + } +} diff --git a/modules/core/02-client/types/codec.go b/modules/core/02-client/types/codec.go index c71caaede98..397480e7f39 100644 --- a/modules/core/02-client/types/codec.go +++ b/modules/core/02-client/types/codec.go @@ -49,6 +49,7 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { &MsgUpgradeClient{}, &MsgSubmitMisbehaviour{}, &MsgUpdateParams{}, + &MsgScheduleIBCClientUpgrade{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/modules/core/02-client/types/msgs.go b/modules/core/02-client/types/msgs.go index 764154afcb5..b3ba4b61119 100644 --- a/modules/core/02-client/types/msgs.go +++ b/modules/core/02-client/types/msgs.go @@ -5,6 +5,7 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" host "github.com/cosmos/ibc-go/v7/modules/core/24-host" ibcerrors "github.com/cosmos/ibc-go/v7/modules/core/errors" @@ -283,3 +284,39 @@ func (msg *MsgUpdateParams) ValidateBasic() error { } return msg.Params.Validate() } + +// NewMsgScheduleIBCClientUpgrade creates a new MsgScheduleIBCClientUpgrade instance +func NewMsgScheduleIBCClientUpgrade(authority string, plan upgradetypes.Plan, upgradedClientState exported.ClientState) (*MsgScheduleIBCClientUpgrade, error) { + anyClient, err := PackClientState(upgradedClientState) + if err != nil { + return nil, err + } + + return &MsgScheduleIBCClientUpgrade{ + Authority: authority, + Plan: plan, + UpgradedClientState: anyClient, + }, nil +} + +// GetSigners returns the expected signers for a MsgScheduleIBCClientUpgrade message. +func (msg *MsgScheduleIBCClientUpgrade) GetSigners() []sdk.AccAddress { + accAddr, err := sdk.AccAddressFromBech32(msg.Authority) + if err != nil { + panic(err) + } + return []sdk.AccAddress{accAddr} +} + +// ValidateBasic performs basic checks on a MsgScheduleIBCClientUpgrade. +func (msg *MsgScheduleIBCClientUpgrade) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "string could not be parsed as address: %v", err) + } + + if _, err := UnpackClientState(msg.UpgradedClientState); err != nil { + return err + } + + return msg.Plan.ValidateBasic() +} diff --git a/modules/core/02-client/types/msgs_test.go b/modules/core/02-client/types/msgs_test.go index b200524221f..cfcfed88c4c 100644 --- a/modules/core/02-client/types/msgs_test.go +++ b/modules/core/02-client/types/msgs_test.go @@ -1,6 +1,7 @@ package types_test import ( + "errors" "testing" "time" @@ -8,10 +9,15 @@ import ( "github.com/stretchr/testify/require" testifysuite "github.com/stretchr/testify/suite" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" + ibcerrors "github.com/cosmos/ibc-go/v7/modules/core/errors" + "github.com/cosmos/ibc-go/v7/modules/core/exported" solomachine "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine" ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" ibctesting "github.com/cosmos/ibc-go/v7/testing" @@ -678,3 +684,155 @@ func TestMsgUpdateParamsGetSigners(t *testing.T) { } } } + +// TestMsgScheduleIBCClientUpgrade_NewMsgScheduleIBCClientUpgrade tests NewMsgScheduleIBCClientUpgrade +func (suite *TypesTestSuite) TestMsgScheduleIBCClientUpgrade_NewMsgScheduleIBCClientUpgrade() { + testCases := []struct { + name string + upgradedClientState exported.ClientState + expPass bool + }{ + { + "success", + ibctm.NewClientState(suite.chainA.ChainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath), + true, + }, + { + "fail: failed to pack ClientState", + nil, + false, + }, + } + + for _, tc := range testCases { + plan := upgradetypes.Plan{ + Name: "upgrade IBC clients", + Height: 1000, + } + _, err := types.NewMsgScheduleIBCClientUpgrade( + ibctesting.TestAccAddress, + plan, + tc.upgradedClientState, + ) + + if tc.expPass { + suite.Require().NoError(err) + } else { + suite.Require().True(errors.Is(err, ibcerrors.ErrPackAny)) + } + } +} + +// TestMsgScheduleIBCClientUpgrade_GetSigners tests GetSigners for MsgScheduleIBCClientUpgrade +func (suite *TypesTestSuite) TestMsgScheduleIBCClientUpgrade_GetSigners() { + testCases := []struct { + name string + address sdk.AccAddress + expPass bool + }{ + { + "success: valid address", + sdk.AccAddress(ibctesting.TestAccAddress), + true, + }, + { + "failure: nil address", + nil, + false, + }, + } + + for _, tc := range testCases { + clientState := ibctm.NewClientState(suite.chainA.ChainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath) + plan := upgradetypes.Plan{ + Name: "upgrade IBC clients", + Height: 1000, + } + msg, err := types.NewMsgScheduleIBCClientUpgrade( + tc.address.String(), + plan, + clientState, + ) + suite.Require().NoError(err) + + if tc.expPass { + suite.Require().Equal([]sdk.AccAddress{tc.address}, msg.GetSigners()) + } else { + suite.Require().Panics(func() { msg.GetSigners() }) + } + } +} + +// TestMsgScheduleIBCClientUpgrade_ValidateBasic tests ValidateBasic for MsgScheduleIBCClientUpgrade +func (suite *TypesTestSuite) TestMsgScheduleIBCClientUpgrade_ValidateBasic() { + var ( + authority string + plan upgradetypes.Plan + anyClient *codectypes.Any + expError error + ) + testCases := []struct { + name string + malleate func() + expPass bool + }{ + { + "success", + func() {}, + true, + }, + { + "failure: invalid authority address", + func() { + authority = "invalid" + expError = ibcerrors.ErrInvalidAddress + }, + false, + }, + { + "failure: error unpacking client state", + func() { + anyClient = &codectypes.Any{} + expError = ibcerrors.ErrUnpackAny + }, + false, + }, + { + "failure: error validating upgrade plan, height is not greater than zero", + func() { + plan.Height = 0 + expError = sdkerrors.ErrInvalidRequest + }, + false, + }, + } + + for _, tc := range testCases { + authority = ibctesting.TestAccAddress + plan = upgradetypes.Plan{ + Name: "upgrade IBC clients", + Height: 1000, + } + upgradedClientState := ibctm.NewClientState(suite.chainA.ChainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath) + var err error + anyClient, err = types.PackClientState(upgradedClientState) + suite.Require().NoError(err) + + tc.malleate() + + msg := types.MsgScheduleIBCClientUpgrade{ + authority, + plan, + anyClient, + } + + err = msg.ValidateBasic() + + if tc.expPass { + suite.Require().NoError(err) + } + if expError != nil { + suite.Require().True(errors.Is(err, expError)) + } + } +} diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index 515304d6e55..942fdbb9193 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -711,19 +711,8 @@ func (k Keeper) UpdateClientParams(goCtx context.Context, msg *clienttypes.MsgUp // ScheduleIBCClientUpgrade defines a rpc handler method for MsgScheduleIBCClientUpgrade. func (k Keeper) ScheduleIBCClientUpgrade(goCtx context.Context, msg *clienttypes.MsgScheduleIBCClientUpgrade) (*clienttypes.MsgScheduleIBCClientUpgradeResponse, error) { - if k.GetAuthority() != msg.Authority { - return nil, errorsmod.Wrapf(ibcerrors.ErrUnauthorized, "expected %s, got %s", k.GetAuthority(), msg.Authority) - } - - ctx := sdk.UnwrapSDKContext(goCtx) - upgradedClientState, err := clienttypes.UnpackClientState(msg.UpgradedClientState) - if err != nil { - return nil, errorsmod.Wrapf(clienttypes.ErrInvalidClientType, "cannot unpack client state: %s", err) - } - - k.ClientKeeper.ScheduleIBCClientUpgrade(ctx, msg.Plan, upgradedClientState) - - return &clienttypes.MsgScheduleIBCClientUpgradeResponse{}, nil + // TODO + return nil, nil } // UpdateConnectionParams defines a rpc handler method for MsgUpdateParams for the 03-connection submodule. diff --git a/modules/core/keeper/msg_server_test.go b/modules/core/keeper/msg_server_test.go index fdcc5f172e4..36d9ebc2cf9 100644 --- a/modules/core/keeper/msg_server_test.go +++ b/modules/core/keeper/msg_server_test.go @@ -826,6 +826,11 @@ func (suite *KeeperTestSuite) TestUpdateClientParams() { } } +// TestScheduleIBCClientUpgrade tests the ScheduleIBCClientUpgrade rpc handler +func (suite *KeeperTestSuite) TestScheduleIBCClientUpgrade() { + // TODO +} + // TestUpdateConnectionParams tests the UpdateConnectionParams rpc handler func (suite *KeeperTestSuite) TestUpdateConnectionParams() { validAuthority := suite.chainA.App.GetIBCKeeper().GetAuthority() From f499db427dc1d1524cad1d883d4dfec1323faccf Mon Sep 17 00:00:00 2001 From: Charly Date: Wed, 23 Aug 2023 15:50:20 +0200 Subject: [PATCH 03/14] fix linter --- modules/core/keeper/msg_server.go | 7 +++---- modules/core/keeper/msg_server_test.go | 5 ++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index 942fdbb9193..5d05c95c865 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -710,10 +710,9 @@ func (k Keeper) UpdateClientParams(goCtx context.Context, msg *clienttypes.MsgUp } // ScheduleIBCClientUpgrade defines a rpc handler method for MsgScheduleIBCClientUpgrade. -func (k Keeper) ScheduleIBCClientUpgrade(goCtx context.Context, msg *clienttypes.MsgScheduleIBCClientUpgrade) (*clienttypes.MsgScheduleIBCClientUpgradeResponse, error) { - // TODO - return nil, nil -} +// func (k Keeper) ScheduleIBCClientUpgrade(goCtx context.Context, msg *clienttypes.MsgScheduleIBCClientUpgrade) (*clienttypes.MsgScheduleIBCClientUpgradeResponse, error) { +// return nil, nil +// } // UpdateConnectionParams defines a rpc handler method for MsgUpdateParams for the 03-connection submodule. func (k Keeper) UpdateConnectionParams(goCtx context.Context, msg *connectiontypes.MsgUpdateParams) (*connectiontypes.MsgUpdateParamsResponse, error) { diff --git a/modules/core/keeper/msg_server_test.go b/modules/core/keeper/msg_server_test.go index 36d9ebc2cf9..8e01beb2246 100644 --- a/modules/core/keeper/msg_server_test.go +++ b/modules/core/keeper/msg_server_test.go @@ -827,9 +827,8 @@ func (suite *KeeperTestSuite) TestUpdateClientParams() { } // TestScheduleIBCClientUpgrade tests the ScheduleIBCClientUpgrade rpc handler -func (suite *KeeperTestSuite) TestScheduleIBCClientUpgrade() { - // TODO -} +// func (suite *KeeperTestSuite) TestScheduleIBCClientUpgrade() { +// } // TestUpdateConnectionParams tests the UpdateConnectionParams rpc handler func (suite *KeeperTestSuite) TestUpdateConnectionParams() { From 59514fe237abaab07dec817183083423b4cf5d4d Mon Sep 17 00:00:00 2001 From: Charly Date: Wed, 23 Aug 2023 16:55:49 +0200 Subject: [PATCH 04/14] bring back msg_server placeholders --- modules/core/keeper/msg_server.go | 7 ++++--- modules/core/keeper/msg_server_test.go | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index 5d05c95c865..942fdbb9193 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -710,9 +710,10 @@ func (k Keeper) UpdateClientParams(goCtx context.Context, msg *clienttypes.MsgUp } // ScheduleIBCClientUpgrade defines a rpc handler method for MsgScheduleIBCClientUpgrade. -// func (k Keeper) ScheduleIBCClientUpgrade(goCtx context.Context, msg *clienttypes.MsgScheduleIBCClientUpgrade) (*clienttypes.MsgScheduleIBCClientUpgradeResponse, error) { -// return nil, nil -// } +func (k Keeper) ScheduleIBCClientUpgrade(goCtx context.Context, msg *clienttypes.MsgScheduleIBCClientUpgrade) (*clienttypes.MsgScheduleIBCClientUpgradeResponse, error) { + // TODO + return nil, nil +} // UpdateConnectionParams defines a rpc handler method for MsgUpdateParams for the 03-connection submodule. func (k Keeper) UpdateConnectionParams(goCtx context.Context, msg *connectiontypes.MsgUpdateParams) (*connectiontypes.MsgUpdateParamsResponse, error) { diff --git a/modules/core/keeper/msg_server_test.go b/modules/core/keeper/msg_server_test.go index 8e01beb2246..1add499a104 100644 --- a/modules/core/keeper/msg_server_test.go +++ b/modules/core/keeper/msg_server_test.go @@ -827,8 +827,8 @@ func (suite *KeeperTestSuite) TestUpdateClientParams() { } // TestScheduleIBCClientUpgrade tests the ScheduleIBCClientUpgrade rpc handler -// func (suite *KeeperTestSuite) TestScheduleIBCClientUpgrade() { -// } +func (suite *KeeperTestSuite) TestScheduleIBCClientUpgrade() { +} // TestUpdateConnectionParams tests the UpdateConnectionParams rpc handler func (suite *KeeperTestSuite) TestUpdateConnectionParams() { From a4922e74b523bbc6ddd4b867ebf64831b0783370 Mon Sep 17 00:00:00 2001 From: Charly Date: Wed, 23 Aug 2023 18:24:04 +0200 Subject: [PATCH 05/14] fix linter --- modules/core/keeper/msg_server.go | 2 +- modules/core/keeper/msg_server_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index 942fdbb9193..30f6a0e74c5 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -710,7 +710,7 @@ func (k Keeper) UpdateClientParams(goCtx context.Context, msg *clienttypes.MsgUp } // ScheduleIBCClientUpgrade defines a rpc handler method for MsgScheduleIBCClientUpgrade. -func (k Keeper) ScheduleIBCClientUpgrade(goCtx context.Context, msg *clienttypes.MsgScheduleIBCClientUpgrade) (*clienttypes.MsgScheduleIBCClientUpgradeResponse, error) { +func (Keeper) ScheduleIBCClientUpgrade(goCtx context.Context, msg *clienttypes.MsgScheduleIBCClientUpgrade) (*clienttypes.MsgScheduleIBCClientUpgradeResponse, error) { // TODO return nil, nil } diff --git a/modules/core/keeper/msg_server_test.go b/modules/core/keeper/msg_server_test.go index 1add499a104..f8415840812 100644 --- a/modules/core/keeper/msg_server_test.go +++ b/modules/core/keeper/msg_server_test.go @@ -827,7 +827,7 @@ func (suite *KeeperTestSuite) TestUpdateClientParams() { } // TestScheduleIBCClientUpgrade tests the ScheduleIBCClientUpgrade rpc handler -func (suite *KeeperTestSuite) TestScheduleIBCClientUpgrade() { +func (*KeeperTestSuite) TestScheduleIBCClientUpgrade() { } // TestUpdateConnectionParams tests the UpdateConnectionParams rpc handler From 70a431f6182dee5bf7a422d1e18a1a35b1058a40 Mon Sep 17 00:00:00 2001 From: Charly Date: Thu, 24 Aug 2023 14:10:21 +0200 Subject: [PATCH 06/14] update msg name, make changes in testing --- modules/core/02-client/keeper/keeper.go | 4 +- modules/core/02-client/keeper/keeper_test.go | 26 ++- modules/core/02-client/types/codec.go | 2 +- modules/core/02-client/types/msgs.go | 14 +- modules/core/02-client/types/msgs_test.go | 36 +-- modules/core/02-client/types/tx.pb.go | 229 +++++++++---------- modules/core/keeper/msg_server.go | 4 +- modules/core/keeper/msg_server_test.go | 4 +- proto/ibc/core/client/v1/tx.proto | 12 +- 9 files changed, 169 insertions(+), 162 deletions(-) diff --git a/modules/core/02-client/keeper/keeper.go b/modules/core/02-client/keeper/keeper.go index 4dfb673ffc5..02baddd5e62 100644 --- a/modules/core/02-client/keeper/keeper.go +++ b/modules/core/02-client/keeper/keeper.go @@ -436,8 +436,8 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { store.Set([]byte(types.ParamsKey), bz) } -// ScheduleIBCClientUpgrade schedules an upgrade for the IBC client. -func (k Keeper) ScheduleIBCClientUpgrade(ctx sdk.Context, plan upgradetypes.Plan, upgradedClientState exported.ClientState) error { +// IBCSoftwareUpgrade schedules an upgrade for the IBC client. +func (k Keeper) IBCSoftwareUpgrade(ctx sdk.Context, plan upgradetypes.Plan, upgradedClientState exported.ClientState) error { // zero out any custom fields before setting cs := upgradedClientState.ZeroCustomFields() bz, err := types.MarshalClientState(k.cdc, cs) diff --git a/modules/core/02-client/keeper/keeper_test.go b/modules/core/02-client/keeper/keeper_test.go index b3bdbe91d47..d8a54a27ca6 100644 --- a/modules/core/02-client/keeper/keeper_test.go +++ b/modules/core/02-client/keeper/keeper_test.go @@ -1,7 +1,6 @@ package keeper_test import ( - "errors" "math/rand" "testing" "time" @@ -487,23 +486,24 @@ func (suite *KeeperTestSuite) TestUnsetParams() { }) } -// TestScheduleIBCClientUpgrade tests that an IBC client upgrade has been properly scheduled -func (suite *KeeperTestSuite) TestScheduleIBCClientUpgrade() { +// TestIBCSoftwareUpgrade tests that an IBC client upgrade has been properly scheduled +func (suite *KeeperTestSuite) TestIBCSoftwareUpgrade() { var ( upgradedClientState *ibctm.ClientState oldPlan, plan upgradetypes.Plan - expError error ) testCases := []struct { name string malleate func() expPass bool + expError error }{ { "valid upgrade proposal", func() {}, true, + nil, }, { "valid upgrade proposal with previous IBC state", func() { @@ -511,15 +511,17 @@ func (suite *KeeperTestSuite) TestScheduleIBCClientUpgrade() { Name: "upgrade IBC clients", Height: 100, } - }, true, + }, + true, + nil, }, { "fail: scheduling upgrade with plan height 0", func() { plan.Height = 0 - expError = sdkerrors.ErrInvalidRequest }, false, + sdkerrors.ErrInvalidRequest, }, } @@ -552,10 +554,10 @@ func (suite *KeeperTestSuite) TestScheduleIBCClientUpgrade() { bz, err := types.MarshalClientState(suite.chainA.App.AppCodec(), upgradedClientState) suite.Require().NoError(err) - suite.chainA.GetSimApp().UpgradeKeeper.SetUpgradedClient(suite.chainA.GetContext(), oldPlan.Height, bz) //nolint:errcheck + suite.Require().NoError(suite.chainA.GetSimApp().UpgradeKeeper.SetUpgradedClient(suite.chainA.GetContext(), oldPlan.Height, bz)) } - err := suite.chainA.App.GetIBCKeeper().ClientKeeper.ScheduleIBCClientUpgrade(suite.chainA.GetContext(), plan, upgradedClientState) + err := suite.chainA.App.GetIBCKeeper().ClientKeeper.IBCSoftwareUpgrade(suite.chainA.GetContext(), plan, upgradedClientState) if tc.expPass { suite.Require().NoError(err) @@ -566,8 +568,9 @@ func (suite *KeeperTestSuite) TestScheduleIBCClientUpgrade() { suite.Require().Equal(plan, storedPlan) // check that old upgraded client state is cleared - _, found = suite.chainA.GetSimApp().UpgradeKeeper.GetUpgradedClient(suite.chainA.GetContext(), oldPlan.Height) + cs, found := suite.chainA.GetSimApp().UpgradeKeeper.GetUpgradedClient(suite.chainA.GetContext(), oldPlan.Height) suite.Require().False(found) + suite.Require().Empty(cs) // check that client state was set storedClientState, found := suite.chainA.GetSimApp().UpgradeKeeper.GetUpgradedClient(suite.chainA.GetContext(), plan.Height) @@ -576,8 +579,6 @@ func (suite *KeeperTestSuite) TestScheduleIBCClientUpgrade() { suite.Require().NoError(err) suite.Require().Equal(upgradedClientState, clientState) } else { - suite.Require().True(errors.Is(err, expError)) - // check that the new plan wasn't stored storedPlan, found := suite.chainA.GetSimApp().UpgradeKeeper.GetUpgradePlan(suite.chainA.GetContext()) if oldPlan.Height != 0 { @@ -591,7 +592,8 @@ func (suite *KeeperTestSuite) TestScheduleIBCClientUpgrade() { } // check that client state was not set - _, found = suite.chainA.GetSimApp().UpgradeKeeper.GetUpgradedClient(suite.chainA.GetContext(), plan.Height) + cs, found := suite.chainA.GetSimApp().UpgradeKeeper.GetUpgradedClient(suite.chainA.GetContext(), plan.Height) + suite.Require().Empty(cs) suite.Require().False(found) } }) diff --git a/modules/core/02-client/types/codec.go b/modules/core/02-client/types/codec.go index 397480e7f39..f937fb8365a 100644 --- a/modules/core/02-client/types/codec.go +++ b/modules/core/02-client/types/codec.go @@ -49,7 +49,7 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { &MsgUpgradeClient{}, &MsgSubmitMisbehaviour{}, &MsgUpdateParams{}, - &MsgScheduleIBCClientUpgrade{}, + &MsgIBCSoftwareUpgrade{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/modules/core/02-client/types/msgs.go b/modules/core/02-client/types/msgs.go index b3ba4b61119..c7470d1931f 100644 --- a/modules/core/02-client/types/msgs.go +++ b/modules/core/02-client/types/msgs.go @@ -285,22 +285,22 @@ func (msg *MsgUpdateParams) ValidateBasic() error { return msg.Params.Validate() } -// NewMsgScheduleIBCClientUpgrade creates a new MsgScheduleIBCClientUpgrade instance -func NewMsgScheduleIBCClientUpgrade(authority string, plan upgradetypes.Plan, upgradedClientState exported.ClientState) (*MsgScheduleIBCClientUpgrade, error) { +// NewMsgIBCSoftwareUpgrade creates a new MsgIBCSoftwareUpgrade instance +func NewMsgIBCSoftwareUpgrade(authority string, plan upgradetypes.Plan, upgradedClientState exported.ClientState) (*MsgIBCSoftwareUpgrade, error) { anyClient, err := PackClientState(upgradedClientState) if err != nil { return nil, err } - return &MsgScheduleIBCClientUpgrade{ + return &MsgIBCSoftwareUpgrade{ Authority: authority, Plan: plan, UpgradedClientState: anyClient, }, nil } -// GetSigners returns the expected signers for a MsgScheduleIBCClientUpgrade message. -func (msg *MsgScheduleIBCClientUpgrade) GetSigners() []sdk.AccAddress { +// GetSigners returns the expected signers for a MsgIBCSoftwareUpgrade message. +func (msg *MsgIBCSoftwareUpgrade) GetSigners() []sdk.AccAddress { accAddr, err := sdk.AccAddressFromBech32(msg.Authority) if err != nil { panic(err) @@ -308,8 +308,8 @@ func (msg *MsgScheduleIBCClientUpgrade) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{accAddr} } -// ValidateBasic performs basic checks on a MsgScheduleIBCClientUpgrade. -func (msg *MsgScheduleIBCClientUpgrade) ValidateBasic() error { +// ValidateBasic performs basic checks on a MsgIBCSoftwareUpgrade. +func (msg *MsgIBCSoftwareUpgrade) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "string could not be parsed as address: %v", err) } diff --git a/modules/core/02-client/types/msgs_test.go b/modules/core/02-client/types/msgs_test.go index cfcfed88c4c..fc89aee0f5c 100644 --- a/modules/core/02-client/types/msgs_test.go +++ b/modules/core/02-client/types/msgs_test.go @@ -685,8 +685,8 @@ func TestMsgUpdateParamsGetSigners(t *testing.T) { } } -// TestMsgScheduleIBCClientUpgrade_NewMsgScheduleIBCClientUpgrade tests NewMsgScheduleIBCClientUpgrade -func (suite *TypesTestSuite) TestMsgScheduleIBCClientUpgrade_NewMsgScheduleIBCClientUpgrade() { +// TestMsgIBCSoftwareUpgrade_NewMsgIBCSoftwareUpgrade tests NewMsgIBCSoftwareUpgrade +func (suite *TypesTestSuite) TestMsgIBCSoftwareUpgrade_NewMsgIBCSoftwareUpgrade() { testCases := []struct { name string upgradedClientState exported.ClientState @@ -709,7 +709,7 @@ func (suite *TypesTestSuite) TestMsgScheduleIBCClientUpgrade_NewMsgScheduleIBCCl Name: "upgrade IBC clients", Height: 1000, } - _, err := types.NewMsgScheduleIBCClientUpgrade( + msg, err := types.NewMsgIBCSoftwareUpgrade( ibctesting.TestAccAddress, plan, tc.upgradedClientState, @@ -717,14 +717,19 @@ func (suite *TypesTestSuite) TestMsgScheduleIBCClientUpgrade_NewMsgScheduleIBCCl if tc.expPass { suite.Require().NoError(err) + suite.Assert().Equal(ibctesting.TestAccAddress, msg.Authority) + suite.Assert().Equal(plan, msg.Plan) + unpackedClientState, err := types.UnpackClientState(msg.UpgradedClientState) + suite.Require().NoError(err) + suite.Assert().Equal(tc.upgradedClientState, unpackedClientState) } else { suite.Require().True(errors.Is(err, ibcerrors.ErrPackAny)) } } } -// TestMsgScheduleIBCClientUpgrade_GetSigners tests GetSigners for MsgScheduleIBCClientUpgrade -func (suite *TypesTestSuite) TestMsgScheduleIBCClientUpgrade_GetSigners() { +// TestMsgIBCSoftwareUpgrade_GetSigners tests GetSigners for MsgIBCSoftwareUpgrade +func (suite *TypesTestSuite) TestMsgIBCSoftwareUpgrade_GetSigners() { testCases := []struct { name string address sdk.AccAddress @@ -748,7 +753,7 @@ func (suite *TypesTestSuite) TestMsgScheduleIBCClientUpgrade_GetSigners() { Name: "upgrade IBC clients", Height: 1000, } - msg, err := types.NewMsgScheduleIBCClientUpgrade( + msg, err := types.NewMsgIBCSoftwareUpgrade( tc.address.String(), plan, clientState, @@ -763,47 +768,48 @@ func (suite *TypesTestSuite) TestMsgScheduleIBCClientUpgrade_GetSigners() { } } -// TestMsgScheduleIBCClientUpgrade_ValidateBasic tests ValidateBasic for MsgScheduleIBCClientUpgrade -func (suite *TypesTestSuite) TestMsgScheduleIBCClientUpgrade_ValidateBasic() { +// TestMsgIBCSoftwareUpgrade_ValidateBasic tests ValidateBasic for MsgIBCSoftwareUpgrade +func (suite *TypesTestSuite) TestMsgIBCSoftwareUpgrade_ValidateBasic() { var ( authority string plan upgradetypes.Plan anyClient *codectypes.Any - expError error ) testCases := []struct { name string malleate func() expPass bool + expError error }{ { "success", func() {}, true, + nil, }, { "failure: invalid authority address", func() { authority = "invalid" - expError = ibcerrors.ErrInvalidAddress }, false, + ibcerrors.ErrInvalidAddress, }, { "failure: error unpacking client state", func() { anyClient = &codectypes.Any{} - expError = ibcerrors.ErrUnpackAny }, false, + ibcerrors.ErrUnpackAny, }, { "failure: error validating upgrade plan, height is not greater than zero", func() { plan.Height = 0 - expError = sdkerrors.ErrInvalidRequest }, false, + sdkerrors.ErrInvalidRequest, }, } @@ -820,7 +826,7 @@ func (suite *TypesTestSuite) TestMsgScheduleIBCClientUpgrade_ValidateBasic() { tc.malleate() - msg := types.MsgScheduleIBCClientUpgrade{ + msg := types.MsgIBCSoftwareUpgrade{ authority, plan, anyClient, @@ -831,8 +837,8 @@ func (suite *TypesTestSuite) TestMsgScheduleIBCClientUpgrade_ValidateBasic() { if tc.expPass { suite.Require().NoError(err) } - if expError != nil { - suite.Require().True(errors.Is(err, expError)) + if tc.expError != nil { + suite.Require().True(errors.Is(err, tc.expError)) } } } diff --git a/modules/core/02-client/types/tx.pb.go b/modules/core/02-client/types/tx.pb.go index 447115a3a55..f0f84dcc735 100644 --- a/modules/core/02-client/types/tx.pb.go +++ b/modules/core/02-client/types/tx.pb.go @@ -281,8 +281,8 @@ func (m *MsgUpgradeClientResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpgradeClientResponse proto.InternalMessageInfo -// MsgScheduleIBCClientUpgrade defines an sdk.Msg to schedule an upgrade of an IBC client using a v1 governance proposal -type MsgScheduleIBCClientUpgrade struct { +// MsgIBCSoftwareUpgrade defines an sdk.Msg to schedule an upgrade of an IBC client using a v1 governance proposal +type MsgIBCSoftwareUpgrade struct { // authority is the address of the governance account. Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` Plan types1.Plan `protobuf:"bytes,2,opt,name=plan,proto3" json:"plan"` @@ -297,18 +297,18 @@ type MsgScheduleIBCClientUpgrade struct { UpgradedClientState *types.Any `protobuf:"bytes,3,opt,name=upgraded_client_state,json=upgradedClientState,proto3" json:"upgraded_client_state,omitempty"` } -func (m *MsgScheduleIBCClientUpgrade) Reset() { *m = MsgScheduleIBCClientUpgrade{} } -func (m *MsgScheduleIBCClientUpgrade) String() string { return proto.CompactTextString(m) } -func (*MsgScheduleIBCClientUpgrade) ProtoMessage() {} -func (*MsgScheduleIBCClientUpgrade) Descriptor() ([]byte, []int) { +func (m *MsgIBCSoftwareUpgrade) Reset() { *m = MsgIBCSoftwareUpgrade{} } +func (m *MsgIBCSoftwareUpgrade) String() string { return proto.CompactTextString(m) } +func (*MsgIBCSoftwareUpgrade) ProtoMessage() {} +func (*MsgIBCSoftwareUpgrade) Descriptor() ([]byte, []int) { return fileDescriptor_cb5dc4651eb49a04, []int{6} } -func (m *MsgScheduleIBCClientUpgrade) XXX_Unmarshal(b []byte) error { +func (m *MsgIBCSoftwareUpgrade) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgScheduleIBCClientUpgrade) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgIBCSoftwareUpgrade) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgScheduleIBCClientUpgrade.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgIBCSoftwareUpgrade.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -318,55 +318,55 @@ func (m *MsgScheduleIBCClientUpgrade) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *MsgScheduleIBCClientUpgrade) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgScheduleIBCClientUpgrade.Merge(m, src) +func (m *MsgIBCSoftwareUpgrade) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgIBCSoftwareUpgrade.Merge(m, src) } -func (m *MsgScheduleIBCClientUpgrade) XXX_Size() int { +func (m *MsgIBCSoftwareUpgrade) XXX_Size() int { return m.Size() } -func (m *MsgScheduleIBCClientUpgrade) XXX_DiscardUnknown() { - xxx_messageInfo_MsgScheduleIBCClientUpgrade.DiscardUnknown(m) +func (m *MsgIBCSoftwareUpgrade) XXX_DiscardUnknown() { + xxx_messageInfo_MsgIBCSoftwareUpgrade.DiscardUnknown(m) } -var xxx_messageInfo_MsgScheduleIBCClientUpgrade proto.InternalMessageInfo +var xxx_messageInfo_MsgIBCSoftwareUpgrade proto.InternalMessageInfo -func (m *MsgScheduleIBCClientUpgrade) GetAuthority() string { +func (m *MsgIBCSoftwareUpgrade) GetAuthority() string { if m != nil { return m.Authority } return "" } -func (m *MsgScheduleIBCClientUpgrade) GetPlan() types1.Plan { +func (m *MsgIBCSoftwareUpgrade) GetPlan() types1.Plan { if m != nil { return m.Plan } return types1.Plan{} } -func (m *MsgScheduleIBCClientUpgrade) GetUpgradedClientState() *types.Any { +func (m *MsgIBCSoftwareUpgrade) GetUpgradedClientState() *types.Any { if m != nil { return m.UpgradedClientState } return nil } -// MsgScheduleIBCClientUpgradeResponse defines the Msg/ScheduleIBCClientUpgrade response type. -type MsgScheduleIBCClientUpgradeResponse struct { +// MsgIBCSoftwareUpgradeResponse defines the Msg/IBCSoftwareUpgrade response type. +type MsgIBCSoftwareUpgradeResponse struct { } -func (m *MsgScheduleIBCClientUpgradeResponse) Reset() { *m = MsgScheduleIBCClientUpgradeResponse{} } -func (m *MsgScheduleIBCClientUpgradeResponse) String() string { return proto.CompactTextString(m) } -func (*MsgScheduleIBCClientUpgradeResponse) ProtoMessage() {} -func (*MsgScheduleIBCClientUpgradeResponse) Descriptor() ([]byte, []int) { +func (m *MsgIBCSoftwareUpgradeResponse) Reset() { *m = MsgIBCSoftwareUpgradeResponse{} } +func (m *MsgIBCSoftwareUpgradeResponse) String() string { return proto.CompactTextString(m) } +func (*MsgIBCSoftwareUpgradeResponse) ProtoMessage() {} +func (*MsgIBCSoftwareUpgradeResponse) Descriptor() ([]byte, []int) { return fileDescriptor_cb5dc4651eb49a04, []int{7} } -func (m *MsgScheduleIBCClientUpgradeResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgIBCSoftwareUpgradeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgScheduleIBCClientUpgradeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgIBCSoftwareUpgradeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgScheduleIBCClientUpgradeResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgIBCSoftwareUpgradeResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -376,17 +376,17 @@ func (m *MsgScheduleIBCClientUpgradeResponse) XXX_Marshal(b []byte, deterministi return b[:n], nil } } -func (m *MsgScheduleIBCClientUpgradeResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgScheduleIBCClientUpgradeResponse.Merge(m, src) +func (m *MsgIBCSoftwareUpgradeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgIBCSoftwareUpgradeResponse.Merge(m, src) } -func (m *MsgScheduleIBCClientUpgradeResponse) XXX_Size() int { +func (m *MsgIBCSoftwareUpgradeResponse) XXX_Size() int { return m.Size() } -func (m *MsgScheduleIBCClientUpgradeResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgScheduleIBCClientUpgradeResponse.DiscardUnknown(m) +func (m *MsgIBCSoftwareUpgradeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgIBCSoftwareUpgradeResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgScheduleIBCClientUpgradeResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgIBCSoftwareUpgradeResponse proto.InternalMessageInfo // MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for // light client misbehaviour. @@ -560,8 +560,8 @@ func init() { proto.RegisterType((*MsgUpdateClientResponse)(nil), "ibc.core.client.v1.MsgUpdateClientResponse") proto.RegisterType((*MsgUpgradeClient)(nil), "ibc.core.client.v1.MsgUpgradeClient") proto.RegisterType((*MsgUpgradeClientResponse)(nil), "ibc.core.client.v1.MsgUpgradeClientResponse") - proto.RegisterType((*MsgScheduleIBCClientUpgrade)(nil), "ibc.core.client.v1.MsgScheduleIBCClientUpgrade") - proto.RegisterType((*MsgScheduleIBCClientUpgradeResponse)(nil), "ibc.core.client.v1.MsgScheduleIBCClientUpgradeResponse") + proto.RegisterType((*MsgIBCSoftwareUpgrade)(nil), "ibc.core.client.v1.MsgIBCSoftwareUpgrade") + proto.RegisterType((*MsgIBCSoftwareUpgradeResponse)(nil), "ibc.core.client.v1.MsgIBCSoftwareUpgradeResponse") proto.RegisterType((*MsgSubmitMisbehaviour)(nil), "ibc.core.client.v1.MsgSubmitMisbehaviour") proto.RegisterType((*MsgSubmitMisbehaviourResponse)(nil), "ibc.core.client.v1.MsgSubmitMisbehaviourResponse") proto.RegisterType((*MsgUpdateParams)(nil), "ibc.core.client.v1.MsgUpdateParams") @@ -571,56 +571,55 @@ func init() { func init() { proto.RegisterFile("ibc/core/client/v1/tx.proto", fileDescriptor_cb5dc4651eb49a04) } var fileDescriptor_cb5dc4651eb49a04 = []byte{ - // 772 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x96, 0xcf, 0x4f, 0xdb, 0x4a, - 0x10, 0xc7, 0x63, 0x7e, 0x44, 0x2f, 0x4b, 0x80, 0xf7, 0xf6, 0x41, 0x09, 0x06, 0x12, 0x14, 0xa8, - 0x44, 0x69, 0xb1, 0x09, 0x95, 0x0a, 0xa2, 0xea, 0x01, 0x72, 0x29, 0x87, 0x48, 0x28, 0xa8, 0x97, - 0x5e, 0x52, 0xdb, 0x59, 0x36, 0x96, 0x62, 0xaf, 0xe5, 0xb5, 0xa3, 0xe6, 0x50, 0xa9, 0xaa, 0x7a, - 0xe8, 0xb1, 0x87, 0x1e, 0xda, 0x5b, 0xff, 0x04, 0xd4, 0xff, 0xa1, 0x12, 0x97, 0x4a, 0x1c, 0x7b, - 0xaa, 0x2a, 0x38, 0xf0, 0x6f, 0x54, 0xf6, 0xae, 0x1d, 0xdb, 0xc4, 0x26, 0xa8, 0x37, 0x7b, 0xe7, - 0x33, 0x3b, 0xdf, 0x99, 0xd9, 0x59, 0x2d, 0x58, 0xd2, 0x55, 0x4d, 0xd6, 0x88, 0x8d, 0x64, 0xad, - 0xab, 0x23, 0xd3, 0x91, 0x7b, 0x35, 0xd9, 0x79, 0x2d, 0x59, 0x36, 0x71, 0x08, 0x84, 0xba, 0xaa, - 0x49, 0x9e, 0x51, 0x62, 0x46, 0xa9, 0x57, 0x13, 0x17, 0x34, 0x42, 0x0d, 0x42, 0x65, 0x83, 0x62, - 0x8f, 0x35, 0x28, 0x66, 0xb0, 0xb8, 0xce, 0x0d, 0xae, 0x85, 0x6d, 0xa5, 0x8d, 0xe4, 0x5e, 0x4d, - 0x45, 0x8e, 0x52, 0x0b, 0xfe, 0x39, 0x35, 0x87, 0x09, 0x26, 0xfe, 0xa7, 0xec, 0x7d, 0xf1, 0xd5, - 0x45, 0x4c, 0x08, 0xee, 0x22, 0xd9, 0xff, 0x53, 0xdd, 0x53, 0x59, 0x31, 0xfb, 0xdc, 0x54, 0x19, - 0x22, 0x90, 0xab, 0xf1, 0x81, 0xea, 0x37, 0x01, 0xcc, 0x36, 0x28, 0xae, 0xdb, 0x48, 0x71, 0x50, - 0xdd, 0xb7, 0xc0, 0x5d, 0x50, 0x64, 0x4c, 0x8b, 0x3a, 0x8a, 0x83, 0x4a, 0xc2, 0xaa, 0xb0, 0x31, - 0xb5, 0x33, 0x27, 0xb1, 0x30, 0x52, 0x10, 0x46, 0x3a, 0x30, 0xfb, 0xcd, 0x29, 0x46, 0x9e, 0x78, - 0x20, 0x7c, 0x06, 0x66, 0x35, 0x62, 0x52, 0x64, 0x52, 0x97, 0x72, 0xdf, 0xb1, 0x0c, 0xdf, 0x99, - 0x10, 0x66, 0xee, 0xf7, 0x40, 0x9e, 0xea, 0xd8, 0x44, 0x76, 0x69, 0x7c, 0x55, 0xd8, 0x28, 0x34, - 0xf9, 0xdf, 0xfe, 0xec, 0x87, 0xaf, 0x95, 0xdc, 0xbb, 0xeb, 0xb3, 0x4d, 0xbe, 0x50, 0x5d, 0x04, - 0x0b, 0x09, 0xcd, 0x4d, 0x44, 0x2d, 0x6f, 0xb3, 0xea, 0x27, 0x96, 0xcf, 0x0b, 0xab, 0x3d, 0xc8, - 0x67, 0x09, 0x14, 0x78, 0x3e, 0x7a, 0xdb, 0x4f, 0xa6, 0xd0, 0xfc, 0x87, 0x2d, 0x1c, 0xb5, 0xe1, - 0x53, 0x30, 0xc3, 0x8d, 0x06, 0xa2, 0x54, 0xc1, 0xd9, 0x92, 0xa7, 0x19, 0xdb, 0x60, 0xe8, 0x5d, - 0x15, 0x47, 0x55, 0x85, 0x8a, 0xbf, 0x8f, 0x81, 0x7f, 0x7d, 0x9b, 0xdf, 0xe8, 0x51, 0x24, 0x27, - 0xfb, 0x33, 0xf6, 0x17, 0xfd, 0x19, 0xbf, 0x43, 0x7f, 0xb6, 0xc1, 0x9c, 0x65, 0x13, 0x72, 0xda, - 0xe2, 0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 0xbb, 0xb2, 0x41, 0xbc, 0xc2, 0x51, 0xf6, 0x52, 0xd8, 0xde, 0xd9, 0xe2, 0x8f, 0x05, 0xa7, 0x6f, - 0x21, 0xaa, 0xe6, 0xfd, 0x81, 0x7f, 0xfc, 0x27, 0x00, 0x00, 0xff, 0xff, 0xb4, 0xf0, 0x1e, 0xb7, - 0xed, 0x08, 0x00, 0x00, + // 761 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x96, 0xbf, 0x4f, 0xdb, 0x4c, + 0x18, 0xc7, 0x63, 0x7e, 0x44, 0x6f, 0x8e, 0x00, 0xef, 0x7b, 0x2f, 0x94, 0x60, 0x20, 0x41, 0x29, + 0x03, 0xa5, 0xc5, 0x26, 0x54, 0x2a, 0x88, 0xaa, 0x03, 0x64, 0x29, 0x43, 0x24, 0x64, 0xd4, 0xa5, + 0x4b, 0x6a, 0x3b, 0x97, 0xc3, 0x52, 0xec, 0xb3, 0x7c, 0x76, 0xda, 0x0c, 0x95, 0xaa, 0x4a, 0x95, + 0x3a, 0x76, 0xe8, 0xd2, 0xad, 0x7f, 0x02, 0xea, 0xff, 0x50, 0x95, 0x91, 0xb1, 0x53, 0x55, 0xc1, + 0xc0, 0xbf, 0x51, 0xd9, 0x77, 0x4e, 0x6c, 0x27, 0x36, 0x41, 0xdd, 0x6c, 0x3f, 0x9f, 0xe7, 0x9e, + 0xef, 0xf3, 0xeb, 0x64, 0xb0, 0x62, 0x68, 0xba, 0xac, 0x13, 0x07, 0xc9, 0x7a, 0xc7, 0x40, 0x96, + 0x2b, 0x77, 0x6b, 0xb2, 0xfb, 0x46, 0xb2, 0x1d, 0xe2, 0x12, 0x08, 0x0d, 0x4d, 0x97, 0x7c, 0xa3, + 0xc4, 0x8c, 0x52, 0xb7, 0x26, 0x2e, 0xe9, 0x84, 0x9a, 0x84, 0xca, 0x26, 0xc5, 0x3e, 0x6b, 0x52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0b, 0x9f, 0xae, 0xcb, 0xb9, 0xcb, 0xeb, 0x72, 0xee, 0xe7, 0x75, 0x39, + 0xf7, 0x72, 0x1f, 0x1b, 0xee, 0x99, 0xa7, 0x49, 0x3a, 0x31, 0x65, 0xfe, 0x33, 0x61, 0x68, 0xfa, + 0x36, 0x26, 0x72, 0x77, 0x4f, 0x36, 0x49, 0xcb, 0xeb, 0x20, 0xca, 0x7e, 0x05, 0x76, 0x76, 0xb7, + 0xf9, 0xdf, 0x80, 0xdb, 0xb3, 0x11, 0xd5, 0xf2, 0xc1, 0x76, 0x3f, 0xfe, 0x13, 0x00, 0x00, 0xff, + 0xff, 0x7b, 0x1f, 0x4f, 0xd6, 0xce, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -641,8 +640,8 @@ type MsgClient interface { UpdateClient(ctx context.Context, in *MsgUpdateClient, opts ...grpc.CallOption) (*MsgUpdateClientResponse, error) // UpgradeClient defines a rpc handler method for MsgUpgradeClient. UpgradeClient(ctx context.Context, in *MsgUpgradeClient, opts ...grpc.CallOption) (*MsgUpgradeClientResponse, error) - // ScheduleIBCClientUpgrade defines a rpc handler method for MsgScheduleIBCClientUpgrade. - ScheduleIBCClientUpgrade(ctx context.Context, in *MsgScheduleIBCClientUpgrade, opts ...grpc.CallOption) (*MsgScheduleIBCClientUpgradeResponse, error) + // IBCSoftwareUpgrade defines a rpc handler method for MsgIBCSoftwareUpgrade. + IBCSoftwareUpgrade(ctx context.Context, in *MsgIBCSoftwareUpgrade, opts ...grpc.CallOption) (*MsgIBCSoftwareUpgradeResponse, error) // SubmitMisbehaviour defines a rpc handler method for MsgSubmitMisbehaviour. SubmitMisbehaviour(ctx context.Context, in *MsgSubmitMisbehaviour, opts ...grpc.CallOption) (*MsgSubmitMisbehaviourResponse, error) // UpdateClientParams defines a rpc handler method for MsgUpdateParams. @@ -684,9 +683,9 @@ func (c *msgClient) UpgradeClient(ctx context.Context, in *MsgUpgradeClient, opt return out, nil } -func (c *msgClient) ScheduleIBCClientUpgrade(ctx context.Context, in *MsgScheduleIBCClientUpgrade, opts ...grpc.CallOption) (*MsgScheduleIBCClientUpgradeResponse, error) { - out := new(MsgScheduleIBCClientUpgradeResponse) - err := c.cc.Invoke(ctx, "/ibc.core.client.v1.Msg/ScheduleIBCClientUpgrade", in, out, opts...) +func (c *msgClient) IBCSoftwareUpgrade(ctx context.Context, in *MsgIBCSoftwareUpgrade, opts ...grpc.CallOption) (*MsgIBCSoftwareUpgradeResponse, error) { + out := new(MsgIBCSoftwareUpgradeResponse) + err := c.cc.Invoke(ctx, "/ibc.core.client.v1.Msg/IBCSoftwareUpgrade", in, out, opts...) if err != nil { return nil, err } @@ -719,8 +718,8 @@ type MsgServer interface { UpdateClient(context.Context, *MsgUpdateClient) (*MsgUpdateClientResponse, error) // UpgradeClient defines a rpc handler method for MsgUpgradeClient. UpgradeClient(context.Context, *MsgUpgradeClient) (*MsgUpgradeClientResponse, error) - // ScheduleIBCClientUpgrade defines a rpc handler method for MsgScheduleIBCClientUpgrade. - ScheduleIBCClientUpgrade(context.Context, *MsgScheduleIBCClientUpgrade) (*MsgScheduleIBCClientUpgradeResponse, error) + // IBCSoftwareUpgrade defines a rpc handler method for MsgIBCSoftwareUpgrade. + IBCSoftwareUpgrade(context.Context, *MsgIBCSoftwareUpgrade) (*MsgIBCSoftwareUpgradeResponse, error) // SubmitMisbehaviour defines a rpc handler method for MsgSubmitMisbehaviour. SubmitMisbehaviour(context.Context, *MsgSubmitMisbehaviour) (*MsgSubmitMisbehaviourResponse, error) // UpdateClientParams defines a rpc handler method for MsgUpdateParams. @@ -740,8 +739,8 @@ func (*UnimplementedMsgServer) UpdateClient(ctx context.Context, req *MsgUpdateC func (*UnimplementedMsgServer) UpgradeClient(ctx context.Context, req *MsgUpgradeClient) (*MsgUpgradeClientResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpgradeClient not implemented") } -func (*UnimplementedMsgServer) ScheduleIBCClientUpgrade(ctx context.Context, req *MsgScheduleIBCClientUpgrade) (*MsgScheduleIBCClientUpgradeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ScheduleIBCClientUpgrade not implemented") +func (*UnimplementedMsgServer) IBCSoftwareUpgrade(ctx context.Context, req *MsgIBCSoftwareUpgrade) (*MsgIBCSoftwareUpgradeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method IBCSoftwareUpgrade not implemented") } func (*UnimplementedMsgServer) SubmitMisbehaviour(ctx context.Context, req *MsgSubmitMisbehaviour) (*MsgSubmitMisbehaviourResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SubmitMisbehaviour not implemented") @@ -808,20 +807,20 @@ func _Msg_UpgradeClient_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } -func _Msg_ScheduleIBCClientUpgrade_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgScheduleIBCClientUpgrade) +func _Msg_IBCSoftwareUpgrade_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgIBCSoftwareUpgrade) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).ScheduleIBCClientUpgrade(ctx, in) + return srv.(MsgServer).IBCSoftwareUpgrade(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ibc.core.client.v1.Msg/ScheduleIBCClientUpgrade", + FullMethod: "/ibc.core.client.v1.Msg/IBCSoftwareUpgrade", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).ScheduleIBCClientUpgrade(ctx, req.(*MsgScheduleIBCClientUpgrade)) + return srv.(MsgServer).IBCSoftwareUpgrade(ctx, req.(*MsgIBCSoftwareUpgrade)) } return interceptor(ctx, in, info, handler) } @@ -879,8 +878,8 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Handler: _Msg_UpgradeClient_Handler, }, { - MethodName: "ScheduleIBCClientUpgrade", - Handler: _Msg_ScheduleIBCClientUpgrade_Handler, + MethodName: "IBCSoftwareUpgrade", + Handler: _Msg_IBCSoftwareUpgrade_Handler, }, { MethodName: "SubmitMisbehaviour", @@ -1142,7 +1141,7 @@ func (m *MsgUpgradeClientResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func (m *MsgScheduleIBCClientUpgrade) Marshal() (dAtA []byte, err error) { +func (m *MsgIBCSoftwareUpgrade) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1152,12 +1151,12 @@ func (m *MsgScheduleIBCClientUpgrade) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgScheduleIBCClientUpgrade) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgIBCSoftwareUpgrade) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgScheduleIBCClientUpgrade) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgIBCSoftwareUpgrade) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1194,7 +1193,7 @@ func (m *MsgScheduleIBCClientUpgrade) MarshalToSizedBuffer(dAtA []byte) (int, er return len(dAtA) - i, nil } -func (m *MsgScheduleIBCClientUpgradeResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgIBCSoftwareUpgradeResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1204,12 +1203,12 @@ func (m *MsgScheduleIBCClientUpgradeResponse) Marshal() (dAtA []byte, err error) return dAtA[:n], nil } -func (m *MsgScheduleIBCClientUpgradeResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgIBCSoftwareUpgradeResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgScheduleIBCClientUpgradeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgIBCSoftwareUpgradeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1465,7 +1464,7 @@ func (m *MsgUpgradeClientResponse) Size() (n int) { return n } -func (m *MsgScheduleIBCClientUpgrade) Size() (n int) { +func (m *MsgIBCSoftwareUpgrade) Size() (n int) { if m == nil { return 0 } @@ -1484,7 +1483,7 @@ func (m *MsgScheduleIBCClientUpgrade) Size() (n int) { return n } -func (m *MsgScheduleIBCClientUpgradeResponse) Size() (n int) { +func (m *MsgIBCSoftwareUpgradeResponse) Size() (n int) { if m == nil { return 0 } @@ -2261,7 +2260,7 @@ func (m *MsgUpgradeClientResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgScheduleIBCClientUpgrade) Unmarshal(dAtA []byte) error { +func (m *MsgIBCSoftwareUpgrade) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2284,10 +2283,10 @@ func (m *MsgScheduleIBCClientUpgrade) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgScheduleIBCClientUpgrade: wiretype end group for non-group") + return fmt.Errorf("proto: MsgIBCSoftwareUpgrade: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgScheduleIBCClientUpgrade: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgIBCSoftwareUpgrade: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2412,7 +2411,7 @@ func (m *MsgScheduleIBCClientUpgrade) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgScheduleIBCClientUpgradeResponse) Unmarshal(dAtA []byte) error { +func (m *MsgIBCSoftwareUpgradeResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2435,10 +2434,10 @@ func (m *MsgScheduleIBCClientUpgradeResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgScheduleIBCClientUpgradeResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgIBCSoftwareUpgradeResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgScheduleIBCClientUpgradeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgIBCSoftwareUpgradeResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index 30f6a0e74c5..d71a3970ba0 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -709,8 +709,8 @@ func (k Keeper) UpdateClientParams(goCtx context.Context, msg *clienttypes.MsgUp return &clienttypes.MsgUpdateParamsResponse{}, nil } -// ScheduleIBCClientUpgrade defines a rpc handler method for MsgScheduleIBCClientUpgrade. -func (Keeper) ScheduleIBCClientUpgrade(goCtx context.Context, msg *clienttypes.MsgScheduleIBCClientUpgrade) (*clienttypes.MsgScheduleIBCClientUpgradeResponse, error) { +// IBCSoftwareUpgrade defines a rpc handler method for MsgIBCSoftwareUpgrade. +func (Keeper) IBCSoftwareUpgrade(goCtx context.Context, msg *clienttypes.MsgIBCSoftwareUpgrade) (*clienttypes.MsgIBCSoftwareUpgradeResponse, error) { // TODO return nil, nil } diff --git a/modules/core/keeper/msg_server_test.go b/modules/core/keeper/msg_server_test.go index f8415840812..a11ded00ee2 100644 --- a/modules/core/keeper/msg_server_test.go +++ b/modules/core/keeper/msg_server_test.go @@ -826,8 +826,8 @@ func (suite *KeeperTestSuite) TestUpdateClientParams() { } } -// TestScheduleIBCClientUpgrade tests the ScheduleIBCClientUpgrade rpc handler -func (*KeeperTestSuite) TestScheduleIBCClientUpgrade() { +// TestIBCSoftwareUpgrade tests the IBCSoftwareUpgrade rpc handler +func (*KeeperTestSuite) TestIBCSoftwareUpgrade() { } // TestUpdateConnectionParams tests the UpdateConnectionParams rpc handler diff --git a/proto/ibc/core/client/v1/tx.proto b/proto/ibc/core/client/v1/tx.proto index 3e57204b707..c88b7a0ed77 100644 --- a/proto/ibc/core/client/v1/tx.proto +++ b/proto/ibc/core/client/v1/tx.proto @@ -23,8 +23,8 @@ service Msg { // UpgradeClient defines a rpc handler method for MsgUpgradeClient. rpc UpgradeClient(MsgUpgradeClient) returns (MsgUpgradeClientResponse); - // ScheduleIBCClientUpgrade defines a rpc handler method for MsgScheduleIBCClientUpgrade. - rpc ScheduleIBCClientUpgrade(MsgScheduleIBCClientUpgrade) returns (MsgScheduleIBCClientUpgradeResponse); + // IBCSoftwareUpgrade defines a rpc handler method for MsgIBCSoftwareUpgrade. + rpc IBCSoftwareUpgrade(MsgIBCSoftwareUpgrade) returns (MsgIBCSoftwareUpgradeResponse); // SubmitMisbehaviour defines a rpc handler method for MsgSubmitMisbehaviour. rpc SubmitMisbehaviour(MsgSubmitMisbehaviour) returns (MsgSubmitMisbehaviourResponse); @@ -94,8 +94,8 @@ message MsgUpgradeClient { // MsgUpgradeClientResponse defines the Msg/UpgradeClient response type. message MsgUpgradeClientResponse {} -// MsgScheduleIBCClientUpgrade defines an sdk.Msg to schedule an upgrade of an IBC client using a v1 governance proposal -message MsgScheduleIBCClientUpgrade { +// MsgIBCSoftwareUpgrade defines an sdk.Msg to schedule an upgrade of an IBC client using a v1 governance proposal +message MsgIBCSoftwareUpgrade { option (cosmos.msg.v1.signer) = "authority"; // authority is the address of the governance account. @@ -113,8 +113,8 @@ message MsgScheduleIBCClientUpgrade { google.protobuf.Any upgraded_client_state = 3; } -// MsgScheduleIBCClientUpgradeResponse defines the Msg/ScheduleIBCClientUpgrade response type. -message MsgScheduleIBCClientUpgradeResponse {} +// MsgIBCSoftwareUpgradeResponse defines the Msg/IBCSoftwareUpgrade response type. +message MsgIBCSoftwareUpgradeResponse {} // MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for // light client misbehaviour. From b2eee553f440290abdb15629095cac85f1f4ba74 Mon Sep 17 00:00:00 2001 From: Charly Date: Mon, 28 Aug 2023 15:48:43 +0200 Subject: [PATCH 07/14] update test bool, method name --- modules/core/02-client/keeper/keeper.go | 4 ++-- modules/core/02-client/keeper/keeper_test.go | 9 +++------ modules/core/02-client/types/msgs_test.go | 8 ++------ 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/modules/core/02-client/keeper/keeper.go b/modules/core/02-client/keeper/keeper.go index 02baddd5e62..03888d74d10 100644 --- a/modules/core/02-client/keeper/keeper.go +++ b/modules/core/02-client/keeper/keeper.go @@ -436,8 +436,8 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { store.Set([]byte(types.ParamsKey), bz) } -// IBCSoftwareUpgrade schedules an upgrade for the IBC client. -func (k Keeper) IBCSoftwareUpgrade(ctx sdk.Context, plan upgradetypes.Plan, upgradedClientState exported.ClientState) error { +// scheduleIBCSoftwareUpgrade schedules an upgrade for the IBC client. +func (k Keeper) ScheduleIBCSoftwareUpgrade(ctx sdk.Context, plan upgradetypes.Plan, upgradedClientState exported.ClientState) error { // zero out any custom fields before setting cs := upgradedClientState.ZeroCustomFields() bz, err := types.MarshalClientState(k.cdc, cs) diff --git a/modules/core/02-client/keeper/keeper_test.go b/modules/core/02-client/keeper/keeper_test.go index d8a54a27ca6..8aee0f7fda0 100644 --- a/modules/core/02-client/keeper/keeper_test.go +++ b/modules/core/02-client/keeper/keeper_test.go @@ -496,13 +496,11 @@ func (suite *KeeperTestSuite) TestIBCSoftwareUpgrade() { testCases := []struct { name string malleate func() - expPass bool expError error }{ { "valid upgrade proposal", func() {}, - true, nil, }, { @@ -512,7 +510,6 @@ func (suite *KeeperTestSuite) TestIBCSoftwareUpgrade() { Height: 100, } }, - true, nil, }, { @@ -520,7 +517,6 @@ func (suite *KeeperTestSuite) TestIBCSoftwareUpgrade() { func() { plan.Height = 0 }, - false, sdkerrors.ErrInvalidRequest, }, } @@ -557,9 +553,10 @@ func (suite *KeeperTestSuite) TestIBCSoftwareUpgrade() { suite.Require().NoError(suite.chainA.GetSimApp().UpgradeKeeper.SetUpgradedClient(suite.chainA.GetContext(), oldPlan.Height, bz)) } - err := suite.chainA.App.GetIBCKeeper().ClientKeeper.IBCSoftwareUpgrade(suite.chainA.GetContext(), plan, upgradedClientState) + err := suite.chainA.App.GetIBCKeeper().ClientKeeper.ScheduleIBCSoftwareUpgrade(suite.chainA.GetContext(), plan, upgradedClientState) + expPass := tc.expError == nil - if tc.expPass { + if expPass { suite.Require().NoError(err) // check that the correct plan is returned diff --git a/modules/core/02-client/types/msgs_test.go b/modules/core/02-client/types/msgs_test.go index fc89aee0f5c..b97badc7d38 100644 --- a/modules/core/02-client/types/msgs_test.go +++ b/modules/core/02-client/types/msgs_test.go @@ -778,13 +778,11 @@ func (suite *TypesTestSuite) TestMsgIBCSoftwareUpgrade_ValidateBasic() { testCases := []struct { name string malleate func() - expPass bool expError error }{ { "success", func() {}, - true, nil, }, { @@ -792,7 +790,6 @@ func (suite *TypesTestSuite) TestMsgIBCSoftwareUpgrade_ValidateBasic() { func() { authority = "invalid" }, - false, ibcerrors.ErrInvalidAddress, }, { @@ -800,7 +797,6 @@ func (suite *TypesTestSuite) TestMsgIBCSoftwareUpgrade_ValidateBasic() { func() { anyClient = &codectypes.Any{} }, - false, ibcerrors.ErrUnpackAny, }, { @@ -808,7 +804,6 @@ func (suite *TypesTestSuite) TestMsgIBCSoftwareUpgrade_ValidateBasic() { func() { plan.Height = 0 }, - false, sdkerrors.ErrInvalidRequest, }, } @@ -833,8 +828,9 @@ func (suite *TypesTestSuite) TestMsgIBCSoftwareUpgrade_ValidateBasic() { } err = msg.ValidateBasic() + expPass := tc.expError == nil - if tc.expPass { + if expPass { suite.Require().NoError(err) } if tc.expError != nil { From 2c94f5ffa24709e65904f40ae909b0bba19cf79c Mon Sep 17 00:00:00 2001 From: Charly Date: Mon, 28 Aug 2023 16:04:01 +0200 Subject: [PATCH 08/14] capitalisation --- modules/core/02-client/keeper/keeper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/core/02-client/keeper/keeper.go b/modules/core/02-client/keeper/keeper.go index 03888d74d10..85cf2984827 100644 --- a/modules/core/02-client/keeper/keeper.go +++ b/modules/core/02-client/keeper/keeper.go @@ -436,7 +436,7 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { store.Set([]byte(types.ParamsKey), bz) } -// scheduleIBCSoftwareUpgrade schedules an upgrade for the IBC client. +// ScheduleIBCSoftwareUpgrade schedules an upgrade for the IBC client. func (k Keeper) ScheduleIBCSoftwareUpgrade(ctx sdk.Context, plan upgradetypes.Plan, upgradedClientState exported.ClientState) error { // zero out any custom fields before setting cs := upgradedClientState.ZeroCustomFields() From 5462ba60b5c897b8458f6c58c59fcf6868133a96 Mon Sep 17 00:00:00 2001 From: Charly Date: Mon, 28 Aug 2023 16:06:58 +0200 Subject: [PATCH 09/14] update testcase --- modules/core/02-client/keeper/keeper_test.go | 3 +-- modules/core/02-client/types/msgs_test.go | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/core/02-client/keeper/keeper_test.go b/modules/core/02-client/keeper/keeper_test.go index 8aee0f7fda0..46edef8d584 100644 --- a/modules/core/02-client/keeper/keeper_test.go +++ b/modules/core/02-client/keeper/keeper_test.go @@ -554,9 +554,8 @@ func (suite *KeeperTestSuite) TestIBCSoftwareUpgrade() { } err := suite.chainA.App.GetIBCKeeper().ClientKeeper.ScheduleIBCSoftwareUpgrade(suite.chainA.GetContext(), plan, upgradedClientState) - expPass := tc.expError == nil - if expPass { + if tc.expError == nil { suite.Require().NoError(err) // check that the correct plan is returned diff --git a/modules/core/02-client/types/msgs_test.go b/modules/core/02-client/types/msgs_test.go index b97badc7d38..06c4d8b7dc3 100644 --- a/modules/core/02-client/types/msgs_test.go +++ b/modules/core/02-client/types/msgs_test.go @@ -828,9 +828,8 @@ func (suite *TypesTestSuite) TestMsgIBCSoftwareUpgrade_ValidateBasic() { } err = msg.ValidateBasic() - expPass := tc.expError == nil - if expPass { + if tc.expError == nil { suite.Require().NoError(err) } if tc.expError != nil { From 776a7ce5a1d0a9487c15a3ab101764d469505dfc Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Tue, 29 Aug 2023 10:36:00 +0200 Subject: [PATCH 10/14] added check that message implements sdk.Msg interface --- modules/core/02-client/types/msgs.go | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/core/02-client/types/msgs.go b/modules/core/02-client/types/msgs.go index c7470d1931f..300a794bbb1 100644 --- a/modules/core/02-client/types/msgs.go +++ b/modules/core/02-client/types/msgs.go @@ -18,6 +18,7 @@ var ( _ sdk.Msg = (*MsgSubmitMisbehaviour)(nil) _ sdk.Msg = (*MsgUpgradeClient)(nil) _ sdk.Msg = (*MsgUpdateParams)(nil) + _ sdk.Msg = (*MsgIBCSoftwareUpgrade)(nil) _ codectypes.UnpackInterfacesMessage = (*MsgCreateClient)(nil) _ codectypes.UnpackInterfacesMessage = (*MsgUpdateClient)(nil) From efa5e43e51a1b5926d4ca768197d58807c50137c Mon Sep 17 00:00:00 2001 From: Charly Date: Tue, 29 Aug 2023 14:25:59 +0200 Subject: [PATCH 11/14] update authority -> signers --- modules/core/02-client/types/msgs.go | 8 +- modules/core/02-client/types/msgs_test.go | 10 +- modules/core/02-client/types/tx.pb.go | 186 +++++++++++----------- proto/ibc/core/client/v1/tx.proto | 12 +- 4 files changed, 107 insertions(+), 109 deletions(-) diff --git a/modules/core/02-client/types/msgs.go b/modules/core/02-client/types/msgs.go index 300a794bbb1..2c76b4b2d62 100644 --- a/modules/core/02-client/types/msgs.go +++ b/modules/core/02-client/types/msgs.go @@ -287,14 +287,14 @@ func (msg *MsgUpdateParams) ValidateBasic() error { } // NewMsgIBCSoftwareUpgrade creates a new MsgIBCSoftwareUpgrade instance -func NewMsgIBCSoftwareUpgrade(authority string, plan upgradetypes.Plan, upgradedClientState exported.ClientState) (*MsgIBCSoftwareUpgrade, error) { +func NewMsgIBCSoftwareUpgrade(signer string, plan upgradetypes.Plan, upgradedClientState exported.ClientState) (*MsgIBCSoftwareUpgrade, error) { anyClient, err := PackClientState(upgradedClientState) if err != nil { return nil, err } return &MsgIBCSoftwareUpgrade{ - Authority: authority, + Signer: signer, Plan: plan, UpgradedClientState: anyClient, }, nil @@ -302,7 +302,7 @@ func NewMsgIBCSoftwareUpgrade(authority string, plan upgradetypes.Plan, upgraded // GetSigners returns the expected signers for a MsgIBCSoftwareUpgrade message. func (msg *MsgIBCSoftwareUpgrade) GetSigners() []sdk.AccAddress { - accAddr, err := sdk.AccAddressFromBech32(msg.Authority) + accAddr, err := sdk.AccAddressFromBech32(msg.Signer) if err != nil { panic(err) } @@ -311,7 +311,7 @@ func (msg *MsgIBCSoftwareUpgrade) GetSigners() []sdk.AccAddress { // ValidateBasic performs basic checks on a MsgIBCSoftwareUpgrade. func (msg *MsgIBCSoftwareUpgrade) ValidateBasic() error { - if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + if _, err := sdk.AccAddressFromBech32(msg.Signer); err != nil { return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "string could not be parsed as address: %v", err) } diff --git a/modules/core/02-client/types/msgs_test.go b/modules/core/02-client/types/msgs_test.go index 06c4d8b7dc3..7456516d30e 100644 --- a/modules/core/02-client/types/msgs_test.go +++ b/modules/core/02-client/types/msgs_test.go @@ -717,7 +717,7 @@ func (suite *TypesTestSuite) TestMsgIBCSoftwareUpgrade_NewMsgIBCSoftwareUpgrade( if tc.expPass { suite.Require().NoError(err) - suite.Assert().Equal(ibctesting.TestAccAddress, msg.Authority) + suite.Assert().Equal(ibctesting.TestAccAddress, msg.Signer) suite.Assert().Equal(plan, msg.Plan) unpackedClientState, err := types.UnpackClientState(msg.UpgradedClientState) suite.Require().NoError(err) @@ -771,7 +771,7 @@ func (suite *TypesTestSuite) TestMsgIBCSoftwareUpgrade_GetSigners() { // TestMsgIBCSoftwareUpgrade_ValidateBasic tests ValidateBasic for MsgIBCSoftwareUpgrade func (suite *TypesTestSuite) TestMsgIBCSoftwareUpgrade_ValidateBasic() { var ( - authority string + signer string plan upgradetypes.Plan anyClient *codectypes.Any ) @@ -788,7 +788,7 @@ func (suite *TypesTestSuite) TestMsgIBCSoftwareUpgrade_ValidateBasic() { { "failure: invalid authority address", func() { - authority = "invalid" + signer = "invalid" }, ibcerrors.ErrInvalidAddress, }, @@ -809,7 +809,7 @@ func (suite *TypesTestSuite) TestMsgIBCSoftwareUpgrade_ValidateBasic() { } for _, tc := range testCases { - authority = ibctesting.TestAccAddress + signer = ibctesting.TestAccAddress plan = upgradetypes.Plan{ Name: "upgrade IBC clients", Height: 1000, @@ -822,9 +822,9 @@ func (suite *TypesTestSuite) TestMsgIBCSoftwareUpgrade_ValidateBasic() { tc.malleate() msg := types.MsgIBCSoftwareUpgrade{ - authority, plan, anyClient, + signer, } err = msg.ValidateBasic() diff --git a/modules/core/02-client/types/tx.pb.go b/modules/core/02-client/types/tx.pb.go index f0f84dcc735..cabd79aa2ba 100644 --- a/modules/core/02-client/types/tx.pb.go +++ b/modules/core/02-client/types/tx.pb.go @@ -283,9 +283,7 @@ var xxx_messageInfo_MsgUpgradeClientResponse proto.InternalMessageInfo // MsgIBCSoftwareUpgrade defines an sdk.Msg to schedule an upgrade of an IBC client using a v1 governance proposal type MsgIBCSoftwareUpgrade struct { - // authority is the address of the governance account. - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - Plan types1.Plan `protobuf:"bytes,2,opt,name=plan,proto3" json:"plan"` + Plan types1.Plan `protobuf:"bytes,1,opt,name=plan,proto3" json:"plan"` // An UpgradedClientState must be provided to perform an IBC breaking upgrade. // This will make the chain commit to the correct upgraded (self) client state // before the upgrade occurs, so that connecting chains can verify that the @@ -294,7 +292,9 @@ type MsgIBCSoftwareUpgrade struct { // planned chain upgrades. Correspondingly, the UpgradedClientState field has been // deprecated in the Cosmos SDK to allow for this logic to exist solely in // the 02-client module. - UpgradedClientState *types.Any `protobuf:"bytes,3,opt,name=upgraded_client_state,json=upgradedClientState,proto3" json:"upgraded_client_state,omitempty"` + UpgradedClientState *types.Any `protobuf:"bytes,2,opt,name=upgraded_client_state,json=upgradedClientState,proto3" json:"upgraded_client_state,omitempty"` + // signer defaults to the governance account address unless otherwise specified. + Signer string `protobuf:"bytes,3,opt,name=signer,proto3" json:"signer,omitempty"` } func (m *MsgIBCSoftwareUpgrade) Reset() { *m = MsgIBCSoftwareUpgrade{} } @@ -330,13 +330,6 @@ func (m *MsgIBCSoftwareUpgrade) XXX_DiscardUnknown() { var xxx_messageInfo_MsgIBCSoftwareUpgrade proto.InternalMessageInfo -func (m *MsgIBCSoftwareUpgrade) GetAuthority() string { - if m != nil { - return m.Authority - } - return "" -} - func (m *MsgIBCSoftwareUpgrade) GetPlan() types1.Plan { if m != nil { return m.Plan @@ -351,6 +344,13 @@ func (m *MsgIBCSoftwareUpgrade) GetUpgradedClientState() *types.Any { return nil } +func (m *MsgIBCSoftwareUpgrade) GetSigner() string { + if m != nil { + return m.Signer + } + return "" +} + // MsgIBCSoftwareUpgradeResponse defines the Msg/IBCSoftwareUpgrade response type. type MsgIBCSoftwareUpgradeResponse struct { } @@ -571,55 +571,55 @@ func init() { func init() { proto.RegisterFile("ibc/core/client/v1/tx.proto", fileDescriptor_cb5dc4651eb49a04) } var fileDescriptor_cb5dc4651eb49a04 = []byte{ - // 761 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x96, 0xbf, 0x4f, 0xdb, 0x4c, - 0x18, 0xc7, 0x63, 0x7e, 0x44, 0x6f, 0x8e, 0x00, 0xef, 0x7b, 0x2f, 0x94, 0x60, 0x20, 0x41, 0x29, - 0x03, 0xa5, 0xc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, 0x0c, 0x5f, 0x81, 0x62, 0xec, 0xae, 0xbc, 0x3f, - 0x2a, 0x60, 0xe2, 0x72, 0x12, 0x1f, 0x8e, 0x01, 0x85, 0x91, 0xfc, 0x08, 0xb1, 0xdb, 0x2b, 0x2d, - 0x42, 0x14, 0x4a, 0x8d, 0x30, 0xea, 0xc6, 0x81, 0x3a, 0x98, 0x8d, 0xaf, 0xe9, 0x46, 0xaa, 0x77, - 0x84, 0x12, 0x1f, 0x8d, 0x43, 0xf5, 0x83, 0x38, 0x00, 0x8e, 0x58, 0xb7, 0x07, 0x29, 0x67, 0x0c, - 0xa3, 0x62, 0x6d, 0x6c, 0x34, 0x1a, 0x73, 0xc4, 0xdc, 0xa7, 0xc5, 0x1c, 0x46, 0x53, 0x63, 0xa6, - 0x8f, 0x2c, 0x6c, 0x03, 0x18, 0x2d, 0x32, 0x9f, 0xda, 0xec, 0xa6, 0x31, 0xe8, 0x96, 0xa6, 0xc5, - 0x07, 0x50, 0x9c, 0x7e, 0x77, 0x73, 0xbe, 0x25, 0x1c, 0x29, 0x17, 0x57, 0x65, 0xe1, 0xf2, 0xaa, - 0x2c, 0xfc, 0xbe, 0x2a, 0x0b, 0x9f, 0xae, 0xcb, 0xb9, 0xcb, 0xeb, 0x72, 0xee, 0xe7, 0x75, 0x39, - 0xf7, 0x72, 0x1f, 0x1b, 0xee, 0x99, 0xa7, 0x49, 0x3a, 0x31, 0x65, 0xfe, 0x33, 0x61, 0x68, 0xfa, - 0x36, 0x26, 0x72, 0x77, 0x4f, 0x36, 0x49, 0xcb, 0xeb, 0x20, 0xca, 0x7e, 0x05, 0x76, 0x76, 0xb7, - 0xf9, 0xdf, 0x80, 0xdb, 0xb3, 0x11, 0xd5, 0xf2, 0xc1, 0x76, 0x3f, 0xfe, 0x13, 0x00, 0x00, 0xff, - 0xff, 0x7b, 0x1f, 0x4f, 0xd6, 0xce, 0x08, 0x00, 0x00, + // 757 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x96, 0x3f, 0x4f, 0xdb, 0x4e, + 0x18, 0xc7, 0x63, 0xfe, 0x44, 0xbf, 0x1c, 0x01, 0x7e, 0xbd, 0x42, 0x09, 0x06, 0x12, 0x44, 0x19, + 0x28, 0x2d, 0x36, 0xa1, 0x52, 0x41, 0x54, 0x1d, 0x20, 0x4b, 0x19, 0x22, 0xa1, 0xa0, 0x2e, 0x5d, + 0xd2, 0xb3, 0x73, 0x39, 0x2c, 0xc5, 0x3e, 0xcb, 0x77, 0x4e, 0x9b, 0xa1, 0x52, 0x55, 0xa9, 0x52, + 0xc7, 0x0e, 0x5d, 0xba, 0xf5, 0x25, 0xa0, 0xbe, 0x80, 0x6e, 0x95, 0x18, 0x19, 0x3b, 0x55, 0x15, + 0x0c, 0xbc, 0x8d, 0x2a, 0xbe, 0x73, 0xb0, 0x9d, 0x38, 0x0d, 0xea, 0x66, 0xdf, 0xf3, 0x79, 0xee, + 0xf9, 0x3e, 0xf7, 0x3c, 0xcf, 0xe9, 0xc0, 0x92, 0x65, 0x98, 0xba, 0x49, 0x3d, 0xac, 0x9b, 0x2d, + 0x0b, 0x3b, 0x5c, 0x6f, 0x97, 0x75, 0xfe, 0x46, 0x73, 0x3d, 0xca, 0x29, 0x84, 0x96, 0x61, 0x6a, + 0x5d, 0xa3, 0x26, 0x8c, 0x5a, 0xbb, 0xac, 0x2e, 0x98, 0x94, 0xd9, 0x94, 0xe9, 0x36, 0x23, 0x5d, + 0xd6, 0x66, 0x44, 0xc0, 0xea, 0xba, 0x34, 0xf8, 0x2e, 0xf1, 0x50, 0x03, 0xeb, 0xed, 0xb2, 0x81, + 0x39, 0x2a, 0x87, 0xff, 0x92, 0x9a, 0x23, 0x94, 0xd0, 0xe0, 0x53, 0xef, 0x7e, 0xc9, 0xd5, 0x45, + 0x42, 0x29, 0x69, 0x61, 0x3d, 0xf8, 0x33, 0xfc, 0xa6, 0x8e, 0x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02, 0x78, 0xc7, + 0xc5, 0xcc, 0xc8, 0x06, 0xd3, 0xfd, 0xf8, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xca, 0x3a, 0xc3, + 0x9a, 0xc5, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1161,6 +1161,13 @@ func (m *MsgIBCSoftwareUpgrade) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- + dAtA[i] = 0x1a + } if m.UpgradedClientState != nil { { size, err := m.UpgradedClientState.MarshalToSizedBuffer(dAtA[:i]) @@ -1171,7 +1178,7 @@ func (m *MsgIBCSoftwareUpgrade) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 } { size, err := m.Plan.MarshalToSizedBuffer(dAtA[:i]) @@ -1182,14 +1189,7 @@ func (m *MsgIBCSoftwareUpgrade) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - if len(m.Authority) > 0 { - i -= len(m.Authority) - copy(dAtA[i:], m.Authority) - i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) - i-- - dAtA[i] = 0xa - } + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -1470,16 +1470,16 @@ func (m *MsgIBCSoftwareUpgrade) Size() (n int) { } var l int _ = l - l = len(m.Authority) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } l = m.Plan.Size() n += 1 + l + sovTx(uint64(l)) if m.UpgradedClientState != nil { l = m.UpgradedClientState.Size() n += 1 + l + sovTx(uint64(l)) } + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -2291,9 +2291,9 @@ func (m *MsgIBCSoftwareUpgrade) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Plan", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2303,27 +2303,28 @@ func (m *MsgIBCSoftwareUpgrade) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Authority = string(dAtA[iNdEx:postIndex]) + if err := m.Plan.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Plan", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field UpgradedClientState", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2350,15 +2351,18 @@ func (m *MsgIBCSoftwareUpgrade) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Plan.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.UpgradedClientState == nil { + m.UpgradedClientState = &types.Any{} + } + if err := m.UpgradedClientState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UpgradedClientState", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2368,27 +2372,23 @@ func (m *MsgIBCSoftwareUpgrade) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - if m.UpgradedClientState == nil { - m.UpgradedClientState = &types.Any{} - } - if err := m.UpgradedClientState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Signer = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/proto/ibc/core/client/v1/tx.proto b/proto/ibc/core/client/v1/tx.proto index c88b7a0ed77..3f02c1a496d 100644 --- a/proto/ibc/core/client/v1/tx.proto +++ b/proto/ibc/core/client/v1/tx.proto @@ -96,12 +96,8 @@ message MsgUpgradeClientResponse {} // MsgIBCSoftwareUpgrade defines an sdk.Msg to schedule an upgrade of an IBC client using a v1 governance proposal message MsgIBCSoftwareUpgrade { - option (cosmos.msg.v1.signer) = "authority"; - - // authority is the address of the governance account. - string authority = 1; - cosmos.upgrade.v1beta1.Plan plan = 2 [(gogoproto.nullable) = false]; - + option (cosmos.msg.v1.signer) = "signer"; + cosmos.upgrade.v1beta1.Plan plan = 1 [(gogoproto.nullable) = false]; // An UpgradedClientState must be provided to perform an IBC breaking upgrade. // This will make the chain commit to the correct upgraded (self) client state // before the upgrade occurs, so that connecting chains can verify that the @@ -110,7 +106,9 @@ message MsgIBCSoftwareUpgrade { // planned chain upgrades. Correspondingly, the UpgradedClientState field has been // deprecated in the Cosmos SDK to allow for this logic to exist solely in // the 02-client module. - google.protobuf.Any upgraded_client_state = 3; + google.protobuf.Any upgraded_client_state = 2; + // signer defaults to the governance account address unless otherwise specified. + string signer = 3; } // MsgIBCSoftwareUpgradeResponse defines the Msg/IBCSoftwareUpgrade response type. From 77a27205cd1ccfa94dbef9ec59e86e2bb3bd292c Mon Sep 17 00:00:00 2001 From: Charly Date: Tue, 29 Aug 2023 14:53:57 +0200 Subject: [PATCH 12/14] fix merge conflicts --- modules/core/02-client/types/msgs.go | 68 ++++++++++++++++++++++- modules/core/02-client/types/msgs_test.go | 8 --- 2 files changed, 67 insertions(+), 9 deletions(-) diff --git a/modules/core/02-client/types/msgs.go b/modules/core/02-client/types/msgs.go index 10d030e2785..44ac45263bb 100644 --- a/modules/core/02-client/types/msgs.go +++ b/modules/core/02-client/types/msgs.go @@ -18,8 +18,8 @@ var ( _ sdk.Msg = (*MsgSubmitMisbehaviour)(nil) _ sdk.Msg = (*MsgUpgradeClient)(nil) _ sdk.Msg = (*MsgUpdateParams)(nil) - _ sdk.Msg = (*MsgRecoverClient)(nil) _ sdk.Msg = (*MsgIBCSoftwareUpgrade)(nil) + _ sdk.Msg = (*MsgRecoverClient)(nil) _ codectypes.UnpackInterfacesMessage = (*MsgCreateClient)(nil) _ codectypes.UnpackInterfacesMessage = (*MsgUpdateClient)(nil) @@ -286,3 +286,69 @@ func (msg *MsgUpdateParams) ValidateBasic() error { } return msg.Params.Validate() } + +// NewMsgIBCSoftwareUpgrade creates a new MsgIBCSoftwareUpgrade instance +func NewMsgIBCSoftwareUpgrade(signer string, plan upgradetypes.Plan, upgradedClientState exported.ClientState) (*MsgIBCSoftwareUpgrade, error) { + anyClient, err := PackClientState(upgradedClientState) + if err != nil { + return nil, err + } + + return &MsgIBCSoftwareUpgrade{ + Signer: signer, + Plan: plan, + UpgradedClientState: anyClient, + }, nil +} + +// ValidateBasic performs basic checks on a MsgIBCSoftwareUpgrade. +func (msg *MsgIBCSoftwareUpgrade) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Signer); err != nil { + return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "string could not be parsed as address: %v", err) + } + if _, err := UnpackClientState(msg.UpgradedClientState); err != nil { + return err + } + + return msg.Plan.ValidateBasic() +} + +// GetSigners returns the expected signers for a MsgIBCSoftwareUpgrade message. +func (msg *MsgIBCSoftwareUpgrade) GetSigners() []sdk.AccAddress { + accAddr, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + panic(err) + } + return []sdk.AccAddress{accAddr} +} + +// NewMsgRecoverClient creates a new MsgRecoverClient instance +func NewMsgRecoverClient(signer, subjectClientID, substituteClientID string) *MsgRecoverClient { + return &MsgRecoverClient{ + Signer: signer, + SubjectClientId: subjectClientID, + SubstituteClientId: substituteClientID, + } +} + +// ValidateBasic performs basic checks on a MsgRecoverClient. +func (msg *MsgRecoverClient) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Signer); err != nil { + return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "string could not be parsed as address: %v", err) + } + + if err := host.ClientIdentifierValidator(msg.SubjectClientId); err != nil { + return err + } + + return host.ClientIdentifierValidator(msg.SubstituteClientId) +} + +// GetSigners returns the expected signers for a MsgRecoverClient message. +func (msg *MsgRecoverClient) GetSigners() []sdk.AccAddress { + accAddr, err := sdk.AccAddressFromBech32(msg.Signer) + if err != nil { + panic(err) + } + return []sdk.AccAddress{accAddr} +} diff --git a/modules/core/02-client/types/msgs_test.go b/modules/core/02-client/types/msgs_test.go index bd2408f2889..b200524221f 100644 --- a/modules/core/02-client/types/msgs_test.go +++ b/modules/core/02-client/types/msgs_test.go @@ -1,7 +1,6 @@ package types_test import ( - "errors" "testing" "time" @@ -9,17 +8,10 @@ import ( "github.com/stretchr/testify/require" testifysuite "github.com/stretchr/testify/suite" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" - host "github.com/cosmos/ibc-go/v7/modules/core/24-host" - ibcerrors "github.com/cosmos/ibc-go/v7/modules/core/errors" - ibcerrors "github.com/cosmos/ibc-go/v7/modules/core/errors" - "github.com/cosmos/ibc-go/v7/modules/core/exported" solomachine "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine" ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" ibctesting "github.com/cosmos/ibc-go/v7/testing" From c418302c9e40c9dc45b7abce3df851170d502c57 Mon Sep 17 00:00:00 2001 From: Charly Date: Tue, 29 Aug 2023 15:16:06 +0200 Subject: [PATCH 13/14] fix merge shenanigans --- modules/core/02-client/types/msgs_test.go | 171 ++++++++++++++++++++++ 1 file changed, 171 insertions(+) diff --git a/modules/core/02-client/types/msgs_test.go b/modules/core/02-client/types/msgs_test.go index b200524221f..af6ad66d976 100644 --- a/modules/core/02-client/types/msgs_test.go +++ b/modules/core/02-client/types/msgs_test.go @@ -1,6 +1,7 @@ package types_test import ( + "errors" "testing" "time" @@ -9,9 +10,13 @@ import ( testifysuite "github.com/stretchr/testify/suite" sdk "github.com/cosmos/cosmos-sdk/types" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" + host "github.com/cosmos/ibc-go/v7/modules/core/24-host" + ibcerrors "github.com/cosmos/ibc-go/v7/modules/core/errors" + "github.com/cosmos/ibc-go/v7/modules/core/exported" solomachine "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine" ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" ibctesting "github.com/cosmos/ibc-go/v7/testing" @@ -678,3 +683,169 @@ func TestMsgUpdateParamsGetSigners(t *testing.T) { } } } + +// TestMsgRecoverClientValidateBasic tests ValidateBasic for MsgRecoverClient +func (suite *TypesTestSuite) TestMsgRecoverClientValidateBasic() { + var msg *types.MsgRecoverClient + + testCases := []struct { + name string + malleate func() + expError error + }{ + { + "success: valid signer and client identifiers", + func() {}, + nil, + }, + { + "failure: invalid signer address", + func() { + msg.Signer = "invalid" + }, + ibcerrors.ErrInvalidAddress, + }, + { + "failure: invalid subject client ID", + func() { + msg.SubjectClientId = "" + }, + host.ErrInvalidID, + }, + { + "failure: invalid substitute client ID", + func() { + msg.SubjectClientId = "" + }, + host.ErrInvalidID, + }, + } + + for _, tc := range testCases { + msg = types.NewMsgRecoverClient( + ibctesting.TestAccAddress, + ibctesting.FirstClientID, + ibctesting.FirstClientID, + ) + + tc.malleate() + + err := msg.ValidateBasic() + expPass := tc.expError == nil + if expPass { + suite.Require().NoError(err, "valid case %s failed", tc.name) + } else { + suite.Require().Error(err, "invalid case %s passed", tc.name) + suite.Require().ErrorIs(err, tc.expError, "invalid case %s passed", tc.name) + } + } +} + +// TestMsgRecoverClientGetSigners tests GetSigners for MsgRecoverClient +func TestMsgRecoverClientGetSigners(t *testing.T) { + testCases := []struct { + name string + address sdk.AccAddress + expPass bool + }{ + {"success: valid address", sdk.AccAddress(ibctesting.TestAccAddress), true}, + {"failure: nil address", nil, false}, + } + + for _, tc := range testCases { + // Leave subject client ID and substitute client ID as empty strings + msg := types.MsgRecoverClient{ + Signer: tc.address.String(), + } + if tc.expPass { + require.Equal(t, []sdk.AccAddress{tc.address}, msg.GetSigners()) + } else { + require.Panics(t, func() { + msg.GetSigners() + }) + } + } +} + +// TestMsgIBCSoftwareUpgrade_NewMsgIBCSoftwareUpgrade tests NewMsgIBCSoftwareUpgrade +func (suite *TypesTestSuite) TestMsgIBCSoftwareUpgrade_NewMsgIBCSoftwareUpgrade() { + testCases := []struct { + name string + upgradedClientState exported.ClientState + expPass bool + }{ + { + "success", + ibctm.NewClientState(suite.chainA.ChainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath), + true, + }, + { + "fail: failed to pack ClientState", + nil, + false, + }, + } + + for _, tc := range testCases { + plan := upgradetypes.Plan{ + Name: "upgrade IBC clients", + Height: 1000, + } + msg, err := types.NewMsgIBCSoftwareUpgrade( + ibctesting.TestAccAddress, + plan, + tc.upgradedClientState, + ) + + if tc.expPass { + suite.Require().NoError(err) + suite.Assert().Equal(ibctesting.TestAccAddress, msg.Signer) + suite.Assert().Equal(plan, msg.Plan) + unpackedClientState, err := types.UnpackClientState(msg.UpgradedClientState) + suite.Require().NoError(err) + suite.Assert().Equal(tc.upgradedClientState, unpackedClientState) + } else { + suite.Require().True(errors.Is(err, ibcerrors.ErrPackAny)) + } + } +} + +// TestMsgIBCSoftwareUpgrade_GetSigners tests GetSigners for MsgIBCSoftwareUpgrade +func (suite *TypesTestSuite) TestMsgIBCSoftwareUpgrade_GetSigners() { + testCases := []struct { + name string + address sdk.AccAddress + expPass bool + }{ + { + "success: valid address", + sdk.AccAddress(ibctesting.TestAccAddress), + true, + }, + { + "failure: nil address", + nil, + false, + }, + } + + for _, tc := range testCases { + clientState := ibctm.NewClientState(suite.chainA.ChainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath) + plan := upgradetypes.Plan{ + Name: "upgrade IBC clients", + Height: 1000, + } + msg, err := types.NewMsgIBCSoftwareUpgrade( + tc.address.String(), + plan, + clientState, + ) + suite.Require().NoError(err) + + if tc.expPass { + suite.Require().Equal([]sdk.AccAddress{tc.address}, msg.GetSigners()) + } else { + suite.Require().Panics(func() { msg.GetSigners() }) + } + } +} From 4cad82844296ae2baade1fa3ec14746c08266977 Mon Sep 17 00:00:00 2001 From: Charly Date: Tue, 29 Aug 2023 15:20:41 +0200 Subject: [PATCH 14/14] add check for tm client type --- modules/core/02-client/types/msgs.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/core/02-client/types/msgs.go b/modules/core/02-client/types/msgs.go index 44ac45263bb..f0894736ae7 100644 --- a/modules/core/02-client/types/msgs.go +++ b/modules/core/02-client/types/msgs.go @@ -306,10 +306,17 @@ func (msg *MsgIBCSoftwareUpgrade) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(msg.Signer); err != nil { return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "string could not be parsed as address: %v", err) } - if _, err := UnpackClientState(msg.UpgradedClientState); err != nil { + + clientState, err := UnpackClientState(msg.UpgradedClientState) + if err != nil { return err } + // for the time being, we should implicitly be on tendermint when using ibc-go + if clientState.ClientType() != exported.Tendermint { + return errorsmod.Wrapf(ErrInvalidUpgradeClient, "upgraded client state must be a Tendermint client") + } + return msg.Plan.ValidateBasic() }