Skip to content

Commit

Permalink
fix(x/upgrade): register missing implementation for CancelSoftwareUpg…
Browse files Browse the repository at this point in the history
…radeProposal (#23378)
  • Loading branch information
mmsqe authored Jan 16, 2025
1 parent 6ffebdf commit 85682ac
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
1 change: 1 addition & 0 deletions x/upgrade/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions x/upgrade/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,9 @@ func RegisterInterfaces(registrar registry.InterfaceRegistrar) {
(*v1beta1.Content)(nil),
&SoftwareUpgradeProposal{},
)
registrar.RegisterImplementations(
(*v1beta1.Content)(nil),
&CancelSoftwareUpgradeProposal{},
)
msgservice.RegisterMsgServiceDesc(registrar, &_Msg_serviceDesc)
}
16 changes: 12 additions & 4 deletions x/upgrade/types/codec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
}
15 changes: 15 additions & 0 deletions x/upgrade/types/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) }

0 comments on commit 85682ac

Please sign in to comment.