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

x/gov:the error about turning VoteOption byte to String. #1756

Closed
4 tasks
MrXJC opened this issue Jul 19, 2018 · 0 comments · Fixed by #1757
Closed
4 tasks

x/gov:the error about turning VoteOption byte to String. #1756

MrXJC opened this issue Jul 19, 2018 · 0 comments · Fixed by #1757

Comments

@MrXJC
Copy link
Contributor

MrXJC commented Jul 19, 2018

Summary of Bug

I submit a Text proposal. But I query the proposal information and it responds me that it is a ParameterChange proposal.

So I review the related code.
In x/gov/proposals.go, the types of the proposals are shown below.

//nolint
const (
	ProposalTypeText            ProposalKind = 0x01
	ProposalTypeParameterChange ProposalKind = 0x02
	ProposalTypeSoftwareUpgrade ProposalKind = 0x03
)

But there is a very obvious mistake.

// Turns VoteOption byte to String
func (pt ProposalKind) String() string {
	switch pt {
	case 0x00:
		return "Text"
	case 0x01:
		return "ParameterChange"
	case 0x02:
		return "SoftwareUpgrade"
	default:
		return ""
	}
}

It should be:

// Turns VoteOption byte to String
func (pt ProposalKind) String() string {
	switch pt {
	case 0x01:
		return "Text"
	case 0x02:
		return "ParameterChange"
	case 0x03:
		return "SoftwareUpgrade"
	default:
		return ""
	}
}

Steps to Reproduce

It is very simple to reproduce.

gaiacli gov  submit-proposal --name=<NAME> --proposer=<ADDR> --title=“I want to be slashed” --description=“I am crazy” --type=Text --deposit=5steak --chain-id=<CHAINID>
gaiacli gov query-proposal  --proposalID=<ID>

you will see this mistake.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants