From e76766a86e19fc32db66ad02ccd9ce2467301aa6 Mon Sep 17 00:00:00 2001 From: DimitrisJim Date: Tue, 9 Jul 2024 17:50:40 +0300 Subject: [PATCH] chore: remove legacy proposal types. (#6782) --- e2e/tests/core/02-client/client_test.go | 29 - e2e/tests/wasm/feature_releases.go | 4 - e2e/tests/wasm/grandpa_test.go | 19 +- modules/core/02-client/types/client.pb.go | 733 +----------------- modules/core/02-client/types/codec.go | 6 - modules/core/02-client/types/codec_test.go | 10 - .../core/02-client/types/legacy_proposal.go | 150 ---- .../02-client/types/legacy_proposal_test.go | 86 -- .../core/23-commitment/types/commitment.pb.go | 1 + proto/ibc/core/client/v1/client.proto | 50 -- 10 files changed, 36 insertions(+), 1052 deletions(-) delete mode 100644 modules/core/02-client/types/legacy_proposal.go delete mode 100644 modules/core/02-client/types/legacy_proposal_test.go diff --git a/e2e/tests/core/02-client/client_test.go b/e2e/tests/core/02-client/client_test.go index 72f12d14ddb..8e17c25328b 100644 --- a/e2e/tests/core/02-client/client_test.go +++ b/e2e/tests/core/02-client/client_test.go @@ -72,7 +72,6 @@ func (s *ClientTestSuite) TestScheduleIBCUpgrade_Succeeds() { chainAWallet := s.CreateUserOnChainA(ctx, testvalues.StartingTokenAmount) const planHeight = int64(300) - const legacyPlanHeight = planHeight * 2 var newChainID string t.Run("execute proposal for MsgIBCSoftwareUpgrade", func(t *testing.T) { @@ -130,34 +129,6 @@ func (s *ClientTestSuite) TestScheduleIBCUpgrade_Succeeds() { s.Require().Equal("upgrade-client", plan.Name) s.Require().Equal(planHeight, plan.Height) }) - - t.Run("ensure legacy proposal does not succeed", func(t *testing.T) { - authority, err := query.ModuleAccountAddress(ctx, govtypes.ModuleName, chainA) - s.Require().NoError(err) - s.Require().NotNil(authority) - - clientState, err := query.ClientState(ctx, chainB, ibctesting.FirstClientID) - s.Require().NoError(err) - - originalChainID := clientState.(*ibctm.ClientState).ChainId - revisionNumber := clienttypes.ParseChainID(originalChainID) - // increment revision number even with new chain ID to prevent loss of misbehaviour detection support - newChainID, err = clienttypes.SetRevisionNumber(originalChainID, revisionNumber+1) - s.Require().NoError(err) - s.Require().NotEqual(originalChainID, newChainID) - - upgradedClientState := clientState.(*ibctm.ClientState).ZeroCustomFields() - upgradedClientState.ChainId = newChainID - - legacyUpgradeProposal, err := clienttypes.NewUpgradeProposal(ibctesting.Title, ibctesting.Description, upgradetypes.Plan{ - Name: "upgrade-client-legacy", - Height: legacyPlanHeight, - }, upgradedClientState) - - s.Require().NoError(err) - txResp := s.ExecuteGovV1Beta1Proposal(ctx, chainA, chainAWallet, legacyUpgradeProposal) - s.AssertTxFailure(txResp, govtypes.ErrInvalidProposalContent) - }) } // TestRecoverClient_Succeeds tests that a governance proposal to recover a client using a MsgRecoverClient is successful. diff --git a/e2e/tests/wasm/feature_releases.go b/e2e/tests/wasm/feature_releases.go index 69c51f55389..3972369999a 100644 --- a/e2e/tests/wasm/feature_releases.go +++ b/e2e/tests/wasm/feature_releases.go @@ -2,10 +2,6 @@ package wasm import "github.com/cosmos/ibc-go/e2e/semverutil" -var govV1FeatureReleases = semverutil.FeatureReleases{ - MajorVersion: "v8", -} - var govV1FailedReasonFeatureReleases = semverutil.FeatureReleases{ MajorVersion: "v8", } diff --git a/e2e/tests/wasm/grandpa_test.go b/e2e/tests/wasm/grandpa_test.go index 09739bb4054..85ab14aac47 100644 --- a/e2e/tests/wasm/grandpa_test.go +++ b/e2e/tests/wasm/grandpa_test.go @@ -31,7 +31,6 @@ import ( transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" - ibctesting "github.com/cosmos/ibc-go/v8/testing" ) const ( @@ -548,19 +547,13 @@ func (s *GrandpaTestSuite) TestRecoverClient_Succeeds_GrandpaContract() { s.Require().NoError(err) s.Require().Equal(ibcexported.Active.String(), status, "unexpected substitute client status") - version := cosmosChain.Nodes()[0].Image.Version - if govV1FeatureReleases.IsSupported(version) { - // create and execute a client recovery proposal - authority, err := query.ModuleAccountAddress(ctx, govtypes.ModuleName, cosmosChain) - s.Require().NoError(err) + // create and execute a client recovery proposal + authority, err := query.ModuleAccountAddress(ctx, govtypes.ModuleName, cosmosChain) + s.Require().NoError(err) - msgRecoverClient := clienttypes.NewMsgRecoverClient(authority.String(), subjectClientID, substituteClientID) - s.Require().NotNil(msgRecoverClient) - s.ExecuteAndPassGovV1Proposal(ctx, msgRecoverClient, cosmosChain, cosmosUser) - } else { - proposal := clienttypes.NewClientUpdateProposal(ibctesting.Title, ibctesting.Description, subjectClientID, substituteClientID) - s.ExecuteAndPassGovV1Beta1Proposal(ctx, cosmosChain, cosmosWallet, proposal) - } + msgRecoverClient := clienttypes.NewMsgRecoverClient(authority.String(), subjectClientID, substituteClientID) + s.Require().NotNil(msgRecoverClient) + s.ExecuteAndPassGovV1Proposal(ctx, msgRecoverClient, cosmosChain, cosmosUser) // ensure subject client is active status, err = query.ClientStatus(ctx, cosmosChain, subjectClientID) diff --git a/modules/core/02-client/types/client.pb.go b/modules/core/02-client/types/client.pb.go index 0405c0e792a..954b4aba6d6 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" @@ -291,202 +289,48 @@ func (m *Params) GetAllowedClients() []string { return nil } -// ClientUpdateProposal is a legacy 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). -// -// Deprecated: Please use MsgRecoverClient in favour of this message type. -// -// Deprecated: Do not use. -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" yaml:"subject_client_id"` - // 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" yaml:"substitute_client_id"` -} - -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{5} -} -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. -// -// Deprecated: Please use MsgIBCSoftwareUpgrade in favour of this message type. -// -// Deprecated: Do not use. -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" yaml:"upgraded_client_state"` -} - -func (m *UpgradeProposal) Reset() { *m = UpgradeProposal{} } -func (*UpgradeProposal) ProtoMessage() {} -func (*UpgradeProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_b6bc4c8185546947, []int{6} -} -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 - 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((*Height)(nil), "ibc.core.client.v1.Height") proto.RegisterType((*Params)(nil), "ibc.core.client.v1.Params") - proto.RegisterType((*ClientUpdateProposal)(nil), "ibc.core.client.v1.ClientUpdateProposal") - proto.RegisterType((*UpgradeProposal)(nil), "ibc.core.client.v1.UpgradeProposal") } func init() { proto.RegisterFile("ibc/core/client/v1/client.proto", fileDescriptor_b6bc4c8185546947) } var fileDescriptor_b6bc4c8185546947 = []byte{ - // 677 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x4d, 0x6b, 0x13, 0x41, - 0x18, 0xce, 0xa6, 0x31, 0x34, 0x13, 0x69, 0x74, 0x4d, 0x61, 0x4d, 0x4b, 0x36, 0x2c, 0x05, 0x73, - 0x68, 0x77, 0x4d, 0x04, 0x2d, 0x01, 0x0f, 0xa6, 0x97, 0xf6, 0x22, 0x75, 0xa5, 0x08, 0x82, 0x84, - 0xfd, 0x98, 0x6e, 0xa6, 0xec, 0xce, 0x2c, 0x3b, 0xb3, 0x91, 0xfc, 0x03, 0x8f, 0x8a, 0x17, 0xc1, - 0x4b, 0x7f, 0x84, 0x3f, 0xa2, 0x78, 0xea, 0xd1, 0x53, 0x90, 0xf6, 0xe2, 0xb9, 0xbf, 0x40, 0x76, - 0x3e, 0x6c, 0x63, 0x5a, 0x15, 0xbc, 0xcd, 0xfb, 0xcc, 0x33, 0xef, 0xfb, 0xcc, 0x33, 0xf3, 0xbe, - 0xc0, 0x44, 0x7e, 0xe0, 0x04, 0x24, 0x83, 0x4e, 0x10, 0x23, 0x88, 0x99, 0x33, 0xe9, 0xc9, 0x95, - 0x9d, 0x66, 0x84, 0x11, 0x5d, 0x47, 0x7e, 0x60, 0x17, 0x04, 0x5b, 0xc2, 0x93, 0x5e, 0x6b, 0x23, - 0x20, 0x34, 0x21, 0xd4, 0xc9, 0xd3, 0x28, 0xf3, 0x42, 0xe8, 0x4c, 0x7a, 0x3e, 0x64, 0x5e, 0x4f, - 0xc5, 0xe2, 0x64, 0xeb, 0xbe, 0x60, 0x8d, 0x78, 0xe4, 0x88, 0x40, 0x6e, 0x35, 0x23, 0x12, 0x11, - 0x81, 0x17, 0x2b, 0x75, 0x20, 0x22, 0x24, 0x8a, 0xa1, 0xc3, 0x23, 0x3f, 0x3f, 0x74, 0x3c, 0x3c, - 0x15, 0x5b, 0x56, 0x02, 0x56, 0xf7, 0x42, 0x88, 0x19, 0x3a, 0x44, 0x30, 0xdc, 0xe1, 0x42, 0x5e, - 0x32, 0x8f, 0x41, 0x7d, 0x0d, 0xd4, 0x84, 0xae, 0x11, 0x0a, 0x0d, 0xad, 0xa3, 0x75, 0x6b, 0xee, - 0xb2, 0x00, 0xf6, 0x42, 0xfd, 0x09, 0xb8, 0x2d, 0x37, 0x69, 0x41, 0x36, 0xca, 0x1d, 0xad, 0x5b, - 0xef, 0x37, 0x6d, 0x51, 0xc7, 0x56, 0x75, 0xec, 0x67, 0x78, 0xea, 0xd6, 0x83, 0xcb, 0xac, 0xd6, - 0x47, 0x0d, 0x18, 0x3b, 0x04, 0x53, 0x88, 0x69, 0x4e, 0x39, 0xf4, 0x0a, 0xb1, 0xf1, 0x2e, 0x44, - 0xd1, 0x98, 0xe9, 0xdb, 0xa0, 0x3a, 0xe6, 0x2b, 0x5e, 0xaf, 0xde, 0x6f, 0xd9, 0x8b, 0x16, 0xd9, - 0x82, 0x3b, 0xac, 0x9c, 0xcc, 0xcc, 0x92, 0x2b, 0xf9, 0xfa, 0x53, 0xd0, 0x08, 0x54, 0xd6, 0x7f, - 0x90, 0xb4, 0x12, 0xcc, 0x49, 0x28, 0x54, 0xad, 0x8a, 0xbb, 0xcf, 0x6b, 0xa3, 0x7f, 0x76, 0xe1, - 0x0d, 0xb8, 0xf3, 0x5b, 0x55, 0x6a, 0x94, 0x3b, 0x4b, 0xdd, 0x7a, 0x7f, 0xf3, 0x3a, 0xe5, 0x37, - 0xdd, 0x5b, 0xde, 0xa5, 0x31, 0x2f, 0x8a, 0x5a, 0x21, 0xa8, 0x4a, 0x63, 0x1e, 0x80, 0x46, 0x06, - 0x27, 0x88, 0x22, 0x82, 0x47, 0x38, 0x4f, 0x7c, 0x98, 0x71, 0x2d, 0x15, 0x77, 0x45, 0xc1, 0xcf, - 0x39, 0x3a, 0x47, 0x94, 0x56, 0x96, 0xe7, 0x89, 0x22, 0xe3, 0x60, 0xf9, 0xdd, 0xb1, 0x59, 0xfa, - 0x74, 0x6c, 0x96, 0xac, 0x1e, 0xa8, 0xee, 0x7b, 0x99, 0x97, 0xd0, 0xe2, 0xb0, 0x17, 0xc7, 0xe4, - 0x2d, 0x0c, 0x47, 0x42, 0x34, 0x35, 0xb4, 0xce, 0x52, 0xb7, 0xe6, 0xae, 0x48, 0x58, 0x58, 0x44, - 0xad, 0x0f, 0x65, 0xd0, 0x14, 0xeb, 0x83, 0x34, 0xf4, 0x18, 0xdc, 0xcf, 0x48, 0x4a, 0xa8, 0x17, - 0xeb, 0x4d, 0x70, 0x8b, 0x21, 0x16, 0x43, 0xe9, 0x94, 0x08, 0xf4, 0x0e, 0xa8, 0x87, 0x90, 0x06, - 0x19, 0x4a, 0x19, 0x22, 0x98, 0x0b, 0xaa, 0xb9, 0x57, 0x21, 0x7d, 0x17, 0xdc, 0xa5, 0xb9, 0x7f, - 0x04, 0x03, 0x36, 0xba, 0x74, 0x7b, 0xa9, 0xe0, 0x0d, 0xd7, 0x2f, 0x66, 0xa6, 0x31, 0xf5, 0x92, - 0x78, 0x60, 0x2d, 0x50, 0x2c, 0xb7, 0x21, 0xb1, 0x1d, 0xf5, 0x24, 0x2f, 0x40, 0x93, 0xe6, 0x3e, - 0x65, 0x88, 0xe5, 0x0c, 0x5e, 0x49, 0x56, 0xe1, 0xc9, 0xcc, 0x8b, 0x99, 0xb9, 0xf6, 0x2b, 0xd9, - 0x02, 0xcb, 0x72, 0xf5, 0x4b, 0x58, 0xa5, 0x1c, 0x6c, 0x14, 0x56, 0x7d, 0xfd, 0xb2, 0xd5, 0x92, - 0x8d, 0x16, 0x91, 0x89, 0x2d, 0xfb, 0xb2, 0x78, 0x52, 0x06, 0x31, 0x33, 0x34, 0xeb, 0x73, 0x19, - 0x34, 0x0e, 0x44, 0x97, 0xfe, 0xb7, 0x1d, 0x8f, 0x41, 0x25, 0x8d, 0x3d, 0xcc, 0x1d, 0xa8, 0xf7, - 0xd7, 0x6d, 0x59, 0x58, 0x0d, 0x01, 0x55, 0x7c, 0x3f, 0xf6, 0xb0, 0xfc, 0x3b, 0x9c, 0xaf, 0x1f, - 0x81, 0x55, 0xc9, 0x51, 0x2f, 0x28, 0x7b, 0xa1, 0x72, 0x73, 0x2f, 0x0c, 0x3b, 0x17, 0x33, 0x73, - 0x5d, 0x78, 0x72, 0xed, 0x61, 0xcb, 0xbd, 0xa7, 0xf0, 0x2b, 0xe3, 0x61, 0xb0, 0xa9, 0x3e, 0xd0, - 0x8f, 0x63, 0x53, 0xfb, 0x9b, 0x3b, 0x43, 0xf7, 0xe4, 0xac, 0xad, 0x9d, 0x9e, 0xb5, 0xb5, 0xef, - 0x67, 0x6d, 0xed, 0xfd, 0x79, 0xbb, 0x74, 0x7a, 0xde, 0x2e, 0x7d, 0x3b, 0x6f, 0x97, 0x5e, 0x6f, - 0x47, 0x88, 0x8d, 0x73, 0xdf, 0x0e, 0x48, 0x22, 0x27, 0x99, 0x83, 0xfc, 0x60, 0x2b, 0x22, 0xce, - 0x64, 0xdb, 0x49, 0x48, 0x98, 0xc7, 0x90, 0x8a, 0x31, 0xfa, 0xb0, 0xbf, 0x25, 0x27, 0x29, 0x9b, - 0xa6, 0x90, 0xfa, 0x55, 0x7e, 0x8d, 0x47, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x1a, 0x80, 0x51, - 0x2a, 0x69, 0x05, 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, 0x07, 0x8b, 0xe0, 0xc1, 0xdd, 0x8b, 0x7b, 0x11, 0x89, 0x07, 0x41, 0x90, 0x92, + 0x4c, 0x66, 0x93, 0x81, 0x64, 0x66, 0xc9, 0x4c, 0x22, 0xfd, 0x0f, 0x3c, 0x0a, 0x5e, 0x3c, 0xee, + 0x9f, 0xb3, 0xc7, 0x3d, 0x7a, 0x12, 0x69, 0xff, 0x11, 0xc9, 0xcc, 0x14, 0x89, 0xbf, 0xd8, 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, 0xaa, 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, 0x97, 0x38, 0xe1, 0x1b, 0xd3, 0x0a, 0x2a, 0x78, + 0x72, 0x91, 0x51, 0xae, 0xd8, 0x25, 0xa3, 0xd9, 0xb9, 0xd6, 0x79, 0xab, 0x12, 0x45, 0xdd, 0x87, + 0x70, 0x64, 0x64, 0xd7, 0x2c, 0xf3, 0xc0, 0x02, 0x84, 0xa3, 0xf8, 0xc8, 0x00, 0x17, 0x99, 0xfb, + 0x0c, 0xde, 0xb3, 0x4d, 0xd9, 0x91, 0xbd, 0xc1, 0x02, 0x84, 0xe3, 0xe8, 0x18, 0x99, 0x39, 0x68, + 0x3f, 0x07, 0xbd, 0xe4, 0x9b, 0x78, 0x4c, 0x7e, 0xa9, 0x06, 0x5f, 0x00, 0xf4, 0xce, 0x05, 0x97, + 0x94, 0xcb, 0x46, 0x6a, 0xe8, 0x1d, 0x53, 0xc5, 0x2b, 0xca, 0xf2, 0x42, 0xb9, 0x2b, 0x38, 0x2c, + 0x74, 0xa5, 0xe7, 0x8d, 0xa3, 0x19, 0xfa, 0x73, 0x43, 0x64, 0xb8, 0x67, 0x87, 0x37, 0xdf, 0xe7, + 0x4e, 0x6c, 0xf9, 0xee, 0x0b, 0x38, 0x25, 0x7b, 0xd5, 0x3b, 0x58, 0x9a, 0x90, 0x9e, 0x85, 0xce, + 0xd5, 0x89, 0xd9, 0xbd, 0xef, 0x4d, 0xfe, 0x3f, 0x85, 0x0f, 0xf0, 0xfe, 0x6f, 0x53, 0xa5, 0x37, + 0x58, 0x1c, 0x84, 0xe3, 0xe8, 0xf1, 0xdf, 0x9c, 0xff, 0x6b, 0x6f, 0xbb, 0xcb, 0xb4, 0x6f, 0x4a, + 0x06, 0x19, 0x1c, 0xda, 0x60, 0x1e, 0xc1, 0x69, 0x4d, 0x5b, 0x26, 0x99, 0xe0, 0x6b, 0xde, 0x54, + 0x29, 0xad, 0xb5, 0x97, 0xc3, 0x78, 0xb2, 0x87, 0x5f, 0x6b, 0xb4, 0x47, 0xb4, 0x51, 0x0e, 0xfa, + 0x44, 0xa3, 0xf8, 0xfc, 0xe8, 0xd3, 0xf5, 0xdc, 0xf9, 0x7a, 0x3d, 0x77, 0x82, 0x25, 0x1c, 0xbe, + 0x49, 0xea, 0xa4, 0x92, 0xdd, 0xcf, 0x49, 0x59, 0x8a, 0x8f, 0x34, 0x5b, 0x1b, 0xd3, 0xd2, 0x03, + 0x8b, 0x83, 0x70, 0x14, 0x4f, 0x2c, 0x6c, 0x22, 0x92, 0x67, 0xf1, 0xcd, 0xd6, 0x07, 0xb7, 0x5b, + 0x1f, 0xfc, 0xd8, 0xfa, 0xe0, 0xf3, 0xce, 0x77, 0x6e, 0x77, 0xbe, 0xf3, 0x6d, 0xe7, 0x3b, 0xef, + 0x57, 0x39, 0x53, 0x45, 0x93, 0x22, 0x22, 0x2a, 0x4c, 0x84, 0xac, 0x84, 0xc4, 0x2c, 0x25, 0xa7, + 0xb9, 0xc0, 0xed, 0x0a, 0x57, 0x22, 0x6b, 0x4a, 0x2a, 0xcd, 0x4d, 0x3f, 0x89, 0x4e, 0xed, 0x59, + 0xab, 0xcd, 0x15, 0x95, 0xe9, 0x50, 0x3f, 0xd0, 0xd3, 0x9f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x17, + 0x37, 0x3f, 0x66, 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) @@ -683,116 +527,6 @@ func (m *Params) 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) - 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 encodeVarintClient(dAtA []byte, offset int, v uint64) int { offset -= sovClient(v) base := offset @@ -885,54 +619,6 @@ func (m *Params) 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 - } - 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 sovClient(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1462,367 +1148,6 @@ func (m *Params) 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 - 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 skipClient(dAtA []byte) (n int, err 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 e70c0682300..fde4fee4e80 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" - govtypesv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ibcerrors "github.com/cosmos/ibc-go/v8/modules/core/errors" "github.com/cosmos/ibc-go/v8/modules/core/exported" @@ -47,11 +46,6 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { &MsgIBCSoftwareUpgrade{}, &MsgUpdateParams{}, ) - registry.RegisterImplementations( - (*govtypesv1beta1.Content)(nil), - &ClientUpdateProposal{}, - &UpgradeProposal{}, - ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } diff --git a/modules/core/02-client/types/codec_test.go b/modules/core/02-client/types/codec_test.go index 914f525eec9..7c814eaea76 100644 --- a/modules/core/02-client/types/codec_test.go +++ b/modules/core/02-client/types/codec_test.go @@ -206,16 +206,6 @@ func (suite *TypesTestSuite) TestCodecTypeRegistration() { sdk.MsgTypeURL(&types.MsgUpdateParams{}), true, }, - { - "success: ClientUpdateProposal", - sdk.MsgTypeURL(&types.ClientUpdateProposal{}), - true, - }, - { - "success: UpgradeProposal", - sdk.MsgTypeURL(&types.UpgradeProposal{}), - true, - }, { "type not registered on codec", "ibc.invalid.MsgTypeURL", diff --git a/modules/core/02-client/types/legacy_proposal.go b/modules/core/02-client/types/legacy_proposal.go deleted file mode 100644 index 05254354695..00000000000 --- a/modules/core/02-client/types/legacy_proposal.go +++ /dev/null @@ -1,150 +0,0 @@ -package types - -import ( - "fmt" - - 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/v8/modules/core/exported" -) - -const ( - // ProposalTypeClientUpdate defines the type for a ClientUpdateProposal - ProposalTypeClientUpdate = "ClientUpdate" - // ProposalTypeUpgrade defines the type for an UpgradeProposal - ProposalTypeUpgrade = "IBCUpgrade" -) - -var ( - _ govtypes.Content = &ClientUpdateProposal{} - _ govtypes.Content = &UpgradeProposal{} - _ codectypes.UnpackInterfacesMessage = &UpgradeProposal{} -) - -func init() { - govtypes.RegisterProposalType(ProposalTypeClientUpdate) - govtypes.RegisterProposalType(ProposalTypeUpgrade) -} - -// NewClientUpdateProposal creates a new client update proposal. -// -// Deprecated: The legacy v1beta1 gov ClientUpdateProposal is deprecated -// and will be removed in a future release. Please use MsgRecoverClient instead. -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. -// -// Deprecated: The legacy v1beta1 gov UpgradeProposal is deprecated -// and will be removed in a future release. Please use MsgIBCSoftwareUpgrade instead. -func NewUpgradeProposal(title, description string, plan upgradetypes.Plan, upgradedClientState exported.ClientState) (govtypes.Content, error) { - clientAny, err := PackClientState(upgradedClientState) - if err != nil { - return nil, err - } - - return &UpgradeProposal{ - Title: title, - Description: description, - Plan: plan, - UpgradedClientState: clientAny, - }, 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") - } - - _, err := UnpackClientState(up.UpgradedClientState) - if err != nil { - return errorsmod.Wrap(err, "failed to unpack upgraded client state") - } - - 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/legacy_proposal_test.go b/modules/core/02-client/types/legacy_proposal_test.go deleted file mode 100644 index a3724616edd..00000000000 --- a/modules/core/02-client/types/legacy_proposal_test.go +++ /dev/null @@ -1,86 +0,0 @@ -package types_test - -import ( - "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/v8/modules/core/02-client/types" - ibctesting "github.com/cosmos/ibc-go/v8/testing" -) - -func (suite *TypesTestSuite) TestValidateBasic() { - subjectPath := ibctesting.NewPath(suite.chainA, suite.chainB) - subjectPath.SetupClients() - subject := subjectPath.EndpointA.ClientID - - substitutePath := ibctesting.NewPath(suite.chainA, suite.chainB) - substitutePath.SetupClients() - 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, ok := proposal.(*types.ClientUpdateProposal) - suite.Require().True(ok) - bz, err := cdc.MarshalJSON(content) - suite.Require().NoError(err) - - // unmarshal proposal - newProposal := &types.ClientUpdateProposal{} - err = cdc.UnmarshalJSON(bz, newProposal) - suite.Require().NoError(err) -} diff --git a/modules/core/23-commitment/types/commitment.pb.go b/modules/core/23-commitment/types/commitment.pb.go index bf95874a8ac..37fabb046e4 100644 --- a/modules/core/23-commitment/types/commitment.pb.go +++ b/modules/core/23-commitment/types/commitment.pb.go @@ -113,6 +113,7 @@ func (m *MerklePrefix) GetKeyPrefix() []byte { // MerklePath is the path used to verify commitment proofs, which can be an // arbitrary structured object (defined by a commitment type). // MerklePath is represented from root-to-leaf +// Deprecated: Please use commitment/v2 MerklePath instead which supports non UTF-8 key paths. type MerklePath struct { KeyPath []string `protobuf:"bytes,1,rep,name=key_path,json=keyPath,proto3" json:"key_path,omitempty"` } diff --git a/proto/ibc/core/client/v1/client.proto b/proto/ibc/core/client/v1/client.proto index 7a09e360ace..5da8f86a3a2 100644 --- a/proto/ibc/core/client/v1/client.proto +++ b/proto/ibc/core/client/v1/client.proto @@ -4,8 +4,6 @@ package ibc.core.client.v1; option go_package = "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"; -import "cosmos/upgrade/v1beta1/upgrade.proto"; -import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; @@ -63,51 +61,3 @@ message Params { // of this client will be disabled until it is added again to the list. repeated string allowed_clients = 1; } - -// ClientUpdateProposal is a legacy 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). -// -// Deprecated: Please use MsgRecoverClient in favour of this message type. -message ClientUpdateProposal { - option deprecated = true; - - option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; - option (gogoproto.goproto_getters) = false; - - // 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 [(gogoproto.moretags) = "yaml:\"subject_client_id\""]; - // the substitute client identifier for the client standing in for the subject - // client - string substitute_client_id = 4 [(gogoproto.moretags) = "yaml:\"substitute_client_id\""]; -} - -// UpgradeProposal is a gov Content type for initiating an IBC breaking -// upgrade. -// -// Deprecated: Please use MsgIBCSoftwareUpgrade in favour of this message type. -message UpgradeProposal { - option deprecated = true; - - option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content"; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; - option (gogoproto.equal) = true; - - 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 [(gogoproto.moretags) = "yaml:\"upgraded_client_state\""]; -}