From 51417eebc53c8da8f5e5f925f50b18b0165ba84d Mon Sep 17 00:00:00 2001 From: Jim Fasarakis-Hilliard Date: Tue, 29 Aug 2023 12:39:31 +0300 Subject: [PATCH 01/34] Add proto message, implement sdk.Msg for Recover Client. (#4494) * Add proto message for Recover client, implement sdk.Message interface. * Update modules/core/02-client/types/msgs.go Co-authored-by: Damian Nolan * Apply suggestions from code review Co-authored-by: Charly * Remove gogoproto false for cmp, lint, move ibctesting address inline. --------- Co-authored-by: Damian Nolan Co-authored-by: Charly --- modules/core/02-client/types/codec.go | 1 + modules/core/02-client/types/msgs.go | 32 ++ modules/core/02-client/types/msgs_test.go | 85 ++++ modules/core/02-client/types/tx.pb.go | 503 ++++++++++++++++++++-- modules/core/keeper/msg_server.go | 5 + proto/ibc/core/client/v1/tx.proto | 22 +- 6 files changed, 605 insertions(+), 43 deletions(-) diff --git a/modules/core/02-client/types/codec.go b/modules/core/02-client/types/codec.go index c71caaede98..dbe5b036c20 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{}, + &MsgRecoverClient{}, ) 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..b854155fdb6 100644 --- a/modules/core/02-client/types/msgs.go +++ b/modules/core/02-client/types/msgs.go @@ -17,6 +17,7 @@ var ( _ sdk.Msg = (*MsgSubmitMisbehaviour)(nil) _ sdk.Msg = (*MsgUpgradeClient)(nil) _ sdk.Msg = (*MsgUpdateParams)(nil) + _ sdk.Msg = (*MsgRecoverClient)(nil) _ codectypes.UnpackInterfacesMessage = (*MsgCreateClient)(nil) _ codectypes.UnpackInterfacesMessage = (*MsgUpdateClient)(nil) @@ -283,3 +284,34 @@ func (msg *MsgUpdateParams) ValidateBasic() error { } return msg.Params.Validate() } + +// NewMsgRecoverClient creates a new MsgRecoverClient instance +func NewMsgRecoverClient(signer, subjectClientID, substituteClientID string) *MsgRecoverClient { + return &MsgRecoverClient{ + Signer: signer, + SubjectClientId: subjectClientID, + SubstituteClientId: 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} +} + +// 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) +} diff --git a/modules/core/02-client/types/msgs_test.go b/modules/core/02-client/types/msgs_test.go index b200524221f..03fc09b59b9 100644 --- a/modules/core/02-client/types/msgs_test.go +++ b/modules/core/02-client/types/msgs_test.go @@ -12,6 +12,8 @@ import ( "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" 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 +680,86 @@ 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() + }) + } + } +} diff --git a/modules/core/02-client/types/tx.pb.go b/modules/core/02-client/types/tx.pb.go index b7bda73776a..d52b6bb51f5 100644 --- a/modules/core/02-client/types/tx.pb.go +++ b/modules/core/02-client/types/tx.pb.go @@ -445,6 +445,87 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo +// MsgRecoverClient defines the sdk.Msg type to recover a client. +type MsgRecoverClient struct { + // signer address (it may be the the address that controls the module, which defaults to x/gov unless overwritten). + Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` + // the client identifier for the client to be updated if the proposal passes + SubjectClientId string `protobuf:"bytes,2,opt,name=subject_client_id,json=subjectClientId,proto3" json:"subject_client_id,omitempty"` + // the substitute client identifier for the client standing in for the subject + // client + SubstituteClientId string `protobuf:"bytes,3,opt,name=substitute_client_id,json=substituteClientId,proto3" json:"substitute_client_id,omitempty"` +} + +func (m *MsgRecoverClient) Reset() { *m = MsgRecoverClient{} } +func (m *MsgRecoverClient) String() string { return proto.CompactTextString(m) } +func (*MsgRecoverClient) ProtoMessage() {} +func (*MsgRecoverClient) Descriptor() ([]byte, []int) { + return fileDescriptor_cb5dc4651eb49a04, []int{10} +} +func (m *MsgRecoverClient) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRecoverClient) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRecoverClient.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 *MsgRecoverClient) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRecoverClient.Merge(m, src) +} +func (m *MsgRecoverClient) XXX_Size() int { + return m.Size() +} +func (m *MsgRecoverClient) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRecoverClient.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRecoverClient proto.InternalMessageInfo + +// MsgRecoverClientResponse defines the MsgRecoverClient response type. +type MsgRecoverClientResponse struct { +} + +func (m *MsgRecoverClientResponse) Reset() { *m = MsgRecoverClientResponse{} } +func (m *MsgRecoverClientResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRecoverClientResponse) ProtoMessage() {} +func (*MsgRecoverClientResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_cb5dc4651eb49a04, []int{11} +} +func (m *MsgRecoverClientResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRecoverClientResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRecoverClientResponse.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 *MsgRecoverClientResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRecoverClientResponse.Merge(m, src) +} +func (m *MsgRecoverClientResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRecoverClientResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRecoverClientResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRecoverClientResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgCreateClient)(nil), "ibc.core.client.v1.MsgCreateClient") proto.RegisterType((*MsgCreateClientResponse)(nil), "ibc.core.client.v1.MsgCreateClientResponse") @@ -456,53 +537,60 @@ func init() { proto.RegisterType((*MsgSubmitMisbehaviourResponse)(nil), "ibc.core.client.v1.MsgSubmitMisbehaviourResponse") proto.RegisterType((*MsgUpdateParams)(nil), "ibc.core.client.v1.MsgUpdateParams") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "ibc.core.client.v1.MsgUpdateParamsResponse") + proto.RegisterType((*MsgRecoverClient)(nil), "ibc.core.client.v1.MsgRecoverClient") + proto.RegisterType((*MsgRecoverClientResponse)(nil), "ibc.core.client.v1.MsgRecoverClientResponse") } 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, 0xe8, 0xdb, - 0x40, 0xf6, 0x5d, 0x1c, 0xdb, 0x8d, 0x4d, 0x2a, 0x36, 0xfb, 0x9e, 0xcf, 0x73, 0xdf, 0xef, 0xf3, - 0xf8, 0x39, 0x1f, 0xd8, 0x36, 0x75, 0x43, 0x31, 0x88, 0x8b, 0x14, 0xa3, 0x6f, 0x22, 0xdb, 0x53, - 0x06, 0x75, 0xc5, 0x7b, 0x2b, 0x3b, 0x2e, 0xf1, 0x08, 0x84, 0xa6, 0x6e, 0xc8, 0x41, 0x50, 0x66, - 0x41, 0x79, 0x50, 0x17, 0x37, 0x0d, 0x42, 0x2d, 0x42, 0x15, 0x8b, 0xe2, 0x80, 0xb5, 0x28, 0x66, - 0xb0, 0xb8, 0x81, 0x09, 0x26, 0xe1, 0xa3, 0x12, 0x3c, 0xf1, 0xd5, 0x2d, 0x4c, 0x08, 0xee, 0x23, - 0x25, 0x7c, 0xd3, 0xfd, 0xae, 0xa2, 0xd9, 0x43, 0x1e, 0xaa, 0xce, 0x90, 0xe6, 0x3a, 0x21, 0x50, - 0xfb, 0x2e, 0x80, 0xf5, 0x16, 0xc5, 0x67, 0x2e, 0xd2, 0x3c, 0x74, 0x16, 0x46, 0xe0, 0x11, 0x28, - 0x33, 0xa6, 0x4d, 0x3d, 0xcd, 0x43, 0x15, 0x61, 0x57, 0xd8, 0x5b, 0x69, 0x6c, 0xc8, 0x4c, 0x46, - 0x9e, 0xc8, 0xc8, 0x27, 0xf6, 0x50, 0x5d, 0x61, 0xe4, 0x79, 0x00, 0xc2, 0xe7, 0x60, 0xdd, 0x20, - 0x36, 0x45, 0x36, 0xf5, 0x29, 0xcf, 0x5d, 0xc8, 0xc9, 0x5d, 0x8b, 0x60, 0x96, 0x7e, 0x0f, 0x14, - 0xa9, 0x89, 0x6d, 0xe4, 0x56, 0x16, 0x77, 0x85, 0xbd, 0x92, 0xca, 0xdf, 0x8e, 0xd7, 0x3f, 0x7e, - 0xab, 0x16, 0x3e, 0x5c, 0x5f, 0xec, 0xf3, 0x85, 0xda, 0x16, 0xd8, 0x4c, 0x79, 0x56, 0x11, 0x75, - 0x82, 0xcd, 0x6a, 0x5f, 0x58, 0x3d, 0xaf, 0x9c, 0xce, 0xb4, 0x9e, 0x6d, 0x50, 0xe2, 0xf5, 0x98, - 0x9d, 0xb0, 0x98, 0x92, 0xfa, 0x1f, 0x5b, 0x78, 0xd1, 0x81, 0xcf, 0xc0, 0x1a, 0x0f, 0x5a, 0x88, - 0x52, 0x0d, 0xe7, 0x5b, 0x5e, 0x65, 0x6c, 0x8b, 0xa1, 0xb7, 0x75, 0x1c, 0x77, 0x15, 0x39, 0xfe, - 0xb1, 0x00, 0xfe, 0x0f, 0x63, 0xd8, 0xd5, 0x3a, 0x73, 0x59, 0x4e, 0x7f, 0x9f, 0x85, 0x7f, 0xf8, - 0x3e, 0x8b, 0xb7, 0xf8, 0x3e, 0x87, 0x60, 0xc3, 0x71, 0x09, 0xe9, 0xb6, 0x7d, 0xe6, 0xb5, 0xcd, - 0xf6, 0xae, 0x2c, 0xed, 0x0a, 0x7b, 0x65, 0x15, 0x86, 0xb1, 0x64, 0x19, 0x27, 0x60, 0x27, 0x95, - 0x91, 0x92, 0x5f, 0x0e, 0x53, 0xc5, 0x44, 0x6a, 0xd6, 0x50, 0x14, 0xf3, 0x5b, 0x2c, 0x82, 0x4a, - 0xba, 0x8d, 0x51, 0x8f, 0xbf, 0x0a, 0xe0, 0x6e, 0x8b, 0xe2, 0x73, 0x5f, 0xb7, 0x4c, 0xaf, 0x65, - 0x52, 0x1d, 0xf5, 0xb4, 0x81, 0x49, 0x7c, 0x37, 0xbf, 0xd1, 0x4d, 0x50, 0xb6, 0x62, 0x70, 0x6e, - 0xa3, 0x13, 0x64, 0xe6, 0x60, 0xdc, 0x49, 0xb9, 0xae, 0x08, 0xb5, 0x2a, 0xd8, 0x99, 0x69, 0x2d, - 0x32, 0xff, 0x2e, 0x36, 0xd1, 0x2f, 0x35, 0x57, 0xb3, 0x28, 0xbc, 0x0f, 0x4a, 0x9a, 0xef, 0xf5, - 0x88, 0x6b, 0x7a, 0x43, 0xee, 0x7a, 0xba, 0x00, 0x9b, 0xa0, 0xe8, 0x84, 0x1c, 0x37, 0x2c, 0xca, - 0x37, 0xff, 0x31, 0x32, 0xdb, 0xe9, 0x74, 0xe9, 0xf2, 0x57, 0xb5, 0xa0, 0x72, 0xfe, 0x18, 0x4e, - 0xec, 0x4d, 0x77, 0x4b, 0x8c, 0x2e, 0x4b, 0x9a, 0x38, 0x6b, 0x7c, 0x5e, 0x02, 0x8b, 0x2d, 0x8a, - 0xe1, 0x1b, 0x50, 0x4e, 0xfc, 0x40, 0x1e, 0xcc, 0x12, 0x4c, 0x9d, 0x58, 0xf1, 0xf1, 0x1c, 0xd0, - 0x44, 0x29, 0x50, 0x48, 0x1c, 0xe9, 0x2c, 0x85, 0x38, 0x94, 0xa9, 0x30, 0xeb, 0x18, 0x42, 0x03, - 0xac, 0x26, 0x67, 0xf7, 0x61, 0x66, 0x76, 0x8c, 0x12, 0x9f, 0xcc, 0x43, 0x45, 0x22, 0x2e, 0x80, - 0x33, 0x66, 0xf0, 0x51, 0xc6, 0x1e, 0x37, 0x51, 0xb1, 0x3e, 0x37, 0x1a, 0x69, 0x76, 0x01, 0x8c, - 0x17, 0xcc, 0x27, 0x28, 0xbf, 0x81, 0x0c, 0xfa, 0x4b, 0x03, 0x93, 0xc3, 0x20, 0x2e, 0xbf, 0xbf, - 0xbe, 0xd8, 0x17, 0x4e, 0xd5, 0xcb, 0x91, 0x24, 0x5c, 0x8d, 0x24, 0xe1, 0xf7, 0x48, 0x12, 0x3e, - 0x8d, 0xa5, 0xc2, 0xd5, 0x58, 0x2a, 0xfc, 0x1c, 0x4b, 0x85, 0xd7, 0x4d, 0x6c, 0x7a, 0x3d, 0x5f, - 0x97, 0x0d, 0x62, 0x29, 0xfc, 0x82, 0x33, 0x75, 0xe3, 0x00, 0x13, 0x65, 0x70, 0xa4, 0x58, 0xa4, - 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, + // 738 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x96, 0x31, 0x6f, 0xd3, 0x40, + 0x14, 0xc7, 0x73, 0x69, 0x1b, 0x91, 0x6b, 0xda, 0xd0, 0x23, 0xd0, 0xd4, 0xa5, 0x49, 0x15, 0x18, + 0x4a, 0xa1, 0x76, 0x5b, 0x86, 0x56, 0x45, 0x0c, 0x6d, 0x27, 0x86, 0x48, 0xc8, 0x15, 0x0b, 0x4b, + 0xb0, 0x9d, 0xeb, 0xd5, 0xa8, 0xce, 0x45, 0xbe, 0x73, 0x44, 0x06, 0x24, 0xc4, 0xc4, 0xc8, 0xc0, + 0xc2, 0x80, 0xc4, 0x47, 0xa8, 0xf8, 0x0e, 0x48, 0x1d, 0x3b, 0x32, 0x21, 0xd4, 0x0e, 0xe5, 0x13, + 0x30, 0x23, 0xfb, 0x2e, 0x8e, 0xed, 0xda, 0x21, 0x15, 0x5b, 0x7c, 0xef, 0xf7, 0xee, 0xfd, 0xdf, + 0xff, 0x9e, 0xcf, 0x81, 0x8b, 0xb6, 0x69, 0x69, 0x16, 0x75, 0xb1, 0x66, 0x1d, 0xdb, 0xb8, 0xc3, + 0xb5, 0xde, 0x86, 0xc6, 0xdf, 0xa8, 0x5d, 0x97, 0x72, 0x8a, 0x90, 0x6d, 0x5a, 0xaa, 0x1f, 0x54, + 0x45, 0x50, 0xed, 0x6d, 0x28, 0xf3, 0x16, 0x65, 0x0e, 0x65, 0x9a, 0xc3, 0x88, 0xcf, 0x3a, 0x8c, + 0x08, 0x58, 0xa9, 0x10, 0x4a, 0x68, 0xf0, 0x53, 0xf3, 0x7f, 0xc9, 0xd5, 0x05, 0x42, 0x29, 0x39, + 0xc6, 0x5a, 0xf0, 0x64, 0x7a, 0x87, 0x9a, 0xd1, 0xe9, 0xcb, 0x50, 0x3d, 0xa5, 0xb4, 0xac, 0x13, + 0x00, 0x8d, 0x6f, 0x00, 0x96, 0x9b, 0x8c, 0xec, 0xbb, 0xd8, 0xe0, 0x78, 0x3f, 0x88, 0xa0, 0x2d, + 0x58, 0x12, 0x4c, 0x8b, 0x71, 0x83, 0xe3, 0x2a, 0x58, 0x06, 0x2b, 0xd3, 0x9b, 0x15, 0x55, 0x94, + 0x51, 0x07, 0x65, 0xd4, 0xdd, 0x4e, 0x5f, 0x9f, 0x16, 0xe4, 0x81, 0x0f, 0xa2, 0xa7, 0xb0, 0x6c, + 0xd1, 0x0e, 0xc3, 0x1d, 0xe6, 0x31, 0x99, 0x9b, 0x1f, 0x91, 0x3b, 0x1b, 0xc2, 0x22, 0xfd, 0x0e, + 0x2c, 0x30, 0x9b, 0x74, 0xb0, 0x5b, 0x9d, 0x58, 0x06, 0x2b, 0x45, 0x5d, 0x3e, 0xed, 0x94, 0x3f, + 0x7c, 0xad, 0xe7, 0xde, 0x5f, 0x9e, 0xac, 0xca, 0x85, 0xc6, 0x02, 0x9c, 0x4f, 0x68, 0xd6, 0x31, + 0xeb, 0xfa, 0x9b, 0x35, 0x3e, 0x89, 0x7e, 0x5e, 0x74, 0xdb, 0xc3, 0x7e, 0x16, 0x61, 0x51, 0xf6, + 0x63, 0xb7, 0x83, 0x66, 0x8a, 0xfa, 0x0d, 0xb1, 0xf0, 0xac, 0x8d, 0x9e, 0xc0, 0x59, 0x19, 0x74, + 0x30, 0x63, 0x06, 0x19, 0x2d, 0x79, 0x46, 0xb0, 0x4d, 0x81, 0x5e, 0x57, 0x71, 0x54, 0x55, 0xa8, + 0xf8, 0x7b, 0x1e, 0xde, 0x0c, 0x62, 0xc4, 0x35, 0xda, 0x63, 0x49, 0x4e, 0x9e, 0x4f, 0xfe, 0x3f, + 0xce, 0x67, 0xe2, 0x1a, 0xe7, 0xb3, 0x0e, 0x2b, 0x5d, 0x97, 0xd2, 0xc3, 0x96, 0x27, 0xb4, 0xb6, + 0xc4, 0xde, 0xd5, 0xc9, 0x65, 0xb0, 0x52, 0xd2, 0x51, 0x10, 0x8b, 0xb7, 0xb1, 0x0b, 0x97, 0x12, + 0x19, 0x89, 0xf2, 0x53, 0x41, 0xaa, 0x12, 0x4b, 0xcd, 0x1a, 0x8a, 0xc2, 0x68, 0x8b, 0x15, 0x58, + 0x4d, 0xda, 0x18, 0x7a, 0xfc, 0x19, 0xc0, 0xdb, 0x4d, 0x46, 0x0e, 0x3c, 0xd3, 0xb1, 0x79, 0xd3, + 0x66, 0x26, 0x3e, 0x32, 0x7a, 0x36, 0xf5, 0xdc, 0xd1, 0x46, 0x6f, 0xc3, 0x92, 0x13, 0x81, 0x47, + 0x1a, 0x1d, 0x23, 0x33, 0x07, 0x63, 0x2e, 0xa1, 0xba, 0x0a, 0x1a, 0x75, 0xb8, 0x94, 0x2a, 0x2d, + 0x14, 0xff, 0x36, 0x32, 0xd1, 0xcf, 0x0d, 0xd7, 0x70, 0x18, 0xba, 0x0b, 0x8b, 0x86, 0xc7, 0x8f, + 0xa8, 0x6b, 0xf3, 0xbe, 0x54, 0x3d, 0x5c, 0x40, 0xdb, 0xb0, 0xd0, 0x0d, 0x38, 0x29, 0x58, 0x51, + 0xaf, 0xde, 0x31, 0xaa, 0xd8, 0x69, 0x6f, 0xf2, 0xf4, 0x67, 0x3d, 0xa7, 0x4b, 0x7e, 0x07, 0x0d, + 0xe4, 0x0d, 0x77, 0x8b, 0x8d, 0xae, 0x48, 0x0a, 0x95, 0x7d, 0x01, 0xc1, 0xe8, 0xea, 0xd8, 0xa2, + 0x3d, 0xec, 0xca, 0x33, 0x1f, 0xb6, 0x0e, 0xa2, 0xad, 0xa3, 0x55, 0x38, 0xc7, 0x3c, 0xf3, 0x35, + 0xb6, 0x78, 0x6b, 0xe8, 0x78, 0x3e, 0x40, 0xca, 0x32, 0xb0, 0x3f, 0x30, 0x7e, 0x1d, 0x56, 0x98, + 0x67, 0x32, 0x6e, 0x73, 0x8f, 0xe3, 0x08, 0x2e, 0xcc, 0x44, 0xc3, 0xd8, 0x20, 0x63, 0xe7, 0x96, + 0xaf, 0xfc, 0x77, 0xea, 0x48, 0xc4, 0xe4, 0x0d, 0xb4, 0x6f, 0xfe, 0x99, 0x84, 0x13, 0x4d, 0x46, + 0xd0, 0x2b, 0x58, 0x8a, 0x5d, 0x7e, 0xf7, 0xd2, 0xcc, 0x4a, 0xdc, 0x36, 0xca, 0xc3, 0x31, 0xa0, + 0x41, 0x25, 0xbf, 0x42, 0xec, 0x3a, 0xca, 0xaa, 0x10, 0x85, 0x32, 0x2b, 0xa4, 0x5d, 0x21, 0xc8, + 0x82, 0x33, 0xf1, 0xf7, 0xee, 0x7e, 0x66, 0x76, 0x84, 0x52, 0x1e, 0x8d, 0x43, 0x85, 0x45, 0x5c, + 0x88, 0x52, 0xde, 0x9f, 0x07, 0x19, 0x7b, 0x5c, 0x45, 0x95, 0x8d, 0xb1, 0xd1, 0xb0, 0xe6, 0x21, + 0x44, 0xd1, 0x86, 0xe5, 0xf4, 0x8f, 0x36, 0x50, 0x40, 0xff, 0x30, 0x30, 0x3e, 0xc8, 0xbe, 0x81, + 0xf1, 0x21, 0xce, 0x32, 0x30, 0x46, 0x65, 0x1a, 0x98, 0x3a, 0x71, 0xca, 0xd4, 0xbb, 0xcb, 0x93, + 0x55, 0xb0, 0xa7, 0x9f, 0x9e, 0xd7, 0xc0, 0xd9, 0x79, 0x0d, 0xfc, 0x3a, 0xaf, 0x81, 0x8f, 0x17, + 0xb5, 0xdc, 0xd9, 0x45, 0x2d, 0xf7, 0xe3, 0xa2, 0x96, 0x7b, 0xb9, 0x4d, 0x6c, 0x7e, 0xe4, 0x99, + 0xaa, 0x45, 0x1d, 0x4d, 0xfe, 0x03, 0xb0, 0x4d, 0x6b, 0x8d, 0x50, 0xad, 0xb7, 0xa5, 0x39, 0xb4, + 0xed, 0x1d, 0x63, 0x26, 0x3e, 0xe6, 0xeb, 0x9b, 0x6b, 0xf2, 0x7b, 0xce, 0xfb, 0x5d, 0xcc, 0xcc, + 0x42, 0x70, 0x15, 0x3d, 0xfe, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x35, 0xf8, 0xa6, 0x5f, 0x6a, 0x08, 0x00, 0x00, } @@ -528,6 +616,8 @@ type MsgClient interface { SubmitMisbehaviour(ctx context.Context, in *MsgSubmitMisbehaviour, opts ...grpc.CallOption) (*MsgSubmitMisbehaviourResponse, error) // UpdateClientParams defines a rpc handler method for MsgUpdateParams. UpdateClientParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + // Recover defines a rpc handler method for MsgRecoverClient. + RecoverClient(ctx context.Context, in *MsgRecoverClient, opts ...grpc.CallOption) (*MsgRecoverClientResponse, error) } type msgClient struct { @@ -583,6 +673,15 @@ func (c *msgClient) UpdateClientParams(ctx context.Context, in *MsgUpdateParams, return out, nil } +func (c *msgClient) RecoverClient(ctx context.Context, in *MsgRecoverClient, opts ...grpc.CallOption) (*MsgRecoverClientResponse, error) { + out := new(MsgRecoverClientResponse) + err := c.cc.Invoke(ctx, "/ibc.core.client.v1.Msg/RecoverClient", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // CreateClient defines a rpc handler method for MsgCreateClient. @@ -595,6 +694,8 @@ type MsgServer interface { SubmitMisbehaviour(context.Context, *MsgSubmitMisbehaviour) (*MsgSubmitMisbehaviourResponse, error) // UpdateClientParams defines a rpc handler method for MsgUpdateParams. UpdateClientParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + // Recover defines a rpc handler method for MsgRecoverClient. + RecoverClient(context.Context, *MsgRecoverClient) (*MsgRecoverClientResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -616,6 +717,9 @@ func (*UnimplementedMsgServer) SubmitMisbehaviour(ctx context.Context, req *MsgS func (*UnimplementedMsgServer) UpdateClientParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateClientParams not implemented") } +func (*UnimplementedMsgServer) RecoverClient(ctx context.Context, req *MsgRecoverClient) (*MsgRecoverClientResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RecoverClient not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -711,6 +815,24 @@ func _Msg_UpdateClientParams_Handler(srv interface{}, ctx context.Context, dec f return interceptor(ctx, in, info, handler) } +func _Msg_RecoverClient_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRecoverClient) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RecoverClient(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ibc.core.client.v1.Msg/RecoverClient", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RecoverClient(ctx, req.(*MsgRecoverClient)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "ibc.core.client.v1.Msg", HandlerType: (*MsgServer)(nil), @@ -735,6 +857,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateClientParams", Handler: _Msg_UpdateClientParams_Handler, }, + { + MethodName: "RecoverClient", + Handler: _Msg_RecoverClient_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "ibc/core/client/v1/tx.proto", @@ -1122,6 +1248,73 @@ func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *MsgRecoverClient) 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 *MsgRecoverClient) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRecoverClient) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.SubstituteClientId) > 0 { + i -= len(m.SubstituteClientId) + copy(dAtA[i:], m.SubstituteClientId) + i = encodeVarintTx(dAtA, i, uint64(len(m.SubstituteClientId))) + i-- + dAtA[i] = 0x1a + } + if len(m.SubjectClientId) > 0 { + i -= len(m.SubjectClientId) + copy(dAtA[i:], m.SubjectClientId) + i = encodeVarintTx(dAtA, i, uint64(len(m.SubjectClientId))) + i-- + dAtA[i] = 0x12 + } + 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] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRecoverClientResponse) 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 *MsgRecoverClientResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRecoverClientResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -1289,6 +1482,36 @@ func (m *MsgUpdateParamsResponse) Size() (n int) { return n } +func (m *MsgRecoverClient) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.SubjectClientId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.SubstituteClientId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRecoverClientResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2368,6 +2591,202 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgRecoverClient) 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: MsgRecoverClient: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRecoverClient: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", 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.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubjectClientId", 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.SubjectClientId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubstituteClientId", 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.SubstituteClientId = string(dAtA[iNdEx:postIndex]) + 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 *MsgRecoverClientResponse) 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: MsgRecoverClientResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRecoverClientResponse: 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 skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index 02e41a0ab83..8e2fae23a8c 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -100,6 +100,11 @@ func (k Keeper) SubmitMisbehaviour(goCtx context.Context, msg *clienttypes.MsgSu return &clienttypes.MsgSubmitMisbehaviourResponse{}, nil } +// RecoverClient defines a rpc handler method for MsgRecoverClient. +func (k Keeper) RecoverClient(goCtx context.Context, msg *clienttypes.MsgRecoverClient) (*clienttypes.MsgRecoverClientResponse, error) { //nolint:revive + return &clienttypes.MsgRecoverClientResponse{}, nil +} + // ConnectionOpenInit defines a rpc handler method for MsgConnectionOpenInit. func (k Keeper) ConnectionOpenInit(goCtx context.Context, msg *connectiontypes.MsgConnectionOpenInit) (*connectiontypes.MsgConnectionOpenInitResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) diff --git a/proto/ibc/core/client/v1/tx.proto b/proto/ibc/core/client/v1/tx.proto index 76efcc7e7b1..bb96ac2c70c 100644 --- a/proto/ibc/core/client/v1/tx.proto +++ b/proto/ibc/core/client/v1/tx.proto @@ -27,6 +27,9 @@ service Msg { // UpdateClientParams defines a rpc handler method for MsgUpdateParams. rpc UpdateClientParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + + // RecoverClient defines a rpc handler method for MsgRecoverClient. + rpc RecoverClient(MsgRecoverClient) returns (MsgRecoverClientResponse); } // MsgCreateClient defines a message to create an IBC client @@ -127,4 +130,21 @@ message MsgUpdateParams { } // MsgUpdateParamsResponse defines the MsgUpdateParams response type. -message MsgUpdateParamsResponse {} \ No newline at end of file +message MsgUpdateParamsResponse {} + +// MsgRecoverClient defines the sdk.Msg type to recover a client. +message MsgRecoverClient { + option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "signer"; + + // signer address (it may be the the address that controls the module, which defaults to x/gov unless overwritten). + string signer = 1; + // the client identifier for the client to be updated if the proposal passes + string subject_client_id = 2; + // the substitute client identifier for the client which will replace the subject + // client + string substitute_client_id = 3; +} + +// MsgRecoverClientResponse defines the MsgRecoverClient response type. +message MsgRecoverClientResponse {} \ No newline at end of file From 35909f6eec4062a01a1961ee6bc17d2a994e579b Mon Sep 17 00:00:00 2001 From: Charly Date: Tue, 29 Aug 2023 16:07:56 +0200 Subject: [PATCH 02/34] add protos, msgs, keeper handler to upgrade clients using v1 governance proposals (#4436) * add protos and keeper function placeholder * add keeper functions/tests, msgs and tests --- modules/core/02-client/keeper/keeper.go | 25 + modules/core/02-client/keeper/keeper_test.go | 112 +++++ modules/core/02-client/types/codec.go | 1 + modules/core/02-client/types/msgs.go | 60 ++- modules/core/02-client/types/msgs_test.go | 86 ++++ modules/core/02-client/types/tx.pb.go | 460 ++++++++++++++++++- modules/core/keeper/msg_server.go | 6 + modules/core/keeper/msg_server_test.go | 4 + proto/ibc/core/client/v1/tx.proto | 24 + 9 files changed, 766 insertions(+), 12 deletions(-) diff --git a/modules/core/02-client/keeper/keeper.go b/modules/core/02-client/keeper/keeper.go index 3588b117f8c..85cf2984827 100644 --- a/modules/core/02-client/keeper/keeper.go +++ b/modules/core/02-client/keeper/keeper.go @@ -435,3 +435,28 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { bz := k.cdc.MustMarshal(¶ms) store.Set([]byte(types.ParamsKey), bz) } + +// 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) + 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..46edef8d584 100644 --- a/modules/core/02-client/keeper/keeper_test.go +++ b/modules/core/02-client/keeper/keeper_test.go @@ -12,7 +12,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 +485,113 @@ func (suite *KeeperTestSuite) TestUnsetParams() { suite.chainA.GetSimApp().IBCKeeper.ClientKeeper.GetParams(ctx) }) } + +// TestIBCSoftwareUpgrade tests that an IBC client upgrade has been properly scheduled +func (suite *KeeperTestSuite) TestIBCSoftwareUpgrade() { + var ( + upgradedClientState *ibctm.ClientState + oldPlan, plan upgradetypes.Plan + ) + + testCases := []struct { + name string + malleate func() + expError error + }{ + { + "valid upgrade proposal", + func() {}, + nil, + }, + { + "valid upgrade proposal with previous IBC state", func() { + oldPlan = upgradetypes.Plan{ + Name: "upgrade IBC clients", + Height: 100, + } + }, + nil, + }, + { + "fail: scheduling upgrade with plan height 0", + func() { + plan.Height = 0 + }, + sdkerrors.ErrInvalidRequest, + }, + } + + 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.Require().NoError(suite.chainA.GetSimApp().UpgradeKeeper.SetUpgradedClient(suite.chainA.GetContext(), oldPlan.Height, bz)) + } + + err := suite.chainA.App.GetIBCKeeper().ClientKeeper.ScheduleIBCSoftwareUpgrade(suite.chainA.GetContext(), plan, upgradedClientState) + + if tc.expError == nil { + 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 + 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) + suite.Require().True(found) + clientState, err := types.UnmarshalClientState(suite.chainA.App.AppCodec(), storedClientState) + suite.Require().NoError(err) + suite.Require().Equal(upgradedClientState, clientState) + } else { + // 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 + 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 dbe5b036c20..e7250824d82 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{}, + &MsgIBCSoftwareUpgrade{}, &MsgRecoverClient{}, ) diff --git a/modules/core/02-client/types/msgs.go b/modules/core/02-client/types/msgs.go index b854155fdb6..f0894736ae7 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" @@ -17,6 +18,7 @@ var ( _ sdk.Msg = (*MsgSubmitMisbehaviour)(nil) _ sdk.Msg = (*MsgUpgradeClient)(nil) _ sdk.Msg = (*MsgUpdateParams)(nil) + _ sdk.Msg = (*MsgIBCSoftwareUpgrade)(nil) _ sdk.Msg = (*MsgRecoverClient)(nil) _ codectypes.UnpackInterfacesMessage = (*MsgCreateClient)(nil) @@ -285,17 +287,41 @@ func (msg *MsgUpdateParams) ValidateBasic() error { return msg.Params.Validate() } -// NewMsgRecoverClient creates a new MsgRecoverClient instance -func NewMsgRecoverClient(signer, subjectClientID, substituteClientID string) *MsgRecoverClient { - return &MsgRecoverClient{ - Signer: signer, - SubjectClientId: subjectClientID, - SubstituteClientId: substituteClientID, +// 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 } -// GetSigners returns the expected signers for a MsgRecoverClient message. -func (msg *MsgRecoverClient) GetSigners() []sdk.AccAddress { +// 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) + } + + 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() +} + +// 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) @@ -303,6 +329,15 @@ func (msg *MsgRecoverClient) GetSigners() []sdk.AccAddress { 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 { @@ -315,3 +350,12 @@ func (msg *MsgRecoverClient) ValidateBasic() error { 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 03fc09b59b9..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,11 +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" @@ -763,3 +766,86 @@ func TestMsgRecoverClientGetSigners(t *testing.T) { } } } + +// 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() }) + } + } +} diff --git a/modules/core/02-client/types/tx.pb.go b/modules/core/02-client/types/tx.pb.go index d52b6bb51f5..95a5d100d55 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 +// MsgIBCSoftwareUpgrade defines an sdk.Msg to schedule an upgrade of an IBC client using a v1 governance proposal +type MsgIBCSoftwareUpgrade struct { + 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 + // 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,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{} } +func (m *MsgIBCSoftwareUpgrade) String() string { return proto.CompactTextString(m) } +func (*MsgIBCSoftwareUpgrade) ProtoMessage() {} +func (*MsgIBCSoftwareUpgrade) Descriptor() ([]byte, []int) { + return fileDescriptor_cb5dc4651eb49a04, []int{6} +} +func (m *MsgIBCSoftwareUpgrade) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgIBCSoftwareUpgrade) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgIBCSoftwareUpgrade.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 *MsgIBCSoftwareUpgrade) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgIBCSoftwareUpgrade.Merge(m, src) +} +func (m *MsgIBCSoftwareUpgrade) XXX_Size() int { + return m.Size() +} +func (m *MsgIBCSoftwareUpgrade) XXX_DiscardUnknown() { + xxx_messageInfo_MsgIBCSoftwareUpgrade.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgIBCSoftwareUpgrade proto.InternalMessageInfo + +func (m *MsgIBCSoftwareUpgrade) GetPlan() types1.Plan { + if m != nil { + return m.Plan + } + return types1.Plan{} +} + +func (m *MsgIBCSoftwareUpgrade) GetUpgradedClientState() *types.Any { + if m != nil { + return m.UpgradedClientState + } + return nil +} + +func (m *MsgIBCSoftwareUpgrade) GetSigner() string { + if m != nil { + return m.Signer + } + return "" +} + +// MsgIBCSoftwareUpgradeResponse defines the Msg/IBCSoftwareUpgrade response type. +type MsgIBCSoftwareUpgradeResponse struct { +} + +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 *MsgIBCSoftwareUpgradeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgIBCSoftwareUpgradeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgIBCSoftwareUpgradeResponse.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 *MsgIBCSoftwareUpgradeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgIBCSoftwareUpgradeResponse.Merge(m, src) +} +func (m *MsgIBCSoftwareUpgradeResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgIBCSoftwareUpgradeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgIBCSoftwareUpgradeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgIBCSoftwareUpgradeResponse 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) @@ -533,6 +641,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((*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") @@ -612,6 +722,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) + // 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. @@ -655,6 +767,15 @@ func (c *msgClient) UpgradeClient(ctx context.Context, in *MsgUpgradeClient, opt return out, nil } +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 + } + 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...) @@ -690,6 +811,8 @@ type MsgServer interface { UpdateClient(context.Context, *MsgUpdateClient) (*MsgUpdateClientResponse, error) // UpgradeClient defines a rpc handler method for MsgUpgradeClient. UpgradeClient(context.Context, *MsgUpgradeClient) (*MsgUpgradeClientResponse, 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. @@ -711,6 +834,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) 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") } @@ -779,6 +905,24 @@ func _Msg_UpgradeClient_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +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).IBCSoftwareUpgrade(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ibc.core.client.v1.Msg/IBCSoftwareUpgrade", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).IBCSoftwareUpgrade(ctx, req.(*MsgIBCSoftwareUpgrade)) + } + 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 { @@ -849,6 +993,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpgradeClient", Handler: _Msg_UpgradeClient_Handler, }, + { + MethodName: "IBCSoftwareUpgrade", + Handler: _Msg_IBCSoftwareUpgrade_Handler, + }, { MethodName: "SubmitMisbehaviour", Handler: _Msg_SubmitMisbehaviour_Handler, @@ -1113,6 +1261,81 @@ func (m *MsgUpgradeClientResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } +func (m *MsgIBCSoftwareUpgrade) 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 *MsgIBCSoftwareUpgrade) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgIBCSoftwareUpgrade) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = 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]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + { + size, err := m.Plan.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgIBCSoftwareUpgradeResponse) 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 *MsgIBCSoftwareUpgradeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgIBCSoftwareUpgradeResponse) 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) @@ -1428,6 +1651,34 @@ func (m *MsgUpgradeClientResponse) Size() (n int) { return n } +func (m *MsgIBCSoftwareUpgrade) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = 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 +} + +func (m *MsgIBCSoftwareUpgradeResponse) 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 @@ -2226,6 +2477,207 @@ func (m *MsgUpgradeClientResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgIBCSoftwareUpgrade) 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: MsgIBCSoftwareUpgrade: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgIBCSoftwareUpgrade: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 2: + 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 + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", 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.Signer = string(dAtA[iNdEx:postIndex]) + 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 *MsgIBCSoftwareUpgradeResponse) 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: MsgIBCSoftwareUpgradeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgIBCSoftwareUpgradeResponse: 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 8e2fae23a8c..ff466352ebf 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -714,6 +714,12 @@ func (k Keeper) UpdateClientParams(goCtx context.Context, msg *clienttypes.MsgUp return &clienttypes.MsgUpdateParamsResponse{}, nil } +// IBCSoftwareUpgrade defines a rpc handler method for MsgIBCSoftwareUpgrade. +func (Keeper) IBCSoftwareUpgrade(goCtx context.Context, msg *clienttypes.MsgIBCSoftwareUpgrade) (*clienttypes.MsgIBCSoftwareUpgradeResponse, 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) { if k.GetAuthority() != msg.Authority { diff --git a/modules/core/keeper/msg_server_test.go b/modules/core/keeper/msg_server_test.go index fdcc5f172e4..a11ded00ee2 100644 --- a/modules/core/keeper/msg_server_test.go +++ b/modules/core/keeper/msg_server_test.go @@ -826,6 +826,10 @@ func (suite *KeeperTestSuite) TestUpdateClientParams() { } } +// TestIBCSoftwareUpgrade tests the IBCSoftwareUpgrade rpc handler +func (*KeeperTestSuite) TestIBCSoftwareUpgrade() { +} + // TestUpdateConnectionParams tests the UpdateConnectionParams rpc handler func (suite *KeeperTestSuite) TestUpdateConnectionParams() { validAuthority := suite.chainA.App.GetIBCKeeper().GetAuthority() diff --git a/proto/ibc/core/client/v1/tx.proto b/proto/ibc/core/client/v1/tx.proto index bb96ac2c70c..59e80600e7e 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); + // 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); @@ -93,6 +97,26 @@ message MsgUpgradeClient { // MsgUpgradeClientResponse defines the Msg/UpgradeClient response type. 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) = "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 + // 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 = 2; + // signer defaults to the governance account address unless otherwise specified. + string signer = 3; +} + +// MsgIBCSoftwareUpgradeResponse defines the Msg/IBCSoftwareUpgrade response type. +message MsgIBCSoftwareUpgradeResponse {} + // MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for // light client misbehaviour. // This message has been deprecated. Use MsgUpdateClient instead. From 3b528db047f1157756056aaca060d411f4bfd6d1 Mon Sep 17 00:00:00 2001 From: Charly Date: Tue, 29 Aug 2023 17:55:46 +0200 Subject: [PATCH 03/34] update to 0.47.5 release branch --- go.mod | 24 ++++++++++++++-------- go.sum | 65 ++++++++++++++++++++++++++++++---------------------------- 2 files changed, 49 insertions(+), 40 deletions(-) diff --git a/go.mod b/go.mod index 8807625dbef..e7905dd8f3f 100644 --- a/go.mod +++ b/go.mod @@ -33,8 +33,8 @@ require ( cloud.google.com/go/iam v1.1.0 // indirect cloud.google.com/go/storage v1.30.1 // indirect cosmossdk.io/core v0.5.1 // indirect - cosmossdk.io/depinject v1.0.0-alpha.3 // indirect - cosmossdk.io/log v1.1.1-0.20230704160919-88f2c830b0ca // indirect + cosmossdk.io/depinject v1.0.0-alpha.4 // indirect + cosmossdk.io/log v1.2.1 // indirect cosmossdk.io/tools/rosetta v0.2.1 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect @@ -50,6 +50,9 @@ require ( github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/chzyer/readline v1.5.1 // indirect github.com/cockroachdb/apd/v2 v2.0.2 // indirect + github.com/cockroachdb/errors v1.10.0 // indirect + github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect + github.com/cockroachdb/redact v1.1.5 // indirect github.com/coinbase/rosetta-sdk-go/types v1.0.0 // indirect github.com/confio/ics23/go v0.9.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect @@ -70,10 +73,10 @@ require ( github.com/dvsekhvalnov/jose2go v1.5.0 // indirect github.com/felixge/httpsnoop v1.0.2 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/getsentry/sentry-go v0.23.0 // indirect github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect - github.com/go-playground/universal-translator v0.18.0 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect @@ -109,7 +112,8 @@ require ( github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect github.com/klauspost/compress v1.16.3 // indirect - github.com/leodido/go-urn v1.2.1 // indirect + github.com/kr/pretty v0.3.1 // indirect + github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.7 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/linxGnu/grocksdb v1.7.16 // indirect @@ -134,8 +138,9 @@ require ( github.com/prometheus/procfs v0.9.0 // indirect github.com/rakyll/statik v0.1.7 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect + github.com/rogpeppe/go-internal v1.11.0 // indirect github.com/rs/cors v1.8.3 // indirect - github.com/rs/zerolog v1.29.1 // indirect + github.com/rs/zerolog v1.30.0 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect github.com/spf13/afero v1.9.5 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect @@ -144,20 +149,19 @@ require ( github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/tendermint/go-amino v0.16.0 // indirect github.com/tidwall/btree v1.6.0 // indirect - github.com/ugorji/go/codec v1.2.7 // indirect github.com/ulikunitz/xz v0.5.11 // indirect github.com/zondax/hid v0.9.1 // indirect github.com/zondax/ledger-go v0.14.1 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.opencensus.io v0.24.0 // indirect golang.org/x/crypto v0.11.0 // indirect - golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect + golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb // indirect golang.org/x/net v0.12.0 // indirect golang.org/x/oauth2 v0.8.0 // indirect golang.org/x/sync v0.2.0 // indirect - golang.org/x/sys v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect golang.org/x/term v0.10.0 // indirect - golang.org/x/text v0.11.0 // indirect + golang.org/x/text v0.12.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/api v0.126.0 // indirect google.golang.org/appengine v1.6.7 // indirect @@ -171,3 +175,5 @@ require ( ) replace github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 + +replace github.com/cosmos/cosmos-sdk => github.com/cosmos/cosmos-sdk v0.47.5-0.20230828070859-c9144f02dda8 diff --git a/go.sum b/go.sum index c2460d9069a..4ba128c73c2 100644 --- a/go.sum +++ b/go.sum @@ -191,12 +191,12 @@ cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= cosmossdk.io/core v0.5.1 h1:vQVtFrIYOQJDV3f7rw4pjjVqc1id4+mE0L9hHP66pyI= cosmossdk.io/core v0.5.1/go.mod h1:KZtwHCLjcFuo0nmDc24Xy6CRNEL9Vl/MeimQ2aC7NLE= -cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= -cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= +cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= +cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= cosmossdk.io/errors v1.0.0/go.mod h1:+hJZLuhdDE0pYN8HkOrVNwrIOYvUGnn6+4fjnJs/oV0= -cosmossdk.io/log v1.1.1-0.20230704160919-88f2c830b0ca h1:msenprh2BLLRwNT7zN56TbBHOGk/7ARQckXHxXyvjoQ= -cosmossdk.io/log v1.1.1-0.20230704160919-88f2c830b0ca/go.mod h1:PkIAKXZvaxrTRc++z53XMRvFk8AcGGWYHcMIPzVYX9c= +cosmossdk.io/log v1.2.1 h1:Xc1GgTCicniwmMiKwDxUjO4eLhPxoVdI9vtMW8Ti/uk= +cosmossdk.io/log v1.2.1/go.mod h1:GNSCc/6+DhFIj1aLn/j7Id7PaO8DzNylUZoOYBL9+I4= cosmossdk.io/math v1.1.2 h1:ORZetZCTyWkI5GlZ6CZS28fMHi83ZYf+A2vVnHNzZBM= cosmossdk.io/math v1.1.2/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= @@ -229,8 +229,6 @@ github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/ github.com/adlio/schema v1.3.3 h1:oBJn8I02PyTB466pZO1UZEn1TV5XLlifBSyMrmHl/1I= github.com/adlio/schema v1.3.3/go.mod h1:1EsRssiv9/Ce2CMzq5DoL7RiMshhuigQxrR4DMV9fHg= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= -github.com/alecthomas/participle/v2 v2.0.0-alpha7 h1:cK4vjj0VSgb3lN1nuKA5F7dw+1s1pWBe5bx7nNCnN+c= -github.com/alecthomas/participle/v2 v2.0.0-alpha7/go.mod h1:NumScqsC42o9x+dGj8/YqsIfhrIQjFEOFovxotbBirA= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -306,9 +304,13 @@ github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= -github.com/cockroachdb/apd/v3 v3.1.0 h1:MK3Ow7LH0W8zkd5GMKA1PvS9qG3bWFI95WaVNfyZJ/w= -github.com/cockroachdb/apd/v3 v3.1.0/go.mod h1:6qgPBMXjATAdD/VefbRP9NoSLKjbB4LCoA7gN4LpHs4= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= +github.com/cockroachdb/errors v1.10.0 h1:lfxS8zZz1+OjtV4MtNWgboi/W5tyLEB6VQZBXN+0VUU= +github.com/cockroachdb/errors v1.10.0/go.mod h1:lknhIsEVQ9Ss/qKDBQS/UqFSvPQjOwNq2qyKAxtHRqE= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= +github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= +github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/coinbase/rosetta-sdk-go/types v1.0.0 h1:jpVIwLcPoOeCR6o1tU+Xv7r5bMONNbHU7MuEHboiFuA= github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c= @@ -330,8 +332,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-proto v1.0.0-beta.2 h1:X3OKvWgK9Gsejo0F1qs5l8Qn6xJV/AzgIWR2wZ8Nua8= github.com/cosmos/cosmos-proto v1.0.0-beta.2/go.mod h1:+XRCLJ14pr5HFEHIUcn51IKXD1Fy3rkEQqt4WqmN4V0= -github.com/cosmos/cosmos-sdk v0.47.4 h1:FVUpEprm58nMmBX4xkRdMDaIG5Nr4yy92HZAfGAw9bg= -github.com/cosmos/cosmos-sdk v0.47.4/go.mod h1:R5n+uM7vguVPFap4pgkdvQCT1nVo/OtPwrlAU40rvok= +github.com/cosmos/cosmos-sdk v0.47.5-0.20230828070859-c9144f02dda8 h1:H4+Ma/eOLsjG3PyK6CLVAup4MfxwzPqUa+02jV2hz08= +github.com/cosmos/cosmos-sdk v0.47.5-0.20230828070859-c9144f02dda8/go.mod h1:EHwCeN9IXonsjKcjpS12MqeStdZvIdxt3VYXhus3G3c= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= @@ -356,10 +358,7 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46t github.com/creachadair/taskgroup v0.4.2 h1:jsBLdAJE42asreGss2xZGZ8fJra7WtwnHWeJFxv2Li8= github.com/creachadair/taskgroup v0.4.2/go.mod h1:qiXUOSrbwAY3u0JPGTzObbE3yf9hcXHDKBZ2ZjpCbgM= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= -github.com/cucumber/common/gherkin/go/v22 v22.0.0 h1:4K8NqptbvdOrjL9DEea6HFjSpbdT9+Q5kgLpmmsHYl0= -github.com/cucumber/common/gherkin/go/v22 v22.0.0/go.mod h1:3mJT10B2GGn3MvVPd3FwR7m2u4tLhSRhWUqJU4KN4Fg= -github.com/cucumber/common/messages/go/v17 v17.1.1 h1:RNqopvIFyLWnKv0LfATh34SWBhXeoFTJnSrgm9cT/Ts= -github.com/cucumber/common/messages/go/v17 v17.1.1/go.mod h1:bpGxb57tDE385Rb2EohgUadLkAbhoC4IyCFi89u/JQI= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -419,12 +418,16 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/getsentry/sentry-go v0.23.0 h1:dn+QRCeJv4pPt9OjVXiMcGIBIefaTJPw/h0bZWO05nE= +github.com/getsentry/sentry-go v0.23.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8= github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk= +github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= +github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -463,8 +466,6 @@ github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MG github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gofrs/uuid v4.3.0+incompatible h1:CaSVZxm5B+7o45rtab4jC2G37WGYX1zQfuU2i6DSvnc= -github.com/gofrs/uuid v4.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/googleapis v1.4.1-0.20201022092350-68b0159b7869/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= @@ -836,6 +837,9 @@ github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 h1:hDSdbBuw3Lefr6 github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= +github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -882,19 +886,18 @@ github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Ung github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/regen-network/gocuke v0.6.2 h1:pHviZ0kKAq2U2hN2q3smKNxct6hS0mGByFMHGnWA97M= -github.com/regen-network/gocuke v0.6.2/go.mod h1:zYaqIHZobHyd0xOrHGPQjbhGJsuZ1oElx150u2o1xuk= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.8.3 h1:O+qNyWn7Z+F9M0ILBHgMVPuB1xTOucVd5gtaYyXBpRo= github.com/rs/cors v1.8.3/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= -github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.29.1 h1:cO+d60CHkknCbvzEWxP0S9K6KqyTjrCNUy1LdQLCGPc= -github.com/rs/zerolog v1.29.1/go.mod h1:Le6ESbR7hc+DP6Lt1THiV8CQSdkkNrd3R0XbEgp3ZBU= +github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/rs/zerolog v1.30.0 h1:SymVODrcRsaRaSInD9yQtKbtWqwsfoPcRff/oRXLj4c= +github.com/rs/zerolog v1.30.0/go.mod h1:/tk+P47gFdPXq4QYjvCmT5/Gsug2nagsFWBWhAiSi1w= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -967,8 +970,8 @@ github.com/tidwall/btree v1.6.0 h1:LDZfKfQIBHGHWSwckhXI0RPSXzlo+KYdjK7FWSqOzzg= github.com/tidwall/btree v1.6.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= +github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= -github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= @@ -1042,8 +1045,8 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc h1:mCRnTeVUjcrhlRmO0VK8a6k6Rrf6TF9htwo2pJVSjIU= -golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w= +golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb h1:xIApU0ow1zwMa2uL1VDNeQlNVFTWMQxZUZCMDy0Q4Us= +golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1070,8 +1073,8 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.11.0 h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU= +golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1276,8 +1279,8 @@ golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1294,8 +1297,8 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= From e30e1bde701bf7b4a0ca9eedc1a3c79d979c39c5 Mon Sep 17 00:00:00 2001 From: Jim Fasarakis-Hilliard Date: Wed, 30 Aug 2023 16:36:26 +0300 Subject: [PATCH 04/34] Move signer as last proto field. (#4510) --- e2e/go.mod | 20 ++-- e2e/go.sum | 59 +++++----- modules/core/02-client/types/tx.pb.go | 153 +++++++++++++------------- proto/ibc/core/client/v1/tx.proto | 9 +- 4 files changed, 128 insertions(+), 113 deletions(-) diff --git a/e2e/go.mod b/e2e/go.mod index 589c7ff6cf6..11312deda3d 100644 --- a/e2e/go.mod +++ b/e2e/go.mod @@ -27,8 +27,8 @@ require ( cloud.google.com/go/storage v1.30.1 // indirect cosmossdk.io/api v0.3.1 // indirect cosmossdk.io/core v0.6.0 // indirect - cosmossdk.io/depinject v1.0.0-alpha.3 // indirect - cosmossdk.io/log v1.1.1-0.20230704160919-88f2c830b0ca // indirect + cosmossdk.io/depinject v1.0.0-alpha.4 // indirect + cosmossdk.io/log v1.2.1 // indirect cosmossdk.io/tools/rosetta v0.2.1 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect @@ -54,6 +54,9 @@ require ( github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/chzyer/readline v1.5.1 // indirect github.com/cockroachdb/apd/v2 v2.0.2 // indirect + github.com/cockroachdb/errors v1.10.0 // indirect + github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect + github.com/cockroachdb/redact v1.1.5 // indirect github.com/coinbase/rosetta-sdk-go/types v1.0.0 // indirect github.com/cometbft/cometbft-db v0.8.0 // indirect github.com/confio/ics23/go v0.9.0 // indirect @@ -86,10 +89,10 @@ require ( github.com/ethereum/go-ethereum v1.11.2 // indirect github.com/felixge/httpsnoop v1.0.3 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/getsentry/sentry-go v0.23.0 // indirect github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect - github.com/go-playground/locales v0.14.0 // indirect github.com/go-stack/stack v1.8.1 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/googleapis v1.4.1 // indirect @@ -132,6 +135,8 @@ require ( github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/klauspost/compress v1.16.3 // indirect github.com/klauspost/cpuid/v2 v2.2.4 // indirect + github.com/kr/pretty v0.3.1 // indirect + github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.7 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/libp2p/go-libp2p v0.26.2 // indirect @@ -172,8 +177,9 @@ require ( github.com/rakyll/statik v0.1.7 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect + github.com/rogpeppe/go-internal v1.11.0 // indirect github.com/rs/cors v1.8.3 // indirect - github.com/rs/zerolog v1.29.1 // indirect + github.com/rs/zerolog v1.30.0 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spf13/afero v1.9.5 // indirect @@ -195,13 +201,13 @@ require ( go.opencensus.io v0.24.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.11.0 // indirect - golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect + golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb // indirect golang.org/x/net v0.12.0 // indirect golang.org/x/oauth2 v0.8.0 // indirect golang.org/x/sync v0.3.0 // indirect - golang.org/x/sys v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect golang.org/x/term v0.10.0 // indirect - golang.org/x/text v0.11.0 // indirect + golang.org/x/text v0.12.0 // indirect golang.org/x/tools v0.10.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/api v0.126.0 // indirect diff --git a/e2e/go.sum b/e2e/go.sum index 1d2ac435995..f9fc5ba1d42 100644 --- a/e2e/go.sum +++ b/e2e/go.sum @@ -191,12 +191,12 @@ cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= cosmossdk.io/core v0.6.0 h1:V2zyaMVFN6hJSVENYx2XE9CMhzqwJPMjzSQpj0MyXAU= cosmossdk.io/core v0.6.0/go.mod h1:YSFzBcKOf/U24e/sa6WFaYSrlZl5zgNvnWwjfFyPniw= -cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= -cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= +cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= +cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= cosmossdk.io/errors v1.0.0/go.mod h1:+hJZLuhdDE0pYN8HkOrVNwrIOYvUGnn6+4fjnJs/oV0= -cosmossdk.io/log v1.1.1-0.20230704160919-88f2c830b0ca h1:msenprh2BLLRwNT7zN56TbBHOGk/7ARQckXHxXyvjoQ= -cosmossdk.io/log v1.1.1-0.20230704160919-88f2c830b0ca/go.mod h1:PkIAKXZvaxrTRc++z53XMRvFk8AcGGWYHcMIPzVYX9c= +cosmossdk.io/log v1.2.1 h1:Xc1GgTCicniwmMiKwDxUjO4eLhPxoVdI9vtMW8Ti/uk= +cosmossdk.io/log v1.2.1/go.mod h1:GNSCc/6+DhFIj1aLn/j7Id7PaO8DzNylUZoOYBL9+I4= cosmossdk.io/math v1.1.2 h1:ORZetZCTyWkI5GlZ6CZS28fMHi83ZYf+A2vVnHNzZBM= cosmossdk.io/math v1.1.2/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= @@ -243,8 +243,6 @@ github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/ github.com/adlio/schema v1.3.3 h1:oBJn8I02PyTB466pZO1UZEn1TV5XLlifBSyMrmHl/1I= github.com/adlio/schema v1.3.3/go.mod h1:1EsRssiv9/Ce2CMzq5DoL7RiMshhuigQxrR4DMV9fHg= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= -github.com/alecthomas/participle/v2 v2.0.0-alpha7 h1:cK4vjj0VSgb3lN1nuKA5F7dw+1s1pWBe5bx7nNCnN+c= -github.com/alecthomas/participle/v2 v2.0.0-alpha7/go.mod h1:NumScqsC42o9x+dGj8/YqsIfhrIQjFEOFovxotbBirA= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -328,9 +326,13 @@ github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= -github.com/cockroachdb/apd/v3 v3.1.0 h1:MK3Ow7LH0W8zkd5GMKA1PvS9qG3bWFI95WaVNfyZJ/w= -github.com/cockroachdb/apd/v3 v3.1.0/go.mod h1:6qgPBMXjATAdD/VefbRP9NoSLKjbB4LCoA7gN4LpHs4= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= +github.com/cockroachdb/errors v1.10.0 h1:lfxS8zZz1+OjtV4MtNWgboi/W5tyLEB6VQZBXN+0VUU= +github.com/cockroachdb/errors v1.10.0/go.mod h1:lknhIsEVQ9Ss/qKDBQS/UqFSvPQjOwNq2qyKAxtHRqE= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= +github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= +github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/coinbase/rosetta-sdk-go/types v1.0.0 h1:jpVIwLcPoOeCR6o1tU+Xv7r5bMONNbHU7MuEHboiFuA= github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c= @@ -380,10 +382,7 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46t github.com/creachadair/taskgroup v0.5.0 h1:44w3girt9OM0yPPoqGDO7u8+XEk6uG49PhnEn+8+nHY= github.com/creachadair/taskgroup v0.5.0/go.mod h1:qiXUOSrbwAY3u0JPGTzObbE3yf9hcXHDKBZ2ZjpCbgM= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= -github.com/cucumber/common/gherkin/go/v22 v22.0.0 h1:4K8NqptbvdOrjL9DEea6HFjSpbdT9+Q5kgLpmmsHYl0= -github.com/cucumber/common/gherkin/go/v22 v22.0.0/go.mod h1:3mJT10B2GGn3MvVPd3FwR7m2u4tLhSRhWUqJU4KN4Fg= -github.com/cucumber/common/messages/go/v17 v17.1.1 h1:RNqopvIFyLWnKv0LfATh34SWBhXeoFTJnSrgm9cT/Ts= -github.com/cucumber/common/messages/go/v17 v17.1.1/go.mod h1:bpGxb57tDE385Rb2EohgUadLkAbhoC4IyCFi89u/JQI= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -459,12 +458,16 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/getsentry/sentry-go v0.23.0 h1:dn+QRCeJv4pPt9OjVXiMcGIBIefaTJPw/h0bZWO05nE= +github.com/getsentry/sentry-go v0.23.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8= github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk= +github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= +github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -507,8 +510,6 @@ github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MG github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gofrs/uuid v4.3.0+incompatible h1:CaSVZxm5B+7o45rtab4jC2G37WGYX1zQfuU2i6DSvnc= -github.com/gofrs/uuid v4.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/googleapis v1.4.1-0.20201022092350-68b0159b7869/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= @@ -916,6 +917,9 @@ github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0 github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pierrec/xxHash v0.1.5 h1:n/jBpwTHiER4xYvK3/CdPVnLDPchj8eTJFFLUb4QHBo= github.com/pierrec/xxHash v0.1.5/go.mod h1:w2waW5Zoa/Wc4Yqe0wgrIYAGKqRMf7czn2HNKXmuL+I= +github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= +github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -962,8 +966,6 @@ github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Ung github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/regen-network/gocuke v0.6.2 h1:pHviZ0kKAq2U2hN2q3smKNxct6hS0mGByFMHGnWA97M= -github.com/regen-network/gocuke v0.6.2/go.mod h1:zYaqIHZobHyd0xOrHGPQjbhGJsuZ1oElx150u2o1xuk= github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= @@ -972,14 +974,15 @@ github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qq github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.8.3 h1:O+qNyWn7Z+F9M0ILBHgMVPuB1xTOucVd5gtaYyXBpRo= github.com/rs/cors v1.8.3/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= -github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.29.1 h1:cO+d60CHkknCbvzEWxP0S9K6KqyTjrCNUy1LdQLCGPc= -github.com/rs/zerolog v1.29.1/go.mod h1:Le6ESbR7hc+DP6Lt1THiV8CQSdkkNrd3R0XbEgp3ZBU= +github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/rs/zerolog v1.30.0 h1:SymVODrcRsaRaSInD9yQtKbtWqwsfoPcRff/oRXLj4c= +github.com/rs/zerolog v1.30.0/go.mod h1:/tk+P47gFdPXq4QYjvCmT5/Gsug2nagsFWBWhAiSi1w= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -1148,8 +1151,8 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc h1:mCRnTeVUjcrhlRmO0VK8a6k6Rrf6TF9htwo2pJVSjIU= -golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w= +golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb h1:xIApU0ow1zwMa2uL1VDNeQlNVFTWMQxZUZCMDy0Q4Us= +golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1383,8 +1386,8 @@ golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1401,14 +1404,14 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.1.0 h1:xYY+Bajn2a7VBmTM5GikTmnK8ZuX8YgnQCqZpbBNtmA= -golang.org/x/time v0.1.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= +golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/modules/core/02-client/types/tx.pb.go b/modules/core/02-client/types/tx.pb.go index 95a5d100d55..5420d2fe671 100644 --- a/modules/core/02-client/types/tx.pb.go +++ b/modules/core/02-client/types/tx.pb.go @@ -555,20 +555,20 @@ var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo // MsgRecoverClient defines the sdk.Msg type to recover a client. type MsgRecoverClient struct { - // signer address (it may be the the address that controls the module, which defaults to x/gov unless overwritten). - Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` // the client identifier for the client to be updated if the proposal passes - SubjectClientId string `protobuf:"bytes,2,opt,name=subject_client_id,json=subjectClientId,proto3" json:"subject_client_id,omitempty"` - // the substitute client identifier for the client standing in for the subject + SubjectClientId string `protobuf:"bytes,1,opt,name=subject_client_id,json=subjectClientId,proto3" json:"subject_client_id,omitempty"` + // the substitute client identifier for the client which will replace the subject // client - SubstituteClientId string `protobuf:"bytes,3,opt,name=substitute_client_id,json=substituteClientId,proto3" json:"substitute_client_id,omitempty"` + SubstituteClientId string `protobuf:"bytes,2,opt,name=substitute_client_id,json=substituteClientId,proto3" json:"substitute_client_id,omitempty"` + // signer address (it may be the the address that controls the module, which defaults to x/gov unless overwritten). + Signer string `protobuf:"bytes,3,opt,name=signer,proto3" json:"signer,omitempty"` } func (m *MsgRecoverClient) Reset() { *m = MsgRecoverClient{} } func (m *MsgRecoverClient) String() string { return proto.CompactTextString(m) } func (*MsgRecoverClient) ProtoMessage() {} func (*MsgRecoverClient) Descriptor() ([]byte, []int) { - return fileDescriptor_cb5dc4651eb49a04, []int{10} + return fileDescriptor_cb5dc4651eb49a04, []int{12} } func (m *MsgRecoverClient) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -605,7 +605,7 @@ func (m *MsgRecoverClientResponse) Reset() { *m = MsgRecoverClientRespon func (m *MsgRecoverClientResponse) String() string { return proto.CompactTextString(m) } func (*MsgRecoverClientResponse) ProtoMessage() {} func (*MsgRecoverClientResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_cb5dc4651eb49a04, []int{11} + return fileDescriptor_cb5dc4651eb49a04, []int{13} } func (m *MsgRecoverClientResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -654,54 +654,59 @@ func init() { func init() { proto.RegisterFile("ibc/core/client/v1/tx.proto", fileDescriptor_cb5dc4651eb49a04) } var fileDescriptor_cb5dc4651eb49a04 = []byte{ - // 738 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x96, 0x31, 0x6f, 0xd3, 0x40, - 0x14, 0xc7, 0x73, 0x69, 0x1b, 0x91, 0x6b, 0xda, 0xd0, 0x23, 0xd0, 0xd4, 0xa5, 0x49, 0x15, 0x18, - 0x4a, 0xa1, 0x76, 0x5b, 0x86, 0x56, 0x45, 0x0c, 0x6d, 0x27, 0x86, 0x48, 0xc8, 0x15, 0x0b, 0x4b, - 0xb0, 0x9d, 0xeb, 0xd5, 0xa8, 0xce, 0x45, 0xbe, 0x73, 0x44, 0x06, 0x24, 0xc4, 0xc4, 0xc8, 0xc0, - 0xc2, 0x80, 0xc4, 0x47, 0xa8, 0xf8, 0x0e, 0x48, 0x1d, 0x3b, 0x32, 0x21, 0xd4, 0x0e, 0xe5, 0x13, - 0x30, 0x23, 0xfb, 0x2e, 0x8e, 0xed, 0xda, 0x21, 0x15, 0x5b, 0x7c, 0xef, 0xf7, 0xee, 0xfd, 0xdf, - 0xff, 0x9e, 0xcf, 0x81, 0x8b, 0xb6, 0x69, 0x69, 0x16, 0x75, 0xb1, 0x66, 0x1d, 0xdb, 0xb8, 0xc3, - 0xb5, 0xde, 0x86, 0xc6, 0xdf, 0xa8, 0x5d, 0x97, 0x72, 0x8a, 0x90, 0x6d, 0x5a, 0xaa, 0x1f, 0x54, - 0x45, 0x50, 0xed, 0x6d, 0x28, 0xf3, 0x16, 0x65, 0x0e, 0x65, 0x9a, 0xc3, 0x88, 0xcf, 0x3a, 0x8c, - 0x08, 0x58, 0xa9, 0x10, 0x4a, 0x68, 0xf0, 0x53, 0xf3, 0x7f, 0xc9, 0xd5, 0x05, 0x42, 0x29, 0x39, - 0xc6, 0x5a, 0xf0, 0x64, 0x7a, 0x87, 0x9a, 0xd1, 0xe9, 0xcb, 0x50, 0x3d, 0xa5, 0xb4, 0xac, 0x13, - 0x00, 0x8d, 0x6f, 0x00, 0x96, 0x9b, 0x8c, 0xec, 0xbb, 0xd8, 0xe0, 0x78, 0x3f, 0x88, 0xa0, 0x2d, - 0x58, 0x12, 0x4c, 0x8b, 0x71, 0x83, 0xe3, 0x2a, 0x58, 0x06, 0x2b, 0xd3, 0x9b, 0x15, 0x55, 0x94, - 0x51, 0x07, 0x65, 0xd4, 0xdd, 0x4e, 0x5f, 0x9f, 0x16, 0xe4, 0x81, 0x0f, 0xa2, 0xa7, 0xb0, 0x6c, - 0xd1, 0x0e, 0xc3, 0x1d, 0xe6, 0x31, 0x99, 0x9b, 0x1f, 0x91, 0x3b, 0x1b, 0xc2, 0x22, 0xfd, 0x0e, - 0x2c, 0x30, 0x9b, 0x74, 0xb0, 0x5b, 0x9d, 0x58, 0x06, 0x2b, 0x45, 0x5d, 0x3e, 0xed, 0x94, 0x3f, - 0x7c, 0xad, 0xe7, 0xde, 0x5f, 0x9e, 0xac, 0xca, 0x85, 0xc6, 0x02, 0x9c, 0x4f, 0x68, 0xd6, 0x31, - 0xeb, 0xfa, 0x9b, 0x35, 0x3e, 0x89, 0x7e, 0x5e, 0x74, 0xdb, 0xc3, 0x7e, 0x16, 0x61, 0x51, 0xf6, - 0x63, 0xb7, 0x83, 0x66, 0x8a, 0xfa, 0x0d, 0xb1, 0xf0, 0xac, 0x8d, 0x9e, 0xc0, 0x59, 0x19, 0x74, - 0x30, 0x63, 0x06, 0x19, 0x2d, 0x79, 0x46, 0xb0, 0x4d, 0x81, 0x5e, 0x57, 0x71, 0x54, 0x55, 0xa8, - 0xf8, 0x7b, 0x1e, 0xde, 0x0c, 0x62, 0xc4, 0x35, 0xda, 0x63, 0x49, 0x4e, 0x9e, 0x4f, 0xfe, 0x3f, - 0xce, 0x67, 0xe2, 0x1a, 0xe7, 0xb3, 0x0e, 0x2b, 0x5d, 0x97, 0xd2, 0xc3, 0x96, 0x27, 0xb4, 0xb6, - 0xc4, 0xde, 0xd5, 0xc9, 0x65, 0xb0, 0x52, 0xd2, 0x51, 0x10, 0x8b, 0xb7, 0xb1, 0x0b, 0x97, 0x12, - 0x19, 0x89, 0xf2, 0x53, 0x41, 0xaa, 0x12, 0x4b, 0xcd, 0x1a, 0x8a, 0xc2, 0x68, 0x8b, 0x15, 0x58, - 0x4d, 0xda, 0x18, 0x7a, 0xfc, 0x19, 0xc0, 0xdb, 0x4d, 0x46, 0x0e, 0x3c, 0xd3, 0xb1, 0x79, 0xd3, - 0x66, 0x26, 0x3e, 0x32, 0x7a, 0x36, 0xf5, 0xdc, 0xd1, 0x46, 0x6f, 0xc3, 0x92, 0x13, 0x81, 0x47, - 0x1a, 0x1d, 0x23, 0x33, 0x07, 0x63, 0x2e, 0xa1, 0xba, 0x0a, 0x1a, 0x75, 0xb8, 0x94, 0x2a, 0x2d, - 0x14, 0xff, 0x36, 0x32, 0xd1, 0xcf, 0x0d, 0xd7, 0x70, 0x18, 0xba, 0x0b, 0x8b, 0x86, 0xc7, 0x8f, - 0xa8, 0x6b, 0xf3, 0xbe, 0x54, 0x3d, 0x5c, 0x40, 0xdb, 0xb0, 0xd0, 0x0d, 0x38, 0x29, 0x58, 0x51, - 0xaf, 0xde, 0x31, 0xaa, 0xd8, 0x69, 0x6f, 0xf2, 0xf4, 0x67, 0x3d, 0xa7, 0x4b, 0x7e, 0x07, 0x0d, - 0xe4, 0x0d, 0x77, 0x8b, 0x8d, 0xae, 0x48, 0x0a, 0x95, 0x7d, 0x01, 0xc1, 0xe8, 0xea, 0xd8, 0xa2, - 0x3d, 0xec, 0xca, 0x33, 0x1f, 0xb6, 0x0e, 0xa2, 0xad, 0xa3, 0x55, 0x38, 0xc7, 0x3c, 0xf3, 0x35, - 0xb6, 0x78, 0x6b, 0xe8, 0x78, 0x3e, 0x40, 0xca, 0x32, 0xb0, 0x3f, 0x30, 0x7e, 0x1d, 0x56, 0x98, - 0x67, 0x32, 0x6e, 0x73, 0x8f, 0xe3, 0x08, 0x2e, 0xcc, 0x44, 0xc3, 0xd8, 0x20, 0x63, 0xe7, 0x96, - 0xaf, 0xfc, 0x77, 0xea, 0x48, 0xc4, 0xe4, 0x0d, 0xb4, 0x6f, 0xfe, 0x99, 0x84, 0x13, 0x4d, 0x46, - 0xd0, 0x2b, 0x58, 0x8a, 0x5d, 0x7e, 0xf7, 0xd2, 0xcc, 0x4a, 0xdc, 0x36, 0xca, 0xc3, 0x31, 0xa0, - 0x41, 0x25, 0xbf, 0x42, 0xec, 0x3a, 0xca, 0xaa, 0x10, 0x85, 0x32, 0x2b, 0xa4, 0x5d, 0x21, 0xc8, - 0x82, 0x33, 0xf1, 0xf7, 0xee, 0x7e, 0x66, 0x76, 0x84, 0x52, 0x1e, 0x8d, 0x43, 0x85, 0x45, 0x5c, - 0x88, 0x52, 0xde, 0x9f, 0x07, 0x19, 0x7b, 0x5c, 0x45, 0x95, 0x8d, 0xb1, 0xd1, 0xb0, 0xe6, 0x21, - 0x44, 0xd1, 0x86, 0xe5, 0xf4, 0x8f, 0x36, 0x50, 0x40, 0xff, 0x30, 0x30, 0x3e, 0xc8, 0xbe, 0x81, - 0xf1, 0x21, 0xce, 0x32, 0x30, 0x46, 0x65, 0x1a, 0x98, 0x3a, 0x71, 0xca, 0xd4, 0xbb, 0xcb, 0x93, - 0x55, 0xb0, 0xa7, 0x9f, 0x9e, 0xd7, 0xc0, 0xd9, 0x79, 0x0d, 0xfc, 0x3a, 0xaf, 0x81, 0x8f, 0x17, - 0xb5, 0xdc, 0xd9, 0x45, 0x2d, 0xf7, 0xe3, 0xa2, 0x96, 0x7b, 0xb9, 0x4d, 0x6c, 0x7e, 0xe4, 0x99, - 0xaa, 0x45, 0x1d, 0x4d, 0xfe, 0x03, 0xb0, 0x4d, 0x6b, 0x8d, 0x50, 0xad, 0xb7, 0xa5, 0x39, 0xb4, - 0xed, 0x1d, 0x63, 0x26, 0x3e, 0xe6, 0xeb, 0x9b, 0x6b, 0xf2, 0x7b, 0xce, 0xfb, 0x5d, 0xcc, 0xcc, - 0x42, 0x70, 0x15, 0x3d, 0xfe, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x35, 0xf8, 0xa6, 0x5f, 0x6a, 0x08, - 0x00, 0x00, + // 824 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x96, 0xbf, 0x4f, 0xdb, 0x4c, + 0x18, 0xc7, 0xe3, 0x00, 0xd1, 0x9b, 0x23, 0x90, 0x97, 0x7b, 0xc3, 0x4b, 0x30, 0x90, 0x20, 0x5e, + 0x06, 0x5e, 0x5a, 0x6c, 0x42, 0xa5, 0x82, 0xa8, 0x3a, 0x40, 0x96, 0x32, 0x44, 0x42, 0x46, 0x5d, + 0xba, 0xa4, 0xb6, 0x73, 0x31, 0xae, 0x62, 0x9f, 0xe5, 0x3b, 0xa7, 0xcd, 0x50, 0xa9, 0xea, 0xd4, + 0xb1, 0x43, 0x97, 0x6e, 0xfd, 0x13, 0x50, 0xff, 0x80, 0x6e, 0x95, 0x18, 0x19, 0x3b, 0x55, 0x15, + 0x0c, 0x48, 0xfd, 0x2b, 0x2a, 0xfb, 0xce, 0x89, 0xed, 0xc4, 0x69, 0x50, 0x37, 0xdb, 0xcf, 0xe7, + 0xb9, 0xe7, 0x7b, 0xcf, 0x2f, 0x19, 0xac, 0x98, 0x9a, 0x2e, 0xeb, 0xd8, 0x45, 0xb2, 0xde, 0x31, + 0x91, 0x4d, 0xe5, 0x6e, 0x4d, 0xa6, 0xaf, 0x24, 0xc7, 0xc5, 0x14, 0x43, 0x68, 0x6a, 0xba, 0xe4, + 0x1b, 0x25, 0x66, 0x94, 0xba, 0x35, 0x71, 0x49, 0xc7, 0xc4, 0xc2, 0x44, 0xb6, 0x88, 0xe1, 0xb3, + 0x16, 0x31, 0x18, 0x2c, 0x6e, 0x72, 0x83, 0xe7, 0x18, 0xae, 0xda, 0x42, 0x72, 0xb7, 0xa6, 0x21, + 0xaa, 0xd6, 0xc2, 0x77, 0x4e, 0x95, 0x0c, 0x6c, 0xe0, 0xe0, 0x51, 0xf6, 0x9f, 0xf8, 0xd7, 0x65, + 0x03, 0x63, 0xa3, 0x83, 0xe4, 0xe0, 0x4d, 0xf3, 0xda, 0xb2, 0x6a, 0xf7, 0xb8, 0xa9, 0x3a, 0x42, + 0x20, 0x57, 0x13, 0x00, 0x1b, 0x9f, 0x05, 0x50, 0x6c, 0x10, 0xa3, 0xee, 0x22, 0x95, 0xa2, 0x7a, + 0x60, 0x81, 0xfb, 0xa0, 0xc0, 0x98, 0x26, 0xa1, 0x2a, 0x45, 0x65, 0x61, 0x5d, 0xd8, 0x9a, 0xdd, + 0x2b, 0x49, 0x2c, 0x8c, 0x14, 0x86, 0x91, 0x8e, 0xec, 0x9e, 0x32, 0xcb, 0xc8, 0x33, 0x1f, 0x84, + 0x8f, 0x41, 0x51, 0xc7, 0x36, 0x41, 0x36, 0xf1, 0x08, 0xf7, 0xcd, 0x8e, 0xf1, 0x9d, 0xef, 0xc3, + 0xcc, 0xfd, 0x5f, 0x90, 0x23, 0xa6, 0x61, 0x23, 0xb7, 0x3c, 0xb5, 0x2e, 0x6c, 0xe5, 0x15, 0xfe, + 0x76, 0x58, 0x7c, 0xf7, 0xa9, 0x9a, 0x79, 0x7b, 0x7b, 0xb1, 0xcd, 0x3f, 0x6c, 0x2c, 0x83, 0xa5, + 0x84, 0x66, 0x05, 0x11, 0xc7, 0x3f, 0x6c, 0xe3, 0x03, 0xbb, 0xcf, 0x53, 0xa7, 0x35, 0xb8, 0xcf, + 0x0a, 0xc8, 0xf3, 0xfb, 0x98, 0xad, 0xe0, 0x32, 0x79, 0xe5, 0x2f, 0xf6, 0xe1, 0xa4, 0x05, 0x1f, + 0x81, 0x79, 0x6e, 0xb4, 0x10, 0x21, 0xaa, 0x31, 0x5e, 0xf2, 0x1c, 0x63, 0x1b, 0x0c, 0xbd, 0xab, + 0xe2, 0xa8, 0xaa, 0xbe, 0xe2, 0xaf, 0x59, 0xf0, 0x77, 0x60, 0x0b, 0x0a, 0x3d, 0x89, 0xe4, 0x64, + 0x7d, 0xb2, 0x7f, 0x50, 0x9f, 0xa9, 0x3b, 0xd4, 0x67, 0x17, 0x94, 0x1c, 0x17, 0xe3, 0x76, 0x93, + 0x37, 0x65, 0x93, 0x9d, 0x5d, 0x9e, 0x5e, 0x17, 0xb6, 0x0a, 0x0a, 0x0c, 0x6c, 0xf1, 0x6b, 0x1c, + 0x81, 0xb5, 0x84, 0x47, 0x22, 0xfc, 0x4c, 0xe0, 0x2a, 0xc6, 0x5c, 0xd3, 0x9a, 0x22, 0x37, 0x3e, + 0xc5, 0x22, 0x28, 0x27, 0xd3, 0xd8, 0xcf, 0xf1, 0x17, 0x01, 0x2c, 0x36, 0x88, 0x71, 0x72, 0x5c, + 0x3f, 0xc3, 0x6d, 0xfa, 0x52, 0x75, 0x11, 0xe7, 0xe0, 0x43, 0x30, 0xed, 0x74, 0x54, 0x9b, 0xf7, + 0xf8, 0xaa, 0xc4, 0xc6, 0x50, 0x0a, 0xc7, 0x8e, 0x8f, 0xa1, 0x74, 0xda, 0x51, 0xed, 0xe3, 0xe9, + 0xcb, 0xef, 0xd5, 0x8c, 0x12, 0xf0, 0xf0, 0x09, 0x58, 0xe4, 0x4c, 0xab, 0x39, 0x71, 0x31, 0xfe, + 0x09, 0x5d, 0xea, 0x91, 0xa2, 0xa4, 0xf5, 0xd0, 0x6c, 0xf4, 0x72, 0x55, 0xb0, 0x36, 0x52, 0x7f, + 0xff, 0x86, 0x1f, 0xd9, 0x0d, 0xcf, 0x3c, 0xcd, 0x32, 0x69, 0xc3, 0x24, 0x1a, 0x3a, 0x57, 0xbb, + 0x26, 0xf6, 0xdc, 0xf1, 0xad, 0x74, 0x00, 0x0a, 0x56, 0x04, 0x1e, 0xab, 0x3e, 0x46, 0xa6, 0xca, + 0x5e, 0x48, 0xd4, 0xa5, 0x2c, 0x70, 0xf1, 0xc3, 0xd2, 0xfa, 0xe2, 0x5f, 0x47, 0x66, 0xf6, 0x54, + 0x75, 0x55, 0x8b, 0xc0, 0x55, 0x90, 0x57, 0x3d, 0x7a, 0x8e, 0x5d, 0x93, 0xf6, 0xb8, 0xea, 0xc1, + 0x07, 0x78, 0x00, 0x72, 0x4e, 0xc0, 0x71, 0xc1, 0xa2, 0x34, 0xbc, 0x6b, 0x25, 0x76, 0x12, 0xaf, + 0x1a, 0xe7, 0x0f, 0x61, 0x28, 0x6f, 0x70, 0x5a, 0x6c, 0x38, 0x99, 0x53, 0x34, 0xad, 0xfe, 0x70, + 0x2a, 0x48, 0xc7, 0x5d, 0xe4, 0xf2, 0xae, 0xde, 0x06, 0x0b, 0xc4, 0xd3, 0x5e, 0x20, 0x9d, 0x36, + 0x93, 0x99, 0x2d, 0x72, 0x43, 0x3d, 0x4c, 0xf0, 0x2e, 0x28, 0x11, 0x4f, 0x23, 0xd4, 0xa4, 0x1e, + 0x45, 0x11, 0x3c, 0x1b, 0xe0, 0x70, 0x60, 0xeb, 0x7b, 0x4c, 0xbc, 0x53, 0x58, 0xc3, 0xc7, 0xa4, + 0x85, 0xba, 0xf7, 0x7e, 0xce, 0x80, 0xa9, 0x06, 0x31, 0xe0, 0x73, 0x50, 0x88, 0xad, 0xf6, 0xff, + 0x46, 0x25, 0x2a, 0xb1, 0x4b, 0xc5, 0x7b, 0x13, 0x40, 0x61, 0x24, 0x3f, 0x42, 0x6c, 0xd9, 0xa6, + 0x45, 0x88, 0x42, 0xa9, 0x11, 0x46, 0x2d, 0x48, 0xa8, 0x83, 0xb9, 0xf8, 0x56, 0xd9, 0x4c, 0xf5, + 0x8e, 0x50, 0xe2, 0xfd, 0x49, 0xa8, 0x7e, 0x10, 0x17, 0xc0, 0x11, 0xdb, 0xe1, 0xff, 0x94, 0x33, + 0x86, 0x51, 0xb1, 0x36, 0x31, 0x1a, 0x8d, 0x39, 0x62, 0x5e, 0xd3, 0x62, 0x0e, 0xa3, 0xa9, 0x31, + 0xd3, 0x47, 0x0d, 0xb6, 0x01, 0x8c, 0x26, 0x99, 0x4f, 0xdb, 0xf8, 0xa2, 0x31, 0xe8, 0x37, 0x45, + 0x8b, 0x0f, 0x8e, 0x5f, 0xb4, 0xf8, 0xd0, 0xa4, 0x15, 0x2d, 0x46, 0xa5, 0x16, 0x6d, 0x64, 0x97, + 0x8b, 0x33, 0x6f, 0x6e, 0x2f, 0xb6, 0x85, 0x63, 0xe5, 0xf2, 0xba, 0x22, 0x5c, 0x5d, 0x57, 0x84, + 0x1f, 0xd7, 0x15, 0xe1, 0xfd, 0x4d, 0x25, 0x73, 0x75, 0x53, 0xc9, 0x7c, 0xbb, 0xa9, 0x64, 0x9e, + 0x1d, 0x18, 0x26, 0x3d, 0xf7, 0x34, 0x49, 0xc7, 0x96, 0xcc, 0x7f, 0xb0, 0x4c, 0x4d, 0xdf, 0x31, + 0xb0, 0xdc, 0xdd, 0x97, 0x2d, 0xdc, 0xf2, 0x3a, 0x88, 0xb0, 0xdf, 0xa3, 0xdd, 0xbd, 0x1d, 0xfe, + 0x87, 0x44, 0x7b, 0x0e, 0x22, 0x5a, 0x2e, 0x58, 0x7d, 0x0f, 0x7e, 0x05, 0x00, 0x00, 0xff, 0xff, + 0x99, 0x83, 0x41, 0x89, 0xe2, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -728,7 +733,7 @@ type MsgClient interface { SubmitMisbehaviour(ctx context.Context, in *MsgSubmitMisbehaviour, opts ...grpc.CallOption) (*MsgSubmitMisbehaviourResponse, error) // UpdateClientParams defines a rpc handler method for MsgUpdateParams. UpdateClientParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) - // Recover defines a rpc handler method for MsgRecoverClient. + // RecoverClient defines a rpc handler method for MsgRecoverClient. RecoverClient(ctx context.Context, in *MsgRecoverClient, opts ...grpc.CallOption) (*MsgRecoverClientResponse, error) } @@ -817,7 +822,7 @@ type MsgServer interface { SubmitMisbehaviour(context.Context, *MsgSubmitMisbehaviour) (*MsgSubmitMisbehaviourResponse, error) // UpdateClientParams defines a rpc handler method for MsgUpdateParams. UpdateClientParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) - // Recover defines a rpc handler method for MsgRecoverClient. + // RecoverClient defines a rpc handler method for MsgRecoverClient. RecoverClient(context.Context, *MsgRecoverClient) (*MsgRecoverClientResponse, error) } @@ -1491,25 +1496,25 @@ func (m *MsgRecoverClient) 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 len(m.SubstituteClientId) > 0 { i -= len(m.SubstituteClientId) copy(dAtA[i:], m.SubstituteClientId) i = encodeVarintTx(dAtA, i, uint64(len(m.SubstituteClientId))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 } if len(m.SubjectClientId) > 0 { i -= len(m.SubjectClientId) copy(dAtA[i:], m.SubjectClientId) i = encodeVarintTx(dAtA, i, uint64(len(m.SubjectClientId))) i-- - dAtA[i] = 0x12 - } - 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] = 0xa } return len(dAtA) - i, nil @@ -1739,15 +1744,15 @@ func (m *MsgRecoverClient) Size() (n int) { } var l int _ = l - l = len(m.Signer) + l = len(m.SubjectClientId) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.SubjectClientId) + l = len(m.SubstituteClientId) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.SubstituteClientId) + l = len(m.Signer) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -3074,7 +3079,7 @@ func (m *MsgRecoverClient) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SubjectClientId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3102,11 +3107,11 @@ func (m *MsgRecoverClient) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Signer = string(dAtA[iNdEx:postIndex]) + m.SubjectClientId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SubjectClientId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SubstituteClientId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3134,11 +3139,11 @@ func (m *MsgRecoverClient) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.SubjectClientId = string(dAtA[iNdEx:postIndex]) + m.SubstituteClientId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SubstituteClientId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3166,7 +3171,7 @@ func (m *MsgRecoverClient) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.SubstituteClientId = string(dAtA[iNdEx:postIndex]) + 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 59e80600e7e..1ea017c1b6a 100644 --- a/proto/ibc/core/client/v1/tx.proto +++ b/proto/ibc/core/client/v1/tx.proto @@ -161,13 +161,14 @@ message MsgRecoverClient { option (gogoproto.goproto_getters) = false; option (cosmos.msg.v1.signer) = "signer"; - // signer address (it may be the the address that controls the module, which defaults to x/gov unless overwritten). - string signer = 1; // the client identifier for the client to be updated if the proposal passes - string subject_client_id = 2; + string subject_client_id = 1; // the substitute client identifier for the client which will replace the subject // client - string substitute_client_id = 3; + string substitute_client_id = 2; + + // signer address (it may be the the address that controls the module, which defaults to x/gov unless overwritten). + string signer = 3; } // MsgRecoverClientResponse defines the MsgRecoverClient response type. From d9f62004ae0d6c8c395d6c9cd89c3a0d7bd20ce1 Mon Sep 17 00:00:00 2001 From: Charly Date: Wed, 30 Aug 2023 15:43:52 +0200 Subject: [PATCH 05/34] msg server function and tests for MsgScheduleIBCClientUpgrade (#4442) --- modules/core/02-client/types/msgs_test.go | 73 +++++++++++++++++++ modules/core/keeper/msg_server.go | 19 ++++- modules/core/keeper/msg_server_test.go | 85 ++++++++++++++++++++++- 3 files changed, 173 insertions(+), 4 deletions(-) diff --git a/modules/core/02-client/types/msgs_test.go b/modules/core/02-client/types/msgs_test.go index af6ad66d976..13b60e6c2ee 100644 --- a/modules/core/02-client/types/msgs_test.go +++ b/modules/core/02-client/types/msgs_test.go @@ -9,7 +9,9 @@ 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" @@ -849,3 +851,74 @@ func (suite *TypesTestSuite) TestMsgIBCSoftwareUpgrade_GetSigners() { } } } + +// TestMsgIBCSoftwareUpgrade_ValidateBasic tests ValidateBasic for MsgIBCSoftwareUpgrade +func (suite *TypesTestSuite) TestMsgIBCSoftwareUpgrade_ValidateBasic() { + var ( + signer string + plan upgradetypes.Plan + anyClient *codectypes.Any + ) + testCases := []struct { + name string + malleate func() + expError error + }{ + { + "success", + func() {}, + nil, + }, + { + "failure: invalid authority address", + func() { + signer = "invalid" + }, + ibcerrors.ErrInvalidAddress, + }, + { + "failure: error unpacking client state", + func() { + anyClient = &codectypes.Any{} + }, + ibcerrors.ErrUnpackAny, + }, + { + "failure: error validating upgrade plan, height is not greater than zero", + func() { + plan.Height = 0 + }, + sdkerrors.ErrInvalidRequest, + }, + } + + for _, tc := range testCases { + signer = 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.MsgIBCSoftwareUpgrade{ + plan, + anyClient, + signer, + } + + err = msg.ValidateBasic() + expPass := tc.expError == nil + + if expPass { + suite.Require().NoError(err) + } + if tc.expError != nil { + suite.Require().True(errors.Is(err, tc.expError)) + } + } +} diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index ff466352ebf..d6cf8470fbf 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -715,9 +715,22 @@ func (k Keeper) UpdateClientParams(goCtx context.Context, msg *clienttypes.MsgUp } // IBCSoftwareUpgrade defines a rpc handler method for MsgIBCSoftwareUpgrade. -func (Keeper) IBCSoftwareUpgrade(goCtx context.Context, msg *clienttypes.MsgIBCSoftwareUpgrade) (*clienttypes.MsgIBCSoftwareUpgradeResponse, error) { - // TODO - return nil, nil +func (k Keeper) IBCSoftwareUpgrade(goCtx context.Context, msg *clienttypes.MsgIBCSoftwareUpgrade) (*clienttypes.MsgIBCSoftwareUpgradeResponse, error) { + if k.GetAuthority() != msg.Signer { + return nil, errorsmod.Wrapf(ibcerrors.ErrUnauthorized, "expected %s, got %s", k.GetAuthority(), msg.Signer) + } + + 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) + } + + if err = k.ClientKeeper.ScheduleIBCSoftwareUpgrade(ctx, msg.Plan, upgradedClientState); err != nil { + return nil, errorsmod.Wrapf(err, "cannot schedule IBC client upgrade") + } + + return &clienttypes.MsgIBCSoftwareUpgradeResponse{}, 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 a11ded00ee2..2a024622238 100644 --- a/modules/core/keeper/msg_server_test.go +++ b/modules/core/keeper/msg_server_test.go @@ -1,6 +1,9 @@ package keeper_test import ( + "errors" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" @@ -8,6 +11,7 @@ import ( channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/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" "github.com/cosmos/ibc-go/v7/modules/core/keeper" ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" @@ -827,7 +831,86 @@ func (suite *KeeperTestSuite) TestUpdateClientParams() { } // TestIBCSoftwareUpgrade tests the IBCSoftwareUpgrade rpc handler -func (*KeeperTestSuite) TestIBCSoftwareUpgrade() { +func (suite *KeeperTestSuite) TestIBCSoftwareUpgrade() { + var msg *clienttypes.MsgIBCSoftwareUpgrade + testCases := []struct { + name string + malleate func() + expError error + }{ + { + "success: valid authority and client upgrade", + func() {}, + nil, + }, + { + "failure: invalid authority address", + func() { + msg.Signer = suite.chainA.SenderAccount.GetAddress().String() + }, + ibcerrors.ErrUnauthorized, + }, + { + "failure: invalid clientState", + func() { + msg.UpgradedClientState = nil + }, + clienttypes.ErrInvalidClientType, + }, + { + "failure: failed to schedule client upgrade", + func() { + msg.Plan.Height = 0 + }, + sdkerrors.ErrInvalidRequest, + }, + } + + for _, tc := range testCases { + tc := tc + suite.Run(tc.name, func() { + path := ibctesting.NewPath(suite.chainA, suite.chainB) + suite.coordinator.SetupClients(path) + validAuthority := suite.chainA.App.GetIBCKeeper().GetAuthority() + plan := upgradetypes.Plan{ + Name: "upgrade IBC clients", + Height: 1000, + } + // update trusting period + clientState := path.EndpointB.GetClientState() + clientState.(*ibctm.ClientState).TrustingPeriod += 100 + + var err error + msg, err = clienttypes.NewMsgIBCSoftwareUpgrade( + validAuthority, + plan, + clientState, + ) + + suite.Require().NoError(err) + + tc.malleate() + + _, err = keeper.Keeper.IBCSoftwareUpgrade(*suite.chainA.App.GetIBCKeeper(), suite.chainA.GetContext(), msg) + + if tc.expError == nil { + suite.Require().NoError(err) + // upgrade plan is stored + storedPlan, found := suite.chainA.GetSimApp().UpgradeKeeper.GetUpgradePlan(suite.chainA.GetContext()) + suite.Require().True(found) + suite.Require().Equal(plan, storedPlan) + + // upgraded client state is stored + bz, found := suite.chainA.GetSimApp().UpgradeKeeper.GetUpgradedClient(suite.chainA.GetContext(), plan.Height) + suite.Require().True(found) + upgradedClientState, err := clienttypes.UnmarshalClientState(suite.chainA.App.AppCodec(), bz) + suite.Require().NoError(err) + suite.Require().Equal(clientState.ZeroCustomFields(), upgradedClientState) + } else { + suite.Require().True(errors.Is(err, tc.expError)) + } + }) + } } // TestUpdateConnectionParams tests the UpdateConnectionParams rpc handler From 9c5499e47c20c7a0b4e99ab9ed7baa33b755e47b Mon Sep 17 00:00:00 2001 From: Jim Fasarakis-Hilliard Date: Thu, 31 Aug 2023 08:40:52 +0300 Subject: [PATCH 06/34] Add 02-client implementation for Recover client. (#4499) * Add 02-client implementation for Recover client. * Partially address feedback. * Docu RecoverClient, add label, re-use error. --- modules/core/02-client/keeper/client.go | 56 +++++++ modules/core/02-client/keeper/client_test.go | 156 +++++++++++++++++++ modules/core/02-client/keeper/events.go | 15 ++ modules/core/02-client/keeper/proposal.go | 2 +- modules/core/02-client/types/errors.go | 2 +- modules/core/02-client/types/events.go | 1 + 6 files changed, 230 insertions(+), 2 deletions(-) diff --git a/modules/core/02-client/keeper/client.go b/modules/core/02-client/keeper/client.go index 34b8ff8c528..b5e49f7f077 100644 --- a/modules/core/02-client/keeper/client.go +++ b/modules/core/02-client/keeper/client.go @@ -149,3 +149,59 @@ func (k Keeper) UpgradeClient(ctx sdk.Context, clientID string, upgradedClient e return nil } + +// RecoverClient will retrieve the subject and substitute client. +// A callback will occur to the subject client state with the client +// prefixed store being provided for both the subject and the substitute client. +// The IBC client implementations are responsible for validating the parameters of the +// substitute (ensuring they match the subject's parameters) as well as copying +// the necessary consensus states from the substitute to the subject client +// store. The substitute must be Active and the subject must not be Active. +func (k Keeper) RecoverClient(ctx sdk.Context, subjectClientID, substituteClientID string) error { + subjectClientState, found := k.GetClientState(ctx, subjectClientID) + if !found { + return errorsmod.Wrapf(types.ErrClientNotFound, "subject client with ID %s", subjectClientID) + } + + subjectClientStore := k.ClientStore(ctx, subjectClientID) + + if status := k.GetClientStatus(ctx, subjectClientState, subjectClientID); status == exported.Active { + return errorsmod.Wrap(types.ErrInvalidRecoveryClient, "cannot recover Active subject client") + } + + substituteClientState, found := k.GetClientState(ctx, substituteClientID) + if !found { + return errorsmod.Wrapf(types.ErrClientNotFound, "substitute client with ID %s", substituteClientID) + } + + if subjectClientState.GetLatestHeight().GTE(substituteClientState.GetLatestHeight()) { + return errorsmod.Wrapf(types.ErrInvalidHeight, "subject client state latest height is greater or equal to substitute client state latest height (%s >= %s)", subjectClientState.GetLatestHeight(), substituteClientState.GetLatestHeight()) + } + + substituteClientStore := k.ClientStore(ctx, substituteClientID) + + if status := k.GetClientStatus(ctx, substituteClientState, substituteClientID); status != exported.Active { + return errorsmod.Wrapf(types.ErrClientNotActive, "substitute client is not Active, status is %s", status) + } + + if err := subjectClientState.CheckSubstituteAndUpdateState(ctx, k.cdc, subjectClientStore, substituteClientStore, substituteClientState); err != nil { + return err + } + + k.Logger(ctx).Info("client recovered", "client-id", subjectClientID) + + defer telemetry.IncrCounterWithLabels( + []string{"ibc", "client", "update"}, + 1, + []metrics.Label{ + telemetry.NewLabel(types.LabelClientType, substituteClientState.ClientType()), + telemetry.NewLabel(types.LabelClientID, subjectClientID), + telemetry.NewLabel(types.LabelUpdateType, "recovery"), + }, + ) + + // emitting events in the keeper for recovering clients + emitRecoverClientEvent(ctx, subjectClientID, substituteClientState.ClientType()) + + return nil +} diff --git a/modules/core/02-client/keeper/client_test.go b/modules/core/02-client/keeper/client_test.go index 99dcd861647..1b386e3572d 100644 --- a/modules/core/02-client/keeper/client_test.go +++ b/modules/core/02-client/keeper/client_test.go @@ -508,3 +508,159 @@ func (suite *KeeperTestSuite) TestUpdateClientEventEmission() { } suite.Require().True(contains) } + +func (suite *KeeperTestSuite) TestRecoverClient() { + var ( + subject, substitute string + subjectClientState, substituteClientState exported.ClientState + ) + + testCases := []struct { + msg string + malleate func() + expErr error + }{ + { + "success", + func() {}, + nil, + }, + { + "success, subject and substitute use different revision number", + func() { + tmClientState, ok := substituteClientState.(*ibctm.ClientState) + suite.Require().True(ok) + consState, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientConsensusState(suite.chainA.GetContext(), substitute, tmClientState.LatestHeight) + suite.Require().True(found) + newRevisionNumber := tmClientState.GetLatestHeight().GetRevisionNumber() + 1 + + tmClientState.LatestHeight = clienttypes.NewHeight(newRevisionNumber, tmClientState.GetLatestHeight().GetRevisionHeight()) + + suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientConsensusState(suite.chainA.GetContext(), substitute, tmClientState.LatestHeight, consState) + clientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), substitute) + ibctm.SetProcessedTime(clientStore, tmClientState.LatestHeight, 100) + ibctm.SetProcessedHeight(clientStore, tmClientState.LatestHeight, clienttypes.NewHeight(0, 1)) + suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainA.GetContext(), substitute, tmClientState) + }, + nil, + }, + { + "subject client does not exist", + func() { + subject = ibctesting.InvalidID + }, + clienttypes.ErrClientNotFound, + }, + { + "subject is Active", + func() { + tmClientState, ok := subjectClientState.(*ibctm.ClientState) + suite.Require().True(ok) + // Set FrozenHeight to zero to ensure client is reported as Active + tmClientState.FrozenHeight = clienttypes.ZeroHeight() + suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainA.GetContext(), subject, tmClientState) + }, + clienttypes.ErrInvalidRecoveryClient, + }, + { + "substitute client does not exist", + func() { + substitute = ibctesting.InvalidID + }, + clienttypes.ErrClientNotFound, + }, + { + "subject and substitute have equal latest height", + func() { + tmClientState, ok := subjectClientState.(*ibctm.ClientState) + suite.Require().True(ok) + tmClientState.LatestHeight = substituteClientState.GetLatestHeight().(clienttypes.Height) + suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainA.GetContext(), subject, tmClientState) + }, + clienttypes.ErrInvalidHeight, + }, + { + "subject height is greater than substitute height", + func() { + tmClientState, ok := subjectClientState.(*ibctm.ClientState) + suite.Require().True(ok) + tmClientState.LatestHeight = substituteClientState.GetLatestHeight().Increment().(clienttypes.Height) + suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainA.GetContext(), subject, tmClientState) + }, + clienttypes.ErrInvalidHeight, + }, + { + "substitute is frozen", + func() { + tmClientState, ok := substituteClientState.(*ibctm.ClientState) + suite.Require().True(ok) + tmClientState.FrozenHeight = clienttypes.NewHeight(0, 1) + suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainA.GetContext(), substitute, tmClientState) + }, + clienttypes.ErrClientNotActive, + }, + { + "CheckSubstituteAndUpdateState fails, substitute client trust level doesn't match subject client trust level", + func() { + tmClientState, ok := substituteClientState.(*ibctm.ClientState) + suite.Require().True(ok) + tmClientState.UnbondingPeriod += time.Minute + suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainA.GetContext(), substitute, tmClientState) + }, + clienttypes.ErrInvalidSubstitute, + }, + } + + for _, tc := range testCases { + tc := tc + + suite.Run(tc.msg, func() { + suite.SetupTest() // reset + + subjectPath := ibctesting.NewPath(suite.chainA, suite.chainB) + suite.coordinator.SetupClients(subjectPath) + subject = subjectPath.EndpointA.ClientID + subjectClientState = suite.chainA.GetClientState(subject) + + substitutePath := ibctesting.NewPath(suite.chainA, suite.chainB) + suite.coordinator.SetupClients(substitutePath) + substitute = substitutePath.EndpointA.ClientID + + // update substitute twice + err := substitutePath.EndpointA.UpdateClient() + suite.Require().NoError(err) + err = substitutePath.EndpointA.UpdateClient() + suite.Require().NoError(err) + substituteClientState = suite.chainA.GetClientState(substitute) + + tmClientState, ok := subjectClientState.(*ibctm.ClientState) + suite.Require().True(ok) + tmClientState.AllowUpdateAfterMisbehaviour = true + tmClientState.AllowUpdateAfterExpiry = true + tmClientState.FrozenHeight = tmClientState.LatestHeight + suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainA.GetContext(), subject, tmClientState) + + tmClientState, ok = substituteClientState.(*ibctm.ClientState) + suite.Require().True(ok) + tmClientState.AllowUpdateAfterMisbehaviour = true + tmClientState.AllowUpdateAfterExpiry = true + + tc.malleate() + + err = suite.chainA.App.GetIBCKeeper().ClientKeeper.RecoverClient(suite.chainA.GetContext(), subject, substitute) + + expPass := tc.expErr == nil + if expPass { + suite.Require().NoError(err) + + // Assert that client status is now Active + clientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), subjectPath.EndpointA.ClientID) + tmClientState := subjectPath.EndpointA.GetClientState().(*ibctm.ClientState) + suite.Require().Equal(tmClientState.Status(suite.chainA.GetContext(), clientStore, suite.chainA.App.AppCodec()), exported.Active) + } else { + suite.Require().Error(err) + suite.Require().ErrorIs(err, tc.expErr) + } + }) + } +} diff --git a/modules/core/02-client/keeper/events.go b/modules/core/02-client/keeper/events.go index 9b0bb6841ba..ce51fe189c5 100644 --- a/modules/core/02-client/keeper/events.go +++ b/modules/core/02-client/keeper/events.go @@ -96,6 +96,21 @@ func emitUpdateClientProposalEvent(ctx sdk.Context, clientID, clientType string) }) } +// emitRecoverClientEvent emits a recover client event +func emitRecoverClientEvent(ctx sdk.Context, clientID, clientType string) { + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeRecoverClient, + sdk.NewAttribute(types.AttributeKeySubjectClientID, clientID), + sdk.NewAttribute(types.AttributeKeyClientType, clientType), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + ), + }) +} + // emitUpgradeClientProposalEvent emits an upgrade client proposal event func emitUpgradeClientProposalEvent(ctx sdk.Context, title string, height int64) { ctx.EventManager().EmitEvents(sdk.Events{ diff --git a/modules/core/02-client/keeper/proposal.go b/modules/core/02-client/keeper/proposal.go index f35f00d616d..12f2685e299 100644 --- a/modules/core/02-client/keeper/proposal.go +++ b/modules/core/02-client/keeper/proposal.go @@ -28,7 +28,7 @@ func (k Keeper) ClientUpdateProposal(ctx sdk.Context, p *types.ClientUpdatePropo subjectClientStore := k.ClientStore(ctx, p.SubjectClientId) if status := k.GetClientStatus(ctx, subjectClientState, p.SubjectClientId); status == exported.Active { - return errorsmod.Wrap(types.ErrInvalidUpdateClientProposal, "cannot update Active subject client") + return errorsmod.Wrap(types.ErrInvalidRecoveryClient, "cannot update Active subject client") } substituteClientState, found := k.GetClientState(ctx, p.SubstituteClientId) diff --git a/modules/core/02-client/types/errors.go b/modules/core/02-client/types/errors.go index cdc84871ca0..3a726378cbc 100644 --- a/modules/core/02-client/types/errors.go +++ b/modules/core/02-client/types/errors.go @@ -28,7 +28,7 @@ var ( ErrFailedNextSeqRecvVerification = errorsmod.Register(SubModuleName, 21, "next sequence receive verification failed") ErrSelfConsensusStateNotFound = errorsmod.Register(SubModuleName, 22, "self consensus state not found") ErrUpdateClientFailed = errorsmod.Register(SubModuleName, 23, "unable to update light client") - ErrInvalidUpdateClientProposal = errorsmod.Register(SubModuleName, 24, "invalid update client proposal") + ErrInvalidRecoveryClient = errorsmod.Register(SubModuleName, 24, "invalid recovery client") ErrInvalidUpgradeClient = errorsmod.Register(SubModuleName, 25, "invalid client upgrade") ErrInvalidHeight = errorsmod.Register(SubModuleName, 26, "invalid height") ErrInvalidSubstitute = errorsmod.Register(SubModuleName, 27, "invalid client state substitute") diff --git a/modules/core/02-client/types/events.go b/modules/core/02-client/types/events.go index 9671cf9dcb9..5a32edf32c2 100644 --- a/modules/core/02-client/types/events.go +++ b/modules/core/02-client/types/events.go @@ -28,6 +28,7 @@ var ( EventTypeUpdateClientProposal = "update_client_proposal" EventTypeUpgradeChain = "upgrade_chain" EventTypeUpgradeClientProposal = "upgrade_client_proposal" + EventTypeRecoverClient = "recover_client" AttributeValueCategory = fmt.Sprintf("%s_%s", ibcexported.ModuleName, SubModuleName) ) From 016e09297247932aa45ceb73569d134e98e6f67c Mon Sep 17 00:00:00 2001 From: Jim Fasarakis-Hilliard Date: Thu, 31 Aug 2023 13:38:10 +0300 Subject: [PATCH 07/34] Add implementation for recover client on message server. (#4503) * Add message server handler for recovering a client * Don't assign to deprecated attrs, clean up unused fields. * Further clean-up, remove declaration of unmutated vars. --- modules/core/keeper/msg_server.go | 11 +++- modules/core/keeper/msg_server_test.go | 76 ++++++++++++++++++++++++++ 2 files changed, 86 insertions(+), 1 deletion(-) diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index d6cf8470fbf..42ff5879c61 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -101,7 +101,16 @@ func (k Keeper) SubmitMisbehaviour(goCtx context.Context, msg *clienttypes.MsgSu } // RecoverClient defines a rpc handler method for MsgRecoverClient. -func (k Keeper) RecoverClient(goCtx context.Context, msg *clienttypes.MsgRecoverClient) (*clienttypes.MsgRecoverClientResponse, error) { //nolint:revive +func (k Keeper) RecoverClient(goCtx context.Context, msg *clienttypes.MsgRecoverClient) (*clienttypes.MsgRecoverClientResponse, error) { + if k.GetAuthority() != msg.Signer { + return nil, errorsmod.Wrapf(ibcerrors.ErrUnauthorized, "expected %s, got %s", k.GetAuthority(), msg.Signer) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + if err := k.ClientKeeper.RecoverClient(ctx, msg.SubjectClientId, msg.SubstituteClientId); err != nil { + return nil, errorsmod.Wrap(err, "client recovery failed") + } + return &clienttypes.MsgRecoverClientResponse{}, nil } diff --git a/modules/core/keeper/msg_server_test.go b/modules/core/keeper/msg_server_test.go index 2a024622238..5815eb08cf6 100644 --- a/modules/core/keeper/msg_server_test.go +++ b/modules/core/keeper/msg_server_test.go @@ -779,6 +779,82 @@ func (suite *KeeperTestSuite) TestUpgradeClient() { } } +func (suite *KeeperTestSuite) TestRecoverClient() { + var msg *clienttypes.MsgRecoverClient + + testCases := []struct { + name string + malleate func() + expErr error + }{ + { + "success: recover client", + func() {}, + nil, + }, + { + "signer doesn't match authority", + func() { + msg.Signer = ibctesting.InvalidID + }, + ibcerrors.ErrUnauthorized, + }, + { + "invalid subject client", + func() { + msg.SubjectClientId = ibctesting.InvalidID + }, + clienttypes.ErrClientNotFound, + }, + } + + for _, tc := range testCases { + tc := tc + suite.Run(tc.name, func() { + suite.SetupTest() + + subjectPath := ibctesting.NewPath(suite.chainA, suite.chainB) + suite.coordinator.SetupClients(subjectPath) + subject := subjectPath.EndpointA.ClientID + subjectClientState := suite.chainA.GetClientState(subject) + + substitutePath := ibctesting.NewPath(suite.chainA, suite.chainB) + suite.coordinator.SetupClients(substitutePath) + substitute := substitutePath.EndpointA.ClientID + + // update substitute twice + err := substitutePath.EndpointA.UpdateClient() + suite.Require().NoError(err) + err = substitutePath.EndpointA.UpdateClient() + suite.Require().NoError(err) + + tmClientState, ok := subjectClientState.(*ibctm.ClientState) + suite.Require().True(ok) + tmClientState.FrozenHeight = tmClientState.LatestHeight + suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainA.GetContext(), subject, tmClientState) + + msg = clienttypes.NewMsgRecoverClient(suite.chainA.App.GetIBCKeeper().GetAuthority(), subject, substitute) + + tc.malleate() + + _, err = keeper.Keeper.RecoverClient(*suite.chainA.App.GetIBCKeeper(), suite.chainA.GetContext(), msg) + + expPass := tc.expErr == nil + if expPass { + suite.Require().NoError(err) + + // Assert that client status is now Active + clientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), subjectPath.EndpointA.ClientID) + tmClientState := subjectPath.EndpointA.GetClientState().(*ibctm.ClientState) + suite.Require().Equal(tmClientState.Status(suite.chainA.GetContext(), clientStore, suite.chainA.App.AppCodec()), exported.Active) + } else { + suite.Require().Error(err) + suite.Require().ErrorIs(err, tc.expErr) + } + }) + } +} + // TestUpdateClientParams tests the UpdateClientParams rpc handler func (suite *KeeperTestSuite) TestUpdateClientParams() { validAuthority := suite.chainA.App.GetIBCKeeper().GetAuthority() From aaee1e392b4f1f4b08f4a475a343c4c20743ed4f Mon Sep 17 00:00:00 2001 From: Jim Fasarakis-Hilliard Date: Thu, 31 Aug 2023 13:57:42 +0300 Subject: [PATCH 08/34] Add cmd for submitting a recover client prop. (#4522) * Add cmd for submitting a recover client prop. * Bump cosmossdk in e2e. * Use govtypes.ModuleName, rename old govtypes to govv1beta1 * Update modules/core/02-client/client/cli/tx.go Co-authored-by: Damian Nolan * Add auth flag. --------- Co-authored-by: Damian Nolan --- e2e/go.mod | 2 + e2e/go.sum | 4 +- modules/core/02-client/client/cli/tx.go | 67 +++++++++++++++++++++++-- 3 files changed, 68 insertions(+), 5 deletions(-) diff --git a/e2e/go.mod b/e2e/go.mod index 11312deda3d..f79d4502cd2 100644 --- a/e2e/go.mod +++ b/e2e/go.mod @@ -248,3 +248,5 @@ replace github.com/cosmos/ibc-go/v7 => ../ replace github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 + +replace github.com/cosmos/cosmos-sdk => github.com/cosmos/cosmos-sdk v0.47.5-0.20230828070859-c9144f02dda8 diff --git a/e2e/go.sum b/e2e/go.sum index f9fc5ba1d42..1b5ae7e6c17 100644 --- a/e2e/go.sum +++ b/e2e/go.sum @@ -354,8 +354,8 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= github.com/cosmos/cosmos-proto v1.0.0-beta.2 h1:X3OKvWgK9Gsejo0F1qs5l8Qn6xJV/AzgIWR2wZ8Nua8= github.com/cosmos/cosmos-proto v1.0.0-beta.2/go.mod h1:+XRCLJ14pr5HFEHIUcn51IKXD1Fy3rkEQqt4WqmN4V0= -github.com/cosmos/cosmos-sdk v0.47.4 h1:FVUpEprm58nMmBX4xkRdMDaIG5Nr4yy92HZAfGAw9bg= -github.com/cosmos/cosmos-sdk v0.47.4/go.mod h1:R5n+uM7vguVPFap4pgkdvQCT1nVo/OtPwrlAU40rvok= +github.com/cosmos/cosmos-sdk v0.47.5-0.20230828070859-c9144f02dda8 h1:H4+Ma/eOLsjG3PyK6CLVAup4MfxwzPqUa+02jV2hz08= +github.com/cosmos/cosmos-sdk v0.47.5-0.20230828070859-c9144f02dda8/go.mod h1:EHwCeN9IXonsjKcjpS12MqeStdZvIdxt3VYXhus3G3c= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= diff --git a/modules/core/02-client/client/cli/tx.go b/modules/core/02-client/client/cli/tx.go index 7966daf7dac..e97ec1dd19b 100644 --- a/modules/core/02-client/client/cli/tx.go +++ b/modules/core/02-client/client/cli/tx.go @@ -12,15 +12,19 @@ import ( "github.com/cosmos/cosmos-sdk/client/tx" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" "github.com/cosmos/cosmos-sdk/version" govcli "github.com/cosmos/cosmos-sdk/x/gov/client/cli" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" "github.com/cosmos/ibc-go/v7/modules/core/exported" ) +const FlagAuthority = "authority" + // NewCreateClientCmd defines the command to create a new IBC light client. func NewCreateClientCmd() *cobra.Command { cmd := &cobra.Command{ @@ -241,6 +245,63 @@ func NewUpgradeClientCmd() *cobra.Command { return cmd } +// NewCmdRecoverClientProposal defines the command to recover an IBC light client +func NewCmdRecoverClientProposal() *cobra.Command { + cmd := &cobra.Command{ + Use: "recover [subject-client-id] [substitute-client-id] [flags]", + Args: cobra.ExactArgs(2), + Short: "recover an IBC client", + Long: "Submit a recover IBC client proposal along with an initial deposit.\n" + + "Please specify a subject client identifier you want to recover..\n" + + "Please specify the substitute client the subject client will be recovered to.", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + proposal, err := govcli.ReadGovPropFlags(clientCtx, cmd.Flags()) + if err != nil { + return err + } + + subjectClientID, substituteClientID := args[0], args[1] + + authority, _ := cmd.Flags().GetString(FlagAuthority) + if authority != "" { + if _, err = sdk.AccAddressFromBech32(authority); err != nil { + return fmt.Errorf("invalid authority address: %w", err) + } + } else { + authority = sdk.AccAddress(address.Module(govtypes.ModuleName)).String() + } + + msg := types.NewMsgRecoverClient(authority, subjectClientID, substituteClientID) + + if err = msg.ValidateBasic(); err != nil { + return err + } + + if err := proposal.SetMsgs([]sdk.Msg{msg}); err != nil { + return fmt.Errorf("failed to create recover client proposal message: %w", err) + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposal) + }, + } + + cmd.Flags().String(FlagAuthority, "", "The address of the client module authority (defaults to gov)") + + flags.AddTxFlagsToCmd(cmd) + govcli.AddGovPropFlagsToCmd(cmd) + err := cmd.MarkFlagRequired(govcli.FlagTitle) + if err != nil { + panic(err) + } + + return cmd +} + // NewCmdSubmitUpdateClientProposal implements a command handler for submitting an update IBC client proposal transaction. func NewCmdSubmitUpdateClientProposal() *cobra.Command { cmd := &cobra.Command{ @@ -282,7 +343,7 @@ func NewCmdSubmitUpdateClientProposal() *cobra.Command { return err } - msg, err := govtypes.NewMsgSubmitProposal(content, deposit, from) + msg, err := govv1beta1.NewMsgSubmitProposal(content, deposit, from) if err != nil { return err } @@ -381,7 +442,7 @@ func NewCmdSubmitUpgradeProposal() *cobra.Command { return err } - msg, err := govtypes.NewMsgSubmitProposal(content, deposit, from) + msg, err := govv1beta1.NewMsgSubmitProposal(content, deposit, from) if err != nil { return err } From 0bf6708ad2b17680adec31a096ebe4679c3403b3 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Thu, 31 Aug 2023 22:40:51 +0200 Subject: [PATCH 09/34] rename command --- modules/core/02-client/client/cli/cli.go | 1 + modules/core/02-client/client/cli/tx.go | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/core/02-client/client/cli/cli.go b/modules/core/02-client/client/cli/cli.go index fd5b4b95338..df2073a091b 100644 --- a/modules/core/02-client/client/cli/cli.go +++ b/modules/core/02-client/client/cli/cli.go @@ -48,6 +48,7 @@ func NewTxCmd() *cobra.Command { NewUpdateClientCmd(), NewSubmitMisbehaviourCmd(), // Deprecated NewUpgradeClientCmd(), + NewCmdSubmitRecoverClientProposal(), ) return txCmd diff --git a/modules/core/02-client/client/cli/tx.go b/modules/core/02-client/client/cli/tx.go index e97ec1dd19b..ebf30c75087 100644 --- a/modules/core/02-client/client/cli/tx.go +++ b/modules/core/02-client/client/cli/tx.go @@ -245,10 +245,10 @@ func NewUpgradeClientCmd() *cobra.Command { return cmd } -// NewCmdRecoverClientProposal defines the command to recover an IBC light client -func NewCmdRecoverClientProposal() *cobra.Command { +// NewCmdSubmitRecoverClientProposal defines the command to recover an IBC light client +func NewCmdSubmitRecoverClientProposal() *cobra.Command { cmd := &cobra.Command{ - Use: "recover [subject-client-id] [substitute-client-id] [flags]", + Use: "recover-client [subject-client-id] [substitute-client-id] [flags]", Args: cobra.ExactArgs(2), Short: "recover an IBC client", Long: "Submit a recover IBC client proposal along with an initial deposit.\n" + From 8a372bdaa12e179866f528f36653085466599e55 Mon Sep 17 00:00:00 2001 From: srdtrk <59252793+srdtrk@users.noreply.github.com> Date: Tue, 5 Sep 2023 11:57:15 +0300 Subject: [PATCH 10/34] docs: fixed broken links (#4571) --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- docs/apps/transfer/metrics.md | 2 +- docs/dev/project-structure.md | 2 +- docs/ibc/apps.md | 2 +- docs/ibc/apps/apps.md | 2 +- docs/ibc/integration.md | 2 +- docs/ibc/overview.md | 2 +- docs/ibc/relayer.md | 2 +- docs/middleware/ics29-fee/fee-distribution.md | 6 +++--- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 18484388b1f..cf6c0168249 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -43,7 +43,7 @@ write a little note why. - [ ] Targeted PR against correct branch (see [CONTRIBUTING.md](https://github.com/cosmos/ibc-go/blob/main/docs/dev/pull-requests.md#pull-request-targeting)). - [ ] Linked to Github issue with discussion and accepted design OR link to spec that describes this work. -- [ ] Code follows the [module structure standards](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/building-modules/11-structure.md) and [Go style guide](../docs/dev/go-style-guide.md). +- [ ] Code follows the [module structure standards](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/build/building-modules/11-structure.md) and [Go style guide](../docs/dev/go-style-guide.md). - [ ] Wrote unit and integration [tests](https://github.com/cosmos/ibc-go/blob/main/testing/README.md#ibc-testing-package). - [ ] Updated relevant documentation (`docs/`) or specification (`x//spec/`). - [ ] Added relevant `godoc` [comments](https://blog.golang.org/godoc-documenting-go-code). diff --git a/docs/apps/transfer/metrics.md b/docs/apps/transfer/metrics.md index 7d83b08eb13..3d2bb4bd82f 100644 --- a/docs/apps/transfer/metrics.md +++ b/docs/apps/transfer/metrics.md @@ -4,7 +4,7 @@ order: 6 # Metrics -The IBC transfer application module exposes the following set of [metrics](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/core/09-telemetry.md). +The IBC transfer application module exposes the following set of [metrics](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/develop/advanced/09-telemetry.md). | Metric | Description | Unit | Type | |:--------------------------------|:------------------------------------------------------------------------------------------|:----------------|:--------| diff --git a/docs/dev/project-structure.md b/docs/dev/project-structure.md index 7e5e68d70cd..bb8e697d904 100644 --- a/docs/dev/project-structure.md +++ b/docs/dev/project-structure.md @@ -1,6 +1,6 @@ # Project structure -If you're not familiar with the overall module structure from the SDK modules, please check this [document](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/building-modules/11-structure.md) as prerequisite reading. +If you're not familiar with the overall module structure from the SDK modules, please check this [document](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/build/building-modules/11-structure.md) as prerequisite reading. Every Interchain Standard (ICS) has been developed in its own package. The development team separated the IBC TAO (Transport, Authentication, Ordering) ICS specifications from the IBC application level specification. The following sections describe the architecture of the most relevant directories that comprise this repository. diff --git a/docs/ibc/apps.md b/docs/ibc/apps.md index 0d80d412337..7a8f07954bd 100644 --- a/docs/ibc/apps.md +++ b/docs/ibc/apps.md @@ -488,4 +488,4 @@ callbacks](https://github.com/cosmos/ibc-go/blob/main/modules/apps/transfer/ibc_ ## Next {hide} -Learn about [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/building-modules/01-intro.md) {hide} +Learn about [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/build/building-modules/01-intro.md) {hide} diff --git a/docs/ibc/apps/apps.md b/docs/ibc/apps/apps.md index 86a53e6f94b..9cf9169c9b7 100644 --- a/docs/ibc/apps/apps.md +++ b/docs/ibc/apps/apps.md @@ -48,4 +48,4 @@ callbacks](https://github.com/cosmos/ibc-go/blob/main/modules/apps/transfer/ibc_ ## Next {hide} -Learn about [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/building-modules/01-intro.md) {hide} +Learn about [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/build/building-modules/01-intro.md) {hide} diff --git a/docs/ibc/integration.md b/docs/ibc/integration.md index 9c709d96826..ec8a78765f9 100644 --- a/docs/ibc/integration.md +++ b/docs/ibc/integration.md @@ -157,7 +157,7 @@ func NewApp(...args) *App { ### Module Managers -In order to use IBC, we need to add the new modules to the module `Manager` and to the `SimulationManager` in case your application supports [simulations](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/building-modules/14-simulator.md). +In order to use IBC, we need to add the new modules to the module `Manager` and to the `SimulationManager` in case your application supports [simulations](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/build/building-modules/14-simulator.md). ```go // app.go diff --git a/docs/ibc/overview.md b/docs/ibc/overview.md index 1b1b5213a36..68c6d31ed8e 100644 --- a/docs/ibc/overview.md +++ b/docs/ibc/overview.md @@ -136,7 +136,7 @@ Proofs are passed from core IBC to light-clients as bytes. It is up to light cli [ICS-24 Host State Machine Requirements](https://github.com/cosmos/ics/tree/master/spec/core/ics-024-host-requirements). - The proof format that all implementations must be able to produce and verify is defined in [ICS-23 Proofs](https://github.com/cosmos/ics23) implementation. -### [Capabilities](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/core/10-ocap.md) +### [Capabilities](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/develop/advanced/10-ocap.md) IBC is intended to work in execution environments where modules do not necessarily trust each other. Thus, IBC must authenticate module actions on ports and channels so that only modules with the diff --git a/docs/ibc/relayer.md b/docs/ibc/relayer.md index d8fdd6a2164..7da4e73bf92 100644 --- a/docs/ibc/relayer.md +++ b/docs/ibc/relayer.md @@ -7,7 +7,7 @@ order: 6 ## Pre-requisites Readings - [IBC Overview](./overview.md) {prereq} -- [Events](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/core/08-events.md) {prereq} +- [Events](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/develop/advanced/08-events.md) {prereq} ## Events diff --git a/docs/middleware/ics29-fee/fee-distribution.md b/docs/middleware/ics29-fee/fee-distribution.md index b23873a6e2d..d1be7e2ff8a 100644 --- a/docs/middleware/ics29-fee/fee-distribution.md +++ b/docs/middleware/ics29-fee/fee-distribution.md @@ -50,7 +50,7 @@ type MsgRegisterCounterpartyPayee struct { > > - `PortId` is invalid (see [24-host naming requirements](https://github.com/cosmos/ibc/blob/master/spec/core/ics-024-host-requirements/README.md#paths-identifiers-separators). > - `ChannelId` is invalid (see [24-host naming requirements](https://github.com/cosmos/ibc/blob/master/spec/core/ics-024-host-requirements/README.md#paths-identifiers-separators)). -> - `Relayer` is an invalid address (see [Cosmos SDK Addresses](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/basics/03-accounts.md#addresses)). +> - `Relayer` is an invalid address (see [Cosmos SDK Addresses](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/develop/beginner/03-accounts.md#addresses)). > - `CounterpartyPayee` is empty. See below for an example CLI command: @@ -95,8 +95,8 @@ type MsgRegisterPayee struct { > > - `PortId` is invalid (see [24-host naming requirements](https://github.com/cosmos/ibc/blob/master/spec/core/ics-024-host-requirements/README.md#paths-identifiers-separators). > - `ChannelId` is invalid (see [24-host naming requirements](https://github.com/cosmos/ibc/blob/master/spec/core/ics-024-host-requirements/README.md#paths-identifiers-separators)). -> - `Relayer` is an invalid address (see [Cosmos SDK Addresses](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/basics/03-accounts.md#addresses)). -> - `Payee` is an invalid address (see [Cosmos SDK Addresses](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/basics/03-accounts.md#addresses)). +> - `Relayer` is an invalid address (see [Cosmos SDK Addresses](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/develop/beginner/03-accounts.md#addresses)). +> - `Payee` is an invalid address (see [Cosmos SDK Addresses](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/develop/beginner/03-accounts.md#addresses)). See below for an example CLI command: From 611e69a1ee83bd6bf95dc94affc3e9883d7e45f2 Mon Sep 17 00:00:00 2001 From: Jim Fasarakis-Hilliard Date: Wed, 6 Sep 2023 06:39:27 +0300 Subject: [PATCH 11/34] Add e2e test for recovering a client. (#4543) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Colin Axnér <25233464+colin-axner@users.noreply.github.com> --- e2e/tests/core/02-client/client_test.go | 85 +++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/e2e/tests/core/02-client/client_test.go b/e2e/tests/core/02-client/client_test.go index 911b22c912e..db09a386dc7 100644 --- a/e2e/tests/core/02-client/client_test.go +++ b/e2e/tests/core/02-client/client_test.go @@ -153,6 +153,91 @@ func (s *ClientTestSuite) TestClientUpdateProposal_Succeeds() { }) } +// TestRecoverClient_Succeeds tests that a governance proposal to recover a client using a MsgRecoverClient is successful. +func (s *ClientTestSuite) TestRecoverClient_Succeeds() { + t := s.T() + ctx := context.TODO() + + var ( + pathName string + relayer ibc.Relayer + subjectClientID string + substituteClientID string + // set the trusting period to a value which will still be valid upon client creation, but invalid before the first update + badTrustingPeriod = time.Duration(time.Second * 10) + ) + + t.Run("create substitute client with correct trusting period", func(t *testing.T) { + relayer, _ = s.SetupChainsRelayerAndChannel(ctx) + + // TODO: update when client identifier created is accessible + // currently assumes first client is 07-tendermint-0 + substituteClientID = clienttypes.FormatClientIdentifier(ibcexported.Tendermint, 0) + + // TODO: replace with better handling of path names + pathName = fmt.Sprintf("%s-path-%d", s.T().Name(), 0) + pathName = strings.ReplaceAll(pathName, "/", "-") + }) + + chainA, chainB := s.GetChains() + chainAWallet := s.CreateUserOnChainA(ctx, testvalues.StartingTokenAmount) + + t.Run("create subject client with bad trusting period", func(t *testing.T) { + createClientOptions := ibc.CreateClientOptions{ + TrustingPeriod: badTrustingPeriod.String(), + } + + s.SetupClients(ctx, relayer, createClientOptions) + + // TODO: update when client identifier created is accessible + // currently assumes second client is 07-tendermint-1 + subjectClientID = clienttypes.FormatClientIdentifier(ibcexported.Tendermint, 1) + }) + + time.Sleep(badTrustingPeriod) + + t.Run("update substitute client", func(t *testing.T) { + s.UpdateClients(ctx, relayer, pathName) + }) + + s.Require().NoError(test.WaitForBlocks(ctx, 1, chainA, chainB), "failed to wait for blocks") + + t.Run("check status of each client", func(t *testing.T) { + t.Run("substitute should be active", func(t *testing.T) { + status, err := s.Status(ctx, chainA, substituteClientID) + s.Require().NoError(err) + s.Require().Equal(ibcexported.Active.String(), status) + }) + + t.Run("subject should be expired", func(t *testing.T) { + status, err := s.Status(ctx, chainA, subjectClientID) + s.Require().NoError(err) + s.Require().Equal(ibcexported.Expired.String(), status) + }) + }) + + t.Run("send recover client message", func(t *testing.T) { + authority, err := s.QueryModuleAccountAddress(ctx, govtypes.ModuleName, chainA) + s.Require().NoError(err) + recoverClientMsg := clienttypes.NewMsgRecoverClient(authority.String(), subjectClientID, substituteClientID) + s.ExecuteGovProposalV1(ctx, recoverClientMsg, chainA, chainAWallet, 1) + }) + + t.Run("check status of each client", func(t *testing.T) { + t.Run("substitute should be active", func(t *testing.T) { + status, err := s.Status(ctx, chainA, substituteClientID) + s.Require().NoError(err) + s.Require().Equal(ibcexported.Active.String(), status) + }) + + t.Run("subject should be active", func(t *testing.T) { + status, err := s.Status(ctx, chainA, subjectClientID) + s.Require().NoError(err) + s.Require().Equal(ibcexported.Active.String(), status) + }) + }) +} + func (s *ClientTestSuite) TestClient_Update_Misbehaviour() { t := s.T() ctx := context.TODO() From 7f3dd429c19bb67b524002ef52421cb62c5b2b63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?colin=20axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Wed, 6 Sep 2023 13:09:34 +0200 Subject: [PATCH 12/34] feat: add unpacket inerfaces message assertion (#4588) --- modules/core/02-client/types/msgs.go | 6 +++++ modules/core/02-client/types/msgs_test.go | 28 +++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/modules/core/02-client/types/msgs.go b/modules/core/02-client/types/msgs.go index 9599b176c26..4f5b3116162 100644 --- a/modules/core/02-client/types/msgs.go +++ b/modules/core/02-client/types/msgs.go @@ -25,6 +25,7 @@ var ( _ codectypes.UnpackInterfacesMessage = (*MsgUpdateClient)(nil) _ codectypes.UnpackInterfacesMessage = (*MsgSubmitMisbehaviour)(nil) _ codectypes.UnpackInterfacesMessage = (*MsgUpgradeClient)(nil) + _ codectypes.UnpackInterfacesMessage = (*MsgIBCSoftwareUpgrade)(nil) ) // NewMsgCreateClient creates a new MsgCreateClient instance @@ -329,6 +330,11 @@ func (msg *MsgIBCSoftwareUpgrade) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{accAddr} } +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces +func (msg *MsgIBCSoftwareUpgrade) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { + return unpacker.UnpackAny(msg.UpgradedClientState, new(exported.ClientState)) +} + // NewMsgRecoverClient creates a new MsgRecoverClient instance func NewMsgRecoverClient(signer, subjectClientID, substituteClientID string) *MsgRecoverClient { return &MsgRecoverClient{ diff --git a/modules/core/02-client/types/msgs_test.go b/modules/core/02-client/types/msgs_test.go index cdffa92a415..46a5409860e 100644 --- a/modules/core/02-client/types/msgs_test.go +++ b/modules/core/02-client/types/msgs_test.go @@ -923,3 +923,31 @@ func (suite *TypesTestSuite) TestMsgIBCSoftwareUpgrade_ValidateBasic() { } } } + +// tests a MsgIBCSoftwareUpgrade can be marshaled and unmarshaled, and the +// client state can be unpacked +func (suite *TypesTestSuite) TestMarshalMsgIBCSoftwareUpgrade() { + cdc := suite.chainA.App.AppCodec() + + // create proposal + plan := upgradetypes.Plan{ + Name: "upgrade ibc", + Height: 1000, + } + + msg, err := types.NewMsgIBCSoftwareUpgrade(ibctesting.TestAccAddress, plan, &ibctm.ClientState{}) + suite.Require().NoError(err) + + // marshal message + bz, err := cdc.MarshalJSON(msg) + suite.Require().NoError(err) + + // unmarshal proposal + newMsg := &types.MsgIBCSoftwareUpgrade{} + err = cdc.UnmarshalJSON(bz, newMsg) + suite.Require().NoError(err) + + // unpack client state + _, err = types.UnpackClientState(newMsg.UpgradedClientState) + suite.Require().NoError(err) +} From a3746319459947d1b7c99ecbf03d4ace90c7dc70 Mon Sep 17 00:00:00 2001 From: Charly Date: Wed, 6 Sep 2023 14:09:38 +0200 Subject: [PATCH 13/34] add cli for MsgIBCSoftwareUpgrade (#4558) --- modules/core/02-client/client/cli/cli.go | 3 +- modules/core/02-client/client/cli/tx.go | 157 ++++++++++++++++++++++- 2 files changed, 155 insertions(+), 5 deletions(-) diff --git a/modules/core/02-client/client/cli/cli.go b/modules/core/02-client/client/cli/cli.go index df2073a091b..97c13cea62b 100644 --- a/modules/core/02-client/client/cli/cli.go +++ b/modules/core/02-client/client/cli/cli.go @@ -48,7 +48,8 @@ func NewTxCmd() *cobra.Command { NewUpdateClientCmd(), NewSubmitMisbehaviourCmd(), // Deprecated NewUpgradeClientCmd(), - NewCmdSubmitRecoverClientProposal(), + newSubmitRecoverClientProposalCmd(), + newScheduleIBCUpgradeProposalCmd(), ) return txCmd diff --git a/modules/core/02-client/client/cli/tx.go b/modules/core/02-client/client/cli/tx.go index 55be0846b11..b4050ed1e67 100644 --- a/modules/core/02-client/client/cli/tx.go +++ b/modules/core/02-client/client/cli/tx.go @@ -246,14 +246,14 @@ func NewUpgradeClientCmd() *cobra.Command { return cmd } -// NewCmdSubmitRecoverClientProposal defines the command to recover an IBC light client -func NewCmdSubmitRecoverClientProposal() *cobra.Command { +// newSubmitRecoverClientProposalCmd defines the command to recover an IBC light client +func newSubmitRecoverClientProposalCmd() *cobra.Command { cmd := &cobra.Command{ Use: "recover-client [subject-client-id] [substitute-client-id] [flags]", Args: cobra.ExactArgs(2), Short: "recover an IBC client", Long: "Submit a recover IBC client proposal along with an initial deposit.\n" + - "Please specify a subject client identifier you want to recover..\n" + + "Please specify a subject client identifier you want to recover.\n" + "Please specify the substitute client the subject client will be recovered to.", RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) @@ -310,7 +310,7 @@ func NewCmdSubmitUpdateClientProposal() *cobra.Command { Args: cobra.ExactArgs(2), Short: "Submit an update IBC client proposal", Long: "Submit an update IBC client proposal along with an initial deposit.\n" + - "Please specify a subject client identifier you want to update..\n" + + "Please specify a subject client identifier you want to update.\n" + "Please specify the substitute client the subject client will be updated to.", RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) @@ -454,3 +454,152 @@ func NewCmdSubmitUpgradeProposal() *cobra.Command { return cmd } + +// newScheduleIBCUpgradeProposalCmd defines the command for submitting an IBC software upgrade proposal. +func newScheduleIBCUpgradeProposalCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "schedule-ibc-upgrade [name] [height] [path/to/upgraded_client_state.json] [flags]", + Args: cobra.ExactArgs(3), + Short: "Submit an IBC software upgrade proposal", + Long: `Please specify a unique name and height for the upgrade to take effect. + The client state specified is the upgraded client state representing the upgraded chain + + Example Upgraded Client State JSON: + { + "@type":"/ibc.lightclients.tendermint.v1.ClientState", + "chain_id":"testchain1", + "unbonding_period":"1814400s", + "latest_height":{ + "revision_number":"0", + "revision_height":"2" + }, + "proof_specs":[ + { + "leaf_spec":{ + "hash":"SHA256", + "prehash_key":"NO_HASH", + "prehash_value":"SHA256", + "length":"VAR_PROTO", + "prefix":"AA==" + }, + "inner_spec":{ + "child_order":[ + 0, + 1 + ], + "child_size":33, + "min_prefix_length":4, + "max_prefix_length":12, + "empty_child":null, + "hash":"SHA256" + }, + "max_depth":0, + "min_depth":0 + }, + { + "leaf_spec":{ + "hash":"SHA256", + "prehash_key":"NO_HASH", + "prehash_value":"SHA256", + "length":"VAR_PROTO", + "prefix":"AA==" + }, + "inner_spec":{ + "child_order":[ + 0, + 1 + ], + "child_size":32, + "min_prefix_length":1, + "max_prefix_length":1, + "empty_child":null, + "hash":"SHA256" + }, + "max_depth":0, + "min_depth":0 + } + ], + "upgrade_path":[ + "upgrade", + "upgradedIBCState" + ] + } + `, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + proposal, err := govcli.ReadGovPropFlags(clientCtx, cmd.Flags()) + if err != nil { + return err + } + + cdc := codec.NewProtoCodec(clientCtx.InterfaceRegistry) + + name := args[0] + + height, err := strconv.ParseInt(args[1], 10, 64) + if err != nil { + return err + } + + plan := upgradetypes.Plan{ + Name: name, + Height: height, + } + + // attempt to unmarshal client state argument + var clientState exported.ClientState + clientContentOrFileName := args[2] + if err := cdc.UnmarshalInterfaceJSON([]byte(clientContentOrFileName), &clientState); err != nil { + + // check for file path if JSON input is not provided + contents, err := os.ReadFile(clientContentOrFileName) + if err != nil { + return fmt.Errorf("neither JSON input nor path to .json file for client state were provided: %w", err) + } + + if err := cdc.UnmarshalInterfaceJSON(contents, &clientState); err != nil { + return fmt.Errorf("error unmarshalling client state file: %w", err) + } + } + + authority, _ := cmd.Flags().GetString(FlagAuthority) + if authority != "" { + if _, err = sdk.AccAddressFromBech32(authority); err != nil { + return fmt.Errorf("invalid authority address: %w", err) + } + } else { + authority = sdk.AccAddress(address.Module(govtypes.ModuleName)).String() + } + + msg, err := types.NewMsgIBCSoftwareUpgrade(authority, plan, clientState) + if err != nil { + return fmt.Errorf("error in NewMsgIBCSoftwareUpgrade: %w", err) + } + + if err = msg.ValidateBasic(); err != nil { + return fmt.Errorf("error validating MsgIBCSoftwareUpgrade: %w", err) + } + + if err := proposal.SetMsgs([]sdk.Msg{msg}); err != nil { + return fmt.Errorf("failed to create proposal message for scheduling an IBC software upgrade: %w", err) + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposal) + }, + } + + cmd.Flags().String(FlagAuthority, "", "The address of the client module authority (defaults to gov)") + + flags.AddTxFlagsToCmd(cmd) + govcli.AddGovPropFlagsToCmd(cmd) + err := cmd.MarkFlagRequired(govcli.FlagTitle) + if err != nil { + panic(err) + } + + return cmd +} From ffcb06d4a6647ea068e11d8d5e310cfebcbc07e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?colin=20axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Wed, 6 Sep 2023 15:49:54 +0200 Subject: [PATCH 14/34] docs: use MsgRecoverClient in docs (#4580) * docs: recover client update * Update docs/ibc/proposals.md * Apply suggestions from code review Co-authored-by: Carlos Rodriguez --------- Co-authored-by: Carlos Rodriguez --- .../adr-026-ibc-client-recovery-mechanisms.md | 9 +++-- docs/ibc/proposals.md | 34 ++++++------------- 2 files changed, 17 insertions(+), 26 deletions(-) diff --git a/docs/architecture/adr-026-ibc-client-recovery-mechanisms.md b/docs/architecture/adr-026-ibc-client-recovery-mechanisms.md index e34244f1d6b..c10ef61c3a7 100644 --- a/docs/architecture/adr-026-ibc-client-recovery-mechanisms.md +++ b/docs/architecture/adr-026-ibc-client-recovery-mechanisms.md @@ -8,6 +8,7 @@ - 2021/05/20: Revision to simplify consensus state copying, remove initial height - 2022/04/08: Revision to deprecate AllowUpdateAfterExpiry and AllowUpdateAfterMisbehaviour - 2022/07/15: Revision to allow updating of TrustingPeriod +- 2023/09/05: Revision to migrate from gov v1beta1 to gov v1 ## Status @@ -44,16 +45,19 @@ We elect not to deal with chains which have actually halted, which is necessaril 1. `allow_update_after_misbehaviour` (boolean, default true). Note that this flag has been deprecated, it remains to signal intent but checks against this value will not be enforced. 1. Require Tendermint light clients (ICS 07) to expose the following additional state mutation functions 1. `Unfreeze()`, which unfreezes a light client after misbehaviour and clears any frozen height previously set -1. Add a new governance proposal type, `ClientUpdateProposal`, in the `x/ibc` module - 1. Extend the base `Proposal` with two client identifiers (`string`). +1. Add a new governance proposal with `MsgRecoverClient`. + 1. Create a new Msg with two client identifiers (`string`) and a signer. 1. The first client identifier is the proposed client to be updated. This client must be either frozen or expired. 1. The second client is a substitute client. It carries all the state for the client which may be updated. It must have identitical client and chain parameters to the client which may be updated (except for latest height, frozen height, and chain-id). It should be continually updated during the voting period. 1. If this governance proposal passes, the client on trial will be updated to the latest state of the substitute. + 1. The signer must be the authority set for the ibc module. Previously, `AllowUpdateAfterExpiry` and `AllowUpdateAfterMisbehaviour` were used to signal the recovery options for an expired or frozen client, and governance proposals were not allowed to overwrite the client if these parameters were set to false. However, this has now been deprecated because a code migration can overwrite the client and consensus states regardless of the value of these parameters. If governance would vote to overwrite a client or consensus state, it is likely that governance would also be willing to perform a code migration to do the same. In addition, `TrustingPeriod` was initally not allowed to be updated by a client upgrade proposal. However, due to the number of situations experienced in production where the `TrustingPeriod` of a client should be allowed to be updated because of ie: initial misconfiguration for a canonical channel, governance should be allowed to update this client parameter. + In versions older than ibc-go v8, `MsgRecoverClient` was a governance proposal type `ClientUpdateProposal`. It has been removed and replaced by `MsgRecoverClient` in the migration from goverance v1beta1 to governacne v1. + Note that this should NOT be lightly updated, as there may be a gap in time between when misbehaviour has occured and when the evidence of misbehaviour is submitted. For example, if the `UnbondingPeriod` is 2 weeks and the `TrustingPeriod` has also been set to two weeks, a validator could wait until right before `UnbondingPeriod` finishes, submit false information, then unbond and exit without being slashed for misbehaviour. Therefore, we recommend that the trusting period for the 07-tendermint client be set to 2/3 of the `UnbondingPeriod`. Note that clients frozen due to misbehaviour must wait for the evidence to expire to avoid becoming refrozen. @@ -83,3 +87,4 @@ No neutral consequences. - [Prior discussion](https://github.com/cosmos/ics/issues/421) - [Epoch number discussion](https://github.com/cosmos/ics/issues/439) - [Upgrade plan discussion](https://github.com/cosmos/ics/issues/445) +- [Migration from gov v1beta1 to gov v1](https://github.com/cosmos/ibc-go/issues/3672) diff --git a/docs/ibc/proposals.md b/docs/ibc/proposals.md index dc22eb441af..013be95834d 100644 --- a/docs/ibc/proposals.md +++ b/docs/ibc/proposals.md @@ -51,7 +51,6 @@ See also the relevant documentation: [ADR-026, IBC client recovery mechanisms](. ## Preconditions -- The chain is updated with ibc-go >= v1.1.0. - There exists an active client (with a known client identifier) for the same counterparty chain as the expired client. - The governance deposit. @@ -76,11 +75,10 @@ The client is attached to the expected Akash `chain-id`. Note that although the ### Step 2 -If the chain has been updated to ibc-go >= v1.1.0, anyone can submit the governance proposal to recover the client by executing this via CLI. +Anyone can submit the governance proposal to recover the client by executing the following via CLI. +If the chain is on an ibc-go version older than v8, please see the [relevant documentation](https://ibc.cosmos.network/v6.1.0/ibc/proposals.html). -> Note that the Cosmos SDK has updated how governance proposals are submitted in SDK v0.46, now requiring to pass a .json proposal file - -- From SDK v0.46.x onwards +- From ibc-go v8 onwards ```shell tx gov submit-proposal [path-to-proposal-json] @@ -92,30 +90,20 @@ If the chain has been updated to ibc-go >= v1.1.0, anyone can submit the governa { "messages": [ { - "@type": "/ibc.core.client.v1.ClientUpdateProposal", - "title": "title_string", - "description": "description_string", + "@type": "/ibc.core.client.v1.MsgRecoverClient", "subject_client_id": "expired_client_id_string", - "substitute_client_id": "active_client_id_string" + "substitute_client_id": "active_client_id_string", + "signer": "" } ], "metadata": "", "deposit": "10stake" + "title": "My proposal", + "summary": "A short summary of my proposal", + "expedited": false } ``` - Alternatively there's a legacy command (that is no longer recommended though): - - ```shell - tx gov submit-legacy-proposal update-client - ``` - -- Until SDK v0.45.x - - ```shell - tx gov submit-proposal update-client - ``` - The `` identifier is the proposed client to be updated. This client must be either frozen or expired. The `` represents a substitute client. It carries all the state for the client which may be updated. It must have identical client and chain parameters to the client which may be updated (except for latest height, frozen height, and chain ID). It should be continually updated during the voting period. @@ -124,6 +112,4 @@ After this, all that remains is deciding who funds the governance deposit and en ## Important considerations -Please note that from v1.0.0 of ibc-go it will not be allowed for transactions to go to expired clients anymore, so please update to at least this version to prevent similar issues in the future. - -Please also note that if the client on the other end of the transaction is also expired, that client will also need to update. This process updates only one client. +Please note that if the client on the other end of the transaction is also expired, that client will also need to update. This process updates only one client. From 40b727af990c776c4fb00cc3446193739f79e3eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?colin=20axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Thu, 7 Sep 2023 15:09:23 +0200 Subject: [PATCH 15/34] refactor: remove legacy client update proposal (#4581) * refactor: remove legacy client update proposal * e2e: swap from ClientUpdateProposal e2e to RecoverClient * refactor: remove unused events --- .../main/client-chain-a.json | 2 +- .../main/client-chain-b.json | 2 +- .../release-v6.1.x/client-chain-a.json | 2 +- .../release-v6.1.x/client-chain-b.json | 2 +- .../release-v6.2.x/client-chain-a.json | 2 +- .../release-v6.2.x/client-chain-b.json | 2 +- .../release-v7.2.x/client-chain-a.json | 2 +- .../release-v7.2.x/client-chain-b.json | 2 +- .../release-v7.3.x/client-chain-a.json | 2 +- .../release-v7.3.x/client-chain-b.json | 2 +- .../unreleased/client.json | 2 +- e2e/tests/core/02-client/client_test.go | 82 ---- modules/core/02-client/client/cli/tx.go | 57 --- .../core/02-client/client/proposal_handler.go | 5 +- modules/core/02-client/keeper/events.go | 15 - modules/core/02-client/keeper/proposal.go | 60 --- .../core/02-client/keeper/proposal_test.go | 138 ------- modules/core/02-client/proposal_handler.go | 2 - .../core/02-client/proposal_handler_test.go | 94 ----- modules/core/02-client/types/client.pb.go | 389 ++---------------- modules/core/02-client/types/codec.go | 1 - modules/core/02-client/types/events.go | 1 - modules/core/02-client/types/proposal.go | 48 +-- modules/core/02-client/types/proposal_test.go | 75 ---- proto/ibc/core/client/v1/client.proto | 18 - testing/simapp/app.go | 1 - 26 files changed, 54 insertions(+), 954 deletions(-) delete mode 100644 modules/core/02-client/proposal_handler_test.go diff --git a/.github/compatibility-test-matrices/main/client-chain-a.json b/.github/compatibility-test-matrices/main/client-chain-a.json index e4e3117a16e..c389c981465 100644 --- a/.github/compatibility-test-matrices/main/client-chain-a.json +++ b/.github/compatibility-test-matrices/main/client-chain-a.json @@ -18,7 +18,7 @@ "TestClientTestSuite" ], "test": [ - "TestClientUpdateProposal_Succeeds", + "TestRecoverClient_Succeeds", "TestClient_Update_Misbehaviour", "TestAllowedClientsParam" ], diff --git a/.github/compatibility-test-matrices/main/client-chain-b.json b/.github/compatibility-test-matrices/main/client-chain-b.json index ca52092c2cd..f5fce3a32d8 100644 --- a/.github/compatibility-test-matrices/main/client-chain-b.json +++ b/.github/compatibility-test-matrices/main/client-chain-b.json @@ -18,7 +18,7 @@ "TestClientTestSuite" ], "test": [ - "TestClientUpdateProposal_Succeeds", + "TestRecoverClient_Succeeds", "TestClient_Update_Misbehaviour" ], "relayer-type": [ diff --git a/.github/compatibility-test-matrices/release-v6.1.x/client-chain-a.json b/.github/compatibility-test-matrices/release-v6.1.x/client-chain-a.json index 24ea765b887..82d676d3c18 100644 --- a/.github/compatibility-test-matrices/release-v6.1.x/client-chain-a.json +++ b/.github/compatibility-test-matrices/release-v6.1.x/client-chain-a.json @@ -17,7 +17,7 @@ "TestClientTestSuite" ], "test": [ - "TestClientUpdateProposal_Succeeds", + "TestRecoverClient_Succeeds", "TestClient_Update_Misbehaviour", "TestAllowedClientsParam" ], diff --git a/.github/compatibility-test-matrices/release-v6.1.x/client-chain-b.json b/.github/compatibility-test-matrices/release-v6.1.x/client-chain-b.json index d423dabf97b..6a6db3424fc 100644 --- a/.github/compatibility-test-matrices/release-v6.1.x/client-chain-b.json +++ b/.github/compatibility-test-matrices/release-v6.1.x/client-chain-b.json @@ -17,7 +17,7 @@ "TestClientTestSuite" ], "test": [ - "TestClientUpdateProposal_Succeeds", + "TestRecoverClient_Succeeds", "TestClient_Update_Misbehaviour" ], "relayer-type": [ diff --git a/.github/compatibility-test-matrices/release-v6.2.x/client-chain-a.json b/.github/compatibility-test-matrices/release-v6.2.x/client-chain-a.json index 1ba47832a7b..e180af2505a 100644 --- a/.github/compatibility-test-matrices/release-v6.2.x/client-chain-a.json +++ b/.github/compatibility-test-matrices/release-v6.2.x/client-chain-a.json @@ -17,7 +17,7 @@ "TestClientTestSuite" ], "test": [ - "TestClientUpdateProposal_Succeeds", + "TestRecoverClient_Succeeds", "TestClient_Update_Misbehaviour", "TestAllowedClientsParam" ], diff --git a/.github/compatibility-test-matrices/release-v6.2.x/client-chain-b.json b/.github/compatibility-test-matrices/release-v6.2.x/client-chain-b.json index d55679c29b3..1f389cb3ea8 100644 --- a/.github/compatibility-test-matrices/release-v6.2.x/client-chain-b.json +++ b/.github/compatibility-test-matrices/release-v6.2.x/client-chain-b.json @@ -17,7 +17,7 @@ "TestClientTestSuite" ], "test": [ - "TestClientUpdateProposal_Succeeds", + "TestRecoverClient_Succeeds", "TestClient_Update_Misbehaviour" ], "relayer-type": [ diff --git a/.github/compatibility-test-matrices/release-v7.2.x/client-chain-a.json b/.github/compatibility-test-matrices/release-v7.2.x/client-chain-a.json index 7c8d51cc7b8..b5520a248b4 100644 --- a/.github/compatibility-test-matrices/release-v7.2.x/client-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.2.x/client-chain-a.json @@ -17,7 +17,7 @@ "TestClientTestSuite" ], "test": [ - "TestClientUpdateProposal_Succeeds", + "TestRecoverClient_Succeeds", "TestClient_Update_Misbehaviour", "TestAllowedClientsParam" ], diff --git a/.github/compatibility-test-matrices/release-v7.2.x/client-chain-b.json b/.github/compatibility-test-matrices/release-v7.2.x/client-chain-b.json index 00890b0ee3b..5d6d51b0605 100644 --- a/.github/compatibility-test-matrices/release-v7.2.x/client-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.2.x/client-chain-b.json @@ -17,7 +17,7 @@ "TestClientTestSuite" ], "test": [ - "TestClientUpdateProposal_Succeeds", + "TestRecoverClient_Succeeds", "TestClient_Update_Misbehaviour" ], "relayer-type": [ diff --git a/.github/compatibility-test-matrices/release-v7.3.x/client-chain-a.json b/.github/compatibility-test-matrices/release-v7.3.x/client-chain-a.json index 29b125aace1..ab8f51f9bae 100644 --- a/.github/compatibility-test-matrices/release-v7.3.x/client-chain-a.json +++ b/.github/compatibility-test-matrices/release-v7.3.x/client-chain-a.json @@ -17,7 +17,7 @@ "TestClientTestSuite" ], "test": [ - "TestClientUpdateProposal_Succeeds", + "TestRecoverClient_Succeeds", "TestClient_Update_Misbehaviour", "TestAllowedClientsParam" ], diff --git a/.github/compatibility-test-matrices/release-v7.3.x/client-chain-b.json b/.github/compatibility-test-matrices/release-v7.3.x/client-chain-b.json index 0c8950e2eda..ecec881f080 100644 --- a/.github/compatibility-test-matrices/release-v7.3.x/client-chain-b.json +++ b/.github/compatibility-test-matrices/release-v7.3.x/client-chain-b.json @@ -17,7 +17,7 @@ "TestClientTestSuite" ], "test": [ - "TestClientUpdateProposal_Succeeds", + "TestRecoverClient_Succeeds", "TestClient_Update_Misbehaviour" ], "relayer-type": [ diff --git a/.github/compatibility-test-matrices/unreleased/client.json b/.github/compatibility-test-matrices/unreleased/client.json index b0a6412a8c5..2b3e2376be2 100644 --- a/.github/compatibility-test-matrices/unreleased/client.json +++ b/.github/compatibility-test-matrices/unreleased/client.json @@ -21,7 +21,7 @@ "TestClientTestSuite" ], "test": [ - "TestClientUpdateProposal_Succeeds", + "TestRecoverClient_Succeeds", "TestClient_Update_Misbehaviour", "TestAllowedClientsParam" ], diff --git a/e2e/tests/core/02-client/client_test.go b/e2e/tests/core/02-client/client_test.go index db09a386dc7..34e6d8d9adc 100644 --- a/e2e/tests/core/02-client/client_test.go +++ b/e2e/tests/core/02-client/client_test.go @@ -71,88 +71,6 @@ func (s *ClientTestSuite) QueryAllowedClients(ctx context.Context, chain ibc.Cha return res.Params.AllowedClients } -func (s *ClientTestSuite) TestClientUpdateProposal_Succeeds() { - t := s.T() - ctx := context.TODO() - - var ( - pathName string - relayer ibc.Relayer - subjectClientID string - substituteClientID string - // set the trusting period to a value which will still be valid upon client creation, but invalid before the first update - badTrustingPeriod = time.Second * 10 - ) - - t.Run("create substitute client with correct trusting period", func(t *testing.T) { - relayer, _ = s.SetupChainsRelayerAndChannel(ctx) - - // TODO: update when client identifier created is accessible - // currently assumes first client is 07-tendermint-0 - substituteClientID = clienttypes.FormatClientIdentifier(ibcexported.Tendermint, 0) - - // TODO: replace with better handling of path names - pathName = fmt.Sprintf("%s-path-%d", s.T().Name(), 0) - pathName = strings.ReplaceAll(pathName, "/", "-") - }) - - chainA, chainB := s.GetChains() - chainAWallet := s.CreateUserOnChainA(ctx, testvalues.StartingTokenAmount) - - t.Run("create subject client with bad trusting period", func(t *testing.T) { - createClientOptions := ibc.CreateClientOptions{ - TrustingPeriod: badTrustingPeriod.String(), - } - - s.SetupClients(ctx, relayer, createClientOptions) - - // TODO: update when client identifier created is accessible - // currently assumes second client is 07-tendermint-1 - subjectClientID = clienttypes.FormatClientIdentifier(ibcexported.Tendermint, 1) - }) - - time.Sleep(badTrustingPeriod) - - t.Run("update substitute client", func(t *testing.T) { - s.UpdateClients(ctx, relayer, pathName) - }) - - s.Require().NoError(test.WaitForBlocks(ctx, 1, chainA, chainB), "failed to wait for blocks") - - t.Run("check status of each client", func(t *testing.T) { - t.Run("substitute should be active", func(t *testing.T) { - status, err := s.Status(ctx, chainA, substituteClientID) - s.Require().NoError(err) - s.Require().Equal(ibcexported.Active.String(), status) - }) - - t.Run("subject should be expired", func(t *testing.T) { - status, err := s.Status(ctx, chainA, subjectClientID) - s.Require().NoError(err) - s.Require().Equal(ibcexported.Expired.String(), status) - }) - }) - - t.Run("pass client update proposal", func(t *testing.T) { - proposal := clienttypes.NewClientUpdateProposal(ibctesting.Title, ibctesting.Description, subjectClientID, substituteClientID) - s.ExecuteGovProposal(ctx, chainA, chainAWallet, proposal) - }) - - t.Run("check status of each client", func(t *testing.T) { - t.Run("substitute should be active", func(t *testing.T) { - status, err := s.Status(ctx, chainA, substituteClientID) - s.Require().NoError(err) - s.Require().Equal(ibcexported.Active.String(), status) - }) - - t.Run("subject should be active", func(t *testing.T) { - status, err := s.Status(ctx, chainA, subjectClientID) - s.Require().NoError(err) - s.Require().Equal(ibcexported.Active.String(), status) - }) - }) -} - // TestRecoverClient_Succeeds tests that a governance proposal to recover a client using a MsgRecoverClient is successful. func (s *ClientTestSuite) TestRecoverClient_Succeeds() { t := s.T() diff --git a/modules/core/02-client/client/cli/tx.go b/modules/core/02-client/client/cli/tx.go index b4050ed1e67..107d7578f83 100644 --- a/modules/core/02-client/client/cli/tx.go +++ b/modules/core/02-client/client/cli/tx.go @@ -303,63 +303,6 @@ func newSubmitRecoverClientProposalCmd() *cobra.Command { return cmd } -// NewCmdSubmitUpdateClientProposal implements a command handler for submitting an update IBC client proposal transaction. -func NewCmdSubmitUpdateClientProposal() *cobra.Command { - cmd := &cobra.Command{ - Use: "update-client [subject-client-id] [substitute-client-id]", - Args: cobra.ExactArgs(2), - Short: "Submit an update IBC client proposal", - Long: "Submit an update IBC client proposal along with an initial deposit.\n" + - "Please specify a subject client identifier you want to update.\n" + - "Please specify the substitute client the subject client will be updated to.", - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - title, err := cmd.Flags().GetString(govcli.FlagTitle) //nolint:staticcheck // need this till full govv1 conversion. - if err != nil { - return err - } - - description, err := cmd.Flags().GetString(govcli.FlagDescription) //nolint:staticcheck // need this till full govv1 conversion. - if err != nil { - return err - } - - subjectClientID := args[0] - substituteClientID := args[1] - - content := types.NewClientUpdateProposal(title, description, subjectClientID, substituteClientID) - - from := clientCtx.GetFromAddress() - - depositStr, err := cmd.Flags().GetString(govcli.FlagDeposit) - if err != nil { - return err - } - deposit, err := sdk.ParseCoinsNormalized(depositStr) - if err != nil { - return err - } - - msg, err := govv1beta1.NewMsgSubmitProposal(content, deposit, from) - if err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - cmd.Flags().String(govcli.FlagTitle, "", "title of proposal") //nolint:staticcheck // need this till full govv1 conversion. - cmd.Flags().String(govcli.FlagDescription, "", "description of proposal") //nolint:staticcheck // need this till full govv1 conversion. - cmd.Flags().String(govcli.FlagDeposit, "", "deposit of proposal") - - return cmd -} - // NewCmdSubmitUpgradeProposal implements a command handler for submitting an upgrade IBC client proposal transaction. func NewCmdSubmitUpgradeProposal() *cobra.Command { cmd := &cobra.Command{ diff --git a/modules/core/02-client/client/proposal_handler.go b/modules/core/02-client/client/proposal_handler.go index 9a540f4da3b..d574c14ce89 100644 --- a/modules/core/02-client/client/proposal_handler.go +++ b/modules/core/02-client/client/proposal_handler.go @@ -6,7 +6,4 @@ import ( "github.com/cosmos/ibc-go/v7/modules/core/02-client/client/cli" ) -var ( - UpdateClientProposalHandler = govclient.NewProposalHandler(cli.NewCmdSubmitUpdateClientProposal) - UpgradeProposalHandler = govclient.NewProposalHandler(cli.NewCmdSubmitUpgradeProposal) -) +var UpgradeProposalHandler = govclient.NewProposalHandler(cli.NewCmdSubmitUpgradeProposal) diff --git a/modules/core/02-client/keeper/events.go b/modules/core/02-client/keeper/events.go index 08bf94f4c62..b94ecaae30c 100644 --- a/modules/core/02-client/keeper/events.go +++ b/modules/core/02-client/keeper/events.go @@ -82,21 +82,6 @@ func emitUpgradeClientEvent(ctx sdk.Context, clientID string, clientState export }) } -// emitUpdateClientProposalEvent emits an update client proposal event -func emitUpdateClientProposalEvent(ctx sdk.Context, clientID, clientType string) { - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeUpdateClientProposal, - sdk.NewAttribute(types.AttributeKeySubjectClientID, clientID), - sdk.NewAttribute(types.AttributeKeyClientType, clientType), - ), - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - ), - }) -} - // emitRecoverClientEvent emits a recover client event func emitRecoverClientEvent(ctx sdk.Context, clientID, clientType string) { ctx.EventManager().EmitEvents(sdk.Events{ diff --git a/modules/core/02-client/keeper/proposal.go b/modules/core/02-client/keeper/proposal.go index eda3bb70492..ee75a16c038 100644 --- a/modules/core/02-client/keeper/proposal.go +++ b/modules/core/02-client/keeper/proposal.go @@ -1,73 +1,13 @@ package keeper import ( - metrics "github.com/hashicorp/go-metrics" - errorsmod "cosmossdk.io/errors" - "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - "github.com/cosmos/ibc-go/v7/modules/core/exported" ) -// ClientUpdateProposal will retrieve the subject and substitute client. -// A callback will occur to the subject client state with the client -// prefixed store being provided for both the subject and the substitute client. -// The IBC client implementations are responsible for validating the parameters of the -// subtitute (enusring they match the subject's parameters) as well as copying -// the necessary consensus states from the subtitute to the subject client -// store. The substitute must be Active and the subject must not be Active. -func (k Keeper) ClientUpdateProposal(ctx sdk.Context, p *types.ClientUpdateProposal) error { - subjectClientState, found := k.GetClientState(ctx, p.SubjectClientId) - if !found { - return errorsmod.Wrapf(types.ErrClientNotFound, "subject client with ID %s", p.SubjectClientId) - } - - subjectClientStore := k.ClientStore(ctx, p.SubjectClientId) - - if status := k.GetClientStatus(ctx, subjectClientState, p.SubjectClientId); status == exported.Active { - return errorsmod.Wrap(types.ErrInvalidRecoveryClient, "cannot update Active subject client") - } - - substituteClientState, found := k.GetClientState(ctx, p.SubstituteClientId) - if !found { - return errorsmod.Wrapf(types.ErrClientNotFound, "substitute client with ID %s", p.SubstituteClientId) - } - - if subjectClientState.GetLatestHeight().GTE(substituteClientState.GetLatestHeight()) { - return errorsmod.Wrapf(types.ErrInvalidHeight, "subject client state latest height is greater or equal to substitute client state latest height (%s >= %s)", subjectClientState.GetLatestHeight(), substituteClientState.GetLatestHeight()) - } - - substituteClientStore := k.ClientStore(ctx, p.SubstituteClientId) - - if status := k.GetClientStatus(ctx, substituteClientState, p.SubstituteClientId); status != exported.Active { - return errorsmod.Wrapf(types.ErrClientNotActive, "substitute client is not Active, status is %s", status) - } - - if err := subjectClientState.CheckSubstituteAndUpdateState(ctx, k.cdc, subjectClientStore, substituteClientStore, substituteClientState); err != nil { - return err - } - - k.Logger(ctx).Info("client updated after governance proposal passed", "client-id", p.SubjectClientId) - - defer telemetry.IncrCounterWithLabels( - []string{"ibc", "client", "update"}, - 1, - []metrics.Label{ - telemetry.NewLabel(types.LabelClientType, substituteClientState.ClientType()), - telemetry.NewLabel(types.LabelClientID, p.SubjectClientId), - telemetry.NewLabel(types.LabelUpdateType, "proposal"), - }, - ) - - // emitting events in the keeper for proposal updates to clients - emitUpdateClientProposalEvent(ctx, p.SubjectClientId, substituteClientState.ClientType()) - - return nil -} - // HandleUpgradeProposal sets the upgraded client state in the upgrade store. It clears // an IBC client state and consensus state if a previous plan was set. Then it // will schedule an upgrade and finally set the upgraded client state in upgrade diff --git a/modules/core/02-client/keeper/proposal_test.go b/modules/core/02-client/keeper/proposal_test.go index a400034622e..cab88ed134b 100644 --- a/modules/core/02-client/keeper/proposal_test.go +++ b/modules/core/02-client/keeper/proposal_test.go @@ -6,148 +6,10 @@ import ( govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - "github.com/cosmos/ibc-go/v7/modules/core/exported" ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" ibctesting "github.com/cosmos/ibc-go/v7/testing" ) -func (suite *KeeperTestSuite) TestClientUpdateProposal() { - var ( - subject, substitute string - subjectClientState, substituteClientState exported.ClientState - content govtypes.Content - ) - - testCases := []struct { - name string - malleate func() - expPass bool - }{ - { - "valid update client proposal", func() { - content = types.NewClientUpdateProposal(ibctesting.Title, ibctesting.Description, subject, substitute) - }, true, - }, - { - "subject and substitute use different revision numbers", func() { - tmClientState, ok := substituteClientState.(*ibctm.ClientState) - suite.Require().True(ok) - consState, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientConsensusState(suite.chainA.GetContext(), substitute, tmClientState.LatestHeight) - suite.Require().True(found) - newRevisionNumber := tmClientState.GetLatestHeight().GetRevisionNumber() + 1 - - tmClientState.LatestHeight = types.NewHeight(newRevisionNumber, tmClientState.GetLatestHeight().GetRevisionHeight()) - - suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientConsensusState(suite.chainA.GetContext(), substitute, tmClientState.LatestHeight, consState) - clientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), substitute) - ibctm.SetProcessedTime(clientStore, tmClientState.LatestHeight, 100) - ibctm.SetProcessedHeight(clientStore, tmClientState.LatestHeight, types.NewHeight(0, 1)) - suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainA.GetContext(), substitute, tmClientState) - - content = types.NewClientUpdateProposal(ibctesting.Title, ibctesting.Description, subject, substitute) - }, true, - }, - { - "cannot use solomachine as substitute for tendermint client", func() { - solomachine := ibctesting.NewSolomachine(suite.T(), suite.cdc, "solo machine", "", 1) - solomachine.Sequence = subjectClientState.GetLatestHeight().GetRevisionHeight() + 1 - substituteClientState = solomachine.ClientState() - suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainA.GetContext(), substitute, substituteClientState) - content = types.NewClientUpdateProposal(ibctesting.Title, ibctesting.Description, subject, substitute) - }, false, - }, - { - "subject client does not exist", func() { - content = types.NewClientUpdateProposal(ibctesting.Title, ibctesting.Description, ibctesting.InvalidID, substitute) - }, false, - }, - { - "substitute client does not exist", func() { - content = types.NewClientUpdateProposal(ibctesting.Title, ibctesting.Description, subject, ibctesting.InvalidID) - }, false, - }, - { - "subject and substitute have equal latest height", func() { - tmClientState, ok := subjectClientState.(*ibctm.ClientState) - suite.Require().True(ok) - tmClientState.LatestHeight = substituteClientState.GetLatestHeight().(types.Height) - suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainA.GetContext(), subject, tmClientState) - - content = types.NewClientUpdateProposal(ibctesting.Title, ibctesting.Description, subject, substitute) - }, false, - }, - { - "update fails, client is not frozen or expired", func() { - tmClientState, ok := subjectClientState.(*ibctm.ClientState) - suite.Require().True(ok) - tmClientState.FrozenHeight = types.ZeroHeight() - suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainA.GetContext(), subject, tmClientState) - - content = types.NewClientUpdateProposal(ibctesting.Title, ibctesting.Description, subject, substitute) - }, false, - }, - { - "substitute is frozen", func() { - tmClientState, ok := substituteClientState.(*ibctm.ClientState) - suite.Require().True(ok) - tmClientState.FrozenHeight = types.NewHeight(0, 1) - suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainA.GetContext(), substitute, tmClientState) - - content = types.NewClientUpdateProposal(ibctesting.Title, ibctesting.Description, subject, substitute) - }, false, - }, - } - - for _, tc := range testCases { - tc := tc - - suite.Run(tc.name, func() { - suite.SetupTest() // reset - - subjectPath := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(subjectPath) - subject = subjectPath.EndpointA.ClientID - subjectClientState = suite.chainA.GetClientState(subject) - - substitutePath := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(substitutePath) - substitute = substitutePath.EndpointA.ClientID - - // update substitute twice - err := substitutePath.EndpointA.UpdateClient() - suite.Require().NoError(err) - err = substitutePath.EndpointA.UpdateClient() - suite.Require().NoError(err) - substituteClientState = suite.chainA.GetClientState(substitute) - - tmClientState, ok := subjectClientState.(*ibctm.ClientState) - suite.Require().True(ok) - tmClientState.AllowUpdateAfterMisbehaviour = true - tmClientState.AllowUpdateAfterExpiry = true - tmClientState.FrozenHeight = tmClientState.LatestHeight - suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainA.GetContext(), subject, tmClientState) - - tmClientState, ok = substituteClientState.(*ibctm.ClientState) - suite.Require().True(ok) - tmClientState.AllowUpdateAfterMisbehaviour = true - tmClientState.AllowUpdateAfterExpiry = true - suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainA.GetContext(), substitute, tmClientState) - - tc.malleate() - - updateProp, ok := content.(*types.ClientUpdateProposal) - suite.Require().True(ok) - err = suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientUpdateProposal(suite.chainA.GetContext(), updateProp) - - if tc.expPass { - suite.Require().NoError(err) - } else { - suite.Require().Error(err) - } - }) - } -} - func (suite *KeeperTestSuite) TestHandleUpgradeProposal() { var ( upgradedClientState *ibctm.ClientState diff --git a/modules/core/02-client/proposal_handler.go b/modules/core/02-client/proposal_handler.go index af6393c7f96..dc041eacecf 100644 --- a/modules/core/02-client/proposal_handler.go +++ b/modules/core/02-client/proposal_handler.go @@ -15,8 +15,6 @@ import ( func NewClientProposalHandler(k keeper.Keeper) govtypes.Handler { return func(ctx sdk.Context, content govtypes.Content) error { switch c := content.(type) { - case *types.ClientUpdateProposal: - return k.ClientUpdateProposal(ctx, c) case *types.UpgradeProposal: return k.HandleUpgradeProposal(ctx, c) diff --git a/modules/core/02-client/proposal_handler_test.go b/modules/core/02-client/proposal_handler_test.go deleted file mode 100644 index b96ee2a05fb..00000000000 --- a/modules/core/02-client/proposal_handler_test.go +++ /dev/null @@ -1,94 +0,0 @@ -package client_test - -import ( - sdkmath "cosmossdk.io/math" - - sdk "github.com/cosmos/cosmos-sdk/types" - distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - - client "github.com/cosmos/ibc-go/v7/modules/core/02-client" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" - ibctesting "github.com/cosmos/ibc-go/v7/testing" -) - -func (suite *ClientTestSuite) TestNewClientUpdateProposalHandler() { - var ( - content govtypes.Content - err error - ) - - testCases := []struct { - name string - malleate func() - expPass bool - }{ - { - "valid update client proposal", func() { - subjectPath := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(subjectPath) - subjectClientState := suite.chainA.GetClientState(subjectPath.EndpointA.ClientID) - - substitutePath := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(substitutePath) - - // update substitute twice - err = substitutePath.EndpointA.UpdateClient() - suite.Require().NoError(err) - err = substitutePath.EndpointA.UpdateClient() - suite.Require().NoError(err) - substituteClientState := suite.chainA.GetClientState(substitutePath.EndpointA.ClientID) - - tmClientState, ok := subjectClientState.(*ibctm.ClientState) - suite.Require().True(ok) - tmClientState.AllowUpdateAfterMisbehaviour = true - tmClientState.FrozenHeight = tmClientState.LatestHeight - suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainA.GetContext(), subjectPath.EndpointA.ClientID, tmClientState) - - // replicate changes to substitute (they must match) - tmClientState, ok = substituteClientState.(*ibctm.ClientState) - suite.Require().True(ok) - tmClientState.AllowUpdateAfterMisbehaviour = true - suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainA.GetContext(), substitutePath.EndpointA.ClientID, tmClientState) - - content = clienttypes.NewClientUpdateProposal(ibctesting.Title, ibctesting.Description, subjectPath.EndpointA.ClientID, substitutePath.EndpointA.ClientID) - }, true, - }, - { - "nil proposal", func() { - content = nil - }, false, - }, - { - "unsupported proposal type", func() { - content = &distributiontypes.CommunityPoolSpendProposal{ //nolint:staticcheck - Title: ibctesting.Title, - Description: ibctesting.Description, - Recipient: suite.chainA.SenderAccount.GetAddress().String(), - Amount: sdk.NewCoins(sdk.NewCoin("communityfunds", sdkmath.NewInt(10))), - } - }, false, - }, - } - - for _, tc := range testCases { - tc := tc - - suite.Run(tc.name, func() { - suite.SetupTest() // reset - - tc.malleate() - - proposalHandler := client.NewClientProposalHandler(suite.chainA.App.GetIBCKeeper().ClientKeeper) - - err = proposalHandler(suite.chainA.GetContext(), content) - - if tc.expPass { - suite.Require().NoError(err) - } else { - suite.Require().Error(err) - } - }) - } -} diff --git a/modules/core/02-client/types/client.pb.go b/modules/core/02-client/types/client.pb.go index 33a4efb5ea1..894f05e5826 100644 --- a/modules/core/02-client/types/client.pb.go +++ b/modules/core/02-client/types/client.pb.go @@ -194,55 +194,6 @@ func (m *ClientConsensusStates) GetConsensusStates() []ConsensusStateWithHeight return nil } -// ClientUpdateProposal is a governance proposal. If it passes, the substitute -// client's latest consensus state is copied over to the subject client. The proposal -// handler may fail if the subject and the substitute do not match in client and -// chain parameters (with exception to latest height, frozen height, and chain-id). -type ClientUpdateProposal struct { - // the title of the update proposal - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - // the description of the proposal - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - // the client identifier for the client to be updated if the proposal passes - SubjectClientId string `protobuf:"bytes,3,opt,name=subject_client_id,json=subjectClientId,proto3" json:"subject_client_id,omitempty"` - // the substitute client identifier for the client standing in for the subject - // client - SubstituteClientId string `protobuf:"bytes,4,opt,name=substitute_client_id,json=substituteClientId,proto3" json:"substitute_client_id,omitempty"` -} - -func (m *ClientUpdateProposal) Reset() { *m = ClientUpdateProposal{} } -func (m *ClientUpdateProposal) String() string { return proto.CompactTextString(m) } -func (*ClientUpdateProposal) ProtoMessage() {} -func (*ClientUpdateProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_b6bc4c8185546947, []int{3} -} -func (m *ClientUpdateProposal) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ClientUpdateProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ClientUpdateProposal.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 *ClientUpdateProposal) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClientUpdateProposal.Merge(m, src) -} -func (m *ClientUpdateProposal) XXX_Size() int { - return m.Size() -} -func (m *ClientUpdateProposal) XXX_DiscardUnknown() { - xxx_messageInfo_ClientUpdateProposal.DiscardUnknown(m) -} - -var xxx_messageInfo_ClientUpdateProposal proto.InternalMessageInfo - // UpgradeProposal is a gov Content type for initiating an IBC breaking // upgrade. type UpgradeProposal struct { @@ -261,7 +212,7 @@ type UpgradeProposal struct { func (m *UpgradeProposal) Reset() { *m = UpgradeProposal{} } func (*UpgradeProposal) ProtoMessage() {} func (*UpgradeProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_b6bc4c8185546947, []int{4} + return fileDescriptor_b6bc4c8185546947, []int{3} } func (m *UpgradeProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -310,7 +261,7 @@ type Height struct { func (m *Height) Reset() { *m = Height{} } func (*Height) ProtoMessage() {} func (*Height) Descriptor() ([]byte, []int) { - return fileDescriptor_b6bc4c8185546947, []int{5} + return fileDescriptor_b6bc4c8185546947, []int{4} } func (m *Height) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -351,7 +302,7 @@ func (m *Params) Reset() { *m = Params{} } func (m *Params) String() string { return proto.CompactTextString(m) } func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_b6bc4c8185546947, []int{6} + return fileDescriptor_b6bc4c8185546947, []int{5} } func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -391,7 +342,6 @@ func init() { proto.RegisterType((*IdentifiedClientState)(nil), "ibc.core.client.v1.IdentifiedClientState") proto.RegisterType((*ConsensusStateWithHeight)(nil), "ibc.core.client.v1.ConsensusStateWithHeight") proto.RegisterType((*ClientConsensusStates)(nil), "ibc.core.client.v1.ClientConsensusStates") - proto.RegisterType((*ClientUpdateProposal)(nil), "ibc.core.client.v1.ClientUpdateProposal") proto.RegisterType((*UpgradeProposal)(nil), "ibc.core.client.v1.UpgradeProposal") proto.RegisterType((*Height)(nil), "ibc.core.client.v1.Height") proto.RegisterType((*Params)(nil), "ibc.core.client.v1.Params") @@ -400,47 +350,44 @@ func init() { func init() { proto.RegisterFile("ibc/core/client/v1/client.proto", fileDescriptor_b6bc4c8185546947) } var fileDescriptor_b6bc4c8185546947 = []byte{ - // 633 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x4f, 0x6b, 0xd4, 0x40, - 0x14, 0x4f, 0xda, 0x75, 0xe9, 0x4e, 0xa4, 0xab, 0x71, 0x0b, 0xeb, 0x2a, 0xd9, 0x25, 0x08, 0x2e, - 0xc5, 0x26, 0xdd, 0x15, 0x6c, 0x29, 0x78, 0xb0, 0xbd, 0xb4, 0x17, 0x29, 0x91, 0x22, 0x08, 0xb2, - 0x24, 0x93, 0x69, 0x76, 0x24, 0x99, 0x09, 0x99, 0x49, 0xa4, 0xdf, 0xc0, 0xa3, 0xe0, 0xc5, 0x63, - 0x3f, 0x84, 0x1f, 0xa2, 0x78, 0xea, 0xd1, 0x93, 0xc8, 0xee, 0xc5, 0x6f, 0xe0, 0x55, 0x32, 0x33, - 0x71, 0x37, 0xfe, 0xa9, 0x82, 0xb7, 0x79, 0xef, 0xfd, 0xe6, 0xbd, 0xdf, 0xef, 0xf1, 0x9b, 0x01, - 0x7d, 0x1c, 0x40, 0x17, 0xd2, 0x0c, 0xb9, 0x30, 0xc6, 0x88, 0x70, 0xb7, 0x18, 0xa9, 0x93, 0x93, - 0x66, 0x94, 0x53, 0xd3, 0xc4, 0x01, 0x74, 0x4a, 0x80, 0xa3, 0xd2, 0xc5, 0xa8, 0xd7, 0x89, 0x68, - 0x44, 0x45, 0xd9, 0x2d, 0x4f, 0x12, 0xd9, 0xbb, 0x1d, 0x51, 0x1a, 0xc5, 0xc8, 0x15, 0x51, 0x90, - 0x9f, 0xba, 0x3e, 0x39, 0x53, 0xa5, 0x7b, 0x90, 0xb2, 0x84, 0x32, 0x37, 0x4f, 0xa3, 0xcc, 0x0f, - 0x91, 0x5b, 0x8c, 0x02, 0xc4, 0xfd, 0x51, 0x15, 0x57, 0x0d, 0x24, 0x6a, 0x22, 0x3b, 0xcb, 0x40, - 0x96, 0xec, 0x04, 0x6c, 0x1c, 0x85, 0x88, 0x70, 0x7c, 0x8a, 0x51, 0x78, 0x20, 0x88, 0x3c, 0xe3, - 0x3e, 0x47, 0xe6, 0x1d, 0xd0, 0x92, 0xbc, 0x26, 0x38, 0xec, 0xea, 0x03, 0x7d, 0xd8, 0xf2, 0xd6, - 0x64, 0xe2, 0x28, 0x34, 0x77, 0xc0, 0x75, 0x55, 0x64, 0x25, 0xb8, 0xbb, 0x32, 0xd0, 0x87, 0xc6, - 0xb8, 0xe3, 0x48, 0xa2, 0x4e, 0x45, 0xd4, 0x79, 0x42, 0xce, 0x3c, 0x03, 0x2e, 0xba, 0xda, 0xef, - 0x74, 0xd0, 0x3d, 0xa0, 0x84, 0x21, 0xc2, 0x72, 0x26, 0x52, 0xcf, 0x31, 0x9f, 0x1e, 0x22, 0x1c, - 0x4d, 0xb9, 0xb9, 0x0b, 0x9a, 0x53, 0x71, 0x12, 0xf3, 0x8c, 0x71, 0xcf, 0xf9, 0x75, 0x45, 0x8e, - 0xc4, 0xee, 0x37, 0x2e, 0x3e, 0xf7, 0x35, 0x4f, 0xe1, 0xcd, 0xc7, 0xa0, 0x0d, 0xab, 0xae, 0xff, - 0x40, 0x69, 0x1d, 0xd6, 0x28, 0x94, 0xac, 0x36, 0xa4, 0xf6, 0x3a, 0x37, 0x76, 0xf5, 0x16, 0x5e, - 0x82, 0x1b, 0x3f, 0x4d, 0x65, 0xdd, 0x95, 0xc1, 0xea, 0xd0, 0x18, 0x3f, 0xf8, 0x1d, 0xf3, 0x3f, - 0xe9, 0x56, 0x5a, 0xda, 0x75, 0x52, 0xcc, 0xbe, 0xd4, 0x41, 0x47, 0xb2, 0x3a, 0x49, 0x43, 0x9f, - 0xa3, 0xe3, 0x8c, 0xa6, 0x94, 0xf9, 0xb1, 0xd9, 0x01, 0xd7, 0x38, 0xe6, 0x31, 0x52, 0x84, 0x64, - 0x60, 0x0e, 0x80, 0x11, 0x22, 0x06, 0x33, 0x9c, 0x72, 0x4c, 0x89, 0xd0, 0xdf, 0xf2, 0x96, 0x53, - 0xe6, 0x26, 0xb8, 0xc9, 0xf2, 0xe0, 0x15, 0x82, 0x7c, 0xb2, 0x10, 0xb5, 0x2a, 0x70, 0x6d, 0x55, - 0x38, 0xa8, 0xb4, 0x6d, 0x83, 0x0e, 0xcb, 0x03, 0xc6, 0x31, 0xcf, 0x39, 0x5a, 0x82, 0x37, 0x04, - 0xdc, 0x5c, 0xd4, 0xaa, 0x1b, 0x7b, 0xf6, 0x9b, 0xf3, 0xbe, 0xf6, 0xf1, 0xc3, 0x56, 0x4f, 0xf9, - 0x2b, 0xa2, 0x85, 0xa3, 0xec, 0x58, 0x4a, 0xe7, 0x88, 0x70, 0xfb, 0x9b, 0x0e, 0xda, 0x27, 0xd2, - 0x9a, 0xff, 0xad, 0xe6, 0x11, 0x68, 0xa4, 0xb1, 0x4f, 0x84, 0x00, 0x63, 0x7c, 0xd7, 0x51, 0x63, - 0x2b, 0xe7, 0x57, 0xa3, 0x8f, 0x63, 0x9f, 0xa8, 0x0d, 0x0b, 0xbc, 0x79, 0x08, 0x36, 0x14, 0x26, - 0x9c, 0xd4, 0x4c, 0xdc, 0xb8, 0xc2, 0x31, 0xb7, 0xaa, 0x2b, 0x4b, 0x4f, 0x64, 0x6f, 0xb3, 0x54, - 0xfc, 0xfe, 0xbc, 0xaf, 0x7d, 0x3d, 0xef, 0xeb, 0x7f, 0x51, 0x1e, 0x82, 0xa6, 0x72, 0xf9, 0x7d, - 0xd0, 0xce, 0x50, 0x81, 0x19, 0xa6, 0x64, 0x42, 0xf2, 0x24, 0x40, 0x99, 0x50, 0xde, 0xf0, 0xd6, - 0xab, 0xf4, 0x53, 0x91, 0xad, 0x01, 0xd5, 0xbb, 0x58, 0xa9, 0x03, 0x65, 0xc7, 0xbd, 0xb5, 0x8a, - 0x87, 0x3d, 0x02, 0xcd, 0x63, 0x3f, 0xf3, 0x13, 0x56, 0x5e, 0xf6, 0xe3, 0x98, 0xbe, 0xfe, 0x21, - 0x92, 0x75, 0xf5, 0xc1, 0xea, 0xb0, 0xe5, 0xad, 0xab, 0xb4, 0x14, 0xc2, 0xf6, 0xbd, 0x8b, 0x99, - 0xa5, 0x5f, 0xce, 0x2c, 0xfd, 0xcb, 0xcc, 0xd2, 0xdf, 0xce, 0x2d, 0xed, 0x72, 0x6e, 0x69, 0x9f, - 0xe6, 0x96, 0xf6, 0x62, 0x37, 0xc2, 0x7c, 0x9a, 0x07, 0x0e, 0xa4, 0x89, 0xfa, 0x33, 0x5c, 0x1c, - 0xc0, 0xad, 0x88, 0xba, 0xc5, 0x8e, 0x9b, 0xd0, 0x30, 0x8f, 0x11, 0x93, 0x3f, 0xdc, 0xf6, 0x78, - 0x4b, 0x7d, 0x72, 0xfc, 0x2c, 0x45, 0x2c, 0x68, 0x8a, 0xdd, 0x3d, 0xfc, 0x1e, 0x00, 0x00, 0xff, - 0xff, 0x80, 0xfe, 0x7c, 0xd0, 0x04, 0x05, 0x00, 0x00, + // 577 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0xcf, 0x8b, 0xd3, 0x40, + 0x14, 0xc7, 0x93, 0xb6, 0x96, 0xed, 0x54, 0x5a, 0x89, 0x2d, 0xc4, 0x2a, 0x69, 0x29, 0x82, 0x45, + 0x6c, 0x62, 0x2b, 0xb8, 0xcb, 0x82, 0x07, 0xb7, 0x97, 0xdd, 0x8b, 0x94, 0x88, 0x08, 0x82, 0x94, + 0x64, 0x32, 0x9b, 0x0e, 0x24, 0x33, 0x21, 0x33, 0x89, 0xf4, 0x3f, 0xf0, 0x28, 0x78, 0xf1, 0xd8, + 0x3f, 0xc2, 0x3f, 0x62, 0xf1, 0xb4, 0x47, 0x4f, 0x22, 0xed, 0xc5, 0xff, 0xc0, 0xab, 0x74, 0x66, + 0xb2, 0x6e, 0xfc, 0xb1, 0xec, 0x6d, 0xde, 0x7b, 0xdf, 0xbc, 0xf9, 0x7c, 0x5f, 0x5e, 0x02, 0xfa, + 0xd8, 0x87, 0x0e, 0xa4, 0x29, 0x72, 0x60, 0x84, 0x11, 0xe1, 0x4e, 0x3e, 0x51, 0x27, 0x3b, 0x49, + 0x29, 0xa7, 0x86, 0x81, 0x7d, 0x68, 0xef, 0x04, 0xb6, 0x4a, 0xe7, 0x93, 0x5e, 0x27, 0xa4, 0x21, + 0x15, 0x65, 0x67, 0x77, 0x92, 0xca, 0xde, 0x9d, 0x90, 0xd2, 0x30, 0x42, 0x8e, 0x88, 0xfc, 0xec, + 0xd4, 0xf1, 0xc8, 0x4a, 0x95, 0xee, 0x43, 0xca, 0x62, 0xca, 0x9c, 0x2c, 0x09, 0x53, 0x2f, 0x40, + 0x4e, 0x3e, 0xf1, 0x11, 0xf7, 0x26, 0x45, 0x5c, 0x34, 0x90, 0xaa, 0x85, 0xec, 0x2c, 0x03, 0x59, + 0x1a, 0xc6, 0xa0, 0x7b, 0x12, 0x20, 0xc2, 0xf1, 0x29, 0x46, 0xc1, 0x4c, 0x80, 0xbc, 0xe4, 0x1e, + 0x47, 0xc6, 0x5d, 0xd0, 0x90, 0x5c, 0x0b, 0x1c, 0x98, 0xfa, 0x40, 0x1f, 0x35, 0xdc, 0x3d, 0x99, + 0x38, 0x09, 0x8c, 0x7d, 0x70, 0x53, 0x15, 0xd9, 0x4e, 0x6c, 0x56, 0x06, 0xfa, 0xa8, 0x39, 0xed, + 0xd8, 0x12, 0xd4, 0x2e, 0x40, 0xed, 0xe7, 0x64, 0xe5, 0x36, 0xe1, 0xef, 0xae, 0xc3, 0x8f, 0x3a, + 0x30, 0x67, 0x94, 0x30, 0x44, 0x58, 0xc6, 0x44, 0xea, 0x35, 0xe6, 0xcb, 0x63, 0x84, 0xc3, 0x25, + 0x37, 0x0e, 0x40, 0x7d, 0x29, 0x4e, 0xe2, 0xbe, 0xe6, 0xb4, 0x67, 0xff, 0x3d, 0x22, 0x5b, 0x6a, + 0x8f, 0x6a, 0x67, 0xdf, 0xfa, 0x9a, 0xab, 0xf4, 0xc6, 0x33, 0xd0, 0x86, 0x45, 0xd7, 0x6b, 0x20, + 0xb5, 0x60, 0x09, 0x61, 0x47, 0xd5, 0x95, 0xde, 0xcb, 0x6c, 0xec, 0xea, 0x29, 0xbc, 0x05, 0xb7, + 0xfe, 0xb8, 0x95, 0x99, 0x95, 0x41, 0x75, 0xd4, 0x9c, 0x3e, 0xfa, 0x17, 0xf9, 0xff, 0x7c, 0x2b, + 0x2f, 0xed, 0x32, 0x14, 0x1b, 0xfe, 0xd4, 0x41, 0xfb, 0x95, 0x7c, 0x8f, 0xf3, 0x94, 0x26, 0x94, + 0x79, 0x91, 0xd1, 0x01, 0x37, 0x38, 0xe6, 0x11, 0x52, 0x2c, 0x32, 0x30, 0x06, 0xa0, 0x19, 0x20, + 0x06, 0x53, 0x9c, 0x70, 0x4c, 0x89, 0xb0, 0xde, 0x70, 0x2f, 0xa7, 0x8c, 0xa7, 0xa0, 0x96, 0x44, + 0x1e, 0x31, 0xab, 0x62, 0x2a, 0xf7, 0x6c, 0xb5, 0x03, 0xc5, 0x9a, 0xa8, 0xb5, 0xb1, 0xe7, 0x91, + 0x47, 0x14, 0x8e, 0xd0, 0x1b, 0xc7, 0xa0, 0xab, 0x34, 0xc1, 0xa2, 0xf4, 0xc6, 0x6b, 0x57, 0x8c, + 0xf7, 0x76, 0xf1, 0xc8, 0xa5, 0x7d, 0x3a, 0x7c, 0xf8, 0x7e, 0xdd, 0xd7, 0x3e, 0xad, 0xfb, 0xda, + 0x8f, 0x75, 0x5f, 0xff, 0xf2, 0x79, 0xdc, 0x53, 0x08, 0x21, 0xcd, 0x2f, 0xae, 0x9f, 0x51, 0xc2, + 0x11, 0xe1, 0xc3, 0x00, 0xd4, 0xd5, 0x4a, 0x3c, 0x00, 0xed, 0x14, 0xe5, 0x98, 0x61, 0x4a, 0x16, + 0x24, 0x8b, 0x7d, 0x94, 0x0a, 0xe7, 0x35, 0xb7, 0x55, 0xa4, 0x5f, 0x88, 0x6c, 0x49, 0xa8, 0x96, + 0xa8, 0x52, 0x16, 0xca, 0x8e, 0x87, 0x7b, 0x05, 0xc7, 0x70, 0x02, 0xea, 0x73, 0x2f, 0xf5, 0x62, + 0xb6, 0x7b, 0xd8, 0x8b, 0x22, 0xfa, 0xee, 0xc2, 0x24, 0x33, 0xf5, 0x41, 0x75, 0xd4, 0x70, 0x5b, + 0x2a, 0x2d, 0x8d, 0xb0, 0x23, 0xf7, 0x6c, 0x63, 0xe9, 0xe7, 0x1b, 0x4b, 0xff, 0xbe, 0xb1, 0xf4, + 0x0f, 0x5b, 0x4b, 0x3b, 0xdf, 0x5a, 0xda, 0xd7, 0xad, 0xa5, 0xbd, 0x39, 0x08, 0x31, 0x5f, 0x66, + 0xbe, 0x0d, 0x69, 0xac, 0x3e, 0x30, 0x07, 0xfb, 0x70, 0x1c, 0x52, 0x27, 0xdf, 0x77, 0x62, 0x1a, + 0x64, 0x11, 0x62, 0xf2, 0x77, 0xf0, 0x78, 0x3a, 0x56, 0x7f, 0x04, 0xbe, 0x4a, 0x10, 0xf3, 0xeb, + 0x62, 0x76, 0x4f, 0x7e, 0x05, 0x00, 0x00, 0xff, 0xff, 0xed, 0x11, 0xbc, 0x47, 0x31, 0x04, 0x00, + 0x00, } func (this *UpgradeProposal) Equal(that interface{}) bool { @@ -607,57 +554,6 @@ func (m *ClientConsensusStates) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ClientUpdateProposal) 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 *ClientUpdateProposal) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ClientUpdateProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.SubstituteClientId) > 0 { - i -= len(m.SubstituteClientId) - copy(dAtA[i:], m.SubstituteClientId) - i = encodeVarintClient(dAtA, i, uint64(len(m.SubstituteClientId))) - i-- - dAtA[i] = 0x22 - } - if len(m.SubjectClientId) > 0 { - i -= len(m.SubjectClientId) - copy(dAtA[i:], m.SubjectClientId) - i = encodeVarintClient(dAtA, i, uint64(len(m.SubjectClientId))) - i-- - dAtA[i] = 0x1a - } - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintClient(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x12 - } - if len(m.Title) > 0 { - i -= len(m.Title) - copy(dAtA[i:], m.Title) - i = encodeVarintClient(dAtA, i, uint64(len(m.Title))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *UpgradeProposal) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -844,31 +740,6 @@ func (m *ClientConsensusStates) Size() (n int) { return n } -func (m *ClientUpdateProposal) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Title) - if l > 0 { - n += 1 + l + sovClient(uint64(l)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovClient(uint64(l)) - } - l = len(m.SubjectClientId) - if l > 0 { - n += 1 + l + sovClient(uint64(l)) - } - l = len(m.SubstituteClientId) - if l > 0 { - n += 1 + l + sovClient(uint64(l)) - } - return n -} - func (m *UpgradeProposal) Size() (n int) { if m == nil { return 0 @@ -1281,184 +1152,6 @@ func (m *ClientConsensusStates) Unmarshal(dAtA []byte) error { } return nil } -func (m *ClientUpdateProposal) 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 ErrIntOverflowClient - } - 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: ClientUpdateProposal: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ClientUpdateProposal: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowClient - } - 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 ErrInvalidLengthClient - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthClient - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Title = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowClient - } - 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 ErrInvalidLengthClient - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthClient - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SubjectClientId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowClient - } - 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 ErrInvalidLengthClient - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthClient - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SubjectClientId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SubstituteClientId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowClient - } - 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 ErrInvalidLengthClient - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthClient - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SubstituteClientId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipClient(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthClient - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *UpgradeProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/modules/core/02-client/types/codec.go b/modules/core/02-client/types/codec.go index e7250824d82..a705ca7b620 100644 --- a/modules/core/02-client/types/codec.go +++ b/modules/core/02-client/types/codec.go @@ -39,7 +39,6 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { ) registry.RegisterImplementations( (*govtypes.Content)(nil), - &ClientUpdateProposal{}, &UpgradeProposal{}, ) registry.RegisterImplementations( diff --git a/modules/core/02-client/types/events.go b/modules/core/02-client/types/events.go index 5a32edf32c2..2458b65dd4e 100644 --- a/modules/core/02-client/types/events.go +++ b/modules/core/02-client/types/events.go @@ -25,7 +25,6 @@ var ( EventTypeUpdateClient = "update_client" EventTypeUpgradeClient = "upgrade_client" EventTypeSubmitMisbehaviour = "client_misbehaviour" - EventTypeUpdateClientProposal = "update_client_proposal" EventTypeUpgradeChain = "upgrade_chain" EventTypeUpgradeClientProposal = "upgrade_client_proposal" EventTypeRecoverClient = "recover_client" diff --git a/modules/core/02-client/types/proposal.go b/modules/core/02-client/types/proposal.go index 2392a01d7a5..14b0bd01a80 100644 --- a/modules/core/02-client/types/proposal.go +++ b/modules/core/02-client/types/proposal.go @@ -14,64 +14,18 @@ import ( ) const ( - // ProposalTypeClientUpdate defines the type for a ClientUpdateProposal - ProposalTypeClientUpdate = "ClientUpdate" - ProposalTypeUpgrade = "IBCUpgrade" + ProposalTypeUpgrade = "IBCUpgrade" ) var ( - _ govtypes.Content = (*ClientUpdateProposal)(nil) _ govtypes.Content = (*UpgradeProposal)(nil) _ codectypes.UnpackInterfacesMessage = (*UpgradeProposal)(nil) ) func init() { - govtypes.RegisterProposalType(ProposalTypeClientUpdate) govtypes.RegisterProposalType(ProposalTypeUpgrade) } -// NewClientUpdateProposal creates a new client update proposal. -func NewClientUpdateProposal(title, description, subjectClientID, substituteClientID string) govtypes.Content { - return &ClientUpdateProposal{ - Title: title, - Description: description, - SubjectClientId: subjectClientID, - SubstituteClientId: substituteClientID, - } -} - -// GetTitle returns the title of a client update proposal. -func (cup *ClientUpdateProposal) GetTitle() string { return cup.Title } - -// GetDescription returns the description of a client update proposal. -func (cup *ClientUpdateProposal) GetDescription() string { return cup.Description } - -// ProposalRoute returns the routing key of a client update proposal. -func (*ClientUpdateProposal) ProposalRoute() string { return RouterKey } - -// ProposalType returns the type of a client update proposal. -func (*ClientUpdateProposal) ProposalType() string { return ProposalTypeClientUpdate } - -// ValidateBasic runs basic stateless validity checks -func (cup *ClientUpdateProposal) ValidateBasic() error { - err := govtypes.ValidateAbstract(cup) - if err != nil { - return err - } - - if cup.SubjectClientId == cup.SubstituteClientId { - return errorsmod.Wrap(ErrInvalidSubstitute, "subject and substitute client identifiers are equal") - } - if _, _, err := ParseClientIdentifier(cup.SubjectClientId); err != nil { - return err - } - if _, _, err := ParseClientIdentifier(cup.SubstituteClientId); err != nil { - return err - } - - return nil -} - // NewUpgradeProposal creates a new IBC breaking upgrade proposal. func NewUpgradeProposal(title, description string, plan upgradetypes.Plan, upgradedClientState exported.ClientState) (govtypes.Content, error) { protoAny, err := PackClientState(upgradedClientState) diff --git a/modules/core/02-client/types/proposal_test.go b/modules/core/02-client/types/proposal_test.go index 268c03fa9be..fd2105b4acd 100644 --- a/modules/core/02-client/types/proposal_test.go +++ b/modules/core/02-client/types/proposal_test.go @@ -14,81 +14,6 @@ import ( ibctesting "github.com/cosmos/ibc-go/v7/testing" ) -func (suite *TypesTestSuite) TestValidateBasic() { - subjectPath := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(subjectPath) - subject := subjectPath.EndpointA.ClientID - - substitutePath := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(substitutePath) - substitute := substitutePath.EndpointA.ClientID - - testCases := []struct { - name string - proposal govtypes.Content - expPass bool - }{ - { - "success", - types.NewClientUpdateProposal(ibctesting.Title, ibctesting.Description, subject, substitute), - true, - }, - { - "fails validate abstract - empty title", - types.NewClientUpdateProposal("", ibctesting.Description, subject, substitute), - false, - }, - { - "subject and substitute use the same identifier", - types.NewClientUpdateProposal(ibctesting.Title, ibctesting.Description, subject, subject), - false, - }, - { - "invalid subject clientID", - types.NewClientUpdateProposal(ibctesting.Title, ibctesting.Description, ibctesting.InvalidID, substitute), - false, - }, - { - "invalid substitute clientID", - types.NewClientUpdateProposal(ibctesting.Title, ibctesting.Description, subject, ibctesting.InvalidID), - false, - }, - } - - for _, tc := range testCases { - - err := tc.proposal.ValidateBasic() - - if tc.expPass { - suite.Require().NoError(err, tc.name) - } else { - suite.Require().Error(err, tc.name) - } - } -} - -// tests a client update proposal can be marshaled and unmarshaled -func (suite *TypesTestSuite) TestMarshalClientUpdateProposalProposal() { - // create proposal - proposal := types.NewClientUpdateProposal("update IBC client", "description", "subject", "substitute") - - // create codec - ir := codectypes.NewInterfaceRegistry() - types.RegisterInterfaces(ir) - govtypes.RegisterInterfaces(ir) - cdc := codec.NewProtoCodec(ir) - - // marshal message - content := proposal.(*types.ClientUpdateProposal) - bz, err := cdc.MarshalJSON(content) - suite.Require().NoError(err) - - // unmarshal proposal - newProposal := &types.ClientUpdateProposal{} - err = cdc.UnmarshalJSON(bz, newProposal) - suite.Require().NoError(err) -} - func (suite *TypesTestSuite) TestUpgradeProposalValidateBasic() { var ( proposal govtypes.Content diff --git a/proto/ibc/core/client/v1/client.proto b/proto/ibc/core/client/v1/client.proto index 9c9178d5f0e..016774c98ee 100644 --- a/proto/ibc/core/client/v1/client.proto +++ b/proto/ibc/core/client/v1/client.proto @@ -36,24 +36,6 @@ message ClientConsensusStates { repeated ConsensusStateWithHeight consensus_states = 2 [(gogoproto.nullable) = false]; } -// ClientUpdateProposal is a governance proposal. If it passes, the substitute -// client's latest consensus state is copied over to the subject client. The proposal -// handler may fail if the subject and the substitute do not match in client and -// chain parameters (with exception to latest height, frozen height, and chain-id). -message ClientUpdateProposal { - option (gogoproto.goproto_getters) = false; - option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; - // the title of the update proposal - string title = 1; - // the description of the proposal - string description = 2; - // the client identifier for the client to be updated if the proposal passes - string subject_client_id = 3; - // the substitute client identifier for the client standing in for the subject - // client - string substitute_client_id = 4; -} - // UpgradeProposal is a gov Content type for initiating an IBC breaking // upgrade. message UpgradeProposal { diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 9a241a1e3c6..47c82318a2a 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -612,7 +612,6 @@ func NewSimApp( govtypes.ModuleName: gov.NewAppModuleBasic( []govclient.ProposalHandler{ paramsclient.ProposalHandler, - ibcclientclient.UpdateClientProposalHandler, ibcclientclient.UpgradeProposalHandler, }, ), From c4f947e6d8090ce4fbdd498f9a221cc34cd437b7 Mon Sep 17 00:00:00 2001 From: Charly Date: Thu, 7 Sep 2023 17:09:39 +0200 Subject: [PATCH 16/34] feat: add proposal simulator interface function and tests (#4466) Co-authored-by: colin axner <25233464+colin-axner@users.noreply.github.com> --- modules/apps/27-interchain-accounts/module.go | 6 ++ .../simulation/proposals.go | 60 +++++++++++++++++++ .../simulation/proposals_test.go | 56 +++++++++++++++++ modules/apps/transfer/module.go | 14 +++-- modules/apps/transfer/simulation/proposals.go | 42 +++++++++++++ .../transfer/simulation/proposals_test.go | 43 +++++++++++++ modules/core/module.go | 6 ++ modules/core/simulation/proposals.go | 60 +++++++++++++++++++ modules/core/simulation/proposals_test.go | 57 ++++++++++++++++++ 9 files changed, 340 insertions(+), 4 deletions(-) create mode 100644 modules/apps/27-interchain-accounts/simulation/proposals.go create mode 100644 modules/apps/27-interchain-accounts/simulation/proposals_test.go create mode 100644 modules/apps/transfer/simulation/proposals.go create mode 100644 modules/apps/transfer/simulation/proposals_test.go create mode 100644 modules/core/simulation/proposals.go create mode 100644 modules/core/simulation/proposals_test.go diff --git a/modules/apps/27-interchain-accounts/module.go b/modules/apps/27-interchain-accounts/module.go index 91d7706701c..346bed3b162 100644 --- a/modules/apps/27-interchain-accounts/module.go +++ b/modules/apps/27-interchain-accounts/module.go @@ -36,6 +36,7 @@ var ( _ module.AppModule = (*AppModule)(nil) _ module.AppModuleBasic = (*AppModuleBasic)(nil) _ module.AppModuleSimulation = (*AppModule)(nil) + _ module.HasProposalMsgs = AppModule{} _ appmodule.AppModule = (*AppModule)(nil) _ porttypes.IBCModule = (*host.IBCModule)(nil) @@ -218,6 +219,11 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { simulation.RandomizedGenState(simState) } +// ProposalMsgs returns msgs used for governance proposals for simulations. +func (AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { + return simulation.ProposalMsgs() +} + // WeightedOperations is unimplemented. func (AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { return nil diff --git a/modules/apps/27-interchain-accounts/simulation/proposals.go b/modules/apps/27-interchain-accounts/simulation/proposals.go new file mode 100644 index 00000000000..a4850a81fe3 --- /dev/null +++ b/modules/apps/27-interchain-accounts/simulation/proposals.go @@ -0,0 +1,60 @@ +package simulation + +import ( + "math/rand" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" + + controllertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" + "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" +) + +// Simulation operation weights constants +const ( + DefaultWeightMsgUpdateParams int = 100 + + OpWeightMsgUpdateParams = "op_weight_msg_update_params" // #nosec +) + +// ProposalMsgs defines the module weighted proposals' contents +func ProposalMsgs() []simtypes.WeightedProposalMsg { + return []simtypes.WeightedProposalMsg{ + simulation.NewWeightedProposalMsg( + OpWeightMsgUpdateParams, + DefaultWeightMsgUpdateParams, + SimulateHostMsgUpdateParams, + ), + simulation.NewWeightedProposalMsg( + OpWeightMsgUpdateParams, + DefaultWeightMsgUpdateParams, + SimulateControllerMsgUpdateParams, + ), + } +} + +// SimulateHostMsgUpdateParams returns a random MsgUpdateParams for the host module +func SimulateHostMsgUpdateParams(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg { + var signer sdk.AccAddress = address.Module("gov") + params := types.DefaultParams() + params.HostEnabled = false + + return &types.MsgUpdateParams{ + Signer: signer.String(), + Params: params, + } +} + +// SimulateControllerMsgUpdateParams returns a random MsgUpdateParams for the controller module +func SimulateControllerMsgUpdateParams(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg { + var signer sdk.AccAddress = address.Module("gov") + params := controllertypes.DefaultParams() + params.ControllerEnabled = false + + return &controllertypes.MsgUpdateParams{ + Signer: signer.String(), + Params: params, + } +} diff --git a/modules/apps/27-interchain-accounts/simulation/proposals_test.go b/modules/apps/27-interchain-accounts/simulation/proposals_test.go new file mode 100644 index 00000000000..7d301845965 --- /dev/null +++ b/modules/apps/27-interchain-accounts/simulation/proposals_test.go @@ -0,0 +1,56 @@ +package simulation_test + +import ( + "math/rand" + "testing" + + "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + + controllertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" + "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" + "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/simulation" +) + +func TestProposalMsgs(t *testing.T) { + // initialize parameters + s := rand.NewSource(1) + r := rand.New(s) + + ctx := sdk.NewContext(nil, cmtproto.Header{}, true, nil) + accounts := simtypes.RandomAccounts(r, 3) + + // execute ProposalMsgs function + weightedProposalMsgs := simulation.ProposalMsgs() + require.Equal(t, 2, len(weightedProposalMsgs)) + w0 := weightedProposalMsgs[0] + + // tests w0 interface: + require.Equal(t, simulation.OpWeightMsgUpdateParams, w0.AppParamsKey()) + require.Equal(t, simulation.DefaultWeightMsgUpdateParams, w0.DefaultWeight()) + + msg := w0.MsgSimulatorFn()(r, ctx, accounts) + msgUpdateHostParams, ok := msg.(*types.MsgUpdateParams) + require.True(t, ok) + + require.Equal(t, sdk.AccAddress(address.Module("gov")).String(), msgUpdateHostParams.Signer) + require.Equal(t, msgUpdateHostParams.Params.HostEnabled, false) + + w1 := weightedProposalMsgs[1] + + // tests w1 interface: + require.Equal(t, simulation.OpWeightMsgUpdateParams, w1.AppParamsKey()) + require.Equal(t, simulation.DefaultWeightMsgUpdateParams, w1.DefaultWeight()) + + msg1 := w1.MsgSimulatorFn()(r, ctx, accounts) + msgUpdateControllerParams, ok := msg1.(*controllertypes.MsgUpdateParams) + require.True(t, ok) + + require.Equal(t, sdk.AccAddress(address.Module("gov")).String(), msgUpdateControllerParams.Signer) + require.Equal(t, msgUpdateControllerParams.Params.ControllerEnabled, false) +} diff --git a/modules/apps/transfer/module.go b/modules/apps/transfer/module.go index 52c54edfb3c..1d85d406c76 100644 --- a/modules/apps/transfer/module.go +++ b/modules/apps/transfer/module.go @@ -27,10 +27,11 @@ import ( ) var ( - _ module.AppModule = (*AppModule)(nil) - _ module.AppModuleBasic = (*AppModuleBasic)(nil) - _ appmodule.AppModule = (*AppModule)(nil) - _ porttypes.IBCModule = (*IBCModule)(nil) + _ module.AppModule = (*AppModule)(nil) + _ module.AppModuleBasic = (*AppModuleBasic)(nil) + _ module.HasProposalMsgs = AppModule{} + _ appmodule.AppModule = (*AppModule)(nil) + _ porttypes.IBCModule = (*IBCModule)(nil) ) // AppModuleBasic is the IBC Transfer AppModuleBasic @@ -154,6 +155,11 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { simulation.RandomizedGenState(simState) } +// ProposalMsgs returns msgs used for governance proposals for simulations. +func (AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { + return simulation.ProposalMsgs() +} + // RegisterStoreDecoder registers a decoder for transfer module's types func (am AppModule) RegisterStoreDecoder(sdr simtypes.StoreDecoderRegistry) { sdr[types.StoreKey] = simulation.NewDecodeStore(am.keeper) diff --git a/modules/apps/transfer/simulation/proposals.go b/modules/apps/transfer/simulation/proposals.go new file mode 100644 index 00000000000..f97fcb9b33d --- /dev/null +++ b/modules/apps/transfer/simulation/proposals.go @@ -0,0 +1,42 @@ +package simulation + +import ( + "math/rand" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" + + "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" +) + +// Simulation operation weights constants +const ( + DefaultWeightMsgUpdateParams int = 100 + + OpWeightMsgUpdateParams = "op_weight_msg_update_params" // #nosec +) + +// ProposalMsgs defines the module weighted proposals' contents +func ProposalMsgs() []simtypes.WeightedProposalMsg { + return []simtypes.WeightedProposalMsg{ + simulation.NewWeightedProposalMsg( + OpWeightMsgUpdateParams, + DefaultWeightMsgUpdateParams, + SimulateMsgUpdateParams, + ), + } +} + +// SimulateMsgUpdateParams returns a random MsgUpdateParams +func SimulateMsgUpdateParams(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg { + var signer sdk.AccAddress = address.Module("gov") + params := types.DefaultParams() + params.SendEnabled = false + + return &types.MsgUpdateParams{ + Signer: signer.String(), + Params: params, + } +} diff --git a/modules/apps/transfer/simulation/proposals_test.go b/modules/apps/transfer/simulation/proposals_test.go new file mode 100644 index 00000000000..c70c2016ed3 --- /dev/null +++ b/modules/apps/transfer/simulation/proposals_test.go @@ -0,0 +1,43 @@ +package simulation_test + +import ( + "math/rand" + "testing" + + "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + + "github.com/cosmos/ibc-go/v7/modules/apps/transfer/simulation" + "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" +) + +func TestProposalMsgs(t *testing.T) { + // initialize parameters + s := rand.NewSource(1) + r := rand.New(s) + + ctx := sdk.NewContext(nil, cmtproto.Header{}, true, nil) + accounts := simtypes.RandomAccounts(r, 3) + + // execute ProposalMsgs function + weightedProposalMsgs := simulation.ProposalMsgs() + require.Equal(t, len(weightedProposalMsgs), 1) + + w0 := weightedProposalMsgs[0] + + // tests w0 interface: + require.Equal(t, simulation.OpWeightMsgUpdateParams, w0.AppParamsKey()) + require.Equal(t, simulation.DefaultWeightMsgUpdateParams, w0.DefaultWeight()) + + msg := w0.MsgSimulatorFn()(r, ctx, accounts) + msgUpdateParams, ok := msg.(*types.MsgUpdateParams) + require.True(t, ok) + + require.Equal(t, sdk.AccAddress(address.Module("gov")).String(), msgUpdateParams.Signer) + require.EqualValues(t, msgUpdateParams.Params.SendEnabled, false) +} diff --git a/modules/core/module.go b/modules/core/module.go index 8c671b4b850..b21e6397f5a 100644 --- a/modules/core/module.go +++ b/modules/core/module.go @@ -36,6 +36,7 @@ var ( _ module.AppModule = (*AppModule)(nil) _ module.AppModuleBasic = (*AppModuleBasic)(nil) _ module.AppModuleSimulation = (*AppModule)(nil) + _ module.HasProposalMsgs = AppModule{} _ appmodule.AppModule = (*AppModule)(nil) ) @@ -193,6 +194,11 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { simulation.RandomizedGenState(simState) } +// ProposalMsgs returns msgs used for governance proposals for simulations. +func (AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { + return simulation.ProposalMsgs() +} + // RegisterStoreDecoder registers a decoder for ibc module's types func (am AppModule) RegisterStoreDecoder(sdr simtypes.StoreDecoderRegistry) { sdr[exported.StoreKey] = simulation.NewDecodeStore(*am.keeper) diff --git a/modules/core/simulation/proposals.go b/modules/core/simulation/proposals.go new file mode 100644 index 00000000000..68546c716a8 --- /dev/null +++ b/modules/core/simulation/proposals.go @@ -0,0 +1,60 @@ +package simulation + +import ( + "math/rand" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" + + "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" +) + +// Simulation operation weights constants +const ( + DefaultWeightMsgUpdateParams int = 100 + + OpWeightMsgUpdateParams = "op_weight_msg_update_params" // #nosec +) + +// ProposalMsgs defines the module weighted proposals' contents +func ProposalMsgs() []simtypes.WeightedProposalMsg { + return []simtypes.WeightedProposalMsg{ + simulation.NewWeightedProposalMsg( + OpWeightMsgUpdateParams, + DefaultWeightMsgUpdateParams, + SimulateClientMsgUpdateParams, + ), + simulation.NewWeightedProposalMsg( + OpWeightMsgUpdateParams, + DefaultWeightMsgUpdateParams, + SimulateConnectionMsgUpdateParams, + ), + } +} + +// SimulateClientMsgUpdateParams returns a random MsgUpdateParams for 02-client +func SimulateClientMsgUpdateParams(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg { + var signer sdk.AccAddress = address.Module("gov") + params := types.DefaultParams() + params.AllowedClients = []string{"06-solomachine", "07-tendermint"} + + return &types.MsgUpdateParams{ + Signer: signer.String(), + Params: params, + } +} + +// SimulateConnectionMsgUpdateParams returns a random MsgUpdateParams 03-connection +func SimulateConnectionMsgUpdateParams(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg { + var signer sdk.AccAddress = address.Module("gov") + params := connectiontypes.DefaultParams() + params.MaxExpectedTimePerBlock = uint64(100) + + return &connectiontypes.MsgUpdateParams{ + Signer: signer.String(), + Params: params, + } +} diff --git a/modules/core/simulation/proposals_test.go b/modules/core/simulation/proposals_test.go new file mode 100644 index 00000000000..18df7281cb6 --- /dev/null +++ b/modules/core/simulation/proposals_test.go @@ -0,0 +1,57 @@ +package simulation_test + +import ( + "math/rand" + "testing" + + "github.com/stretchr/testify/require" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + + "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" + "github.com/cosmos/ibc-go/v7/modules/core/simulation" +) + +func TestProposalMsgs(t *testing.T) { + // initialize parameters + s := rand.NewSource(1) + r := rand.New(s) + + ctx := sdk.NewContext(nil, cmtproto.Header{}, true, nil) + accounts := simtypes.RandomAccounts(r, 3) + + // execute ProposalMsgs function + weightedProposalMsgs := simulation.ProposalMsgs() + require.Equal(t, 2, len(weightedProposalMsgs)) + + w0 := weightedProposalMsgs[0] + + // tests w0 interface: + require.Equal(t, simulation.OpWeightMsgUpdateParams, w0.AppParamsKey()) + require.Equal(t, simulation.DefaultWeightMsgUpdateParams, w0.DefaultWeight()) + + msg := w0.MsgSimulatorFn()(r, ctx, accounts) + msgUpdateParams, ok := msg.(*types.MsgUpdateParams) + require.True(t, ok) + + require.Equal(t, sdk.AccAddress(address.Module("gov")).String(), msgUpdateParams.Signer) + require.EqualValues(t, []string{"06-solomachine", "07-tendermint"}, msgUpdateParams.Params.AllowedClients) + + w1 := weightedProposalMsgs[1] + + // tests w1 interface: + require.Equal(t, simulation.OpWeightMsgUpdateParams, w1.AppParamsKey()) + require.Equal(t, simulation.DefaultWeightMsgUpdateParams, w1.DefaultWeight()) + + msg1 := w1.MsgSimulatorFn()(r, ctx, accounts) + msgUpdateConnectionParams, ok := msg1.(*connectiontypes.MsgUpdateParams) + require.True(t, ok) + + require.Equal(t, sdk.AccAddress(address.Module("gov")).String(), msgUpdateParams.Signer) + require.EqualValues(t, uint64(100), msgUpdateConnectionParams.Params.MaxExpectedTimePerBlock) +} From 386ea017e58e17dc3d34f39cc33a912e8fdafd78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?colin=20axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Fri, 8 Sep 2023 10:56:02 +0200 Subject: [PATCH 17/34] refactor!: remove UpgradeProposal type (#4602) --- modules/core/02-client/client/cli/tx.go | 96 ---- .../core/02-client/client/proposal_handler.go | 9 - modules/core/02-client/keeper/proposal.go | 42 -- .../core/02-client/keeper/proposal_test.go | 132 ------ modules/core/02-client/proposal_handler.go | 25 -- modules/core/02-client/types/client.pb.go | 419 ++---------------- modules/core/02-client/types/codec.go | 5 - modules/core/02-client/types/proposal.go | 102 ----- modules/core/02-client/types/proposal_test.go | 152 ------- proto/ibc/core/client/v1/client.proto | 23 - testing/simapp/app.go | 8 +- 11 files changed, 32 insertions(+), 981 deletions(-) delete mode 100644 modules/core/02-client/client/proposal_handler.go delete mode 100644 modules/core/02-client/keeper/proposal.go delete mode 100644 modules/core/02-client/keeper/proposal_test.go delete mode 100644 modules/core/02-client/proposal_handler.go delete mode 100644 modules/core/02-client/types/proposal.go delete mode 100644 modules/core/02-client/types/proposal_test.go diff --git a/modules/core/02-client/client/cli/tx.go b/modules/core/02-client/client/cli/tx.go index 107d7578f83..403b4fb94ff 100644 --- a/modules/core/02-client/client/cli/tx.go +++ b/modules/core/02-client/client/cli/tx.go @@ -18,7 +18,6 @@ import ( "github.com/cosmos/cosmos-sdk/version" govcli "github.com/cosmos/cosmos-sdk/x/gov/client/cli" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" "github.com/cosmos/ibc-go/v7/modules/core/exported" @@ -303,101 +302,6 @@ func newSubmitRecoverClientProposalCmd() *cobra.Command { return cmd } -// NewCmdSubmitUpgradeProposal implements a command handler for submitting an upgrade IBC client proposal transaction. -func NewCmdSubmitUpgradeProposal() *cobra.Command { - cmd := &cobra.Command{ - Use: "ibc-upgrade [name] [height] [path/to/upgraded_client_state.json] [flags]", - Args: cobra.ExactArgs(3), - Short: "Submit an IBC upgrade proposal", - Long: "Submit an IBC client breaking upgrade proposal along with an initial deposit.\n" + - "The client state specified is the upgraded client state representing the upgraded chain\n" + - `Example Upgraded Client State JSON: -{ - "@type":"/ibc.lightclients.tendermint.v1.ClientState", - "chain_id":"testchain1", - "unbonding_period":"1814400s", - "latest_height":{"revision_number":"0","revision_height":"2"}, - "proof_specs":[{"leaf_spec":{"hash":"SHA256","prehash_key":"NO_HASH","prehash_value":"SHA256","length":"VAR_PROTO","prefix":"AA=="},"inner_spec":{"child_order":[0,1],"child_size":33,"min_prefix_length":4,"max_prefix_length":12,"empty_child":null,"hash":"SHA256"},"max_depth":0,"min_depth":0},{"leaf_spec":{"hash":"SHA256","prehash_key":"NO_HASH","prehash_value":"SHA256","length":"VAR_PROTO","prefix":"AA=="},"inner_spec":{"child_order":[0,1],"child_size":32,"min_prefix_length":1,"max_prefix_length":1,"empty_child":null,"hash":"SHA256"},"max_depth":0,"min_depth":0}], - "upgrade_path":["upgrade","upgradedIBCState"], -} - `, - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - cdc := codec.NewProtoCodec(clientCtx.InterfaceRegistry) - - title, err := cmd.Flags().GetString(govcli.FlagTitle) //nolint:staticcheck // need this till full govv1 conversion. - if err != nil { - return err - } - - description, err := cmd.Flags().GetString(govcli.FlagDescription) //nolint:staticcheck // need this till full govv1 conversion. - if err != nil { - return err - } - - name := args[0] - - height, err := strconv.ParseInt(args[1], 10, 64) - if err != nil { - return err - } - - plan := upgradetypes.Plan{ - Name: name, - Height: height, - } - - // attempt to unmarshal client state argument - var clientState exported.ClientState - clientContentOrFileName := args[2] - if err := cdc.UnmarshalInterfaceJSON([]byte(clientContentOrFileName), &clientState); err != nil { - - // check for file path if JSON input is not provided - contents, err := os.ReadFile(clientContentOrFileName) - if err != nil { - return fmt.Errorf("neither JSON input nor path to .json file for client state were provided: %w", err) - } - - if err := cdc.UnmarshalInterfaceJSON(contents, &clientState); err != nil { - return fmt.Errorf("error unmarshalling client state file: %w", err) - } - } - - content, err := types.NewUpgradeProposal(title, description, plan, clientState) - if err != nil { - return err - } - - from := clientCtx.GetFromAddress() - - depositStr, err := cmd.Flags().GetString(govcli.FlagDeposit) - if err != nil { - return err - } - deposit, err := sdk.ParseCoinsNormalized(depositStr) - if err != nil { - return err - } - - msg, err := govv1beta1.NewMsgSubmitProposal(content, deposit, from) - if err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - cmd.Flags().String(govcli.FlagTitle, "", "title of proposal") //nolint:staticcheck // need this till full govv1 conversion. - cmd.Flags().String(govcli.FlagDescription, "", "description of proposal") //nolint:staticcheck // need this till full govv1 conversion. - cmd.Flags().String(govcli.FlagDeposit, "", "deposit of proposal") - - return cmd -} - // newScheduleIBCUpgradeProposalCmd defines the command for submitting an IBC software upgrade proposal. func newScheduleIBCUpgradeProposalCmd() *cobra.Command { cmd := &cobra.Command{ diff --git a/modules/core/02-client/client/proposal_handler.go b/modules/core/02-client/client/proposal_handler.go deleted file mode 100644 index d574c14ce89..00000000000 --- a/modules/core/02-client/client/proposal_handler.go +++ /dev/null @@ -1,9 +0,0 @@ -package client - -import ( - govclient "github.com/cosmos/cosmos-sdk/x/gov/client" - - "github.com/cosmos/ibc-go/v7/modules/core/02-client/client/cli" -) - -var UpgradeProposalHandler = govclient.NewProposalHandler(cli.NewCmdSubmitUpgradeProposal) diff --git a/modules/core/02-client/keeper/proposal.go b/modules/core/02-client/keeper/proposal.go deleted file mode 100644 index ee75a16c038..00000000000 --- a/modules/core/02-client/keeper/proposal.go +++ /dev/null @@ -1,42 +0,0 @@ -package keeper - -import ( - errorsmod "cosmossdk.io/errors" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" -) - -// HandleUpgradeProposal sets the upgraded client state in the upgrade store. It clears -// an IBC client state and consensus state if a previous plan was set. Then it -// will schedule an upgrade and finally set the upgraded client state in upgrade -// store. -func (k Keeper) HandleUpgradeProposal(ctx sdk.Context, p *types.UpgradeProposal) error { - clientState, err := types.UnpackClientState(p.UpgradedClientState) - if err != nil { - return errorsmod.Wrap(err, "could not unpack UpgradedClientState") - } - - // zero out any custom fields before setting - cs := clientState.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, p.Plan); err != nil { - return err - } - - // sets the new upgraded client in last height committed on this chain is 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, p.Plan.Height, bz); err != nil { - return err - } - - // emitting an event for handling client upgrade proposal - emitUpgradeClientProposalEvent(ctx, p.Title, p.Plan.Height) - - return nil -} diff --git a/modules/core/02-client/keeper/proposal_test.go b/modules/core/02-client/keeper/proposal_test.go deleted file mode 100644 index cab88ed134b..00000000000 --- a/modules/core/02-client/keeper/proposal_test.go +++ /dev/null @@ -1,132 +0,0 @@ -package keeper_test - -import ( - upgradetypes "cosmossdk.io/x/upgrade/types" - - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - - "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" - ibctesting "github.com/cosmos/ibc-go/v7/testing" -) - -func (suite *KeeperTestSuite) TestHandleUpgradeProposal() { - var ( - upgradedClientState *ibctm.ClientState - oldPlan, plan upgradetypes.Plan - content govtypes.Content - err error - ) - - testCases := []struct { - name string - malleate func() - expPass bool - }{ - { - "valid upgrade proposal", func() { - content, err = types.NewUpgradeProposal(ibctesting.Title, ibctesting.Description, plan, upgradedClientState) - suite.Require().NoError(err) - }, true, - }, - { - "valid upgrade proposal with previous IBC state", func() { - oldPlan = upgradetypes.Plan{ - Name: "upgrade IBC clients", - Height: 100, - } - - content, err = types.NewUpgradeProposal(ibctesting.Title, ibctesting.Description, plan, upgradedClientState) - suite.Require().NoError(err) - }, true, - }, - { - "cannot unpack client state", func() { - protoAny, err := types.PackConsensusState(&ibctm.ConsensusState{}) - suite.Require().NoError(err) - content = &types.UpgradeProposal{ - Title: ibctesting.Title, - Description: ibctesting.Description, - Plan: plan, - UpgradedClientState: protoAny, - } - }, 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 - } - - upgradeProp, ok := content.(*types.UpgradeProposal) - suite.Require().True(ok) - err = suite.chainA.App.GetIBCKeeper().ClientKeeper.HandleUpgradeProposal(suite.chainA.GetContext(), upgradeProp) - - if tc.expPass { - suite.Require().NoError(err) - - // check that the correct plan is returned - storedPlan, err := suite.chainA.GetSimApp().UpgradeKeeper.GetUpgradePlan(suite.chainA.GetContext()) - suite.Require().NoError(err) - suite.Require().Equal(plan, storedPlan) - - // check that old upgraded client state is cleared - _, err = suite.chainA.GetSimApp().UpgradeKeeper.GetUpgradedClient(suite.chainA.GetContext(), oldPlan.Height) - suite.Require().ErrorIs(err, upgradetypes.ErrNoUpgradedClientFound) - - // check that client state was set - storedClientState, err := suite.chainA.GetSimApp().UpgradeKeeper.GetUpgradedClient(suite.chainA.GetContext(), plan.Height) - suite.Require().NoError(err) - clientState, err := types.UnmarshalClientState(suite.chainA.App.AppCodec(), storedClientState) - suite.Require().NoError(err) - suite.Require().Equal(upgradedClientState, clientState) - } else { - suite.Require().Error(err) - - // check that the new plan wasn't stored - storedPlan, err := 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().NoError(err) - suite.Require().Equal(oldPlan, storedPlan) - } else { - suite.Require().ErrorIs(err, upgradetypes.ErrNoUpgradePlanFound) - suite.Require().Empty(storedPlan) - } - - // check that client state was not set - _, err = suite.chainA.GetSimApp().UpgradeKeeper.GetUpgradedClient(suite.chainA.GetContext(), plan.Height) - suite.Require().ErrorIs(err, upgradetypes.ErrNoUpgradedClientFound) - } - }) - } -} diff --git a/modules/core/02-client/proposal_handler.go b/modules/core/02-client/proposal_handler.go deleted file mode 100644 index dc041eacecf..00000000000 --- a/modules/core/02-client/proposal_handler.go +++ /dev/null @@ -1,25 +0,0 @@ -package client - -import ( - errorsmod "cosmossdk.io/errors" - - sdk "github.com/cosmos/cosmos-sdk/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - - "github.com/cosmos/ibc-go/v7/modules/core/02-client/keeper" - "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - ibcerrors "github.com/cosmos/ibc-go/v7/modules/core/errors" -) - -// NewClientProposalHandler defines the 02-client proposal handler -func NewClientProposalHandler(k keeper.Keeper) govtypes.Handler { - return func(ctx sdk.Context, content govtypes.Content) error { - switch c := content.(type) { - case *types.UpgradeProposal: - return k.HandleUpgradeProposal(ctx, c) - - default: - return errorsmod.Wrapf(ibcerrors.ErrUnknownRequest, "unrecognized ibc proposal content type: %T", c) - } - } -} diff --git a/modules/core/02-client/types/client.pb.go b/modules/core/02-client/types/client.pb.go index 894f05e5826..16a555b9c7c 100644 --- a/modules/core/02-client/types/client.pb.go +++ b/modules/core/02-client/types/client.pb.go @@ -4,9 +4,7 @@ package types import ( - types1 "cosmossdk.io/x/upgrade/types" fmt "fmt" - _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/codec/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" @@ -194,53 +192,6 @@ func (m *ClientConsensusStates) GetConsensusStates() []ConsensusStateWithHeight return nil } -// UpgradeProposal is a gov Content type for initiating an IBC breaking -// upgrade. -type UpgradeProposal struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - Plan types1.Plan `protobuf:"bytes,3,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 - UpgradedClientState *types.Any `protobuf:"bytes,4,opt,name=upgraded_client_state,json=upgradedClientState,proto3" json:"upgraded_client_state,omitempty"` -} - -func (m *UpgradeProposal) Reset() { *m = UpgradeProposal{} } -func (*UpgradeProposal) ProtoMessage() {} -func (*UpgradeProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_b6bc4c8185546947, []int{3} -} -func (m *UpgradeProposal) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *UpgradeProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_UpgradeProposal.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 *UpgradeProposal) XXX_Merge(src proto.Message) { - xxx_messageInfo_UpgradeProposal.Merge(m, src) -} -func (m *UpgradeProposal) XXX_Size() int { - return m.Size() -} -func (m *UpgradeProposal) XXX_DiscardUnknown() { - xxx_messageInfo_UpgradeProposal.DiscardUnknown(m) -} - -var xxx_messageInfo_UpgradeProposal proto.InternalMessageInfo - // Height is a monotonically increasing data type // that can be compared against another Height for the purposes of updating and // freezing clients @@ -261,7 +212,7 @@ type Height struct { func (m *Height) Reset() { *m = Height{} } func (*Height) ProtoMessage() {} func (*Height) Descriptor() ([]byte, []int) { - return fileDescriptor_b6bc4c8185546947, []int{4} + return fileDescriptor_b6bc4c8185546947, []int{3} } func (m *Height) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -302,7 +253,7 @@ func (m *Params) Reset() { *m = Params{} } func (m *Params) String() string { return proto.CompactTextString(m) } func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_b6bc4c8185546947, []int{5} + return fileDescriptor_b6bc4c8185546947, []int{4} } func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -342,7 +293,6 @@ func init() { proto.RegisterType((*IdentifiedClientState)(nil), "ibc.core.client.v1.IdentifiedClientState") proto.RegisterType((*ConsensusStateWithHeight)(nil), "ibc.core.client.v1.ConsensusStateWithHeight") proto.RegisterType((*ClientConsensusStates)(nil), "ibc.core.client.v1.ClientConsensusStates") - proto.RegisterType((*UpgradeProposal)(nil), "ibc.core.client.v1.UpgradeProposal") proto.RegisterType((*Height)(nil), "ibc.core.client.v1.Height") proto.RegisterType((*Params)(nil), "ibc.core.client.v1.Params") } @@ -350,79 +300,37 @@ func init() { func init() { proto.RegisterFile("ibc/core/client/v1/client.proto", fileDescriptor_b6bc4c8185546947) } var fileDescriptor_b6bc4c8185546947 = []byte{ - // 577 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0xcf, 0x8b, 0xd3, 0x40, - 0x14, 0xc7, 0x93, 0xb6, 0x96, 0xed, 0x54, 0x5a, 0x89, 0x2d, 0xc4, 0x2a, 0x69, 0x29, 0x82, 0x45, - 0x6c, 0x62, 0x2b, 0xb8, 0xcb, 0x82, 0x07, 0xb7, 0x97, 0xdd, 0x8b, 0x94, 0x88, 0x08, 0x82, 0x94, - 0x64, 0x32, 0x9b, 0x0e, 0x24, 0x33, 0x21, 0x33, 0x89, 0xf4, 0x3f, 0xf0, 0x28, 0x78, 0xf1, 0xd8, - 0x3f, 0xc2, 0x3f, 0x62, 0xf1, 0xb4, 0x47, 0x4f, 0x22, 0xed, 0xc5, 0xff, 0xc0, 0xab, 0x74, 0x66, - 0xb2, 0x6e, 0xfc, 0xb1, 0xec, 0x6d, 0xde, 0x7b, 0xdf, 0xbc, 0xf9, 0x7c, 0x5f, 0x5e, 0x02, 0xfa, - 0xd8, 0x87, 0x0e, 0xa4, 0x29, 0x72, 0x60, 0x84, 0x11, 0xe1, 0x4e, 0x3e, 0x51, 0x27, 0x3b, 0x49, - 0x29, 0xa7, 0x86, 0x81, 0x7d, 0x68, 0xef, 0x04, 0xb6, 0x4a, 0xe7, 0x93, 0x5e, 0x27, 0xa4, 0x21, - 0x15, 0x65, 0x67, 0x77, 0x92, 0xca, 0xde, 0x9d, 0x90, 0xd2, 0x30, 0x42, 0x8e, 0x88, 0xfc, 0xec, - 0xd4, 0xf1, 0xc8, 0x4a, 0x95, 0xee, 0x43, 0xca, 0x62, 0xca, 0x9c, 0x2c, 0x09, 0x53, 0x2f, 0x40, - 0x4e, 0x3e, 0xf1, 0x11, 0xf7, 0x26, 0x45, 0x5c, 0x34, 0x90, 0xaa, 0x85, 0xec, 0x2c, 0x03, 0x59, - 0x1a, 0xc6, 0xa0, 0x7b, 0x12, 0x20, 0xc2, 0xf1, 0x29, 0x46, 0xc1, 0x4c, 0x80, 0xbc, 0xe4, 0x1e, - 0x47, 0xc6, 0x5d, 0xd0, 0x90, 0x5c, 0x0b, 0x1c, 0x98, 0xfa, 0x40, 0x1f, 0x35, 0xdc, 0x3d, 0x99, - 0x38, 0x09, 0x8c, 0x7d, 0x70, 0x53, 0x15, 0xd9, 0x4e, 0x6c, 0x56, 0x06, 0xfa, 0xa8, 0x39, 0xed, - 0xd8, 0x12, 0xd4, 0x2e, 0x40, 0xed, 0xe7, 0x64, 0xe5, 0x36, 0xe1, 0xef, 0xae, 0xc3, 0x8f, 0x3a, - 0x30, 0x67, 0x94, 0x30, 0x44, 0x58, 0xc6, 0x44, 0xea, 0x35, 0xe6, 0xcb, 0x63, 0x84, 0xc3, 0x25, - 0x37, 0x0e, 0x40, 0x7d, 0x29, 0x4e, 0xe2, 0xbe, 0xe6, 0xb4, 0x67, 0xff, 0x3d, 0x22, 0x5b, 0x6a, - 0x8f, 0x6a, 0x67, 0xdf, 0xfa, 0x9a, 0xab, 0xf4, 0xc6, 0x33, 0xd0, 0x86, 0x45, 0xd7, 0x6b, 0x20, - 0xb5, 0x60, 0x09, 0x61, 0x47, 0xd5, 0x95, 0xde, 0xcb, 0x6c, 0xec, 0xea, 0x29, 0xbc, 0x05, 0xb7, - 0xfe, 0xb8, 0x95, 0x99, 0x95, 0x41, 0x75, 0xd4, 0x9c, 0x3e, 0xfa, 0x17, 0xf9, 0xff, 0x7c, 0x2b, - 0x2f, 0xed, 0x32, 0x14, 0x1b, 0xfe, 0xd4, 0x41, 0xfb, 0x95, 0x7c, 0x8f, 0xf3, 0x94, 0x26, 0x94, - 0x79, 0x91, 0xd1, 0x01, 0x37, 0x38, 0xe6, 0x11, 0x52, 0x2c, 0x32, 0x30, 0x06, 0xa0, 0x19, 0x20, - 0x06, 0x53, 0x9c, 0x70, 0x4c, 0x89, 0xb0, 0xde, 0x70, 0x2f, 0xa7, 0x8c, 0xa7, 0xa0, 0x96, 0x44, - 0x1e, 0x31, 0xab, 0x62, 0x2a, 0xf7, 0x6c, 0xb5, 0x03, 0xc5, 0x9a, 0xa8, 0xb5, 0xb1, 0xe7, 0x91, - 0x47, 0x14, 0x8e, 0xd0, 0x1b, 0xc7, 0xa0, 0xab, 0x34, 0xc1, 0xa2, 0xf4, 0xc6, 0x6b, 0x57, 0x8c, - 0xf7, 0x76, 0xf1, 0xc8, 0xa5, 0x7d, 0x3a, 0x7c, 0xf8, 0x7e, 0xdd, 0xd7, 0x3e, 0xad, 0xfb, 0xda, - 0x8f, 0x75, 0x5f, 0xff, 0xf2, 0x79, 0xdc, 0x53, 0x08, 0x21, 0xcd, 0x2f, 0xae, 0x9f, 0x51, 0xc2, - 0x11, 0xe1, 0xc3, 0x00, 0xd4, 0xd5, 0x4a, 0x3c, 0x00, 0xed, 0x14, 0xe5, 0x98, 0x61, 0x4a, 0x16, - 0x24, 0x8b, 0x7d, 0x94, 0x0a, 0xe7, 0x35, 0xb7, 0x55, 0xa4, 0x5f, 0x88, 0x6c, 0x49, 0xa8, 0x96, - 0xa8, 0x52, 0x16, 0xca, 0x8e, 0x87, 0x7b, 0x05, 0xc7, 0x70, 0x02, 0xea, 0x73, 0x2f, 0xf5, 0x62, - 0xb6, 0x7b, 0xd8, 0x8b, 0x22, 0xfa, 0xee, 0xc2, 0x24, 0x33, 0xf5, 0x41, 0x75, 0xd4, 0x70, 0x5b, - 0x2a, 0x2d, 0x8d, 0xb0, 0x23, 0xf7, 0x6c, 0x63, 0xe9, 0xe7, 0x1b, 0x4b, 0xff, 0xbe, 0xb1, 0xf4, - 0x0f, 0x5b, 0x4b, 0x3b, 0xdf, 0x5a, 0xda, 0xd7, 0xad, 0xa5, 0xbd, 0x39, 0x08, 0x31, 0x5f, 0x66, - 0xbe, 0x0d, 0x69, 0xac, 0x3e, 0x30, 0x07, 0xfb, 0x70, 0x1c, 0x52, 0x27, 0xdf, 0x77, 0x62, 0x1a, - 0x64, 0x11, 0x62, 0xf2, 0x77, 0xf0, 0x78, 0x3a, 0x56, 0x7f, 0x04, 0xbe, 0x4a, 0x10, 0xf3, 0xeb, - 0x62, 0x76, 0x4f, 0x7e, 0x05, 0x00, 0x00, 0xff, 0xff, 0xed, 0x11, 0xbc, 0x47, 0x31, 0x04, 0x00, - 0x00, + // 439 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0xcf, 0x8b, 0xd3, 0x40, + 0x14, 0xce, 0x74, 0x97, 0xb2, 0x9d, 0x4a, 0x2b, 0x61, 0x17, 0x62, 0x85, 0xb4, 0xe4, 0x62, 0x0e, + 0xee, 0x8c, 0x8d, 0x87, 0x5d, 0x04, 0x0f, 0xee, 0x5e, 0xdc, 0x8b, 0x48, 0x3c, 0x08, 0x82, 0x94, + 0x64, 0x32, 0x9b, 0x0c, 0x24, 0x33, 0x4b, 0x66, 0x12, 0xe9, 0x7f, 0xe0, 0x51, 0xf0, 0xe2, 0x71, + 0xff, 0x9c, 0x3d, 0xf6, 0xe8, 0x49, 0xa4, 0xfd, 0x47, 0x24, 0x33, 0x53, 0x24, 0xfe, 0xc2, 0xdb, + 0xcb, 0xf7, 0xbe, 0x7c, 0xef, 0x7b, 0xdf, 0x3c, 0x38, 0x67, 0x29, 0xc1, 0x44, 0xd4, 0x14, 0x93, + 0x92, 0x51, 0xae, 0x70, 0xbb, 0xb4, 0x15, 0xba, 0xa9, 0x85, 0x12, 0xae, 0xcb, 0x52, 0x82, 0x3a, + 0x02, 0xb2, 0x70, 0xbb, 0x9c, 0x1d, 0xe7, 0x22, 0x17, 0xba, 0x8d, 0xbb, 0xca, 0x30, 0x67, 0x0f, + 0x72, 0x21, 0xf2, 0x92, 0x62, 0xfd, 0x95, 0x36, 0xd7, 0x38, 0xe1, 0x6b, 0xd3, 0x0a, 0x2a, 0x78, + 0x72, 0x95, 0x51, 0xae, 0xd8, 0x35, 0xa3, 0xd9, 0xa5, 0xd6, 0x79, 0xa3, 0x12, 0x45, 0xdd, 0x87, + 0x70, 0x64, 0x64, 0x57, 0x2c, 0xf3, 0xc0, 0x02, 0x84, 0xa3, 0xf8, 0xc8, 0x00, 0x57, 0x99, 0x7b, + 0x06, 0xef, 0xd9, 0xa6, 0xec, 0xc8, 0xde, 0x60, 0x01, 0xc2, 0x71, 0x74, 0x8c, 0xcc, 0x1c, 0xb4, + 0x9f, 0x83, 0x5e, 0xf0, 0x75, 0x3c, 0x26, 0x3f, 0x55, 0x83, 0xcf, 0x00, 0x7a, 0x97, 0x82, 0x4b, + 0xca, 0x65, 0x23, 0x35, 0xf4, 0x96, 0xa9, 0xe2, 0x25, 0x65, 0x79, 0xa1, 0xdc, 0x73, 0x38, 0x2c, + 0x74, 0xa5, 0xe7, 0x8d, 0xa3, 0x19, 0xfa, 0x7d, 0x43, 0x64, 0xb8, 0x17, 0x87, 0x77, 0xdf, 0xe6, + 0x4e, 0x6c, 0xf9, 0xee, 0x73, 0x38, 0x25, 0x7b, 0xd5, 0xff, 0xb0, 0x34, 0x21, 0x3d, 0x0b, 0x9d, + 0xab, 0x13, 0xb3, 0x7b, 0xdf, 0x9b, 0xfc, 0x77, 0x0a, 0xef, 0xe1, 0xfd, 0x5f, 0xa6, 0x4a, 0x6f, + 0xb0, 0x38, 0x08, 0xc7, 0xd1, 0xe3, 0x3f, 0x39, 0xff, 0xdb, 0xde, 0x76, 0x97, 0x69, 0xdf, 0x94, + 0x0c, 0x32, 0x38, 0xb4, 0xc1, 0x3c, 0x82, 0xd3, 0x9a, 0xb6, 0x4c, 0x32, 0xc1, 0x57, 0xbc, 0xa9, + 0x52, 0x5a, 0x6b, 0x2f, 0x87, 0xf1, 0x64, 0x0f, 0xbf, 0xd2, 0x68, 0x8f, 0x68, 0xa3, 0x1c, 0xf4, + 0x89, 0x46, 0xf1, 0xd9, 0xd1, 0xc7, 0xdb, 0xb9, 0xf3, 0xe5, 0x76, 0xee, 0x04, 0x4b, 0x38, 0x7c, + 0x9d, 0xd4, 0x49, 0x25, 0xbb, 0x9f, 0x93, 0xb2, 0x14, 0x1f, 0x68, 0xb6, 0x32, 0xa6, 0xa5, 0x07, + 0x16, 0x07, 0xe1, 0x28, 0x9e, 0x58, 0xd8, 0x44, 0x24, 0x2f, 0xe2, 0xbb, 0xad, 0x0f, 0x36, 0x5b, + 0x1f, 0x7c, 0xdf, 0xfa, 0xe0, 0xd3, 0xce, 0x77, 0x36, 0x3b, 0xdf, 0xf9, 0xba, 0xf3, 0x9d, 0x77, + 0xe7, 0x39, 0x53, 0x45, 0x93, 0x22, 0x22, 0x2a, 0x4c, 0x84, 0xac, 0x84, 0xc4, 0x2c, 0x25, 0xa7, + 0xb9, 0xc0, 0xed, 0x19, 0xae, 0x44, 0xd6, 0x94, 0x54, 0x9a, 0x9b, 0x7e, 0x12, 0x9d, 0xda, 0xb3, + 0x56, 0xeb, 0x1b, 0x2a, 0xd3, 0xa1, 0x7e, 0xa0, 0xa7, 0x3f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xad, + 0x30, 0x06, 0xc7, 0xf6, 0x02, 0x00, 0x00, } -func (this *UpgradeProposal) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*UpgradeProposal) - if !ok { - that2, ok := that.(UpgradeProposal) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Title != that1.Title { - return false - } - if this.Description != that1.Description { - return false - } - if !this.Plan.Equal(&that1.Plan) { - return false - } - if !this.UpgradedClientState.Equal(that1.UpgradedClientState) { - return false - } - return true -} func (m *IdentifiedClientState) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -554,65 +462,6 @@ func (m *ClientConsensusStates) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *UpgradeProposal) 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 *UpgradeProposal) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *UpgradeProposal) 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 = encodeVarintClient(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - { - size, err := m.Plan.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintClient(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintClient(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x12 - } - if len(m.Title) > 0 { - i -= len(m.Title) - copy(dAtA[i:], m.Title) - i = encodeVarintClient(dAtA, i, uint64(len(m.Title))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *Height) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -740,29 +589,6 @@ func (m *ClientConsensusStates) Size() (n int) { return n } -func (m *UpgradeProposal) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Title) - if l > 0 { - n += 1 + l + sovClient(uint64(l)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovClient(uint64(l)) - } - l = m.Plan.Size() - n += 1 + l + sovClient(uint64(l)) - if m.UpgradedClientState != nil { - l = m.UpgradedClientState.Size() - n += 1 + l + sovClient(uint64(l)) - } - return n -} - func (m *Height) Size() (n int) { if m == nil { return 0 @@ -1152,189 +978,6 @@ func (m *ClientConsensusStates) Unmarshal(dAtA []byte) error { } return nil } -func (m *UpgradeProposal) 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 ErrIntOverflowClient - } - 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: UpgradeProposal: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: UpgradeProposal: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowClient - } - 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 ErrInvalidLengthClient - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthClient - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Title = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowClient - } - 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 ErrInvalidLengthClient - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthClient - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - 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 ErrIntOverflowClient - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthClient - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthClient - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Plan.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - 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 ErrIntOverflowClient - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthClient - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthClient - } - 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 := skipClient(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthClient - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *Height) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/modules/core/02-client/types/codec.go b/modules/core/02-client/types/codec.go index a705ca7b620..7d1b4b65cd4 100644 --- a/modules/core/02-client/types/codec.go +++ b/modules/core/02-client/types/codec.go @@ -8,7 +8,6 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ibcerrors "github.com/cosmos/ibc-go/v7/modules/core/errors" "github.com/cosmos/ibc-go/v7/modules/core/exported" @@ -37,10 +36,6 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { "ibc.core.client.v1.Misbehaviour", (*exported.ClientMessage)(nil), ) - registry.RegisterImplementations( - (*govtypes.Content)(nil), - &UpgradeProposal{}, - ) registry.RegisterImplementations( (*sdk.Msg)(nil), &MsgCreateClient{}, diff --git a/modules/core/02-client/types/proposal.go b/modules/core/02-client/types/proposal.go deleted file mode 100644 index 14b0bd01a80..00000000000 --- a/modules/core/02-client/types/proposal.go +++ /dev/null @@ -1,102 +0,0 @@ -package types - -import ( - "fmt" - "reflect" - - errorsmod "cosmossdk.io/errors" - upgradetypes "cosmossdk.io/x/upgrade/types" - - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - - "github.com/cosmos/ibc-go/v7/modules/core/exported" -) - -const ( - ProposalTypeUpgrade = "IBCUpgrade" -) - -var ( - _ govtypes.Content = (*UpgradeProposal)(nil) - _ codectypes.UnpackInterfacesMessage = (*UpgradeProposal)(nil) -) - -func init() { - govtypes.RegisterProposalType(ProposalTypeUpgrade) -} - -// NewUpgradeProposal creates a new IBC breaking upgrade proposal. -func NewUpgradeProposal(title, description string, plan upgradetypes.Plan, upgradedClientState exported.ClientState) (govtypes.Content, error) { - protoAny, err := PackClientState(upgradedClientState) - if err != nil { - return nil, err - } - - return &UpgradeProposal{ - Title: title, - Description: description, - Plan: plan, - UpgradedClientState: protoAny, - }, nil -} - -// GetTitle returns the title of a upgrade proposal. -func (up *UpgradeProposal) GetTitle() string { return up.Title } - -// GetDescription returns the description of a upgrade proposal. -func (up *UpgradeProposal) GetDescription() string { return up.Description } - -// ProposalRoute returns the routing key of a upgrade proposal. -func (*UpgradeProposal) ProposalRoute() string { return RouterKey } - -// ProposalType returns the upgrade proposal type. -func (*UpgradeProposal) ProposalType() string { return ProposalTypeUpgrade } - -// ValidateBasic runs basic stateless validity checks -func (up *UpgradeProposal) ValidateBasic() error { - if err := govtypes.ValidateAbstract(up); err != nil { - return err - } - - if err := up.Plan.ValidateBasic(); err != nil { - return err - } - - if up.UpgradedClientState == nil { - return errorsmod.Wrap(ErrInvalidUpgradeProposal, "upgraded client state cannot be nil") - } - - clientState, err := UnpackClientState(up.UpgradedClientState) - if err != nil { - return errorsmod.Wrap(err, "failed to unpack upgraded client state") - } - - if !reflect.DeepEqual(clientState, clientState.ZeroCustomFields()) { - return errorsmod.Wrap(ErrInvalidUpgradeProposal, "upgraded client state is not zeroed out") - } - - return nil -} - -// String returns the string representation of the UpgradeProposal. -func (up UpgradeProposal) String() string { - var upgradedClientStr string - upgradedClient, err := UnpackClientState(up.UpgradedClientState) - if err != nil { - upgradedClientStr = "invalid IBC Client State" - } else { - upgradedClientStr = upgradedClient.String() - } - - return fmt.Sprintf(`IBC Upgrade Proposal - Title: %s - Description: %s - %s - Upgraded IBC Client: %s`, up.Title, up.Description, up.Plan.String(), upgradedClientStr) -} - -// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (up UpgradeProposal) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { - return unpacker.UnpackAny(up.UpgradedClientState, new(exported.ClientState)) -} diff --git a/modules/core/02-client/types/proposal_test.go b/modules/core/02-client/types/proposal_test.go deleted file mode 100644 index fd2105b4acd..00000000000 --- a/modules/core/02-client/types/proposal_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package types_test - -import ( - "fmt" - - upgradetypes "cosmossdk.io/x/upgrade/types" - - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - - "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" - ibctesting "github.com/cosmos/ibc-go/v7/testing" -) - -func (suite *TypesTestSuite) TestUpgradeProposalValidateBasic() { - var ( - proposal govtypes.Content - err error - ) - - path := ibctesting.NewPath(suite.chainA, suite.chainB) - suite.coordinator.SetupClients(path) - cs := suite.chainA.GetClientState(path.EndpointA.ClientID) - plan := upgradetypes.Plan{ - Name: "ibc upgrade", - Height: 1000, - } - - testCases := []struct { - name string - malleate func() - expPass bool - }{ - { - "success", func() { - proposal, err = types.NewUpgradeProposal(ibctesting.Title, ibctesting.Description, plan, cs.ZeroCustomFields()) - suite.Require().NoError(err) - }, true, - }, - { - "fails validate abstract - empty title", func() { - proposal, err = types.NewUpgradeProposal("", ibctesting.Description, plan, cs.ZeroCustomFields()) - suite.Require().NoError(err) - }, false, - }, - { - "non zeroed fields", func() { - proposal, err = types.NewUpgradeProposal(ibctesting.Title, ibctesting.Description, plan, &ibctm.ClientState{ - FrozenHeight: types.Height{ - RevisionHeight: 10, - }, - }) - suite.Require().NoError(err) - }, false, - }, - { - "plan height is zero", func() { - invalidPlan := upgradetypes.Plan{Name: "ibc upgrade", Height: 0} - proposal, err = types.NewUpgradeProposal(ibctesting.Title, ibctesting.Description, invalidPlan, cs.ZeroCustomFields()) - suite.Require().NoError(err) - }, false, - }, - { - "client state is nil", func() { - proposal = &types.UpgradeProposal{ - Title: ibctesting.Title, - Description: ibctesting.Description, - Plan: plan, - UpgradedClientState: nil, - } - }, false, - }, - { - "failed to unpack client state", func() { - protoAny, err := types.PackConsensusState(&ibctm.ConsensusState{}) - suite.Require().NoError(err) - - proposal = &types.UpgradeProposal{ - Title: ibctesting.Title, - Description: ibctesting.Description, - Plan: plan, - UpgradedClientState: protoAny, - } - }, false, - }, - } - - for _, tc := range testCases { - - tc.malleate() - - err := proposal.ValidateBasic() - - if tc.expPass { - suite.Require().NoError(err, tc.name) - } else { - suite.Require().Error(err, tc.name) - } - } -} - -// tests an upgrade proposal can be marshaled and unmarshaled, and the -// client state can be unpacked -func (suite *TypesTestSuite) TestMarshalUpgradeProposal() { - // create proposal - plan := upgradetypes.Plan{ - Name: "upgrade ibc", - Height: 1000, - } - content, err := types.NewUpgradeProposal("title", "description", plan, &ibctm.ClientState{}) - suite.Require().NoError(err) - - up, ok := content.(*types.UpgradeProposal) - suite.Require().True(ok) - - // create codec - ir := codectypes.NewInterfaceRegistry() - types.RegisterInterfaces(ir) - govtypes.RegisterInterfaces(ir) - ibctm.RegisterInterfaces(ir) - cdc := codec.NewProtoCodec(ir) - - // marshal message - bz, err := cdc.MarshalJSON(up) - suite.Require().NoError(err) - - // unmarshal proposal - newUp := &types.UpgradeProposal{} - err = cdc.UnmarshalJSON(bz, newUp) - suite.Require().NoError(err) - - // unpack client state - _, err = types.UnpackClientState(newUp.UpgradedClientState) - suite.Require().NoError(err) -} - -func (suite *TypesTestSuite) TestUpgradeString() { - plan := upgradetypes.Plan{ - Name: "ibc upgrade", - Info: "https://foo.bar/baz", - Height: 1000, - } - - proposal, err := types.NewUpgradeProposal(ibctesting.Title, ibctesting.Description, plan, &ibctm.ClientState{}) - suite.Require().NoError(err) - - expect := fmt.Sprintf("IBC Upgrade Proposal\n Title: title\n Description: description\n name:\"ibc upgrade\" time: height:1000 info:\"https://foo.bar/baz\" \n Upgraded IBC Client: %s", &ibctm.ClientState{}) - - suite.Require().Equal(expect, proposal.String()) -} diff --git a/proto/ibc/core/client/v1/client.proto b/proto/ibc/core/client/v1/client.proto index 016774c98ee..00ecf9dcc30 100644 --- a/proto/ibc/core/client/v1/client.proto +++ b/proto/ibc/core/client/v1/client.proto @@ -6,8 +6,6 @@ option go_package = "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; -import "cosmos/upgrade/v1beta1/upgrade.proto"; -import "cosmos_proto/cosmos.proto"; // IdentifiedClientState defines a client state with an additional client // identifier field. @@ -36,27 +34,6 @@ message ClientConsensusStates { repeated ConsensusStateWithHeight consensus_states = 2 [(gogoproto.nullable) = false]; } -// UpgradeProposal is a gov Content type for initiating an IBC breaking -// upgrade. -message UpgradeProposal { - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; - option (gogoproto.equal) = true; - option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; - - string title = 1; - string description = 2; - cosmos.upgrade.v1beta1.Plan plan = 3 [(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 - google.protobuf.Any upgraded_client_state = 4; -} - // Height is a monotonically increasing data type // that can be compared against another Height for the purposes of updating and // freezing clients diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 47c82318a2a..a9dae474641 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -121,9 +121,6 @@ import ( ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" ibc "github.com/cosmos/ibc-go/v7/modules/core" - ibcclient "github.com/cosmos/ibc-go/v7/modules/core/02-client" - ibcclientclient "github.com/cosmos/ibc-go/v7/modules/core/02-client/client" - ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" @@ -414,9 +411,7 @@ func NewSimApp( // See: https://docs.cosmos.network/main/modules/gov#proposal-messages govRouter := govv1beta1.NewRouter() govRouter.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). - AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)). - AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)) - + AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)) govConfig := govtypes.DefaultConfig() /* Example of setting gov params: @@ -612,7 +607,6 @@ func NewSimApp( govtypes.ModuleName: gov.NewAppModuleBasic( []govclient.ProposalHandler{ paramsclient.ProposalHandler, - ibcclientclient.UpgradeProposalHandler, }, ), }) From f2e7b0d2fe373654abb6e8dc2ece6b93f63fcebb Mon Sep 17 00:00:00 2001 From: Charly Date: Fri, 8 Sep 2023 23:34:12 +0200 Subject: [PATCH 18/34] create separate event emission for ibc software upgrades vs an upgraded client (#4594) * add new event type * update event name --- modules/core/02-client/keeper/events.go | 17 +++++++++++++++++ modules/core/02-client/keeper/keeper.go | 4 ++-- modules/core/02-client/types/events.go | 15 ++++++++------- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/modules/core/02-client/keeper/events.go b/modules/core/02-client/keeper/events.go index b94ecaae30c..608a121edae 100644 --- a/modules/core/02-client/keeper/events.go +++ b/modules/core/02-client/keeper/events.go @@ -112,6 +112,23 @@ func emitUpgradeClientProposalEvent(ctx sdk.Context, title string, height int64) }) } +// emitScheduleIBCSoftwareUpgradeEvent emits a schedule IBC software upgrade event +func emitScheduleIBCSoftwareUpgradeEvent(ctx sdk.Context, title string, height int64, upgradeClientState exported.ClientState) { + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeScheduleIBCSoftwareUpgrade, + sdk.NewAttribute(types.AttributeKeyUpgradePlanTitle, title), + sdk.NewAttribute(types.AttributeKeyUpgradePlanHeight, fmt.Sprintf("%d", height)), + sdk.NewAttribute(types.AttributeKeyClientType, upgradeClientState.ClientType()), + sdk.NewAttribute(types.AttributeKeyConsensusHeight, upgradeClientState.GetLatestHeight().String()), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + ), + }) +} + // emitSubmitMisbehaviourEvent emits a client misbehaviour event func emitSubmitMisbehaviourEvent(ctx sdk.Context, clientID string, clientState exported.ClientState) { ctx.EventManager().EmitEvents(sdk.Events{ diff --git a/modules/core/02-client/keeper/keeper.go b/modules/core/02-client/keeper/keeper.go index c956604c208..01659a8f91d 100644 --- a/modules/core/02-client/keeper/keeper.go +++ b/modules/core/02-client/keeper/keeper.go @@ -459,8 +459,8 @@ func (k Keeper) ScheduleIBCSoftwareUpgrade(ctx sdk.Context, plan upgradetypes.Pl return err } - // emitting an event for handling client upgrade proposal - emitUpgradeClientProposalEvent(ctx, plan.Name, plan.Height) + // emitting an event for scheduling an upgrade plan + emitScheduleIBCSoftwareUpgradeEvent(ctx, plan.Name, plan.Height, cs) return nil } diff --git a/modules/core/02-client/types/events.go b/modules/core/02-client/types/events.go index 2458b65dd4e..bb58360098a 100644 --- a/modules/core/02-client/types/events.go +++ b/modules/core/02-client/types/events.go @@ -21,13 +21,14 @@ const ( // IBC client events vars var ( - EventTypeCreateClient = "create_client" - EventTypeUpdateClient = "update_client" - EventTypeUpgradeClient = "upgrade_client" - EventTypeSubmitMisbehaviour = "client_misbehaviour" - EventTypeUpgradeChain = "upgrade_chain" - EventTypeUpgradeClientProposal = "upgrade_client_proposal" - EventTypeRecoverClient = "recover_client" + EventTypeCreateClient = "create_client" + EventTypeUpdateClient = "update_client" + EventTypeUpgradeClient = "upgrade_client" + EventTypeSubmitMisbehaviour = "client_misbehaviour" + EventTypeUpgradeChain = "upgrade_chain" + EventTypeUpgradeClientProposal = "upgrade_client_proposal" + EventTypeScheduleIBCSoftwareUpgrade = "schedule_ibc_software_upgrade" + EventTypeRecoverClient = "recover_client" AttributeValueCategory = fmt.Sprintf("%s_%s", ibcexported.ModuleName, SubModuleName) ) From 1f6911f2198b6276f8a5c9b6627cfae1a8f5921a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Colin=20Axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Mon, 11 Sep 2023 13:02:27 +0200 Subject: [PATCH 19/34] fix build --- modules/core/02-client/types/msgs_test.go | 3 +++ modules/core/keeper/msg_server_test.go | 1 + testing/simapp/app.go | 2 -- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/core/02-client/types/msgs_test.go b/modules/core/02-client/types/msgs_test.go index ae07603424f..e3e3d5cf407 100644 --- a/modules/core/02-client/types/msgs_test.go +++ b/modules/core/02-client/types/msgs_test.go @@ -17,6 +17,9 @@ import ( "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types" + host "github.com/cosmos/ibc-go/v8/modules/core/24-host" + ibcerrors "github.com/cosmos/ibc-go/v8/modules/core/errors" + "github.com/cosmos/ibc-go/v8/modules/core/exported" solomachine "github.com/cosmos/ibc-go/v8/modules/light-clients/06-solomachine" ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" ibctesting "github.com/cosmos/ibc-go/v8/testing" diff --git a/modules/core/keeper/msg_server_test.go b/modules/core/keeper/msg_server_test.go index 029c20c2e8b..a54a377c3d6 100644 --- a/modules/core/keeper/msg_server_test.go +++ b/modules/core/keeper/msg_server_test.go @@ -12,6 +12,7 @@ import ( channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types" host "github.com/cosmos/ibc-go/v8/modules/core/24-host" + ibcerrors "github.com/cosmos/ibc-go/v8/modules/core/errors" "github.com/cosmos/ibc-go/v8/modules/core/exported" "github.com/cosmos/ibc-go/v8/modules/core/keeper" ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 252a0d5cdb6..3fd6110046b 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -121,8 +121,6 @@ import ( ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" ibc "github.com/cosmos/ibc-go/v8/modules/core" - ibcclient "github.com/cosmos/ibc-go/v8/modules/core/02-client" - ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" From 14e5593c14b85e03b2918ffe933f9306eed80fd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Colin=20Axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Mon, 11 Sep 2023 13:10:39 +0200 Subject: [PATCH 20/34] remove: legacy event emissions --- modules/core/02-client/keeper/events.go | 15 --------------- modules/core/02-client/types/events.go | 1 - 2 files changed, 16 deletions(-) diff --git a/modules/core/02-client/keeper/events.go b/modules/core/02-client/keeper/events.go index b9a9241faf9..5c7561b457b 100644 --- a/modules/core/02-client/keeper/events.go +++ b/modules/core/02-client/keeper/events.go @@ -97,21 +97,6 @@ func emitRecoverClientEvent(ctx sdk.Context, clientID, clientType string) { }) } -// emitUpgradeClientProposalEvent emits an upgrade client proposal event -func emitUpgradeClientProposalEvent(ctx sdk.Context, title string, height int64) { - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeUpgradeClientProposal, - sdk.NewAttribute(types.AttributeKeyUpgradePlanTitle, title), - sdk.NewAttribute(types.AttributeKeyUpgradePlanHeight, fmt.Sprintf("%d", height)), - ), - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - ), - }) -} - // emitScheduleIBCSoftwareUpgradeEvent emits a schedule IBC software upgrade event func emitScheduleIBCSoftwareUpgradeEvent(ctx sdk.Context, title string, height int64, upgradeClientState exported.ClientState) { ctx.EventManager().EmitEvents(sdk.Events{ diff --git a/modules/core/02-client/types/events.go b/modules/core/02-client/types/events.go index 39d5620f3fa..fc8c1506882 100644 --- a/modules/core/02-client/types/events.go +++ b/modules/core/02-client/types/events.go @@ -26,7 +26,6 @@ var ( EventTypeUpgradeClient = "upgrade_client" EventTypeSubmitMisbehaviour = "client_misbehaviour" EventTypeUpgradeChain = "upgrade_chain" - EventTypeUpgradeClientProposal = "upgrade_client_proposal" EventTypeScheduleIBCSoftwareUpgrade = "schedule_ibc_software_upgrade" EventTypeRecoverClient = "recover_client" From b2a6b2b886d85964f64c17a26abaa1a64320c6db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Colin=20Axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Mon, 11 Sep 2023 13:20:01 +0200 Subject: [PATCH 21/34] remove: unnecessary assignments, apply suggestion from code review --- modules/core/02-client/keeper/client_test.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/modules/core/02-client/keeper/client_test.go b/modules/core/02-client/keeper/client_test.go index 3730b3d8677..89f4c0ad993 100644 --- a/modules/core/02-client/keeper/client_test.go +++ b/modules/core/02-client/keeper/client_test.go @@ -635,15 +635,11 @@ func (suite *KeeperTestSuite) TestRecoverClient() { tmClientState, ok := subjectClientState.(*ibctm.ClientState) suite.Require().True(ok) - tmClientState.AllowUpdateAfterMisbehaviour = true - tmClientState.AllowUpdateAfterExpiry = true tmClientState.FrozenHeight = tmClientState.LatestHeight suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainA.GetContext(), subject, tmClientState) tmClientState, ok = substituteClientState.(*ibctm.ClientState) suite.Require().True(ok) - tmClientState.AllowUpdateAfterMisbehaviour = true - tmClientState.AllowUpdateAfterExpiry = true tc.malleate() From 7585e3fc4efdfac35bf6f116eff7487663712cea Mon Sep 17 00:00:00 2001 From: Charly Date: Mon, 11 Sep 2023 15:25:50 +0200 Subject: [PATCH 22/34] e2e: schedule IBC software upgrade (#4585) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * wip e2e test * query proposal * update upgrade height in plan * rm unnecessary wait/authority * rm test artifact from merge * add checks for scheduled plan * hook up upgrade query client * plan height * pr fixes * update test * import space * update newchainID value * update clientID upgrade * linter * gci * rm unnecessary event --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Damian Nolan Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com> Co-authored-by: Sishir Giri Co-authored-by: srdtrk <59252793+srdtrk@users.noreply.github.com> Co-authored-by: Cian Hatton Co-authored-by: Julien Robert Co-authored-by: Carlos Rodriguez Co-authored-by: Jim Fasarakis-Hilliard Co-authored-by: sontrinh16 Co-authored-by: catShaark Co-authored-by: khanh-notional <50263489+catShaark@users.noreply.github.com> --- e2e/tests/core/02-client/client_test.go | 60 +++++++++++++++++++++++++ e2e/testsuite/grpc_query.go | 44 +++++++++++++++--- modules/core/02-client/keeper/events.go | 15 ------- 3 files changed, 98 insertions(+), 21 deletions(-) diff --git a/e2e/tests/core/02-client/client_test.go b/e2e/tests/core/02-client/client_test.go index 34e6d8d9adc..aa93b5df3ed 100644 --- a/e2e/tests/core/02-client/client_test.go +++ b/e2e/tests/core/02-client/client_test.go @@ -14,6 +14,8 @@ import ( test "github.com/strangelove-ventures/interchaintest/v7/testutil" testifysuite "github.com/stretchr/testify/suite" + "cosmossdk.io/x/upgrade/types" + "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" @@ -71,6 +73,64 @@ func (s *ClientTestSuite) QueryAllowedClients(ctx context.Context, chain ibc.Cha return res.Params.AllowedClients } +// TestScheduleIBCUpgrade_Succeeds tests that a governance proposal to schedule an IBC software upgrade is successful. +func (s *ClientTestSuite) TestScheduleIBCUpgrade_Succeeds() { + t := s.T() + ctx := context.TODO() + + _, _ = s.SetupChainsRelayerAndChannel(ctx) + chainA, chainB := s.GetChains() + chainAWallet := s.CreateUserOnChainA(ctx, testvalues.StartingTokenAmount) + + const planHeight = int64(75) + var newChainID string + + t.Run("send schedule IBC upgrade message", func(t *testing.T) { + authority, err := s.QueryModuleAccountAddress(ctx, govtypes.ModuleName, chainA) + s.Require().NoError(err) + s.Assert().NotNil(authority) + + clientState, err := s.QueryClientState(ctx, chainB, ibctesting.FirstClientID) + s.Require().NoError(err) + + originalChainID := clientState.(*ibctm.ClientState).ChainId + revisionNumber := clienttypes.ParseChainID(fmt.Sprintf("%s-%d", originalChainID, 1)) + // increment revision number even with new chain ID to prevent loss of misbehaviour detection support + newChainID, err = clienttypes.SetRevisionNumber(fmt.Sprintf("%s-%d", originalChainID, 1), revisionNumber+1) + s.Require().NoError(err) + s.Assert().NotEqual(originalChainID, newChainID) + + upgradedClientState := clientState.(*ibctm.ClientState) + upgradedClientState.ChainId = newChainID + + scheduleUpgradeMsg, err := clienttypes.NewMsgIBCSoftwareUpgrade( + authority.String(), + types.Plan{ + Name: "upgrade-client", + Height: planHeight, + }, + upgradedClientState, + ) + s.Require().NoError(err) + s.ExecuteGovProposalV1(ctx, scheduleUpgradeMsg, chainA, chainAWallet, 1) + }) + + t.Run("check that IBC software upgrade has been scheduled successfully on chainA", func(t *testing.T) { + // checks there is an upgraded client state stored + cs, err := s.QueryUpgradedClientState(ctx, chainA, ibctesting.FirstClientID) + s.Require().NoError(err) + + upgradedClientState := cs.(*ibctm.ClientState) + s.Assert().Equal(upgradedClientState.ChainId, newChainID) + + plan, err := s.QueryCurrentPlan(ctx, chainA) + s.Require().NoError(err) + + s.Assert().Equal("upgrade-client", plan.Name) + s.Assert().Equal(planHeight, plan.Height) + }) +} + // TestRecoverClient_Succeeds tests that a governance proposal to recover a client using a MsgRecoverClient is successful. func (s *ClientTestSuite) TestRecoverClient_Succeeds() { t := s.T() diff --git a/e2e/testsuite/grpc_query.go b/e2e/testsuite/grpc_query.go index 03155feb408..eb7f62db1a2 100644 --- a/e2e/testsuite/grpc_query.go +++ b/e2e/testsuite/grpc_query.go @@ -12,6 +12,8 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" + upgradetypes "cosmossdk.io/x/upgrade/types" + "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -45,12 +47,13 @@ type GRPCClients struct { InterTxQueryClient intertxtypes.QueryClient // SDK query clients - GovQueryClient govtypesv1beta1.QueryClient - GovQueryClientV1 govtypesv1.QueryClient - GroupsQueryClient grouptypes.QueryClient - ParamsQueryClient paramsproposaltypes.QueryClient - AuthQueryClient authtypes.QueryClient - AuthZQueryClient authz.QueryClient + GovQueryClient govtypesv1beta1.QueryClient + GovQueryClientV1 govtypesv1.QueryClient + GroupsQueryClient grouptypes.QueryClient + ParamsQueryClient paramsproposaltypes.QueryClient + AuthQueryClient authtypes.QueryClient + AuthZQueryClient authz.QueryClient + UpgradeQueryClient upgradetypes.QueryClient ConsensusServiceClient cmtservice.ServiceClient } @@ -90,6 +93,7 @@ func (s *E2ETestSuite) InitGRPCClients(chain *cosmos.CosmosChain) { AuthQueryClient: authtypes.NewQueryClient(grpcConn), AuthZQueryClient: authz.NewQueryClient(grpcConn), ConsensusServiceClient: cmtservice.NewServiceClient(grpcConn), + UpgradeQueryClient: upgradetypes.NewQueryClient(grpcConn), } } @@ -119,6 +123,23 @@ func (s *E2ETestSuite) QueryClientState(ctx context.Context, chain ibc.Chain, cl return clientState, nil } +// QueryUpgradedClientState queries the upgraded client state on the given chain for the provided clientID. +func (s *E2ETestSuite) QueryUpgradedClientState(ctx context.Context, chain ibc.Chain, clientID string) (ibcexported.ClientState, error) { + queryClient := s.GetChainGRCPClients(chain).ClientQueryClient + res, err := queryClient.UpgradedClientState(ctx, &clienttypes.QueryUpgradedClientStateRequest{}) + if err != nil { + return nil, err + } + + cfg := EncodingConfig() + var clientState ibcexported.ClientState + if err := cfg.InterfaceRegistry.UnpackAny(res.UpgradedClientState, &clientState); err != nil { + return nil, err + } + + return clientState, nil +} + // QueryClientStatus queries the status of the client by clientID func (s *E2ETestSuite) QueryClientStatus(ctx context.Context, chain ibc.Chain, clientID string) (string, error) { queryClient := s.GetChainGRCPClients(chain).ClientQueryClient @@ -132,6 +153,17 @@ func (s *E2ETestSuite) QueryClientStatus(ctx context.Context, chain ibc.Chain, c return res.Status, nil } +// QueryCurrentPlan queries the currently scheduled plans, if any +func (s *E2ETestSuite) QueryCurrentPlan(ctx context.Context, chain ibc.Chain) (upgradetypes.Plan, error) { + queryClient := s.GetChainGRCPClients(chain).UpgradeQueryClient + res, err := queryClient.CurrentPlan(ctx, &upgradetypes.QueryCurrentPlanRequest{}) + if err != nil { + return upgradetypes.Plan{}, err + } + + return *res.Plan, nil +} + // QueryConnection queries the connection end using the given chain and connection id. func (s *E2ETestSuite) QueryConnection(ctx context.Context, chain ibc.Chain, connectionID string) (connectiontypes.ConnectionEnd, error) { queryClient := s.GetChainGRCPClients(chain).ConnectionQueryClient diff --git a/modules/core/02-client/keeper/events.go b/modules/core/02-client/keeper/events.go index 608a121edae..4b8a875bddd 100644 --- a/modules/core/02-client/keeper/events.go +++ b/modules/core/02-client/keeper/events.go @@ -97,21 +97,6 @@ func emitRecoverClientEvent(ctx sdk.Context, clientID, clientType string) { }) } -// emitUpgradeClientProposalEvent emits an upgrade client proposal event -func emitUpgradeClientProposalEvent(ctx sdk.Context, title string, height int64) { - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeUpgradeClientProposal, - sdk.NewAttribute(types.AttributeKeyUpgradePlanTitle, title), - sdk.NewAttribute(types.AttributeKeyUpgradePlanHeight, fmt.Sprintf("%d", height)), - ), - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - ), - }) -} - // emitScheduleIBCSoftwareUpgradeEvent emits a schedule IBC software upgrade event func emitScheduleIBCSoftwareUpgradeEvent(ctx sdk.Context, title string, height int64, upgradeClientState exported.ClientState) { ctx.EventManager().EmitEvents(sdk.Events{ From 1bf1b17fc31e1a02c2c7a7d466173867db7f939d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?colin=20axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Mon, 11 Sep 2023 15:26:09 +0200 Subject: [PATCH 23/34] chore: docs for MsgIBCSoftwareUpgrade (#4601) * chore: update docs for UpgradeProposal -> MsgIBCSoftwareUpgrade * chore: anticipate link change * fix event docs --- docs/ibc/events.md | 14 ++++++++------ docs/ibc/upgrades/genesis-restart.md | 8 ++++---- docs/ibc/upgrades/quick-guide.md | 6 +++--- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/docs/ibc/events.md b/docs/ibc/events.md index ea077454c72..025e252ffb4 100644 --- a/docs/ibc/events.md +++ b/docs/ibc/events.md @@ -58,12 +58,14 @@ callbacks to IBC applications. | update_client_proposal | client_type | {clientType} | | update_client_proposal | consensus_height | {consensusHeight} | -### UpgradeProposal - -| Type | Attribute Key | Attribute Value | -|-------------------------|-----------------|-------------------| -| upgrade_client_proposal | title | {title} | -| upgrade_client_proposal | height | {height} | +### IBCSoftwareUpgrade + +| Type | Attribute Key | Attribute Value | +|-------------------------------|---------------------|---------------------------------| +| schedule_ibc_software_upgrade | title | {title} | +| schedule_ibc_software_upgrade | upgrade_plan_height | {plan.height} | +| schedule_ibc_software_upgrade | client_type | {upgraded_client_type} | +| schedule_ibc_software_upgrade | consensus_height | {upgraded_client_latest_height} | ## ICS 03 - Connection diff --git a/docs/ibc/upgrades/genesis-restart.md b/docs/ibc/upgrades/genesis-restart.md index abb0fa9a817..d2788d8d14a 100644 --- a/docs/ibc/upgrades/genesis-restart.md +++ b/docs/ibc/upgrades/genesis-restart.md @@ -20,18 +20,18 @@ Genesis restarts still require the usage of an IBC upgrade proposal in order to If the IBC-connected chain is conducting an upgrade that will break counterparty clients, it must ensure that the upgrade is first supported by IBC using the [IBC Client Breaking Upgrade List](https://github.com/cosmos/ibc-go/blob/main/docs/ibc/upgrades/quick-guide.md#ibc-client-breaking-upgrades) and then execute the upgrade process described below in order to prevent counterparty clients from breaking. -1. Create a 02-client [`UpgradeProposal`](https://github.com/cosmos/ibc-go/blob/main/docs/ibc/proto-docs.md#upgradeproposal) with an `UpgradePlan` and a new IBC ClientState in the `UpgradedClientState` field. Note that the `UpgradePlan` must specify an upgrade height **only** (no upgrade time), and the `ClientState` should only include the fields common to all valid clients and zero out any client-customizable fields (such as TrustingPeriod). -2. Vote on and pass the `UpgradeProposal`. +1. Create a governance proposal with the [`MsgIBCSoftwareUpgrade`](https://buf.build/cosmos/ibc/docs/main:ibc.core.client.v1#ibc.core.client.v1.MsgIBCSoftwareUpgrade) which contains an `UpgradePlan` and a new IBC ClientState in the `UpgradedClientState` field. Note that the `UpgradePlan` must specify an upgrade height **only** (no upgrade time), and the `ClientState` should only include the fields common to all valid clients and zero out any client-customizable fields (such as TrustingPeriod). +2. Vote on and pass the governance proposal. 3. Halt the node after successful upgrade. 4. Export the genesis file. 5. Swap to the new binary. 6. Run migrations on the genesis file. -7. Remove the `UpgradeProposal` plan from the genesis file. This may be done by migrations. +7. Remove the upgrade plan set by the governance proposal from the genesis file. This may be done by migrations. 8. Change desired chain-specific fields (chain id, unbonding period, etc). This may be done by migrations. 8. Reset the node's data. 9. Start the chain. -Upon the `UpgradeProposal` passing, the upgrade module will commit the UpgradedClient under the key: `upgrade/UpgradedIBCState/{upgradeHeight}/upgradedClient`. On the block right before the upgrade height, the upgrade module will also commit an initial consensus state for the next chain under the key: `upgrade/UpgradedIBCState/{upgradeHeight}/upgradedConsState`. +Upon passing the governance proposal, the upgrade module will commit the UpgradedClient under the key: `upgrade/UpgradedIBCState/{upgradeHeight}/upgradedClient`. On the block right before the upgrade height, the upgrade module will also commit an initial consensus state for the next chain under the key: `upgrade/UpgradedIBCState/{upgradeHeight}/upgradedConsState`. Once the chain reaches the upgrade height and halts, a relayer can upgrade the counterparty clients to the last block of the old chain. They can then submit the proofs of the `UpgradedClient` and `UpgradedConsensusState` against this last block and upgrade the counterparty client. diff --git a/docs/ibc/upgrades/quick-guide.md b/docs/ibc/upgrades/quick-guide.md index 1bdca7a567e..152768161d1 100644 --- a/docs/ibc/upgrades/quick-guide.md +++ b/docs/ibc/upgrades/quick-guide.md @@ -30,10 +30,10 @@ Note: Since upgrades are only implemented for Tendermint clients, this doc only If the IBC-connected chain is conducting an upgrade that will break counterparty clients, it must ensure that the upgrade is first supported by IBC using the list above and then execute the upgrade process described below in order to prevent counterparty clients from breaking. -1. Create a 02-client [`UpgradeProposal`](https://github.com/cosmos/ibc-go/blob/main/docs/ibc/proto-docs.md#upgradeproposal) with an `UpgradePlan` and a new IBC ClientState in the `UpgradedClientState` field. Note that the `UpgradePlan` must specify an upgrade height **only** (no upgrade time), and the `ClientState` should only include the fields common to all valid clients and zero out any client-customizable fields (such as TrustingPeriod). -2. Vote on and pass the `UpgradeProposal`. +1. Create a governance proposal with the [`MsgIBCSoftwareUpgrade`](https://buf.build/cosmos/ibc/docs/main:ibc.core.client.v1#ibc.core.client.v1.MsgIBCSoftwareUpgrade) message which contains an `UpgradePlan` and a new IBC ClientState in the `UpgradedClientState` field. Note that the `UpgradePlan` must specify an upgrade height **only** (no upgrade time), and the `ClientState` should only include the fields common to all valid clients and zero out any client-customizable fields (such as TrustingPeriod). +2. Vote on and pass the governance proposal. -Upon the `UpgradeProposal` passing, the upgrade module will commit the UpgradedClient under the key: `upgrade/UpgradedIBCState/{upgradeHeight}/upgradedClient`. On the block right before the upgrade height, the upgrade module will also commit an initial consensus state for the next chain under the key: `upgrade/UpgradedIBCState/{upgradeHeight}/upgradedConsState`. +Upon passing the governance proposal, the upgrade module will commit the UpgradedClient under the key: `upgrade/UpgradedIBCState/{upgradeHeight}/upgradedClient`. On the block right before the upgrade height, the upgrade module will also commit an initial consensus state for the next chain under the key: `upgrade/UpgradedIBCState/{upgradeHeight}/upgradedConsState`. Once the chain reaches the upgrade height and halts, a relayer can upgrade the counterparty clients to the last block of the old chain. They can then submit the proofs of the `UpgradedClient` and `UpgradedConsensusState` against this last block and upgrade the counterparty client. From 551e2cfcba4b6d53eb600658fdd0c28fa7215c73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Colin=20Axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Mon, 11 Sep 2023 15:30:14 +0200 Subject: [PATCH 24/34] refactor: s.Assert -> s.Require --- e2e/go.mod | 12 ++++-------- e2e/go.sum | 12 +++--------- e2e/tests/core/02-client/client_test.go | 10 +++++----- 3 files changed, 12 insertions(+), 22 deletions(-) diff --git a/e2e/go.mod b/e2e/go.mod index e57990a228c..e021400cdfb 100644 --- a/e2e/go.mod +++ b/e2e/go.mod @@ -115,8 +115,6 @@ require ( github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect - github.com/gtank/merlin v0.1.1 // indirect - github.com/gtank/ristretto255 v0.1.2 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-getter v1.7.1 // indirect github.com/hashicorp/go-hclog v1.5.0 // indirect @@ -134,7 +132,6 @@ require ( github.com/icza/dyno v0.0.0-20220812133438-f0b6f8a18845 // indirect github.com/improbable-eng/grpc-web v0.15.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/ipfs/go-cid v0.4.1 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect @@ -150,8 +147,6 @@ require ( github.com/mattn/go-isatty v0.0.19 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/minio/highwayhash v1.0.2 // indirect - github.com/minio/sha256-simd v1.0.0 // indirect - github.com/misko9/go-substrate-rpc-client/v4 v4.0.0-20230413215336-5bd2aea337ae // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect @@ -186,9 +181,6 @@ require ( github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/tendermint/go-amino v0.16.0 // indirect github.com/tidwall/btree v1.6.0 // indirect - github.com/tklauser/go-sysconf v0.3.11 // indirect - github.com/tyler-smith/go-bip32 v1.0.0 // indirect - github.com/tyler-smith/go-bip39 v1.1.0 // indirect github.com/ulikunitz/xz v0.5.11 // indirect github.com/zondax/hid v0.9.1 // indirect github.com/zondax/ledger-go v0.14.1 // indirect @@ -198,11 +190,15 @@ require ( golang.org/x/crypto v0.13.0 // indirect golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 // indirect golang.org/x/net v0.15.0 // indirect + golang.org/x/oauth2 v0.8.0 // indirect golang.org/x/sync v0.3.0 // indirect golang.org/x/sys v0.12.0 // indirect golang.org/x/term v0.12.0 // indirect golang.org/x/text v0.13.0 // indirect golang.org/x/tools v0.13.0 // indirect + golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect + google.golang.org/api v0.126.0 // indirect + google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230815205213-6bfd019c3878 // indirect diff --git a/e2e/go.sum b/e2e/go.sum index a99e820967e..c52e0ca97fa 100644 --- a/e2e/go.sum +++ b/e2e/go.sum @@ -498,15 +498,8 @@ github.com/gobwas/pool v0.2.1 h1:xfeeEhW7pwmX8nuLVlqbzVc7udMDrwetjEv+TZIz1og= github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= -<<<<<<< HEAD -github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk= -github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= -======= -github.com/gobwas/ws v1.1.0 h1:7RFti/xnNkMJnrK7D1yQ/iCIB5OrrY/54/H930kIbHA= -github.com/gobwas/ws v1.1.0/go.mod h1:nzvNcVha5eUziGrbxFCo6qFIojQHjJV5cLYIbezhfL0= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= ->>>>>>> 23eabb55bf2987c2bec3a132d9bab4c4b9e674fb github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -1031,11 +1024,12 @@ github.com/tidwall/btree v1.6.0 h1:LDZfKfQIBHGHWSwckhXI0RPSXzlo+KYdjK7FWSqOzzg= github.com/tidwall/btree v1.6.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= +github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= -github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= +github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8= github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= diff --git a/e2e/tests/core/02-client/client_test.go b/e2e/tests/core/02-client/client_test.go index e1103c11556..83de04552f9 100644 --- a/e2e/tests/core/02-client/client_test.go +++ b/e2e/tests/core/02-client/client_test.go @@ -88,7 +88,7 @@ func (s *ClientTestSuite) TestScheduleIBCUpgrade_Succeeds() { t.Run("send schedule IBC upgrade message", func(t *testing.T) { authority, err := s.QueryModuleAccountAddress(ctx, govtypes.ModuleName, chainA) s.Require().NoError(err) - s.Assert().NotNil(authority) + s.Require().NotNil(authority) clientState, err := s.QueryClientState(ctx, chainB, ibctesting.FirstClientID) s.Require().NoError(err) @@ -98,7 +98,7 @@ func (s *ClientTestSuite) TestScheduleIBCUpgrade_Succeeds() { // increment revision number even with new chain ID to prevent loss of misbehaviour detection support newChainID, err = clienttypes.SetRevisionNumber(fmt.Sprintf("%s-%d", originalChainID, 1), revisionNumber+1) s.Require().NoError(err) - s.Assert().NotEqual(originalChainID, newChainID) + s.Require().NotEqual(originalChainID, newChainID) upgradedClientState := clientState.(*ibctm.ClientState) upgradedClientState.ChainId = newChainID @@ -121,13 +121,13 @@ func (s *ClientTestSuite) TestScheduleIBCUpgrade_Succeeds() { s.Require().NoError(err) upgradedClientState := cs.(*ibctm.ClientState) - s.Assert().Equal(upgradedClientState.ChainId, newChainID) + s.Require().Equal(upgradedClientState.ChainId, newChainID) plan, err := s.QueryCurrentPlan(ctx, chainA) s.Require().NoError(err) - s.Assert().Equal("upgrade-client", plan.Name) - s.Assert().Equal(planHeight, plan.Height) + s.Require().Equal("upgrade-client", plan.Name) + s.Require().Equal(planHeight, plan.Height) }) } From 1a5b2746740a470a5bca76a55ef5530a95e8a835 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?colin=20axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Mon, 11 Sep 2023 15:32:28 +0200 Subject: [PATCH 25/34] Apply suggestions from code review Co-authored-by: Damian Nolan --- docs/ibc/proposals.md | 2 +- proto/ibc/core/client/v1/tx.proto | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/ibc/proposals.md b/docs/ibc/proposals.md index 013be95834d..18cc03baec6 100644 --- a/docs/ibc/proposals.md +++ b/docs/ibc/proposals.md @@ -112,4 +112,4 @@ After this, all that remains is deciding who funds the governance deposit and en ## Important considerations -Please note that if the client on the other end of the transaction is also expired, that client will also need to update. This process updates only one client. +Please note that if the counterparty client is also expired, that client will also need to update. This process updates only one client. diff --git a/proto/ibc/core/client/v1/tx.proto b/proto/ibc/core/client/v1/tx.proto index 3e18538435e..547ba582036 100644 --- a/proto/ibc/core/client/v1/tx.proto +++ b/proto/ibc/core/client/v1/tx.proto @@ -97,7 +97,7 @@ message MsgUpgradeClient { // MsgUpgradeClientResponse defines the Msg/UpgradeClient response type. message MsgUpgradeClientResponse {} -// MsgIBCSoftwareUpgrade defines an sdk.Msg to schedule an upgrade of an IBC client using a v1 governance proposal +// MsgIBCSoftwareUpgrade defines the message used to schedule an upgrade of an IBC client using a v1 governance proposal message MsgIBCSoftwareUpgrade { option (cosmos.msg.v1.signer) = "signer"; cosmos.upgrade.v1beta1.Plan plan = 1 [(gogoproto.nullable) = false]; @@ -156,7 +156,7 @@ message MsgUpdateParams { // MsgUpdateParamsResponse defines the MsgUpdateParams response type. message MsgUpdateParamsResponse {} -// MsgRecoverClient defines the sdk.Msg type to recover a client. +// MsgRecoverClient defines the message used to recover a frozen or expired client. message MsgRecoverClient { option (gogoproto.goproto_getters) = false; option (cosmos.msg.v1.signer) = "signer"; From 132cf3f746999fec0257600f7d7ce036bb1f9d23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Colin=20Axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Mon, 11 Sep 2023 15:34:20 +0200 Subject: [PATCH 26/34] make proto-all --- modules/core/02-client/types/tx.pb.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/core/02-client/types/tx.pb.go b/modules/core/02-client/types/tx.pb.go index 400b0d7b3ab..6b295c51af4 100644 --- a/modules/core/02-client/types/tx.pb.go +++ b/modules/core/02-client/types/tx.pb.go @@ -281,7 +281,7 @@ func (m *MsgUpgradeClientResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpgradeClientResponse proto.InternalMessageInfo -// MsgIBCSoftwareUpgrade defines an sdk.Msg to schedule an upgrade of an IBC client using a v1 governance proposal +// MsgIBCSoftwareUpgrade defines the message used to schedule an upgrade of an IBC client using a v1 governance proposal type MsgIBCSoftwareUpgrade struct { Plan types1.Plan `protobuf:"bytes,1,opt,name=plan,proto3" json:"plan"` // An UpgradedClientState must be provided to perform an IBC breaking upgrade. @@ -553,7 +553,7 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo -// MsgRecoverClient defines the sdk.Msg type to recover a client. +// MsgRecoverClient defines the message used to recover a frozen or expired client. type MsgRecoverClient struct { // the client identifier for the client to be updated if the proposal passes SubjectClientId string `protobuf:"bytes,1,opt,name=subject_client_id,json=subjectClientId,proto3" json:"subject_client_id,omitempty"` From 6569ac9eace4d2ff8b40df0e04c045f24a768194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Colin=20Axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Mon, 11 Sep 2023 15:41:12 +0200 Subject: [PATCH 27/34] chore: update compiler assertion --- modules/apps/27-interchain-accounts/module.go | 2 +- modules/apps/transfer/module.go | 2 +- modules/core/module.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/apps/27-interchain-accounts/module.go b/modules/apps/27-interchain-accounts/module.go index 338f6c2c3d8..e7a9b45c384 100644 --- a/modules/apps/27-interchain-accounts/module.go +++ b/modules/apps/27-interchain-accounts/module.go @@ -36,7 +36,7 @@ var ( _ module.AppModule = (*AppModule)(nil) _ module.AppModuleBasic = (*AppModuleBasic)(nil) _ module.AppModuleSimulation = (*AppModule)(nil) - _ module.HasProposalMsgs = AppModule{} + _ module.HasProposalMsgs = (*AppModule)(nil) _ appmodule.AppModule = (*AppModule)(nil) _ porttypes.IBCModule = (*host.IBCModule)(nil) diff --git a/modules/apps/transfer/module.go b/modules/apps/transfer/module.go index 3f437dc648b..6fb6aa6b70d 100644 --- a/modules/apps/transfer/module.go +++ b/modules/apps/transfer/module.go @@ -29,7 +29,7 @@ import ( var ( _ module.AppModule = (*AppModule)(nil) _ module.AppModuleBasic = (*AppModuleBasic)(nil) - _ module.HasProposalMsgs = AppModule{} + _ module.HasProposalMsgs = (*AppModule)(nil) _ appmodule.AppModule = (*AppModule)(nil) _ porttypes.IBCModule = (*IBCModule)(nil) ) diff --git a/modules/core/module.go b/modules/core/module.go index 0383d41dae9..a90d6c30fe4 100644 --- a/modules/core/module.go +++ b/modules/core/module.go @@ -36,7 +36,7 @@ var ( _ module.AppModule = (*AppModule)(nil) _ module.AppModuleBasic = (*AppModuleBasic)(nil) _ module.AppModuleSimulation = (*AppModule)(nil) - _ module.HasProposalMsgs = AppModule{} + _ module.HasProposalMsgs = (*AppModule)(nil) _ appmodule.HasBeginBlocker = (*AppModule)(nil) _ appmodule.AppModule = (*AppModule)(nil) ) From 2cd4fe701c01401fb8290f203d514a75921d7a24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Colin=20Axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Mon, 11 Sep 2023 16:01:58 +0200 Subject: [PATCH 28/34] refactor: ordering, order as follows: create, update, upgrade, misbheaviour, recover, ibcsoftwareupgrade, update params --- modules/core/02-client/keeper/events.go | 30 +- modules/core/02-client/types/codec.go | 4 +- modules/core/02-client/types/events.go | 4 +- modules/core/02-client/types/msgs.go | 72 +- modules/core/02-client/types/msgs_test.go | 132 +-- modules/core/02-client/types/tx.pb.go | 956 +++++++++++----------- modules/core/keeper/msg_server.go | 38 +- modules/core/keeper/msg_server_test.go | 102 +-- proto/ibc/core/client/v1/tx.proto | 88 +- 9 files changed, 713 insertions(+), 713 deletions(-) diff --git a/modules/core/02-client/keeper/events.go b/modules/core/02-client/keeper/events.go index 5c7561b457b..cc35c66c3d2 100644 --- a/modules/core/02-client/keeper/events.go +++ b/modules/core/02-client/keeper/events.go @@ -82,6 +82,21 @@ func emitUpgradeClientEvent(ctx sdk.Context, clientID string, clientState export }) } +// emitSubmitMisbehaviourEvent emits a client misbehaviour event +func emitSubmitMisbehaviourEvent(ctx sdk.Context, clientID string, clientState exported.ClientState) { + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeSubmitMisbehaviour, + sdk.NewAttribute(types.AttributeKeyClientID, clientID), + sdk.NewAttribute(types.AttributeKeyClientType, clientState.ClientType()), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + ), + }) +} + // emitRecoverClientEvent emits a recover client event func emitRecoverClientEvent(ctx sdk.Context, clientID, clientType string) { ctx.EventManager().EmitEvents(sdk.Events{ @@ -114,21 +129,6 @@ func emitScheduleIBCSoftwareUpgradeEvent(ctx sdk.Context, title string, height i }) } -// emitSubmitMisbehaviourEvent emits a client misbehaviour event -func emitSubmitMisbehaviourEvent(ctx sdk.Context, clientID string, clientState exported.ClientState) { - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeSubmitMisbehaviour, - sdk.NewAttribute(types.AttributeKeyClientID, clientID), - sdk.NewAttribute(types.AttributeKeyClientType, clientState.ClientType()), - ), - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - ), - }) -} - // EmitUpgradeChainEvent emits an upgrade chain event. func EmitUpgradeChainEvent(ctx sdk.Context, height int64) { ctx.EventManager().EmitEvents(sdk.Events{ diff --git a/modules/core/02-client/types/codec.go b/modules/core/02-client/types/codec.go index 918084aa028..f115fa39ea7 100644 --- a/modules/core/02-client/types/codec.go +++ b/modules/core/02-client/types/codec.go @@ -42,9 +42,9 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { &MsgUpdateClient{}, &MsgUpgradeClient{}, &MsgSubmitMisbehaviour{}, - &MsgUpdateParams{}, - &MsgIBCSoftwareUpgrade{}, &MsgRecoverClient{}, + &MsgIBCSoftwareUpgrade{}, + &MsgUpdateParams{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/modules/core/02-client/types/events.go b/modules/core/02-client/types/events.go index fc8c1506882..f729106e01c 100644 --- a/modules/core/02-client/types/events.go +++ b/modules/core/02-client/types/events.go @@ -25,9 +25,9 @@ var ( EventTypeUpdateClient = "update_client" EventTypeUpgradeClient = "upgrade_client" EventTypeSubmitMisbehaviour = "client_misbehaviour" - EventTypeUpgradeChain = "upgrade_chain" - EventTypeScheduleIBCSoftwareUpgrade = "schedule_ibc_software_upgrade" EventTypeRecoverClient = "recover_client" + EventTypeScheduleIBCSoftwareUpgrade = "schedule_ibc_software_upgrade" + EventTypeUpgradeChain = "upgrade_chain" AttributeValueCategory = fmt.Sprintf("%s_%s", ibcexported.ModuleName, SubModuleName) ) diff --git a/modules/core/02-client/types/msgs.go b/modules/core/02-client/types/msgs.go index 118f3f252ad..8eda74107b9 100644 --- a/modules/core/02-client/types/msgs.go +++ b/modules/core/02-client/types/msgs.go @@ -263,16 +263,30 @@ func (msg MsgSubmitMisbehaviour) UnpackInterfaces(unpacker codectypes.AnyUnpacke return unpacker.UnpackAny(msg.Misbehaviour, &misbehaviour) } -// NewMsgUpdateParams creates a new instance of MsgUpdateParams. -func NewMsgUpdateParams(signer string, params Params) *MsgUpdateParams { - return &MsgUpdateParams{ - Signer: signer, - Params: params, +// NewMsgRecoverClient creates a new MsgRecoverClient instance +func NewMsgRecoverClient(signer, subjectClientID, substituteClientID string) *MsgRecoverClient { + return &MsgRecoverClient{ + Signer: signer, + SubjectClientId: subjectClientID, + SubstituteClientId: substituteClientID, } } -// GetSigners returns the expected signers for a MsgUpdateParams message. -func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress { +// 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) @@ -280,14 +294,6 @@ func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{accAddr} } -// ValidateBasic performs basic checks on a MsgUpdateParams. -func (msg *MsgUpdateParams) ValidateBasic() error { - if _, err := sdk.AccAddressFromBech32(msg.Signer); err != nil { - return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "string could not be parsed as address: %v", err) - } - 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) @@ -335,33 +341,27 @@ func (msg *MsgIBCSoftwareUpgrade) UnpackInterfaces(unpacker codectypes.AnyUnpack return unpacker.UnpackAny(msg.UpgradedClientState, new(exported.ClientState)) } -// 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 +// NewMsgUpdateParams creates a new instance of MsgUpdateParams. +func NewMsgUpdateParams(signer string, params Params) *MsgUpdateParams { + return &MsgUpdateParams{ + Signer: signer, + Params: params, } - - return host.ClientIdentifierValidator(msg.SubstituteClientId) } -// GetSigners returns the expected signers for a MsgRecoverClient message. -func (msg *MsgRecoverClient) GetSigners() []sdk.AccAddress { +// GetSigners returns the expected signers for a MsgUpdateParams message. +func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress { accAddr, err := sdk.AccAddressFromBech32(msg.Signer) if err != nil { panic(err) } return []sdk.AccAddress{accAddr} } + +// ValidateBasic performs basic checks on a MsgUpdateParams. +func (msg *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Signer); err != nil { + return errorsmod.Wrapf(ibcerrors.ErrInvalidAddress, "string could not be parsed as address: %v", err) + } + return msg.Params.Validate() +} diff --git a/modules/core/02-client/types/msgs_test.go b/modules/core/02-client/types/msgs_test.go index e3e3d5cf407..003938317df 100644 --- a/modules/core/02-client/types/msgs_test.go +++ b/modules/core/02-client/types/msgs_test.go @@ -621,72 +621,6 @@ func (suite *TypesTestSuite) TestMsgSubmitMisbehaviour_ValidateBasic() { } } -// TestMsgUpdateParamsValidateBasic tests ValidateBasic for MsgUpdateParams -func (suite *TypesTestSuite) TestMsgUpdateParamsValidateBasic() { - signer := suite.chainA.App.GetIBCKeeper().GetAuthority() - testCases := []struct { - name string - msg *types.MsgUpdateParams - expPass bool - }{ - { - "success: valid signer and params", - types.NewMsgUpdateParams(signer, types.DefaultParams()), - true, - }, - { - "success: valid signer empty params", - types.NewMsgUpdateParams(signer, types.Params{}), - true, - }, - { - "failure: invalid signer address", - types.NewMsgUpdateParams("invalid", types.DefaultParams()), - false, - }, - { - "failure: invalid allowed client", - types.NewMsgUpdateParams(signer, types.NewParams("")), - false, - }, - } - - for _, tc := range testCases { - err := tc.msg.ValidateBasic() - if tc.expPass { - suite.Require().NoError(err, "valid case %s failed", tc.name) - } else { - suite.Require().Error(err, "invalid case %s passed", tc.name) - } - } -} - -// TestMsgUpdateParamsGetSigners tests GetSigners for MsgUpdateParams -func TestMsgUpdateParamsGetSigners(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 { - msg := types.MsgUpdateParams{ - Signer: tc.address.String(), - Params: types.DefaultParams(), - } - if tc.expPass { - require.Equal(t, []sdk.AccAddress{tc.address}, msg.GetSigners()) - } else { - require.Panics(t, func() { - msg.GetSigners() - }) - } - } -} - // TestMsgRecoverClientValidateBasic tests ValidateBasic for MsgRecoverClient func (suite *TypesTestSuite) TestMsgRecoverClientValidateBasic() { var msg *types.MsgRecoverClient @@ -951,3 +885,69 @@ func (suite *TypesTestSuite) TestMarshalMsgIBCSoftwareUpgrade() { _, err = types.UnpackClientState(newMsg.UpgradedClientState) suite.Require().NoError(err) } + +// TestMsgUpdateParamsValidateBasic tests ValidateBasic for MsgUpdateParams +func (suite *TypesTestSuite) TestMsgUpdateParamsValidateBasic() { + signer := suite.chainA.App.GetIBCKeeper().GetAuthority() + testCases := []struct { + name string + msg *types.MsgUpdateParams + expPass bool + }{ + { + "success: valid signer and params", + types.NewMsgUpdateParams(signer, types.DefaultParams()), + true, + }, + { + "success: valid signer empty params", + types.NewMsgUpdateParams(signer, types.Params{}), + true, + }, + { + "failure: invalid signer address", + types.NewMsgUpdateParams("invalid", types.DefaultParams()), + false, + }, + { + "failure: invalid allowed client", + types.NewMsgUpdateParams(signer, types.NewParams("")), + false, + }, + } + + for _, tc := range testCases { + err := tc.msg.ValidateBasic() + if tc.expPass { + suite.Require().NoError(err, "valid case %s failed", tc.name) + } else { + suite.Require().Error(err, "invalid case %s passed", tc.name) + } + } +} + +// TestMsgUpdateParamsGetSigners tests GetSigners for MsgUpdateParams +func TestMsgUpdateParamsGetSigners(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 { + msg := types.MsgUpdateParams{ + Signer: tc.address.String(), + Params: types.DefaultParams(), + } + if tc.expPass { + require.Equal(t, []sdk.AccAddress{tc.address}, msg.GetSigners()) + } else { + require.Panics(t, func() { + msg.GetSigners() + }) + } + } +} diff --git a/modules/core/02-client/types/tx.pb.go b/modules/core/02-client/types/tx.pb.go index 6b295c51af4..5362984d537 100644 --- a/modules/core/02-client/types/tx.pb.go +++ b/modules/core/02-client/types/tx.pb.go @@ -281,6 +281,172 @@ func (m *MsgUpgradeClientResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpgradeClientResponse proto.InternalMessageInfo +// MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for +// light client misbehaviour. +// This message has been deprecated. Use MsgUpdateClient instead. +// +// Deprecated: Do not use. +type MsgSubmitMisbehaviour struct { + // client unique identifier + ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + // misbehaviour used for freezing the light client + Misbehaviour *types.Any `protobuf:"bytes,2,opt,name=misbehaviour,proto3" json:"misbehaviour,omitempty"` + // signer address + Signer string `protobuf:"bytes,3,opt,name=signer,proto3" json:"signer,omitempty"` +} + +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} +} +func (m *MsgSubmitMisbehaviour) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitMisbehaviour) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitMisbehaviour.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 *MsgSubmitMisbehaviour) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitMisbehaviour.Merge(m, src) +} +func (m *MsgSubmitMisbehaviour) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitMisbehaviour) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitMisbehaviour.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitMisbehaviour proto.InternalMessageInfo + +// MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response +// type. +type MsgSubmitMisbehaviourResponse struct { +} + +func (m *MsgSubmitMisbehaviourResponse) Reset() { *m = MsgSubmitMisbehaviourResponse{} } +func (m *MsgSubmitMisbehaviourResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitMisbehaviourResponse) ProtoMessage() {} +func (*MsgSubmitMisbehaviourResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_cb5dc4651eb49a04, []int{7} +} +func (m *MsgSubmitMisbehaviourResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitMisbehaviourResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitMisbehaviourResponse.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 *MsgSubmitMisbehaviourResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitMisbehaviourResponse.Merge(m, src) +} +func (m *MsgSubmitMisbehaviourResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitMisbehaviourResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitMisbehaviourResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitMisbehaviourResponse proto.InternalMessageInfo + +// MsgRecoverClient defines the message used to recover a frozen or expired client. +type MsgRecoverClient struct { + // the client identifier for the client to be updated if the proposal passes + SubjectClientId string `protobuf:"bytes,1,opt,name=subject_client_id,json=subjectClientId,proto3" json:"subject_client_id,omitempty"` + // the substitute client identifier for the client which will replace the subject + // client + SubstituteClientId string `protobuf:"bytes,2,opt,name=substitute_client_id,json=substituteClientId,proto3" json:"substitute_client_id,omitempty"` + // signer address (it may be the the address that controls the module, which defaults to x/gov unless overwritten). + Signer string `protobuf:"bytes,3,opt,name=signer,proto3" json:"signer,omitempty"` +} + +func (m *MsgRecoverClient) Reset() { *m = MsgRecoverClient{} } +func (m *MsgRecoverClient) String() string { return proto.CompactTextString(m) } +func (*MsgRecoverClient) ProtoMessage() {} +func (*MsgRecoverClient) Descriptor() ([]byte, []int) { + return fileDescriptor_cb5dc4651eb49a04, []int{8} +} +func (m *MsgRecoverClient) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRecoverClient) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRecoverClient.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 *MsgRecoverClient) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRecoverClient.Merge(m, src) +} +func (m *MsgRecoverClient) XXX_Size() int { + return m.Size() +} +func (m *MsgRecoverClient) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRecoverClient.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRecoverClient proto.InternalMessageInfo + +// MsgRecoverClientResponse defines the MsgRecoverClient response type. +type MsgRecoverClientResponse struct { +} + +func (m *MsgRecoverClientResponse) Reset() { *m = MsgRecoverClientResponse{} } +func (m *MsgRecoverClientResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRecoverClientResponse) ProtoMessage() {} +func (*MsgRecoverClientResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_cb5dc4651eb49a04, []int{9} +} +func (m *MsgRecoverClientResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRecoverClientResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRecoverClientResponse.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 *MsgRecoverClientResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRecoverClientResponse.Merge(m, src) +} +func (m *MsgRecoverClientResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRecoverClientResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRecoverClientResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRecoverClientResponse proto.InternalMessageInfo + // MsgIBCSoftwareUpgrade defines the message used to schedule an upgrade of an IBC client using a v1 governance proposal type MsgIBCSoftwareUpgrade struct { Plan types1.Plan `protobuf:"bytes,1,opt,name=plan,proto3" json:"plan"` @@ -301,7 +467,7 @@ 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} + return fileDescriptor_cb5dc4651eb49a04, []int{10} } func (m *MsgIBCSoftwareUpgrade) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -359,7 +525,7 @@ func (m *MsgIBCSoftwareUpgradeResponse) Reset() { *m = MsgIBCSoftwareUpg func (m *MsgIBCSoftwareUpgradeResponse) String() string { return proto.CompactTextString(m) } func (*MsgIBCSoftwareUpgradeResponse) ProtoMessage() {} func (*MsgIBCSoftwareUpgradeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_cb5dc4651eb49a04, []int{7} + return fileDescriptor_cb5dc4651eb49a04, []int{11} } func (m *MsgIBCSoftwareUpgradeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -388,91 +554,6 @@ func (m *MsgIBCSoftwareUpgradeResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgIBCSoftwareUpgradeResponse proto.InternalMessageInfo -// MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for -// light client misbehaviour. -// This message has been deprecated. Use MsgUpdateClient instead. -// -// Deprecated: Do not use. -type MsgSubmitMisbehaviour struct { - // client unique identifier - ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` - // misbehaviour used for freezing the light client - Misbehaviour *types.Any `protobuf:"bytes,2,opt,name=misbehaviour,proto3" json:"misbehaviour,omitempty"` - // signer address - Signer string `protobuf:"bytes,3,opt,name=signer,proto3" json:"signer,omitempty"` -} - -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{8} -} -func (m *MsgSubmitMisbehaviour) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSubmitMisbehaviour) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSubmitMisbehaviour.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 *MsgSubmitMisbehaviour) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSubmitMisbehaviour.Merge(m, src) -} -func (m *MsgSubmitMisbehaviour) XXX_Size() int { - return m.Size() -} -func (m *MsgSubmitMisbehaviour) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSubmitMisbehaviour.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSubmitMisbehaviour proto.InternalMessageInfo - -// MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response -// type. -type MsgSubmitMisbehaviourResponse struct { -} - -func (m *MsgSubmitMisbehaviourResponse) Reset() { *m = MsgSubmitMisbehaviourResponse{} } -func (m *MsgSubmitMisbehaviourResponse) String() string { return proto.CompactTextString(m) } -func (*MsgSubmitMisbehaviourResponse) ProtoMessage() {} -func (*MsgSubmitMisbehaviourResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_cb5dc4651eb49a04, []int{9} -} -func (m *MsgSubmitMisbehaviourResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSubmitMisbehaviourResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSubmitMisbehaviourResponse.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 *MsgSubmitMisbehaviourResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSubmitMisbehaviourResponse.Merge(m, src) -} -func (m *MsgSubmitMisbehaviourResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgSubmitMisbehaviourResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSubmitMisbehaviourResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSubmitMisbehaviourResponse proto.InternalMessageInfo - // MsgUpdateParams defines the sdk.Msg type to update the client parameters. type MsgUpdateParams struct { // signer address (it may be the the address that controls the module, which defaults to x/gov unless overwritten). @@ -487,7 +568,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{10} + return fileDescriptor_cb5dc4651eb49a04, []int{12} } func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -524,7 +605,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{11} + return fileDescriptor_cb5dc4651eb49a04, []int{13} } func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -551,88 +632,7 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo - -// MsgRecoverClient defines the message used to recover a frozen or expired client. -type MsgRecoverClient struct { - // the client identifier for the client to be updated if the proposal passes - SubjectClientId string `protobuf:"bytes,1,opt,name=subject_client_id,json=subjectClientId,proto3" json:"subject_client_id,omitempty"` - // the substitute client identifier for the client which will replace the subject - // client - SubstituteClientId string `protobuf:"bytes,2,opt,name=substitute_client_id,json=substituteClientId,proto3" json:"substitute_client_id,omitempty"` - // signer address (it may be the the address that controls the module, which defaults to x/gov unless overwritten). - Signer string `protobuf:"bytes,3,opt,name=signer,proto3" json:"signer,omitempty"` -} - -func (m *MsgRecoverClient) Reset() { *m = MsgRecoverClient{} } -func (m *MsgRecoverClient) String() string { return proto.CompactTextString(m) } -func (*MsgRecoverClient) ProtoMessage() {} -func (*MsgRecoverClient) Descriptor() ([]byte, []int) { - return fileDescriptor_cb5dc4651eb49a04, []int{12} -} -func (m *MsgRecoverClient) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgRecoverClient) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgRecoverClient.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 *MsgRecoverClient) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRecoverClient.Merge(m, src) -} -func (m *MsgRecoverClient) XXX_Size() int { - return m.Size() -} -func (m *MsgRecoverClient) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRecoverClient.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgRecoverClient proto.InternalMessageInfo - -// MsgRecoverClientResponse defines the MsgRecoverClient response type. -type MsgRecoverClientResponse struct { -} - -func (m *MsgRecoverClientResponse) Reset() { *m = MsgRecoverClientResponse{} } -func (m *MsgRecoverClientResponse) String() string { return proto.CompactTextString(m) } -func (*MsgRecoverClientResponse) ProtoMessage() {} -func (*MsgRecoverClientResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_cb5dc4651eb49a04, []int{13} -} -func (m *MsgRecoverClientResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgRecoverClientResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgRecoverClientResponse.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 *MsgRecoverClientResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRecoverClientResponse.Merge(m, src) -} -func (m *MsgRecoverClientResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgRecoverClientResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRecoverClientResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgRecoverClientResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo func init() { proto.RegisterType((*MsgCreateClient)(nil), "ibc.core.client.v1.MsgCreateClient") @@ -641,71 +641,71 @@ 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((*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") - proto.RegisterType((*MsgUpdateParamsResponse)(nil), "ibc.core.client.v1.MsgUpdateParamsResponse") proto.RegisterType((*MsgRecoverClient)(nil), "ibc.core.client.v1.MsgRecoverClient") proto.RegisterType((*MsgRecoverClientResponse)(nil), "ibc.core.client.v1.MsgRecoverClientResponse") + proto.RegisterType((*MsgIBCSoftwareUpgrade)(nil), "ibc.core.client.v1.MsgIBCSoftwareUpgrade") + proto.RegisterType((*MsgIBCSoftwareUpgradeResponse)(nil), "ibc.core.client.v1.MsgIBCSoftwareUpgradeResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "ibc.core.client.v1.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "ibc.core.client.v1.MsgUpdateParamsResponse") } func init() { proto.RegisterFile("ibc/core/client/v1/tx.proto", fileDescriptor_cb5dc4651eb49a04) } var fileDescriptor_cb5dc4651eb49a04 = []byte{ - // 808 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x96, 0xbf, 0x4f, 0xdb, 0x4c, - 0x18, 0xc7, 0xe3, 0x00, 0xd1, 0xcb, 0x11, 0xc8, 0xcb, 0xbd, 0xe1, 0x25, 0x98, 0x97, 0x04, 0xf1, - 0x32, 0x50, 0x5a, 0x6c, 0x42, 0xa5, 0x36, 0x6a, 0xd5, 0x01, 0xb2, 0x94, 0x21, 0x12, 0x32, 0xea, - 0xd2, 0x25, 0xb5, 0x9d, 0xcb, 0xe1, 0x2a, 0xf6, 0x59, 0xbe, 0x73, 0x5a, 0xb6, 0xaa, 0x53, 0xc7, - 0x0e, 0x5d, 0xba, 0xf5, 0x4f, 0x40, 0xfd, 0x03, 0xba, 0x55, 0x62, 0x64, 0xec, 0x54, 0x55, 0x30, - 0x20, 0xf5, 0xaf, 0xa8, 0xec, 0xbb, 0x04, 0xdb, 0x89, 0xdd, 0xa0, 0x6e, 0xb6, 0x9f, 0xcf, 0x73, - 0xcf, 0xf7, 0x9e, 0x5f, 0x32, 0x58, 0xb5, 0x0c, 0x53, 0x35, 0x89, 0x87, 0x54, 0xb3, 0x67, 0x21, - 0x87, 0xa9, 0xfd, 0xba, 0xca, 0x5e, 0x2b, 0xae, 0x47, 0x18, 0x81, 0xd0, 0x32, 0x4c, 0x25, 0x30, - 0x2a, 0xdc, 0xa8, 0xf4, 0xeb, 0xf2, 0xb2, 0x49, 0xa8, 0x4d, 0xa8, 0x6a, 0x53, 0x1c, 0xb0, 0x36, - 0xc5, 0x1c, 0x96, 0x37, 0x85, 0xc1, 0x77, 0xb1, 0xa7, 0x77, 0x90, 0xda, 0xaf, 0x1b, 0x88, 0xe9, - 0xf5, 0xc1, 0xbb, 0xa0, 0xca, 0x98, 0x60, 0x12, 0x3e, 0xaa, 0xc1, 0x93, 0xf8, 0xba, 0x82, 0x09, - 0xc1, 0x3d, 0xa4, 0x86, 0x6f, 0x86, 0xdf, 0x55, 0x75, 0xe7, 0x54, 0x98, 0x6a, 0x63, 0x04, 0x0a, - 0x35, 0x21, 0xb0, 0xf1, 0x59, 0x02, 0xa5, 0x16, 0xc5, 0x4d, 0x0f, 0xe9, 0x0c, 0x35, 0x43, 0x0b, - 0x7c, 0x08, 0x8a, 0x9c, 0x69, 0x53, 0xa6, 0x33, 0x54, 0x91, 0xd6, 0xa5, 0xad, 0xb9, 0xbd, 0xb2, - 0xc2, 0xc3, 0x28, 0x83, 0x30, 0xca, 0xbe, 0x73, 0xaa, 0xcd, 0x71, 0xf2, 0x38, 0x00, 0xe1, 0x13, - 0x50, 0x32, 0x89, 0x43, 0x91, 0x43, 0x7d, 0x2a, 0x7c, 0xf3, 0x19, 0xbe, 0x0b, 0x43, 0x98, 0xbb, - 0xff, 0x0b, 0x0a, 0xd4, 0xc2, 0x0e, 0xf2, 0x2a, 0x53, 0xeb, 0xd2, 0xd6, 0xac, 0x26, 0xde, 0x1e, - 0x95, 0xde, 0x7d, 0xaa, 0xe5, 0xde, 0x5e, 0x9f, 0x6d, 0x8b, 0x0f, 0x1b, 0x2b, 0x60, 0x39, 0xa1, - 0x59, 0x43, 0xd4, 0x0d, 0x0e, 0xdb, 0xf8, 0xc0, 0xef, 0xf3, 0xcc, 0xed, 0xdc, 0xdc, 0x67, 0x15, - 0xcc, 0x8a, 0xfb, 0x58, 0x9d, 0xf0, 0x32, 0xb3, 0xda, 0x5f, 0xfc, 0xc3, 0x61, 0x07, 0x3e, 0x06, - 0x0b, 0xc2, 0x68, 0x23, 0x4a, 0x75, 0x9c, 0x2d, 0x79, 0x9e, 0xb3, 0x2d, 0x8e, 0xde, 0x56, 0x71, - 0x54, 0xd5, 0x50, 0xf1, 0xd7, 0x3c, 0xf8, 0x3b, 0xb4, 0x85, 0x85, 0x9e, 0x44, 0x72, 0xb2, 0x3e, - 0xf9, 0x3f, 0xa8, 0xcf, 0xd4, 0x2d, 0xea, 0xb3, 0x0b, 0xca, 0xae, 0x47, 0x48, 0xb7, 0x2d, 0x9a, - 0xb2, 0xcd, 0xcf, 0xae, 0x4c, 0xaf, 0x4b, 0x5b, 0x45, 0x0d, 0x86, 0xb6, 0xf8, 0x35, 0xf6, 0xc1, - 0x5a, 0xc2, 0x23, 0x11, 0x7e, 0x26, 0x74, 0x95, 0x63, 0xae, 0x69, 0x4d, 0x51, 0xc8, 0x4e, 0xb1, - 0x0c, 0x2a, 0xc9, 0x34, 0x0e, 0x73, 0xfc, 0x45, 0x02, 0x4b, 0x2d, 0x8a, 0x0f, 0x0f, 0x9a, 0xc7, - 0xa4, 0xcb, 0x5e, 0xe9, 0x1e, 0x12, 0x1c, 0x7c, 0x00, 0xa6, 0xdd, 0x9e, 0xee, 0x88, 0x1e, 0xff, - 0x4f, 0xe1, 0x63, 0xa8, 0x0c, 0xc6, 0x4e, 0x8c, 0xa1, 0x72, 0xd4, 0xd3, 0x9d, 0x83, 0xe9, 0xf3, - 0xef, 0xb5, 0x9c, 0x16, 0xf2, 0xf0, 0x29, 0x58, 0x12, 0x4c, 0xa7, 0x3d, 0x71, 0x31, 0xfe, 0x19, - 0xb8, 0x34, 0x23, 0x45, 0x49, 0xeb, 0xa1, 0xb9, 0xe8, 0xe5, 0x6a, 0x60, 0x6d, 0xac, 0xfe, 0xe1, - 0x0d, 0x3f, 0xf2, 0x1b, 0x1e, 0xfb, 0x86, 0x6d, 0xb1, 0x96, 0x45, 0x0d, 0x74, 0xa2, 0xf7, 0x2d, - 0xe2, 0x7b, 0xd9, 0xad, 0xd4, 0x00, 0x45, 0x3b, 0x02, 0x67, 0xaa, 0x8f, 0x91, 0xa9, 0xb2, 0x17, - 0x13, 0x75, 0xa9, 0x48, 0x42, 0xfc, 0xa8, 0xb4, 0xa1, 0x78, 0x16, 0x99, 0xd9, 0x23, 0xdd, 0xd3, - 0x6d, 0x1a, 0x39, 0x5e, 0x8a, 0x1e, 0x0f, 0x1b, 0xa0, 0xe0, 0x86, 0x84, 0x90, 0x2a, 0x2b, 0xa3, - 0x5b, 0x56, 0xe1, 0x67, 0x88, 0x7a, 0x09, 0x3e, 0x7b, 0x26, 0xb9, 0x47, 0x34, 0x9b, 0xc1, 0x4c, - 0x6a, 0xc8, 0x24, 0x7d, 0xe4, 0x89, 0x66, 0xde, 0x06, 0x8b, 0xd4, 0x37, 0x5e, 0x22, 0x93, 0xb5, - 0x93, 0x09, 0x2d, 0x09, 0x43, 0x73, 0x90, 0xd7, 0x5d, 0x50, 0xa6, 0xbe, 0x41, 0x99, 0xc5, 0x7c, - 0x86, 0x22, 0x78, 0x3e, 0xc4, 0xe1, 0x8d, 0x6d, 0xe8, 0x31, 0xf1, 0x2a, 0xe1, 0x7d, 0x1e, 0x93, - 0x36, 0xd0, 0xbd, 0xf7, 0x73, 0x06, 0x4c, 0xb5, 0x28, 0x86, 0x2f, 0x40, 0x31, 0xb6, 0xd1, 0xff, - 0x1f, 0x97, 0xa5, 0xc4, 0x0a, 0x95, 0xef, 0x4e, 0x00, 0x0d, 0x22, 0x05, 0x11, 0x62, 0x3b, 0x36, - 0x2d, 0x42, 0x14, 0x4a, 0x8d, 0x30, 0x6e, 0x2f, 0x42, 0x13, 0xcc, 0xc7, 0x97, 0xc9, 0x66, 0xaa, - 0x77, 0x84, 0x92, 0xef, 0x4d, 0x42, 0x0d, 0x83, 0x78, 0x00, 0x8e, 0x59, 0x0a, 0x77, 0x52, 0xce, - 0x18, 0x45, 0xe5, 0xfa, 0xc4, 0x68, 0x34, 0xe6, 0x98, 0x31, 0x4d, 0x8b, 0x39, 0x8a, 0xa6, 0xc6, - 0x4c, 0x9f, 0x30, 0xd8, 0x05, 0x30, 0x9a, 0x64, 0x31, 0x64, 0xd9, 0x45, 0xe3, 0xd0, 0x6f, 0x8a, - 0x16, 0x1f, 0x9c, 0xa0, 0x68, 0xf1, 0xa1, 0x49, 0x2b, 0x5a, 0x8c, 0x4a, 0x2d, 0xda, 0xd8, 0x2e, - 0x97, 0x67, 0xde, 0x5c, 0x9f, 0x6d, 0x4b, 0x07, 0xda, 0xf9, 0x65, 0x55, 0xba, 0xb8, 0xac, 0x4a, - 0x3f, 0x2e, 0xab, 0xd2, 0xfb, 0xab, 0x6a, 0xee, 0xe2, 0xaa, 0x9a, 0xfb, 0x76, 0x55, 0xcd, 0x3d, - 0x6f, 0x60, 0x8b, 0x9d, 0xf8, 0x86, 0x62, 0x12, 0x5b, 0x15, 0xff, 0x55, 0x96, 0x61, 0xee, 0x60, - 0xa2, 0xf6, 0x1b, 0xaa, 0x4d, 0x3a, 0x7e, 0x0f, 0x51, 0xfe, 0x57, 0xb4, 0xbb, 0xb7, 0x23, 0x7e, - 0x8c, 0xd8, 0xa9, 0x8b, 0xa8, 0x51, 0x08, 0x37, 0xde, 0xfd, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, - 0x27, 0x6c, 0x19, 0x45, 0xd9, 0x09, 0x00, 0x00, + // 809 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xb1, 0x6f, 0xd3, 0x4e, + 0x14, 0x8e, 0xd3, 0x36, 0xfa, 0xf5, 0x9a, 0x36, 0xbf, 0x1e, 0x29, 0x4d, 0x5d, 0x9a, 0x54, 0xa1, + 0x43, 0x29, 0xd4, 0x6e, 0x8a, 0x04, 0x11, 0x88, 0xa1, 0xcd, 0x42, 0x87, 0x48, 0x95, 0x2b, 0x16, + 0x96, 0x60, 0x3b, 0x97, 0xab, 0x51, 0xec, 0xb3, 0x7c, 0xe7, 0x40, 0x37, 0xc4, 0xc4, 0xc8, 0xc0, + 0xc2, 0xc6, 0x9f, 0x50, 0xf1, 0x07, 0xb0, 0x21, 0x75, 0xec, 0xc8, 0x84, 0x50, 0x3b, 0x54, 0xe2, + 0xaf, 0x40, 0xf6, 0x5d, 0x52, 0xdb, 0x89, 0x43, 0x2a, 0xb6, 0xd8, 0xef, 0x7b, 0xf7, 0xbe, 0xef, + 0xdd, 0x7b, 0x5f, 0x0c, 0x56, 0x2d, 0xc3, 0x54, 0x4d, 0xe2, 0x21, 0xd5, 0xec, 0x5a, 0xc8, 0x61, + 0x6a, 0xaf, 0xa6, 0xb2, 0xb7, 0x8a, 0xeb, 0x11, 0x46, 0x20, 0xb4, 0x0c, 0x53, 0x09, 0x82, 0x0a, + 0x0f, 0x2a, 0xbd, 0x9a, 0xbc, 0x6c, 0x12, 0x6a, 0x13, 0xaa, 0xda, 0x14, 0x07, 0x58, 0x9b, 0x62, + 0x0e, 0x96, 0x37, 0x44, 0xc0, 0x77, 0xb1, 0xa7, 0xb7, 0x91, 0xda, 0xab, 0x19, 0x88, 0xe9, 0xb5, + 0xfe, 0xb3, 0x40, 0x15, 0x31, 0xc1, 0x24, 0xfc, 0xa9, 0x06, 0xbf, 0xc4, 0xdb, 0x15, 0x4c, 0x08, + 0xee, 0x22, 0x35, 0x7c, 0x32, 0xfc, 0x8e, 0xaa, 0x3b, 0x27, 0x22, 0x54, 0x19, 0x41, 0x50, 0xb0, + 0x09, 0x01, 0xd5, 0xaf, 0x12, 0x28, 0x34, 0x29, 0x6e, 0x78, 0x48, 0x67, 0xa8, 0x11, 0x46, 0xe0, + 0x63, 0x90, 0xe7, 0x98, 0x16, 0x65, 0x3a, 0x43, 0x25, 0x69, 0x5d, 0xda, 0x9c, 0xdb, 0x2d, 0x2a, + 0xbc, 0x8c, 0xd2, 0x2f, 0xa3, 0xec, 0x39, 0x27, 0xda, 0x1c, 0x47, 0x1e, 0x05, 0x40, 0xf8, 0x0c, + 0x14, 0x4c, 0xe2, 0x50, 0xe4, 0x50, 0x9f, 0x8a, 0xdc, 0xec, 0x98, 0xdc, 0x85, 0x01, 0x98, 0xa7, + 0xdf, 0x06, 0x39, 0x6a, 0x61, 0x07, 0x79, 0xa5, 0xa9, 0x75, 0x69, 0x73, 0x56, 0x13, 0x4f, 0x4f, + 0x0a, 0x1f, 0xbe, 0x54, 0x32, 0xef, 0xaf, 0x4e, 0xb7, 0xc4, 0x8b, 0xea, 0x0a, 0x58, 0x4e, 0x70, + 0xd6, 0x10, 0x75, 0x83, 0xc3, 0xaa, 0x9f, 0xb8, 0x9e, 0x17, 0x6e, 0xfb, 0x5a, 0xcf, 0x2a, 0x98, + 0x15, 0x7a, 0xac, 0x76, 0x28, 0x66, 0x56, 0xfb, 0x8f, 0xbf, 0x38, 0x68, 0xc3, 0xa7, 0x60, 0x41, + 0x04, 0x6d, 0x44, 0xa9, 0x8e, 0xc7, 0x53, 0x9e, 0xe7, 0xd8, 0x26, 0x87, 0xde, 0x94, 0x71, 0x94, + 0xd5, 0x80, 0xf1, 0xf7, 0x2c, 0xf8, 0x3f, 0x8c, 0x85, 0x17, 0x3d, 0x09, 0xe5, 0xe4, 0xfd, 0x64, + 0xff, 0xe1, 0x7e, 0xa6, 0x6e, 0x70, 0x3f, 0x3b, 0xa0, 0xe8, 0x7a, 0x84, 0x74, 0x5a, 0x62, 0x28, + 0x5b, 0xfc, 0xec, 0xd2, 0xf4, 0xba, 0xb4, 0x99, 0xd7, 0x60, 0x18, 0x8b, 0xcb, 0xd8, 0x03, 0x6b, + 0x89, 0x8c, 0x44, 0xf9, 0x99, 0x30, 0x55, 0x8e, 0xa5, 0xa6, 0x0d, 0x45, 0x6e, 0x7c, 0x8b, 0x65, + 0x50, 0x4a, 0xb6, 0x71, 0xd0, 0xe3, 0xcf, 0x12, 0x58, 0x6a, 0x52, 0x7c, 0xe4, 0x1b, 0xb6, 0xc5, + 0x9a, 0x16, 0x35, 0xd0, 0xb1, 0xde, 0xb3, 0x88, 0xef, 0x8d, 0x6f, 0x74, 0x1d, 0xe4, 0xed, 0x08, + 0x78, 0x6c, 0xa3, 0x63, 0xc8, 0xd4, 0xc1, 0x58, 0x4c, 0xb0, 0x2e, 0x49, 0xd5, 0x0a, 0x58, 0x1b, + 0x49, 0x2d, 0x4a, 0x3e, 0x18, 0x10, 0x0d, 0x99, 0xa4, 0x87, 0x3c, 0xd1, 0xd9, 0x2d, 0xb0, 0x48, + 0x7d, 0xe3, 0x35, 0x32, 0x59, 0x2b, 0xc9, 0xbf, 0x20, 0x02, 0x8d, 0xbe, 0x8c, 0x1d, 0x50, 0xa4, + 0xbe, 0x41, 0x99, 0xc5, 0x7c, 0x86, 0x22, 0xf0, 0x6c, 0x08, 0x87, 0xd7, 0xb1, 0x41, 0xc6, 0xc4, + 0x73, 0xcd, 0x9b, 0x1e, 0xa3, 0x36, 0xe0, 0xfd, 0x8d, 0x37, 0xfd, 0x60, 0xbf, 0x71, 0x44, 0x3a, + 0xec, 0x8d, 0xee, 0x21, 0x71, 0x39, 0xf0, 0x11, 0x98, 0x76, 0xbb, 0xba, 0x23, 0x8c, 0xe5, 0x8e, + 0xc2, 0xbd, 0x4f, 0xe9, 0x7b, 0x9d, 0xf0, 0x3e, 0xe5, 0xb0, 0xab, 0x3b, 0xfb, 0xd3, 0x67, 0x3f, + 0x2b, 0x19, 0x2d, 0xc4, 0xc3, 0xe7, 0x60, 0x49, 0x60, 0xda, 0xad, 0x89, 0x37, 0xe0, 0x56, 0x3f, + 0xa5, 0x11, 0xd9, 0x84, 0x34, 0x81, 0x73, 0x51, 0x71, 0xfc, 0x66, 0x86, 0xf9, 0x0f, 0x14, 0xb2, + 0x88, 0xd7, 0x1c, 0xea, 0x9e, 0x6e, 0xd3, 0xc8, 0xc1, 0x52, 0xf4, 0x60, 0x58, 0x07, 0x39, 0x37, + 0x44, 0x08, 0xae, 0xb2, 0x32, 0xfc, 0xef, 0xa0, 0xf0, 0x33, 0x84, 0x64, 0x81, 0x1f, 0xef, 0x25, + 0x3c, 0xa3, 0x4f, 0x68, 0xf7, 0xf7, 0x0c, 0x98, 0x6a, 0x52, 0x0c, 0x5f, 0x81, 0x7c, 0xcc, 0xd1, + 0xef, 0x8e, 0xaa, 0x96, 0xb0, 0x50, 0xf9, 0xfe, 0x04, 0xa0, 0x7e, 0xa5, 0xa0, 0x42, 0xcc, 0x63, + 0xd3, 0x2a, 0x44, 0x41, 0xa9, 0x15, 0x46, 0xf9, 0x22, 0x34, 0xc1, 0x7c, 0xdc, 0x4c, 0x36, 0x52, + 0xb3, 0x23, 0x28, 0xf9, 0xc1, 0x24, 0xa8, 0x41, 0x11, 0x0f, 0xc0, 0x11, 0xa6, 0x70, 0x2f, 0xe5, + 0x8c, 0x61, 0xa8, 0x5c, 0x9b, 0x18, 0x1a, 0x15, 0x16, 0xdf, 0xe5, 0x34, 0x61, 0x31, 0x54, 0xaa, + 0xb0, 0x91, 0xcb, 0x17, 0x08, 0x1b, 0xb1, 0x78, 0x69, 0xc2, 0x86, 0xa1, 0xa9, 0xc2, 0xd2, 0xd7, + 0x01, 0x76, 0x00, 0x8c, 0xde, 0xa4, 0xd8, 0x88, 0xf1, 0x93, 0xc1, 0x41, 0x7f, 0x99, 0x8c, 0xf8, + 0x94, 0xcb, 0x33, 0xef, 0xae, 0x4e, 0xb7, 0xa4, 0x7d, 0xed, 0xec, 0xa2, 0x2c, 0x9d, 0x5f, 0x94, + 0xa5, 0x5f, 0x17, 0x65, 0xe9, 0xe3, 0x65, 0x39, 0x73, 0x7e, 0x59, 0xce, 0xfc, 0xb8, 0x2c, 0x67, + 0x5e, 0xd6, 0xb1, 0xc5, 0x8e, 0x7d, 0x43, 0x31, 0x89, 0xad, 0x8a, 0xef, 0x2a, 0xcb, 0x30, 0xb7, + 0x31, 0x51, 0x7b, 0x75, 0xd5, 0x26, 0x6d, 0xbf, 0x8b, 0x28, 0xff, 0x2a, 0xda, 0xd9, 0xdd, 0x16, + 0x1f, 0x46, 0xec, 0xc4, 0x45, 0xd4, 0xc8, 0x85, 0xd6, 0xf1, 0xf0, 0x4f, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xa3, 0x68, 0xc1, 0x10, 0xd9, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -726,14 +726,14 @@ 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) - // 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. - UpdateClientParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) // RecoverClient defines a rpc handler method for MsgRecoverClient. RecoverClient(ctx context.Context, in *MsgRecoverClient, opts ...grpc.CallOption) (*MsgRecoverClientResponse, error) + // IBCSoftwareUpgrade defines a rpc handler method for MsgIBCSoftwareUpgrade. + IBCSoftwareUpgrade(ctx context.Context, in *MsgIBCSoftwareUpgrade, opts ...grpc.CallOption) (*MsgIBCSoftwareUpgradeResponse, error) + // UpdateClientParams defines a rpc handler method for MsgUpdateParams. + UpdateClientParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -771,36 +771,36 @@ func (c *msgClient) UpgradeClient(ctx context.Context, in *MsgUpgradeClient, opt return out, nil } -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...) +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...) 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...) +func (c *msgClient) RecoverClient(ctx context.Context, in *MsgRecoverClient, opts ...grpc.CallOption) (*MsgRecoverClientResponse, error) { + out := new(MsgRecoverClientResponse) + err := c.cc.Invoke(ctx, "/ibc.core.client.v1.Msg/RecoverClient", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *msgClient) UpdateClientParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { - out := new(MsgUpdateParamsResponse) - err := c.cc.Invoke(ctx, "/ibc.core.client.v1.Msg/UpdateClientParams", 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 } return out, nil } -func (c *msgClient) RecoverClient(ctx context.Context, in *MsgRecoverClient, opts ...grpc.CallOption) (*MsgRecoverClientResponse, error) { - out := new(MsgRecoverClientResponse) - err := c.cc.Invoke(ctx, "/ibc.core.client.v1.Msg/RecoverClient", in, out, opts...) +func (c *msgClient) UpdateClientParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/ibc.core.client.v1.Msg/UpdateClientParams", in, out, opts...) if err != nil { return nil, err } @@ -815,14 +815,14 @@ type MsgServer interface { UpdateClient(context.Context, *MsgUpdateClient) (*MsgUpdateClientResponse, error) // UpgradeClient defines a rpc handler method for MsgUpgradeClient. UpgradeClient(context.Context, *MsgUpgradeClient) (*MsgUpgradeClientResponse, 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. - UpdateClientParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) // RecoverClient defines a rpc handler method for MsgRecoverClient. RecoverClient(context.Context, *MsgRecoverClient) (*MsgRecoverClientResponse, error) + // IBCSoftwareUpgrade defines a rpc handler method for MsgIBCSoftwareUpgrade. + IBCSoftwareUpgrade(context.Context, *MsgIBCSoftwareUpgrade) (*MsgIBCSoftwareUpgradeResponse, error) + // UpdateClientParams defines a rpc handler method for MsgUpdateParams. + UpdateClientParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -838,18 +838,18 @@ 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) 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") } -func (*UnimplementedMsgServer) UpdateClientParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateClientParams not implemented") -} func (*UnimplementedMsgServer) RecoverClient(ctx context.Context, req *MsgRecoverClient) (*MsgRecoverClientResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RecoverClient not implemented") } +func (*UnimplementedMsgServer) IBCSoftwareUpgrade(ctx context.Context, req *MsgIBCSoftwareUpgrade) (*MsgIBCSoftwareUpgradeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method IBCSoftwareUpgrade not implemented") +} +func (*UnimplementedMsgServer) UpdateClientParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateClientParams not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -909,74 +909,74 @@ func _Msg_UpgradeClient_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } -func _Msg_IBCSoftwareUpgrade_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgIBCSoftwareUpgrade) +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 { return nil, err } if interceptor == nil { - return srv.(MsgServer).IBCSoftwareUpgrade(ctx, in) + return srv.(MsgServer).SubmitMisbehaviour(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ibc.core.client.v1.Msg/IBCSoftwareUpgrade", + FullMethod: "/ibc.core.client.v1.Msg/SubmitMisbehaviour", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).IBCSoftwareUpgrade(ctx, req.(*MsgIBCSoftwareUpgrade)) + return srv.(MsgServer).SubmitMisbehaviour(ctx, req.(*MsgSubmitMisbehaviour)) } 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) +func _Msg_RecoverClient_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRecoverClient) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).SubmitMisbehaviour(ctx, in) + return srv.(MsgServer).RecoverClient(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ibc.core.client.v1.Msg/SubmitMisbehaviour", + FullMethod: "/ibc.core.client.v1.Msg/RecoverClient", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).SubmitMisbehaviour(ctx, req.(*MsgSubmitMisbehaviour)) + return srv.(MsgServer).RecoverClient(ctx, req.(*MsgRecoverClient)) } return interceptor(ctx, in, info, handler) } -func _Msg_UpdateClientParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUpdateParams) +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).UpdateClientParams(ctx, in) + return srv.(MsgServer).IBCSoftwareUpgrade(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ibc.core.client.v1.Msg/UpdateClientParams", + FullMethod: "/ibc.core.client.v1.Msg/IBCSoftwareUpgrade", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateClientParams(ctx, req.(*MsgUpdateParams)) + return srv.(MsgServer).IBCSoftwareUpgrade(ctx, req.(*MsgIBCSoftwareUpgrade)) } return interceptor(ctx, in, info, handler) } -func _Msg_RecoverClient_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgRecoverClient) +func _Msg_UpdateClientParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).RecoverClient(ctx, in) + return srv.(MsgServer).UpdateClientParams(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ibc.core.client.v1.Msg/RecoverClient", + FullMethod: "/ibc.core.client.v1.Msg/UpdateClientParams", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).RecoverClient(ctx, req.(*MsgRecoverClient)) + return srv.(MsgServer).UpdateClientParams(ctx, req.(*MsgUpdateParams)) } return interceptor(ctx, in, info, handler) } @@ -997,22 +997,22 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpgradeClient", Handler: _Msg_UpgradeClient_Handler, }, - { - MethodName: "IBCSoftwareUpgrade", - Handler: _Msg_IBCSoftwareUpgrade_Handler, - }, { MethodName: "SubmitMisbehaviour", Handler: _Msg_SubmitMisbehaviour_Handler, }, - { - MethodName: "UpdateClientParams", - Handler: _Msg_UpdateClientParams_Handler, - }, { MethodName: "RecoverClient", Handler: _Msg_RecoverClient_Handler, }, + { + MethodName: "IBCSoftwareUpgrade", + Handler: _Msg_IBCSoftwareUpgrade_Handler, + }, + { + MethodName: "UpdateClientParams", + Handler: _Msg_UpdateClientParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "ibc/core/client/v1/tx.proto", @@ -1265,7 +1265,7 @@ func (m *MsgUpgradeClientResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func (m *MsgIBCSoftwareUpgrade) Marshal() (dAtA []byte, err error) { +func (m *MsgSubmitMisbehaviour) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1275,12 +1275,12 @@ func (m *MsgIBCSoftwareUpgrade) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgIBCSoftwareUpgrade) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgSubmitMisbehaviour) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgIBCSoftwareUpgrade) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgSubmitMisbehaviour) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1292,9 +1292,9 @@ func (m *MsgIBCSoftwareUpgrade) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1a } - if m.UpgradedClientState != nil { + if m.Misbehaviour != nil { { - size, err := m.UpgradedClientState.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Misbehaviour.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1304,20 +1304,17 @@ func (m *MsgIBCSoftwareUpgrade) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - { - size, err := m.Plan.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) + if len(m.ClientId) > 0 { + i -= len(m.ClientId) + copy(dAtA[i:], m.ClientId) + i = encodeVarintTx(dAtA, i, uint64(len(m.ClientId))) + i-- + dAtA[i] = 0xa } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *MsgIBCSoftwareUpgradeResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgSubmitMisbehaviourResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1327,12 +1324,12 @@ func (m *MsgIBCSoftwareUpgradeResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgIBCSoftwareUpgradeResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgSubmitMisbehaviourResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgIBCSoftwareUpgradeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgSubmitMisbehaviourResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1340,7 +1337,7 @@ func (m *MsgIBCSoftwareUpgradeResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *MsgSubmitMisbehaviour) Marshal() (dAtA []byte, err error) { +func (m *MsgRecoverClient) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1350,12 +1347,12 @@ func (m *MsgSubmitMisbehaviour) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgSubmitMisbehaviour) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgRecoverClient) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgSubmitMisbehaviour) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgRecoverClient) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1367,29 +1364,24 @@ func (m *MsgSubmitMisbehaviour) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1a } - if m.Misbehaviour != nil { - { - size, err := m.Misbehaviour.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } + if len(m.SubstituteClientId) > 0 { + i -= len(m.SubstituteClientId) + copy(dAtA[i:], m.SubstituteClientId) + i = encodeVarintTx(dAtA, i, uint64(len(m.SubstituteClientId))) i-- dAtA[i] = 0x12 } - if len(m.ClientId) > 0 { - i -= len(m.ClientId) - copy(dAtA[i:], m.ClientId) - i = encodeVarintTx(dAtA, i, uint64(len(m.ClientId))) + if len(m.SubjectClientId) > 0 { + i -= len(m.SubjectClientId) + copy(dAtA[i:], m.SubjectClientId) + i = encodeVarintTx(dAtA, i, uint64(len(m.SubjectClientId))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *MsgSubmitMisbehaviourResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgRecoverClientResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1399,12 +1391,12 @@ func (m *MsgSubmitMisbehaviourResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgSubmitMisbehaviourResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgRecoverClientResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgSubmitMisbehaviourResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgRecoverClientResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1412,7 +1404,7 @@ func (m *MsgSubmitMisbehaviourResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *MsgUpdateParams) 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]) @@ -1422,18 +1414,37 @@ func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgIBCSoftwareUpgrade) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgIBCSoftwareUpgrade) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = 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]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Plan.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1441,18 +1452,11 @@ func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - 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] = 0xa - } + dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *MsgUpdateParamsResponse) 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]) @@ -1462,12 +1466,12 @@ func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgIBCSoftwareUpgradeResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgIBCSoftwareUpgradeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1475,7 +1479,7 @@ func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *MsgRecoverClient) Marshal() (dAtA []byte, err error) { +func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1485,41 +1489,37 @@ func (m *MsgRecoverClient) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgRecoverClient) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgRecoverClient) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = 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 len(m.SubstituteClientId) > 0 { - i -= len(m.SubstituteClientId) - copy(dAtA[i:], m.SubstituteClientId) - i = encodeVarintTx(dAtA, i, uint64(len(m.SubstituteClientId))) - i-- - dAtA[i] = 0x12 + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) } - if len(m.SubjectClientId) > 0 { - i -= len(m.SubjectClientId) - copy(dAtA[i:], m.SubjectClientId) - i = encodeVarintTx(dAtA, i, uint64(len(m.SubjectClientId))) + i-- + dAtA[i] = 0x12 + 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] = 0xa } return len(dAtA) - i, nil } -func (m *MsgRecoverClientResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1529,12 +1529,12 @@ func (m *MsgRecoverClientResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgRecoverClientResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgRecoverClientResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1655,16 +1655,18 @@ func (m *MsgUpgradeClientResponse) Size() (n int) { return n } -func (m *MsgIBCSoftwareUpgrade) Size() (n int) { +func (m *MsgSubmitMisbehaviour) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.Plan.Size() - n += 1 + l + sovTx(uint64(l)) - if m.UpgradedClientState != nil { - l = m.UpgradedClientState.Size() + l = len(m.ClientId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Misbehaviour != nil { + l = m.Misbehaviour.Size() n += 1 + l + sovTx(uint64(l)) } l = len(m.Signer) @@ -1674,7 +1676,7 @@ func (m *MsgIBCSoftwareUpgrade) Size() (n int) { return n } -func (m *MsgIBCSoftwareUpgradeResponse) Size() (n int) { +func (m *MsgSubmitMisbehaviourResponse) Size() (n int) { if m == nil { return 0 } @@ -1683,18 +1685,18 @@ func (m *MsgIBCSoftwareUpgradeResponse) Size() (n int) { return n } -func (m *MsgSubmitMisbehaviour) Size() (n int) { +func (m *MsgRecoverClient) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.ClientId) + l = len(m.SubjectClientId) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if m.Misbehaviour != nil { - l = m.Misbehaviour.Size() + l = len(m.SubstituteClientId) + if l > 0 { n += 1 + l + sovTx(uint64(l)) } l = len(m.Signer) @@ -1704,7 +1706,7 @@ func (m *MsgSubmitMisbehaviour) Size() (n int) { return n } -func (m *MsgSubmitMisbehaviourResponse) Size() (n int) { +func (m *MsgRecoverClientResponse) Size() (n int) { if m == nil { return 0 } @@ -1713,22 +1715,26 @@ func (m *MsgSubmitMisbehaviourResponse) Size() (n int) { return n } -func (m *MsgUpdateParams) Size() (n int) { +func (m *MsgIBCSoftwareUpgrade) Size() (n int) { if m == nil { return 0 } var l int _ = 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)) } - l = m.Params.Size() - n += 1 + l + sovTx(uint64(l)) return n } -func (m *MsgUpdateParamsResponse) Size() (n int) { +func (m *MsgIBCSoftwareUpgradeResponse) Size() (n int) { if m == nil { return 0 } @@ -1737,28 +1743,22 @@ func (m *MsgUpdateParamsResponse) Size() (n int) { return n } -func (m *MsgRecoverClient) Size() (n int) { +func (m *MsgUpdateParams) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.SubjectClientId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.SubstituteClientId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } l = len(m.Signer) if l > 0 { n += 1 + l + sovTx(uint64(l)) } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) return n } -func (m *MsgRecoverClientResponse) Size() (n int) { +func (m *MsgUpdateParamsResponse) Size() (n int) { if m == nil { return 0 } @@ -2481,7 +2481,7 @@ func (m *MsgUpgradeClientResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgIBCSoftwareUpgrade) Unmarshal(dAtA []byte) error { +func (m *MsgSubmitMisbehaviour) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2504,17 +2504,17 @@ func (m *MsgIBCSoftwareUpgrade) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgIBCSoftwareUpgrade: wiretype end group for non-group") + return fmt.Errorf("proto: MsgSubmitMisbehaviour: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgIBCSoftwareUpgrade: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgSubmitMisbehaviour: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Plan", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2524,28 +2524,27 @@ 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 err := m.Plan.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.ClientId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UpgradedClientState", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Misbehaviour", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2572,10 +2571,10 @@ func (m *MsgIBCSoftwareUpgrade) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.UpgradedClientState == nil { - m.UpgradedClientState = &types.Any{} + if m.Misbehaviour == nil { + m.Misbehaviour = &types.Any{} } - if err := m.UpgradedClientState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Misbehaviour.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2632,7 +2631,7 @@ func (m *MsgIBCSoftwareUpgrade) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgIBCSoftwareUpgradeResponse) Unmarshal(dAtA []byte) error { +func (m *MsgSubmitMisbehaviourResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2655,10 +2654,10 @@ func (m *MsgIBCSoftwareUpgradeResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgIBCSoftwareUpgradeResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgSubmitMisbehaviourResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgIBCSoftwareUpgradeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgSubmitMisbehaviourResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2682,7 +2681,7 @@ func (m *MsgIBCSoftwareUpgradeResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgSubmitMisbehaviour) Unmarshal(dAtA []byte) error { +func (m *MsgRecoverClient) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2705,15 +2704,15 @@ func (m *MsgSubmitMisbehaviour) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgSubmitMisbehaviour: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRecoverClient: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSubmitMisbehaviour: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRecoverClient: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SubjectClientId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2741,13 +2740,13 @@ func (m *MsgSubmitMisbehaviour) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClientId = string(dAtA[iNdEx:postIndex]) + m.SubjectClientId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Misbehaviour", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SubstituteClientId", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2757,27 +2756,23 @@ func (m *MsgSubmitMisbehaviour) 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.Misbehaviour == nil { - m.Misbehaviour = &types.Any{} - } - if err := m.Misbehaviour.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.SubstituteClientId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { @@ -2832,7 +2827,7 @@ func (m *MsgSubmitMisbehaviour) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgSubmitMisbehaviourResponse) Unmarshal(dAtA []byte) error { +func (m *MsgRecoverClientResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2855,10 +2850,10 @@ func (m *MsgSubmitMisbehaviourResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgSubmitMisbehaviourResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRecoverClientResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSubmitMisbehaviourResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRecoverClientResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2882,7 +2877,7 @@ func (m *MsgSubmitMisbehaviourResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { +func (m *MsgIBCSoftwareUpgrade) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2905,17 +2900,17 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + return fmt.Errorf("proto: MsgIBCSoftwareUpgrade: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParams: 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: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signer", 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 @@ -2925,27 +2920,28 @@ func (m *MsgUpdateParams) 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.Signer = 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 Params", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field UpgradedClientState", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2972,10 +2968,45 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Params.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 Signer", 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.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -2997,7 +3028,7 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { +func (m *MsgIBCSoftwareUpgradeResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3020,10 +3051,10 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgIBCSoftwareUpgradeResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgIBCSoftwareUpgradeResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3047,7 +3078,7 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgRecoverClient) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3070,15 +3101,15 @@ func (m *MsgRecoverClient) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgRecoverClient: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRecoverClient: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SubjectClientId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3106,13 +3137,13 @@ func (m *MsgRecoverClient) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.SubjectClientId = string(dAtA[iNdEx:postIndex]) + m.Signer = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SubstituteClientId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -3122,55 +3153,24 @@ func (m *MsgRecoverClient) 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.SubstituteClientId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signer", 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 + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - m.Signer = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3193,7 +3193,7 @@ func (m *MsgRecoverClient) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgRecoverClientResponse) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3216,10 +3216,10 @@ func (m *MsgRecoverClientResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgRecoverClientResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRecoverClientResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateParamsResponse: 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 4f0acb4cc44..4d313f79c96 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -114,6 +114,25 @@ func (k Keeper) RecoverClient(goCtx context.Context, msg *clienttypes.MsgRecover return &clienttypes.MsgRecoverClientResponse{}, nil } +// IBCSoftwareUpgrade defines a rpc handler method for MsgIBCSoftwareUpgrade. +func (k Keeper) IBCSoftwareUpgrade(goCtx context.Context, msg *clienttypes.MsgIBCSoftwareUpgrade) (*clienttypes.MsgIBCSoftwareUpgradeResponse, error) { + if k.GetAuthority() != msg.Signer { + return nil, errorsmod.Wrapf(ibcerrors.ErrUnauthorized, "expected %s, got %s", k.GetAuthority(), msg.Signer) + } + + 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) + } + + if err = k.ClientKeeper.ScheduleIBCSoftwareUpgrade(ctx, msg.Plan, upgradedClientState); err != nil { + return nil, errorsmod.Wrapf(err, "cannot schedule IBC client upgrade") + } + + return &clienttypes.MsgIBCSoftwareUpgradeResponse{}, nil +} + // ConnectionOpenInit defines a rpc handler method for MsgConnectionOpenInit. func (k Keeper) ConnectionOpenInit(goCtx context.Context, msg *connectiontypes.MsgConnectionOpenInit) (*connectiontypes.MsgConnectionOpenInitResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) @@ -726,25 +745,6 @@ func (k Keeper) UpdateClientParams(goCtx context.Context, msg *clienttypes.MsgUp return &clienttypes.MsgUpdateParamsResponse{}, nil } -// IBCSoftwareUpgrade defines a rpc handler method for MsgIBCSoftwareUpgrade. -func (k Keeper) IBCSoftwareUpgrade(goCtx context.Context, msg *clienttypes.MsgIBCSoftwareUpgrade) (*clienttypes.MsgIBCSoftwareUpgradeResponse, error) { - if k.GetAuthority() != msg.Signer { - return nil, errorsmod.Wrapf(ibcerrors.ErrUnauthorized, "expected %s, got %s", k.GetAuthority(), msg.Signer) - } - - 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) - } - - if err = k.ClientKeeper.ScheduleIBCSoftwareUpgrade(ctx, msg.Plan, upgradedClientState); err != nil { - return nil, errorsmod.Wrapf(err, "cannot schedule IBC client upgrade") - } - - return &clienttypes.MsgIBCSoftwareUpgradeResponse{}, 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.Signer { diff --git a/modules/core/keeper/msg_server_test.go b/modules/core/keeper/msg_server_test.go index a54a377c3d6..84298ae0481 100644 --- a/modules/core/keeper/msg_server_test.go +++ b/modules/core/keeper/msg_server_test.go @@ -856,57 +856,6 @@ func (suite *KeeperTestSuite) TestRecoverClient() { } } -// TestUpdateClientParams tests the UpdateClientParams rpc handler -func (suite *KeeperTestSuite) TestUpdateClientParams() { - signer := suite.chainA.App.GetIBCKeeper().GetAuthority() - testCases := []struct { - name string - msg *clienttypes.MsgUpdateParams - expPass bool - }{ - { - "success: valid signer and default params", - clienttypes.NewMsgUpdateParams(signer, clienttypes.DefaultParams()), - true, - }, - { - "failure: malformed signer address", - clienttypes.NewMsgUpdateParams(ibctesting.InvalidID, clienttypes.DefaultParams()), - false, - }, - { - "failure: empty signer address", - clienttypes.NewMsgUpdateParams("", clienttypes.DefaultParams()), - false, - }, - { - "failure: whitespace signer address", - clienttypes.NewMsgUpdateParams(" ", clienttypes.DefaultParams()), - false, - }, - { - "failure: unauthorized signer address", - clienttypes.NewMsgUpdateParams(ibctesting.TestAccAddress, clienttypes.DefaultParams()), - false, - }, - } - - for _, tc := range testCases { - tc := tc - suite.Run(tc.name, func() { - suite.SetupTest() - _, err := keeper.Keeper.UpdateClientParams(*suite.chainA.App.GetIBCKeeper(), suite.chainA.GetContext(), tc.msg) - if tc.expPass { - suite.Require().NoError(err) - p := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetParams(suite.chainA.GetContext()) - suite.Require().Equal(tc.msg.Params, p) - } else { - suite.Require().Error(err) - } - }) - } -} - // TestIBCSoftwareUpgrade tests the IBCSoftwareUpgrade rpc handler func (suite *KeeperTestSuite) TestIBCSoftwareUpgrade() { var msg *clienttypes.MsgIBCSoftwareUpgrade @@ -990,6 +939,57 @@ func (suite *KeeperTestSuite) TestIBCSoftwareUpgrade() { } } +// TestUpdateClientParams tests the UpdateClientParams rpc handler +func (suite *KeeperTestSuite) TestUpdateClientParams() { + signer := suite.chainA.App.GetIBCKeeper().GetAuthority() + testCases := []struct { + name string + msg *clienttypes.MsgUpdateParams + expPass bool + }{ + { + "success: valid signer and default params", + clienttypes.NewMsgUpdateParams(signer, clienttypes.DefaultParams()), + true, + }, + { + "failure: malformed signer address", + clienttypes.NewMsgUpdateParams(ibctesting.InvalidID, clienttypes.DefaultParams()), + false, + }, + { + "failure: empty signer address", + clienttypes.NewMsgUpdateParams("", clienttypes.DefaultParams()), + false, + }, + { + "failure: whitespace signer address", + clienttypes.NewMsgUpdateParams(" ", clienttypes.DefaultParams()), + false, + }, + { + "failure: unauthorized signer address", + clienttypes.NewMsgUpdateParams(ibctesting.TestAccAddress, clienttypes.DefaultParams()), + false, + }, + } + + for _, tc := range testCases { + tc := tc + suite.Run(tc.name, func() { + suite.SetupTest() + _, err := keeper.Keeper.UpdateClientParams(*suite.chainA.App.GetIBCKeeper(), suite.chainA.GetContext(), tc.msg) + if tc.expPass { + suite.Require().NoError(err) + p := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetParams(suite.chainA.GetContext()) + suite.Require().Equal(tc.msg.Params, p) + } else { + suite.Require().Error(err) + } + }) + } +} + // TestUpdateConnectionParams tests the UpdateConnectionParams rpc handler func (suite *KeeperTestSuite) TestUpdateConnectionParams() { signer := suite.chainA.App.GetIBCKeeper().GetAuthority() diff --git a/proto/ibc/core/client/v1/tx.proto b/proto/ibc/core/client/v1/tx.proto index 547ba582036..9cbb5e1fd9f 100644 --- a/proto/ibc/core/client/v1/tx.proto +++ b/proto/ibc/core/client/v1/tx.proto @@ -23,17 +23,17 @@ service Msg { // UpgradeClient defines a rpc handler method for MsgUpgradeClient. rpc UpgradeClient(MsgUpgradeClient) returns (MsgUpgradeClientResponse); - // 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); - // UpdateClientParams defines a rpc handler method for MsgUpdateParams. - rpc UpdateClientParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); - // RecoverClient defines a rpc handler method for MsgRecoverClient. rpc RecoverClient(MsgRecoverClient) returns (MsgRecoverClientResponse); + + // IBCSoftwareUpgrade defines a rpc handler method for MsgIBCSoftwareUpgrade. + rpc IBCSoftwareUpgrade(MsgIBCSoftwareUpgrade) returns (MsgIBCSoftwareUpgradeResponse); + + // UpdateClientParams defines a rpc handler method for MsgUpdateParams. + rpc UpdateClientParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } // MsgCreateClient defines a message to create an IBC client @@ -97,26 +97,6 @@ message MsgUpgradeClient { // MsgUpgradeClientResponse defines the Msg/UpgradeClient response type. message MsgUpgradeClientResponse {} -// MsgIBCSoftwareUpgrade defines the message used to schedule an upgrade of an IBC client using a v1 governance proposal -message MsgIBCSoftwareUpgrade { - 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 - // 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 = 2; - // signer defaults to the governance account address unless otherwise specified. - string signer = 3; -} - -// MsgIBCSoftwareUpgradeResponse defines the Msg/IBCSoftwareUpgrade response type. -message MsgIBCSoftwareUpgradeResponse {} - // MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for // light client misbehaviour. // This message has been deprecated. Use MsgUpdateClient instead. @@ -138,6 +118,44 @@ message MsgSubmitMisbehaviour { // type. message MsgSubmitMisbehaviourResponse {} +// MsgRecoverClient defines the message used to recover a frozen or expired client. +message MsgRecoverClient { + option (gogoproto.goproto_getters) = false; + option (cosmos.msg.v1.signer) = "signer"; + + // the client identifier for the client to be updated if the proposal passes + string subject_client_id = 1; + // the substitute client identifier for the client which will replace the subject + // client + string substitute_client_id = 2; + + // signer address (it may be the the address that controls the module, which defaults to x/gov unless overwritten). + string signer = 3; +} + +// MsgRecoverClientResponse defines the MsgRecoverClient response type. +message MsgRecoverClientResponse {} + +// MsgIBCSoftwareUpgrade defines the message used to schedule an upgrade of an IBC client using a v1 governance proposal +message MsgIBCSoftwareUpgrade { + 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 + // 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 = 2; + // signer defaults to the governance account address unless otherwise specified. + string signer = 3; +} + +// MsgIBCSoftwareUpgradeResponse defines the Msg/IBCSoftwareUpgrade response type. +message MsgIBCSoftwareUpgradeResponse {} + // MsgUpdateParams defines the sdk.Msg type to update the client parameters. message MsgUpdateParams { option (cosmos.msg.v1.signer) = "signer"; @@ -155,21 +173,3 @@ message MsgUpdateParams { // MsgUpdateParamsResponse defines the MsgUpdateParams response type. message MsgUpdateParamsResponse {} - -// MsgRecoverClient defines the message used to recover a frozen or expired client. -message MsgRecoverClient { - option (gogoproto.goproto_getters) = false; - option (cosmos.msg.v1.signer) = "signer"; - - // the client identifier for the client to be updated if the proposal passes - string subject_client_id = 1; - // the substitute client identifier for the client which will replace the subject - // client - string substitute_client_id = 2; - - // signer address (it may be the the address that controls the module, which defaults to x/gov unless overwritten). - string signer = 3; -} - -// MsgRecoverClientResponse defines the MsgRecoverClient response type. -message MsgRecoverClientResponse {} \ No newline at end of file From d3a526cc3d8b8089f66a2bca3a77b1a152dff68f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Colin=20Axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Mon, 11 Sep 2023 16:03:37 +0200 Subject: [PATCH 29/34] refactor: simplify ibc software upgrade emitted event --- modules/core/02-client/keeper/events.go | 4 +--- modules/core/02-client/keeper/keeper.go | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/core/02-client/keeper/events.go b/modules/core/02-client/keeper/events.go index cc35c66c3d2..c8809c6183e 100644 --- a/modules/core/02-client/keeper/events.go +++ b/modules/core/02-client/keeper/events.go @@ -113,14 +113,12 @@ func emitRecoverClientEvent(ctx sdk.Context, clientID, clientType string) { } // emitScheduleIBCSoftwareUpgradeEvent emits a schedule IBC software upgrade event -func emitScheduleIBCSoftwareUpgradeEvent(ctx sdk.Context, title string, height int64, upgradeClientState exported.ClientState) { +func emitScheduleIBCSoftwareUpgradeEvent(ctx sdk.Context, title string, height int64) { ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeScheduleIBCSoftwareUpgrade, sdk.NewAttribute(types.AttributeKeyUpgradePlanTitle, title), sdk.NewAttribute(types.AttributeKeyUpgradePlanHeight, fmt.Sprintf("%d", height)), - sdk.NewAttribute(types.AttributeKeyClientType, upgradeClientState.ClientType()), - sdk.NewAttribute(types.AttributeKeyConsensusHeight, upgradeClientState.GetLatestHeight().String()), ), sdk.NewEvent( sdk.EventTypeMessage, diff --git a/modules/core/02-client/keeper/keeper.go b/modules/core/02-client/keeper/keeper.go index 88011df7d15..8efb679e18e 100644 --- a/modules/core/02-client/keeper/keeper.go +++ b/modules/core/02-client/keeper/keeper.go @@ -460,7 +460,7 @@ func (k Keeper) ScheduleIBCSoftwareUpgrade(ctx sdk.Context, plan upgradetypes.Pl } // emitting an event for scheduling an upgrade plan - emitScheduleIBCSoftwareUpgradeEvent(ctx, plan.Name, plan.Height, cs) + emitScheduleIBCSoftwareUpgradeEvent(ctx, plan.Name, plan.Height) return nil } From b6ff18bb26c1af70487a8f06c1fdb42b34b1ceef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Colin=20Axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Mon, 11 Sep 2023 16:22:27 +0200 Subject: [PATCH 30/34] lint lint lint --- modules/core/02-client/keeper/client_test.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/modules/core/02-client/keeper/client_test.go b/modules/core/02-client/keeper/client_test.go index 89f4c0ad993..0f0786fa873 100644 --- a/modules/core/02-client/keeper/client_test.go +++ b/modules/core/02-client/keeper/client_test.go @@ -638,9 +638,6 @@ func (suite *KeeperTestSuite) TestRecoverClient() { tmClientState.FrozenHeight = tmClientState.LatestHeight suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainA.GetContext(), subject, tmClientState) - tmClientState, ok = substituteClientState.(*ibctm.ClientState) - suite.Require().True(ok) - tc.malleate() err = suite.chainA.App.GetIBCKeeper().ClientKeeper.RecoverClient(suite.chainA.GetContext(), subject, substitute) From 46648c52b887042d310c29ad5cd4dc032811b1ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?colin=20axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Mon, 11 Sep 2023 17:36:48 +0200 Subject: [PATCH 31/34] Apply suggestions from code review Co-authored-by: Charly --- docs/architecture/adr-026-ibc-client-recovery-mechanisms.md | 2 +- docs/ibc/events.md | 2 -- docs/ibc/upgrades/quick-guide.md | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/architecture/adr-026-ibc-client-recovery-mechanisms.md b/docs/architecture/adr-026-ibc-client-recovery-mechanisms.md index c10ef61c3a7..05f615a7aaf 100644 --- a/docs/architecture/adr-026-ibc-client-recovery-mechanisms.md +++ b/docs/architecture/adr-026-ibc-client-recovery-mechanisms.md @@ -56,7 +56,7 @@ We elect not to deal with chains which have actually halted, which is necessaril In addition, `TrustingPeriod` was initally not allowed to be updated by a client upgrade proposal. However, due to the number of situations experienced in production where the `TrustingPeriod` of a client should be allowed to be updated because of ie: initial misconfiguration for a canonical channel, governance should be allowed to update this client parameter. - In versions older than ibc-go v8, `MsgRecoverClient` was a governance proposal type `ClientUpdateProposal`. It has been removed and replaced by `MsgRecoverClient` in the migration from goverance v1beta1 to governacne v1. + In versions older than ibc-go v8, `MsgRecoverClient` was a governance proposal type `ClientUpdateProposal`. It has been removed and replaced by `MsgRecoverClient` in the migration from governance v1beta1 to governance v1. Note that this should NOT be lightly updated, as there may be a gap in time between when misbehaviour has occured and when the evidence of misbehaviour is submitted. For example, if the `UnbondingPeriod` is 2 weeks and the `TrustingPeriod` has also been set to two weeks, a validator could wait until right before `UnbondingPeriod` finishes, submit false information, then unbond and exit without being slashed for misbehaviour. Therefore, we recommend that the trusting period for the 07-tendermint client be set to 2/3 of the `UnbondingPeriod`. diff --git a/docs/ibc/events.md b/docs/ibc/events.md index 025e252ffb4..ee8b4e44fb7 100644 --- a/docs/ibc/events.md +++ b/docs/ibc/events.md @@ -64,8 +64,6 @@ callbacks to IBC applications. |-------------------------------|---------------------|---------------------------------| | schedule_ibc_software_upgrade | title | {title} | | schedule_ibc_software_upgrade | upgrade_plan_height | {plan.height} | -| schedule_ibc_software_upgrade | client_type | {upgraded_client_type} | -| schedule_ibc_software_upgrade | consensus_height | {upgraded_client_latest_height} | ## ICS 03 - Connection diff --git a/docs/ibc/upgrades/quick-guide.md b/docs/ibc/upgrades/quick-guide.md index 152768161d1..a516052a91e 100644 --- a/docs/ibc/upgrades/quick-guide.md +++ b/docs/ibc/upgrades/quick-guide.md @@ -30,7 +30,7 @@ Note: Since upgrades are only implemented for Tendermint clients, this doc only If the IBC-connected chain is conducting an upgrade that will break counterparty clients, it must ensure that the upgrade is first supported by IBC using the list above and then execute the upgrade process described below in order to prevent counterparty clients from breaking. -1. Create a governance proposal with the [`MsgIBCSoftwareUpgrade`](https://buf.build/cosmos/ibc/docs/main:ibc.core.client.v1#ibc.core.client.v1.MsgIBCSoftwareUpgrade) message which contains an `UpgradePlan` and a new IBC ClientState in the `UpgradedClientState` field. Note that the `UpgradePlan` must specify an upgrade height **only** (no upgrade time), and the `ClientState` should only include the fields common to all valid clients and zero out any client-customizable fields (such as TrustingPeriod). +1. Create a governance proposal with the [`MsgIBCSoftwareUpgrade`](https://buf.build/cosmos/ibc/docs/main:ibc.core.client.v1#ibc.core.client.v1.MsgIBCSoftwareUpgrade) message which contains an `UpgradePlan` and a new IBC ClientState in the `UpgradedClientState` field. Note that the `UpgradePlan` must specify an upgrade height **only** (no upgrade time), and the `ClientState` should only include the fields common to all valid clients (chain-specified parameters) and zero out any client-customizable fields (such as TrustingPeriod). 2. Vote on and pass the governance proposal. Upon passing the governance proposal, the upgrade module will commit the UpgradedClient under the key: `upgrade/UpgradedIBCState/{upgradeHeight}/upgradedClient`. On the block right before the upgrade height, the upgrade module will also commit an initial consensus state for the next chain under the key: `upgrade/UpgradedIBCState/{upgradeHeight}/upgradedConsState`. From 33a4ce4b83a959e06a4128d58d1ee7335e33a55f Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Tue, 12 Sep 2023 14:25:23 +0200 Subject: [PATCH 32/34] review of feat/govv1 --- docs/ibc/proposals.md | 2 +- docs/ibc/upgrades/genesis-restart.md | 4 ++-- docs/ibc/upgrades/quick-guide.md | 4 ++-- e2e/tests/core/02-client/client_test.go | 4 ++-- modules/core/02-client/client/cli/tx.go | 6 +++--- modules/core/02-client/keeper/client.go | 4 ++-- modules/core/02-client/types/msgs.go | 10 +++++++++- modules/core/02-client/types/msgs_test.go | 11 +++++++++-- modules/core/02-client/types/tx.pb.go | 2 +- proto/ibc/core/client/v1/tx.proto | 2 +- testing/values.go | 1 + 11 files changed, 33 insertions(+), 17 deletions(-) diff --git a/docs/ibc/proposals.md b/docs/ibc/proposals.md index 18cc03baec6..e326daf3cc7 100644 --- a/docs/ibc/proposals.md +++ b/docs/ibc/proposals.md @@ -76,7 +76,7 @@ The client is attached to the expected Akash `chain-id`. Note that although the ### Step 2 Anyone can submit the governance proposal to recover the client by executing the following via CLI. -If the chain is on an ibc-go version older than v8, please see the [relevant documentation](https://ibc.cosmos.network/v6.1.0/ibc/proposals.html). +If the chain is on an ibc-go version older than v8, please see the [relevant documentation](https://ibc.cosmos.network/v7.3.0/ibc/proposals.html). - From ibc-go v8 onwards diff --git a/docs/ibc/upgrades/genesis-restart.md b/docs/ibc/upgrades/genesis-restart.md index d2788d8d14a..22a4c375718 100644 --- a/docs/ibc/upgrades/genesis-restart.md +++ b/docs/ibc/upgrades/genesis-restart.md @@ -20,7 +20,7 @@ Genesis restarts still require the usage of an IBC upgrade proposal in order to If the IBC-connected chain is conducting an upgrade that will break counterparty clients, it must ensure that the upgrade is first supported by IBC using the [IBC Client Breaking Upgrade List](https://github.com/cosmos/ibc-go/blob/main/docs/ibc/upgrades/quick-guide.md#ibc-client-breaking-upgrades) and then execute the upgrade process described below in order to prevent counterparty clients from breaking. -1. Create a governance proposal with the [`MsgIBCSoftwareUpgrade`](https://buf.build/cosmos/ibc/docs/main:ibc.core.client.v1#ibc.core.client.v1.MsgIBCSoftwareUpgrade) which contains an `UpgradePlan` and a new IBC ClientState in the `UpgradedClientState` field. Note that the `UpgradePlan` must specify an upgrade height **only** (no upgrade time), and the `ClientState` should only include the fields common to all valid clients and zero out any client-customizable fields (such as TrustingPeriod). +1. Create a governance proposal with the [`MsgIBCSoftwareUpgrade`](https://buf.build/cosmos/ibc/docs/main:ibc.core.client.v1#ibc.core.client.v1.MsgIBCSoftwareUpgrade) which contains an `UpgradePlan` and a new IBC `ClientState` in the `UpgradedClientState` field. Note that the `UpgradePlan` must specify an upgrade height **only** (no upgrade time), and the `ClientState` should only include the fields common to all valid clients and zero out any client-customizable fields (such as `TrustingPeriod`). 2. Vote on and pass the governance proposal. 3. Halt the node after successful upgrade. 4. Export the genesis file. @@ -31,7 +31,7 @@ If the IBC-connected chain is conducting an upgrade that will break counterparty 8. Reset the node's data. 9. Start the chain. -Upon passing the governance proposal, the upgrade module will commit the UpgradedClient under the key: `upgrade/UpgradedIBCState/{upgradeHeight}/upgradedClient`. On the block right before the upgrade height, the upgrade module will also commit an initial consensus state for the next chain under the key: `upgrade/UpgradedIBCState/{upgradeHeight}/upgradedConsState`. +Upon passing the governance proposal, the upgrade module will commit the `UpgradedClient` under the key: `upgrade/UpgradedIBCState/{upgradeHeight}/upgradedClient`. On the block right before the upgrade height, the upgrade module will also commit an initial consensus state for the next chain under the key: `upgrade/UpgradedIBCState/{upgradeHeight}/upgradedConsState`. Once the chain reaches the upgrade height and halts, a relayer can upgrade the counterparty clients to the last block of the old chain. They can then submit the proofs of the `UpgradedClient` and `UpgradedConsensusState` against this last block and upgrade the counterparty client. diff --git a/docs/ibc/upgrades/quick-guide.md b/docs/ibc/upgrades/quick-guide.md index a516052a91e..021cb7ce5a1 100644 --- a/docs/ibc/upgrades/quick-guide.md +++ b/docs/ibc/upgrades/quick-guide.md @@ -30,10 +30,10 @@ Note: Since upgrades are only implemented for Tendermint clients, this doc only If the IBC-connected chain is conducting an upgrade that will break counterparty clients, it must ensure that the upgrade is first supported by IBC using the list above and then execute the upgrade process described below in order to prevent counterparty clients from breaking. -1. Create a governance proposal with the [`MsgIBCSoftwareUpgrade`](https://buf.build/cosmos/ibc/docs/main:ibc.core.client.v1#ibc.core.client.v1.MsgIBCSoftwareUpgrade) message which contains an `UpgradePlan` and a new IBC ClientState in the `UpgradedClientState` field. Note that the `UpgradePlan` must specify an upgrade height **only** (no upgrade time), and the `ClientState` should only include the fields common to all valid clients (chain-specified parameters) and zero out any client-customizable fields (such as TrustingPeriod). +1. Create a governance proposal with the [`MsgIBCSoftwareUpgrade`](https://buf.build/cosmos/ibc/docs/main:ibc.core.client.v1#ibc.core.client.v1.MsgIBCSoftwareUpgrade) message which contains an `UpgradePlan` and a new IBC `ClientState` in the `UpgradedClientState` field. Note that the `UpgradePlan` must specify an upgrade height **only** (no upgrade time), and the `ClientState` should only include the fields common to all valid clients (chain-specified parameters) and zero out any client-customizable fields (such as `TrustingPeriod`). 2. Vote on and pass the governance proposal. -Upon passing the governance proposal, the upgrade module will commit the UpgradedClient under the key: `upgrade/UpgradedIBCState/{upgradeHeight}/upgradedClient`. On the block right before the upgrade height, the upgrade module will also commit an initial consensus state for the next chain under the key: `upgrade/UpgradedIBCState/{upgradeHeight}/upgradedConsState`. +Upon passing the governance proposal, the upgrade module will commit the `UpgradedClient` under the key: `upgrade/UpgradedIBCState/{upgradeHeight}/upgradedClient`. On the block right before the upgrade height, the upgrade module will also commit an initial consensus state for the next chain under the key: `upgrade/UpgradedIBCState/{upgradeHeight}/upgradedConsState`. Once the chain reaches the upgrade height and halts, a relayer can upgrade the counterparty clients to the last block of the old chain. They can then submit the proofs of the `UpgradedClient` and `UpgradedConsensusState` against this last block and upgrade the counterparty client. diff --git a/e2e/tests/core/02-client/client_test.go b/e2e/tests/core/02-client/client_test.go index 83de04552f9..872e74ef3c8 100644 --- a/e2e/tests/core/02-client/client_test.go +++ b/e2e/tests/core/02-client/client_test.go @@ -85,7 +85,7 @@ func (s *ClientTestSuite) TestScheduleIBCUpgrade_Succeeds() { const planHeight = int64(75) var newChainID string - t.Run("send schedule IBC upgrade message", func(t *testing.T) { + t.Run("execute proposal for MsgIBCSoftwareUpgrade", func(t *testing.T) { authority, err := s.QueryModuleAccountAddress(ctx, govtypes.ModuleName, chainA) s.Require().NoError(err) s.Require().NotNil(authority) @@ -194,7 +194,7 @@ func (s *ClientTestSuite) TestRecoverClient_Succeeds() { }) }) - t.Run("send recover client message", func(t *testing.T) { + t.Run("execute proposal for MsgRecoverClient", func(t *testing.T) { authority, err := s.QueryModuleAccountAddress(ctx, govtypes.ModuleName, chainA) s.Require().NoError(err) recoverClientMsg := clienttypes.NewMsgRecoverClient(authority.String(), subjectClientID, substituteClientID) diff --git a/modules/core/02-client/client/cli/tx.go b/modules/core/02-client/client/cli/tx.go index c1e5f7bf70b..a7f41f82265 100644 --- a/modules/core/02-client/client/cli/tx.go +++ b/modules/core/02-client/client/cli/tx.go @@ -279,7 +279,7 @@ func newSubmitRecoverClientProposalCmd() *cobra.Command { msg := types.NewMsgRecoverClient(authority, subjectClientID, substituteClientID) if err = msg.ValidateBasic(); err != nil { - return err + return fmt.Errorf("error validating %T: %w", types.MsgRecoverClient{}, err) } if err := proposal.SetMsgs([]sdk.Msg{msg}); err != nil { @@ -424,11 +424,11 @@ func newScheduleIBCUpgradeProposalCmd() *cobra.Command { msg, err := types.NewMsgIBCSoftwareUpgrade(authority, plan, clientState) if err != nil { - return fmt.Errorf("error in NewMsgIBCSoftwareUpgrade: %w", err) + return fmt.Errorf("error in %T: %w", types.MsgIBCSoftwareUpgrade{}, err) } if err = msg.ValidateBasic(); err != nil { - return fmt.Errorf("error validating MsgIBCSoftwareUpgrade: %w", err) + return fmt.Errorf("error validating %T: %w", types.MsgIBCSoftwareUpgrade{}, err) } if err := proposal.SetMsgs([]sdk.Msg{msg}); err != nil { diff --git a/modules/core/02-client/keeper/client.go b/modules/core/02-client/keeper/client.go index 4ee643ed415..f5d03cd39dd 100644 --- a/modules/core/02-client/keeper/client.go +++ b/modules/core/02-client/keeper/client.go @@ -166,7 +166,7 @@ func (k Keeper) RecoverClient(ctx sdk.Context, subjectClientID, substituteClient subjectClientStore := k.ClientStore(ctx, subjectClientID) if status := k.GetClientStatus(ctx, subjectClientState, subjectClientID); status == exported.Active { - return errorsmod.Wrap(types.ErrInvalidRecoveryClient, "cannot recover Active subject client") + return errorsmod.Wrapf(types.ErrInvalidRecoveryClient, "cannot recover %s subject client", exported.Active) } substituteClientState, found := k.GetClientState(ctx, substituteClientID) @@ -181,7 +181,7 @@ func (k Keeper) RecoverClient(ctx sdk.Context, subjectClientID, substituteClient substituteClientStore := k.ClientStore(ctx, substituteClientID) if status := k.GetClientStatus(ctx, substituteClientState, substituteClientID); status != exported.Active { - return errorsmod.Wrapf(types.ErrClientNotActive, "substitute client is not Active, status is %s", status) + return errorsmod.Wrapf(types.ErrClientNotActive, "substitute client is not %s, status is %s", status, exported.Active) } if err := subjectClientState.CheckSubstituteAndUpdateState(ctx, k.cdc, subjectClientStore, substituteClientStore, substituteClientState); err != nil { diff --git a/modules/core/02-client/types/msgs.go b/modules/core/02-client/types/msgs.go index 8eda74107b9..b0d4528bd87 100644 --- a/modules/core/02-client/types/msgs.go +++ b/modules/core/02-client/types/msgs.go @@ -282,7 +282,15 @@ func (msg *MsgRecoverClient) ValidateBasic() error { return err } - return host.ClientIdentifierValidator(msg.SubstituteClientId) + if err := host.ClientIdentifierValidator(msg.SubstituteClientId); err != nil { + return err + } + + if msg.SubjectClientId == msg.SubstituteClientId { + return errorsmod.Wrapf(ErrInvalidSubstitute, "subject and substitute clients must be different") + } + + return nil } // GetSigners returns the expected signers for a MsgRecoverClient message. diff --git a/modules/core/02-client/types/msgs_test.go b/modules/core/02-client/types/msgs_test.go index 003938317df..0c9d881300a 100644 --- a/modules/core/02-client/types/msgs_test.go +++ b/modules/core/02-client/types/msgs_test.go @@ -652,17 +652,24 @@ func (suite *TypesTestSuite) TestMsgRecoverClientValidateBasic() { { "failure: invalid substitute client ID", func() { - msg.SubjectClientId = "" + msg.SubstituteClientId = "" }, host.ErrInvalidID, }, + { + "failure: subject and substribute client IDs are the same", + func() { + msg.SubstituteClientId = ibctesting.FirstClientID + }, + types.ErrInvalidSubstitute, + }, } for _, tc := range testCases { msg = types.NewMsgRecoverClient( ibctesting.TestAccAddress, ibctesting.FirstClientID, - ibctesting.FirstClientID, + ibctesting.SecondClientID, ) tc.malleate() diff --git a/modules/core/02-client/types/tx.pb.go b/modules/core/02-client/types/tx.pb.go index 5362984d537..41954fe8f29 100644 --- a/modules/core/02-client/types/tx.pb.go +++ b/modules/core/02-client/types/tx.pb.go @@ -410,7 +410,7 @@ func (m *MsgRecoverClient) XXX_DiscardUnknown() { var xxx_messageInfo_MsgRecoverClient proto.InternalMessageInfo -// MsgRecoverClientResponse defines the MsgRecoverClient response type. +// MsgRecoverClientResponse defines the Msg/RecoverClient response type. type MsgRecoverClientResponse struct { } diff --git a/proto/ibc/core/client/v1/tx.proto b/proto/ibc/core/client/v1/tx.proto index 9cbb5e1fd9f..d7f8e2f97a0 100644 --- a/proto/ibc/core/client/v1/tx.proto +++ b/proto/ibc/core/client/v1/tx.proto @@ -133,7 +133,7 @@ message MsgRecoverClient { string signer = 3; } -// MsgRecoverClientResponse defines the MsgRecoverClient response type. +// MsgRecoverClientResponse defines the Msg/RecoverClient response type. message MsgRecoverClientResponse {} // MsgIBCSoftwareUpgrade defines the message used to schedule an upgrade of an IBC client using a v1 governance proposal diff --git a/testing/values.go b/testing/values.go index 6459112a1cd..2741b1a5fed 100644 --- a/testing/values.go +++ b/testing/values.go @@ -21,6 +21,7 @@ import ( const ( FirstClientID = "07-tendermint-0" + SecondClientID = "07-tendermint-1" FirstChannelID = "channel-0" FirstConnectionID = "connection-0" From cd97b1d7122f3a2dcb37f31fe23d556d72dc6e40 Mon Sep 17 00:00:00 2001 From: Charly Date: Tue, 12 Sep 2023 19:02:04 +0200 Subject: [PATCH 33/34] pr nits --- e2e/tests/core/02-client/client_test.go | 8 ++++--- e2e/testsuite/grpc_query.go | 4 ++-- .../simulation/proposals.go | 4 ++-- modules/apps/transfer/simulation/proposals.go | 6 ++--- modules/core/02-client/client/cli/cli.go | 8 +++---- modules/core/02-client/client/cli/tx.go | 24 +++++++++---------- modules/core/02-client/keeper/client.go | 2 +- modules/core/02-client/types/errors.go | 2 ++ modules/core/keeper/msg_server.go | 2 +- 9 files changed, 32 insertions(+), 28 deletions(-) diff --git a/e2e/tests/core/02-client/client_test.go b/e2e/tests/core/02-client/client_test.go index 97fbb5df868..21b4cbbf0e0 100644 --- a/e2e/tests/core/02-client/client_test.go +++ b/e2e/tests/core/02-client/client_test.go @@ -120,10 +120,11 @@ func (s *ClientTestSuite) TestScheduleIBCUpgrade_Succeeds() { cs, err := s.QueryUpgradedClientState(ctx, chainA, ibctesting.FirstClientID) s.Require().NoError(err) - upgradedClientState := cs.(*ibctm.ClientState) + upgradedClientState, ok := cs.(*ibctm.ClientState) + s.Require().True(ok) s.Require().Equal(upgradedClientState.ChainId, newChainID) - plan, err := s.QueryCurrentPlan(ctx, chainA) + plan, err := s.QueryCurrentUpgradePlan(ctx, chainA) s.Require().NoError(err) s.Require().Equal("upgrade-client", plan.Name) @@ -142,7 +143,7 @@ func (s *ClientTestSuite) TestRecoverClient_Succeeds() { subjectClientID string substituteClientID string // set the trusting period to a value which will still be valid upon client creation, but invalid before the first update - badTrustingPeriod = time.Duration(time.Second * 10) + badTrustingPeriod = time.Second * 10 ) t.Run("create substitute client with correct trusting period", func(t *testing.T) { @@ -198,6 +199,7 @@ func (s *ClientTestSuite) TestRecoverClient_Succeeds() { authority, err := s.QueryModuleAccountAddress(ctx, govtypes.ModuleName, chainA) s.Require().NoError(err) recoverClientMsg := clienttypes.NewMsgRecoverClient(authority.String(), subjectClientID, substituteClientID) + s.Require().NotNil(recoverClientMsg) s.ExecuteGovV1Proposal(ctx, recoverClientMsg, chainA, chainAWallet, 1) }) diff --git a/e2e/testsuite/grpc_query.go b/e2e/testsuite/grpc_query.go index 2977625958a..c89d340abd8 100644 --- a/e2e/testsuite/grpc_query.go +++ b/e2e/testsuite/grpc_query.go @@ -153,8 +153,8 @@ func (s *E2ETestSuite) QueryClientStatus(ctx context.Context, chain ibc.Chain, c return res.Status, nil } -// QueryCurrentPlan queries the currently scheduled plans, if any -func (s *E2ETestSuite) QueryCurrentPlan(ctx context.Context, chain ibc.Chain) (upgradetypes.Plan, error) { +// QueryCurrentUpgradePlan queries the currently scheduled upgrade plans. +func (s *E2ETestSuite) QueryCurrentUpgradePlan(ctx context.Context, chain ibc.Chain) (upgradetypes.Plan, error) { queryClient := s.GetChainGRCPClients(chain).UpgradeQueryClient res, err := queryClient.CurrentPlan(ctx, &upgradetypes.QueryCurrentPlanRequest{}) if err != nil { diff --git a/modules/apps/27-interchain-accounts/simulation/proposals.go b/modules/apps/27-interchain-accounts/simulation/proposals.go index 6f99e2dde71..6485aee71a0 100644 --- a/modules/apps/27-interchain-accounts/simulation/proposals.go +++ b/modules/apps/27-interchain-accounts/simulation/proposals.go @@ -36,7 +36,7 @@ func ProposalMsgs() []simtypes.WeightedProposalMsg { } // SimulateHostMsgUpdateParams returns a random MsgUpdateParams for the host module -func SimulateHostMsgUpdateParams(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg { +func SimulateHostMsgUpdateParams(_ *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg { var signer sdk.AccAddress = address.Module("gov") params := types.DefaultParams() params.HostEnabled = false @@ -48,7 +48,7 @@ func SimulateHostMsgUpdateParams(r *rand.Rand, _ sdk.Context, _ []simtypes.Accou } // SimulateControllerMsgUpdateParams returns a random MsgUpdateParams for the controller module -func SimulateControllerMsgUpdateParams(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg { +func SimulateControllerMsgUpdateParams(_ *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg { var signer sdk.AccAddress = address.Module("gov") params := controllertypes.DefaultParams() params.ControllerEnabled = false diff --git a/modules/apps/transfer/simulation/proposals.go b/modules/apps/transfer/simulation/proposals.go index 7f866984aec..deef5ec6edc 100644 --- a/modules/apps/transfer/simulation/proposals.go +++ b/modules/apps/transfer/simulation/proposals.go @@ -30,13 +30,13 @@ func ProposalMsgs() []simtypes.WeightedProposalMsg { } // SimulateMsgUpdateParams returns a random MsgUpdateParams -func SimulateMsgUpdateParams(r *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg { - var signer sdk.AccAddress = address.Module("gov") +func SimulateMsgUpdateParams(_ *rand.Rand, _ sdk.Context, _ []simtypes.Account) sdk.Msg { + var gov sdk.AccAddress = address.Module("gov") params := types.DefaultParams() params.SendEnabled = false return &types.MsgUpdateParams{ - Signer: signer.String(), + Signer: gov.String(), Params: params, } } diff --git a/modules/core/02-client/client/cli/cli.go b/modules/core/02-client/client/cli/cli.go index cb7f93a8fdf..05c79735f44 100644 --- a/modules/core/02-client/client/cli/cli.go +++ b/modules/core/02-client/client/cli/cli.go @@ -44,10 +44,10 @@ func NewTxCmd() *cobra.Command { } txCmd.AddCommand( - NewCreateClientCmd(), - NewUpdateClientCmd(), - NewSubmitMisbehaviourCmd(), // Deprecated - NewUpgradeClientCmd(), + newCreateClientCmd(), + newUpdateClientCmd(), + newSubmitMisbehaviourCmd(), // Deprecated + newUpgradeClientCmd(), newSubmitRecoverClientProposalCmd(), newScheduleIBCUpgradeProposalCmd(), ) diff --git a/modules/core/02-client/client/cli/tx.go b/modules/core/02-client/client/cli/tx.go index a7f41f82265..46d46678742 100644 --- a/modules/core/02-client/client/cli/tx.go +++ b/modules/core/02-client/client/cli/tx.go @@ -25,8 +25,8 @@ import ( const FlagAuthority = "authority" -// NewCreateClientCmd defines the command to create a new IBC light client. -func NewCreateClientCmd() *cobra.Command { +// newCreateClientCmd defines the command to create a new IBC light client. +func newCreateClientCmd() *cobra.Command { cmd := &cobra.Command{ Use: "create [path/to/client_state.json] [path/to/consensus_state.json]", Short: "create new IBC client", @@ -87,8 +87,8 @@ func NewCreateClientCmd() *cobra.Command { return cmd } -// NewUpdateClientCmd defines the command to update an IBC client. -func NewUpdateClientCmd() *cobra.Command { +// newUpdateClientCmd defines the command to update an IBC client. +func newUpdateClientCmd() *cobra.Command { cmd := &cobra.Command{ Use: "update [client-id] [path/to/client_msg.json]", Short: "update existing client with a client message", @@ -132,11 +132,11 @@ func NewUpdateClientCmd() *cobra.Command { return cmd } -// NewSubmitMisbehaviourCmd defines the command to submit a misbehaviour to prevent +// newSubmitMisbehaviourCmd defines the command to submit a misbehaviour to prevent // future updates. // Deprecated: NewSubmitMisbehaviourCmd is deprecated and will be removed in a future release. // Please use NewUpdateClientCmd instead. -func NewSubmitMisbehaviourCmd() *cobra.Command { +func newSubmitMisbehaviourCmd() *cobra.Command { cmd := &cobra.Command{ Use: "misbehaviour [clientID] [path/to/misbehaviour.json]", Short: "submit a client misbehaviour", @@ -179,8 +179,8 @@ func NewSubmitMisbehaviourCmd() *cobra.Command { return cmd } -// NewUpgradeClientCmd defines the command to upgrade an IBC light client. -func NewUpgradeClientCmd() *cobra.Command { +// newUpgradeClientCmd defines the command to upgrade an IBC light client. +func newUpgradeClientCmd() *cobra.Command { cmd := &cobra.Command{ Use: "upgrade [client-identifier] [path/to/client_state.json] [path/to/consensus_state.json] [upgrade-client-proof] [upgrade-consensus-state-proof]", Short: "upgrade an IBC client", @@ -245,15 +245,15 @@ func NewUpgradeClientCmd() *cobra.Command { return cmd } -// newSubmitRecoverClientProposalCmd defines the command to recover an IBC light client +// newSubmitRecoverClientProposalCmd defines the command to recover an IBC light client. func newSubmitRecoverClientProposalCmd() *cobra.Command { cmd := &cobra.Command{ Use: "recover-client [subject-client-id] [substitute-client-id] [flags]", Args: cobra.ExactArgs(2), Short: "recover an IBC client", - Long: "Submit a recover IBC client proposal along with an initial deposit.\n" + - "Please specify a subject client identifier you want to recover.\n" + - "Please specify the substitute client the subject client will be recovered to.", + Long: `Submit a recover IBC client proposal along with an initial deposit + Please specify a subject client identifier you want to recover + Please specify the substitute client the subject client will be recovered to.`, RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { diff --git a/modules/core/02-client/keeper/client.go b/modules/core/02-client/keeper/client.go index f5d03cd39dd..04ea4993366 100644 --- a/modules/core/02-client/keeper/client.go +++ b/modules/core/02-client/keeper/client.go @@ -185,7 +185,7 @@ func (k Keeper) RecoverClient(ctx sdk.Context, subjectClientID, substituteClient } if err := subjectClientState.CheckSubstituteAndUpdateState(ctx, k.cdc, subjectClientStore, substituteClientStore, substituteClientState); err != nil { - return err + return errorsmod.Wrapf(types.ErrValidatingSubstituteClient, "failed to validate substitute client: %s", err) } k.Logger(ctx).Info("client recovered", "client-id", subjectClientID) diff --git a/modules/core/02-client/types/errors.go b/modules/core/02-client/types/errors.go index 3a726378cbc..d060ae6a44b 100644 --- a/modules/core/02-client/types/errors.go +++ b/modules/core/02-client/types/errors.go @@ -36,4 +36,6 @@ var ( ErrClientNotActive = errorsmod.Register(SubModuleName, 29, "client state is not active") ErrFailedMembershipVerification = errorsmod.Register(SubModuleName, 30, "membership verification failed") ErrFailedNonMembershipVerification = errorsmod.Register(SubModuleName, 31, "non-membership verification failed") + ErrSchedulingIBCUpgrade = errorsmod.Register(SubModuleName, 32, "failed to schedule IBC upgrade") + ErrValidatingSubstituteClient = errorsmod.Register(SubModuleName, 33, "failed to validate substitute client") ) diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index 4d313f79c96..250afc19c92 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -127,7 +127,7 @@ func (k Keeper) IBCSoftwareUpgrade(goCtx context.Context, msg *clienttypes.MsgIB } if err = k.ClientKeeper.ScheduleIBCSoftwareUpgrade(ctx, msg.Plan, upgradedClientState); err != nil { - return nil, errorsmod.Wrapf(err, "cannot schedule IBC client upgrade") + return nil, errorsmod.Wrapf(clienttypes.ErrSchedulingIBCUpgrade, "cannot schedule IBC client upgrade: %s", err) } return &clienttypes.MsgIBCSoftwareUpgradeResponse{}, nil From c63ed1811d87314f2ede08f32b17f702a08bce62 Mon Sep 17 00:00:00 2001 From: Charly Date: Wed, 13 Sep 2023 11:02:32 +0200 Subject: [PATCH 34/34] fix tests for error wrapping --- modules/core/02-client/keeper/client.go | 2 +- modules/core/02-client/types/errors.go | 2 -- modules/core/keeper/msg_server.go | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/core/02-client/keeper/client.go b/modules/core/02-client/keeper/client.go index 04ea4993366..d17d41679b8 100644 --- a/modules/core/02-client/keeper/client.go +++ b/modules/core/02-client/keeper/client.go @@ -185,7 +185,7 @@ func (k Keeper) RecoverClient(ctx sdk.Context, subjectClientID, substituteClient } if err := subjectClientState.CheckSubstituteAndUpdateState(ctx, k.cdc, subjectClientStore, substituteClientStore, substituteClientState); err != nil { - return errorsmod.Wrapf(types.ErrValidatingSubstituteClient, "failed to validate substitute client: %s", err) + return errorsmod.Wrap(err, "failed to validate substitute client") } k.Logger(ctx).Info("client recovered", "client-id", subjectClientID) diff --git a/modules/core/02-client/types/errors.go b/modules/core/02-client/types/errors.go index d060ae6a44b..3a726378cbc 100644 --- a/modules/core/02-client/types/errors.go +++ b/modules/core/02-client/types/errors.go @@ -36,6 +36,4 @@ var ( ErrClientNotActive = errorsmod.Register(SubModuleName, 29, "client state is not active") ErrFailedMembershipVerification = errorsmod.Register(SubModuleName, 30, "membership verification failed") ErrFailedNonMembershipVerification = errorsmod.Register(SubModuleName, 31, "non-membership verification failed") - ErrSchedulingIBCUpgrade = errorsmod.Register(SubModuleName, 32, "failed to schedule IBC upgrade") - ErrValidatingSubstituteClient = errorsmod.Register(SubModuleName, 33, "failed to validate substitute client") ) diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index 250afc19c92..922c365842b 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -127,7 +127,7 @@ func (k Keeper) IBCSoftwareUpgrade(goCtx context.Context, msg *clienttypes.MsgIB } if err = k.ClientKeeper.ScheduleIBCSoftwareUpgrade(ctx, msg.Plan, upgradedClientState); err != nil { - return nil, errorsmod.Wrapf(clienttypes.ErrSchedulingIBCUpgrade, "cannot schedule IBC client upgrade: %s", err) + return nil, errorsmod.Wrap(err, "failed to schedule upgrade") } return &clienttypes.MsgIBCSoftwareUpgradeResponse{}, nil