fix(x/upgrade): register missing implementation for CancelSoftwareUpgradeProposal (backport #23378) (#23412)

Co-authored-by: mmsqe <mavis@crypto.com>
This commit is contained in:
mergify[bot] 2025-01-16 10:23:43 +01:00 committed by GitHub
parent 4426a9792b
commit be0c895b67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 32 additions and 4 deletions

View File

@ -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

View File

@ -28,5 +28,9 @@ func RegisterInterfaces(registrar registry.InterfaceRegistrar) {
(*v1beta1.Content)(nil),
&SoftwareUpgradeProposal{},
)
registrar.RegisterImplementations(
(*v1beta1.Content)(nil),
&CancelSoftwareUpgradeProposal{},
)
msgservice.RegisterMsgServiceDesc(registrar, &_Msg_serviceDesc)
}

View File

@ -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)))
}

View File

@ -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) }