From ffea978766984267a403732a7a57d25e2360fbee Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Tue, 6 Sep 2022 10:45:32 +0200 Subject: [PATCH 1/3] remove custom marshaling --- x/gov/types/v1/proposal.go | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/x/gov/types/v1/proposal.go b/x/gov/types/v1/proposal.go index cb04be0d45a5..2e8f40cafffc 100644 --- a/x/gov/types/v1/proposal.go +++ b/x/gov/types/v1/proposal.go @@ -94,17 +94,6 @@ func ProposalStatusFromString(str string) (ProposalStatus, error) { return ProposalStatus(num), nil } -// Marshal needed for protobuf compatibility -func (status ProposalStatus) Marshal() ([]byte, error) { - return []byte{byte(status)}, nil -} - -// Unmarshal needed for protobuf compatibility -func (status *ProposalStatus) Unmarshal(data []byte) error { - *status = ProposalStatus(data[0]) - return nil -} - // Format implements the fmt.Formatter interface. func (status ProposalStatus) Format(s fmt.State, verb rune) { From 1c2cffa0f425c66e9e2929a6aaf490dc810cd22b Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Tue, 6 Sep 2022 14:21:13 +0200 Subject: [PATCH 2/3] remove custom marshaling inother places --- x/gov/types/v1/vote.go | 11 ----------- x/gov/types/v1beta1/proposal.go | 12 ------------ x/gov/types/v1beta1/vote.go | 11 ----------- 3 files changed, 34 deletions(-) diff --git a/x/gov/types/v1/vote.go b/x/gov/types/v1/vote.go index 94d9ab52de62..b752cb2b4f4c 100644 --- a/x/gov/types/v1/vote.go +++ b/x/gov/types/v1/vote.go @@ -143,17 +143,6 @@ func ValidVoteOption(option VoteOption) bool { return false } -// Marshal needed for protobuf compatibility. -func (vo VoteOption) Marshal() ([]byte, error) { - return []byte{byte(vo)}, nil -} - -// Unmarshal needed for protobuf compatibility. -func (vo *VoteOption) Unmarshal(data []byte) error { - *vo = VoteOption(data[0]) - return nil -} - // Format implements the fmt.Formatter interface. func (vo VoteOption) Format(s fmt.State, verb rune) { switch verb { diff --git a/x/gov/types/v1beta1/proposal.go b/x/gov/types/v1beta1/proposal.go index 09b6db0041e5..daecf3b5d1e4 100644 --- a/x/gov/types/v1beta1/proposal.go +++ b/x/gov/types/v1beta1/proposal.go @@ -137,19 +137,7 @@ func ProposalStatusFromString(str string) (ProposalStatus, error) { return ProposalStatus(num), nil } -// Marshal needed for protobuf compatibility -func (status ProposalStatus) Marshal() ([]byte, error) { - return []byte{byte(status)}, nil -} - -// Unmarshal needed for protobuf compatibility -func (status *ProposalStatus) Unmarshal(data []byte) error { - *status = ProposalStatus(data[0]) - return nil -} - // Format implements the fmt.Formatter interface. - func (status ProposalStatus) Format(s fmt.State, verb rune) { switch verb { case 's': diff --git a/x/gov/types/v1beta1/vote.go b/x/gov/types/v1beta1/vote.go index c5b60b5fc0d9..ecec54e490d5 100644 --- a/x/gov/types/v1beta1/vote.go +++ b/x/gov/types/v1beta1/vote.go @@ -129,17 +129,6 @@ func ValidVoteOption(option VoteOption) bool { return false } -// Marshal needed for protobuf compatibility. -func (vo VoteOption) Marshal() ([]byte, error) { - return []byte{byte(vo)}, nil -} - -// Unmarshal needed for protobuf compatibility. -func (vo *VoteOption) Unmarshal(data []byte) error { - *vo = VoteOption(data[0]) - return nil -} - // Format implements the fmt.Formatter interface. func (vo VoteOption) Format(s fmt.State, verb rune) { switch verb { From 839dd3a1f62506ce3b358de5c0fd394eca5d9873 Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Tue, 6 Sep 2022 14:28:04 +0200 Subject: [PATCH 3/3] add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fced6ba736f..be10bdce3055 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -127,6 +127,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/genutil)[#12956](https://github.com/cosmos/cosmos-sdk/pull/12956) `genutil.AppModuleBasic` has a new attribute: genesis transaction validation function. The existing validation logic is implemented in `genutiltypes.DefaultMessageValidator`. Use `genutil.NewAppModuleBasic` to create a new genutil Module Basic. * (codec) [#12964](https://github.com/cosmos/cosmos-sdk/pull/12964) `ProtoCodec.MarshalInterface` now returns an error when serializing unregistered types and a subsequent `ProtoCodec.UnmarshalInterface` would fail. * (x/staking) [#12973](https://github.com/cosmos/cosmos-sdk/pull/12973) Removed `stakingkeeper.RandomValidator`. Use `testutil.RandSliceElem(r, sk.GetAllValidators(ctx))` instead. +* (x/gov) [13160](https://github.com/cosmos/cosmos-sdk/pull/13160) Remove custom marshaling of proposl and voteoption. ### CLI Breaking Changes