Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove custom marshaling of proposal status #13160

Merged
merged 4 commits into from
Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 0 additions & 11 deletions x/gov/types/v1/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
tac0turtle marked this conversation as resolved.
Show resolved Hide resolved
return []byte{byte(status)}, nil
}

// Unmarshal needed for protobuf compatibility
func (status *ProposalStatus) Unmarshal(data []byte) error {
tac0turtle marked this conversation as resolved.
Show resolved Hide resolved
*status = ProposalStatus(data[0])
return nil
}

// Format implements the fmt.Formatter interface.

func (status ProposalStatus) Format(s fmt.State, verb rune) {
Expand Down
11 changes: 0 additions & 11 deletions x/gov/types/v1/vote.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 0 additions & 12 deletions x/gov/types/v1beta1/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down
11 changes: 0 additions & 11 deletions x/gov/types/v1beta1/vote.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down