diff --git a/x/upgrade/CHANGELOG.md b/x/upgrade/CHANGELOG.md index 4e0521d344..6d84386e94 100644 --- a/x/upgrade/CHANGELOG.md +++ b/x/upgrade/CHANGELOG.md @@ -27,6 +27,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes * (x/upgrade) [#23179](https://github.com/cosmos/cosmos-sdk/pull/23179) Register missing implementation for SoftwareUpgradeProposal to avoid no concrete type registered for type URL /cosmos.upgrade.v1beta1.SoftwareUpgradeProposal against interface *v1beta1.Content error. +* (x/upgrade) [#23378](https://github.com/cosmos/cosmos-sdk/pull/23378) Register missing implementation for CancelSoftwareUpgradeProposal to avoid no concrete type registered for type URL /cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal against interface *v1beta1.Content error. ## [v0.2.0-rc.1](https://github.com/cosmos/cosmos-sdk/releases/tag/x/upgrade/v0.2.0-rc.1) - 2024-12-18 diff --git a/x/upgrade/types/codec.go b/x/upgrade/types/codec.go index abfd8a8560..02ddc5f10d 100644 --- a/x/upgrade/types/codec.go +++ b/x/upgrade/types/codec.go @@ -28,5 +28,9 @@ func RegisterInterfaces(registrar registry.InterfaceRegistrar) { (*v1beta1.Content)(nil), &SoftwareUpgradeProposal{}, ) + registrar.RegisterImplementations( + (*v1beta1.Content)(nil), + &CancelSoftwareUpgradeProposal{}, + ) msgservice.RegisterMsgServiceDesc(registrar, &_Msg_serviceDesc) } diff --git a/x/upgrade/types/codec_test.go b/x/upgrade/types/codec_test.go index 27198d1d12..a1c0387d27 100644 --- a/x/upgrade/types/codec_test.go +++ b/x/upgrade/types/codec_test.go @@ -25,9 +25,17 @@ func TestInterfaceRegistrationOfContent(t *testing.T) { }) require.NoError(t, err) RegisterInterfaces(registrar) - val := &gogoprotoany.Any{ - TypeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", - Value: []byte{}, + testCases := []struct { + typeUrl string + }{ + {"/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal"}, + {"/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal"}, + } + for _, tc := range testCases { + val := &gogoprotoany.Any{ + TypeUrl: tc.typeUrl, + Value: []byte{}, + } + require.NoError(t, registrar.UnpackAny(val, new(v1beta1.Content))) } - require.NoError(t, registrar.UnpackAny(val, new(v1beta1.Content))) } diff --git a/x/upgrade/types/proposal.go b/x/upgrade/types/proposal.go index 0df833c9f7..ca8f5a8820 100644 --- a/x/upgrade/types/proposal.go +++ b/x/upgrade/types/proposal.go @@ -19,3 +19,18 @@ func (sp *SoftwareUpgradeProposal) ProposalType() string { return v1beta1.Propos // ValidateBasic validates the content's title and description of the proposal func (sp *SoftwareUpgradeProposal) ValidateBasic() error { return v1beta1.ValidateAbstract(sp) } + +// GetTitle returns the proposal title +func (cp *CancelSoftwareUpgradeProposal) GetTitle() string { return cp.Title } + +// GetDescription returns the proposal description +func (cp *CancelSoftwareUpgradeProposal) GetDescription() string { return cp.Description } + +// ProposalRoute returns the proposal router key +func (cp *CancelSoftwareUpgradeProposal) ProposalRoute() string { return types.RouterKey } + +// ProposalType is "Text" +func (cp *CancelSoftwareUpgradeProposal) ProposalType() string { return v1beta1.ProposalTypeText } + +// ValidateBasic validates the content's title and description of the proposal +func (cp *CancelSoftwareUpgradeProposal) ValidateBasic() error { return v1beta1.ValidateAbstract(cp) }