Skip to content

Commit

Permalink
fix: rawlog JSON formatting of proposal_vote option field (#16231)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimiandre committed May 19, 2023
1 parent 05cf824 commit bda51f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (x/crypto) [#15258](https://github.com/cosmos/cosmos-sdk/pull/15258) Write keyhash file with permissions 0600 instead of 0555.
* (cli) [#16138](https://github.com/cosmos/cosmos-sdk/pull/16138) Fix snapshot commands panic if snapshot don't exists.
* (types) [#16145](https://github.com/cosmos/cosmos-sdk/pull/16145) Rename interface `ExtensionOptionI` back to `TxExtensionOptionI` to avoid breaking change.
* (x/gov) [#16230](https://github.com/cosmos/cosmos-sdk/pull/16231) Fix: rawlog JSON formatting of proposal_vote option field

### Deprecated

Expand Down
10 changes: 4 additions & 6 deletions x/gov/types/v1/vote.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package v1

import (
"encoding/json"
"fmt"
"strings"

Expand Down Expand Up @@ -92,12 +93,9 @@ func ValidWeightedVoteOption(option WeightedVoteOption) bool {
// WeightedVoteOptions describes array of WeightedVoteOptions
type WeightedVoteOptions []*WeightedVoteOption

func (v WeightedVoteOptions) String() (out string) {
for _, opt := range v {
out += opt.String() + "\n"
}

return strings.TrimSpace(out)
func (v WeightedVoteOptions) String() string {
out, _ := json.Marshal(v)
return string(out)
}

// VoteOptionFromString returns a VoteOption from a string. It returns an error
Expand Down

0 comments on commit bda51f2

Please sign in to comment.