Apply suggestions from code review

Co-Authored-By: Denali Marsh <denali@kava.io>
Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>
This commit is contained in:
Ruaridh 2020-04-24 19:15:57 +01:00 committed by GitHub
parent 5dcbe73c62
commit 73dc488239
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 12 additions and 12 deletions

View File

@ -40,7 +40,7 @@ func GetQueryCmd(queryRoute string, cdc *codec.Codec) *cobra.Command {
return govQueryCmd
}
// GetCmdQueryProposals implements a query proposals command.
// GetCmdQueryCommittees implements a query committees command.
func GetCmdQueryCommittees(queryRoute string, cdc *codec.Codec) *cobra.Command {
cmd := &cobra.Command{
Use: "committees",

View File

@ -189,7 +189,7 @@ func mustGetExampleCommitteeChangeProposal(cdc *codec.Codec) string {
types.NewCommittee(
1,
"The description of this committee.",
[]sdk.AccAddress{sdk.AccAddress(crypto.AddressHash([]byte("exampleAddres")))},
[]sdk.AccAddress{sdk.AccAddress(crypto.AddressHash([]byte("exampleAddress")))},
[]types.Permission{
types.ParamChangePermission{
AllowedParams: types.AllowedParams{{Subspace: "cdp", Key: "CircuitBreaker"}},

View File

@ -190,6 +190,7 @@ func queryProposerHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
}
// Write response
cliCtx = cliCtx.WithHeight(height)
rest.PostProcessResponse(w, cliCtx, res)
}
}
@ -209,7 +210,7 @@ func queryVotesOnProposalHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
// Prepare params for querier
vars := mux.Vars(r)
if len(vars[RestProposalID]) == 0 {
err := errors.New("proposalID required but not specified")
err := errors.New(fmt.Sprintf("%s required but not specified", RestProposalID))
rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
return
}
@ -247,7 +248,7 @@ func queryTallyOnProposalHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
// Prepare params for querier
vars := mux.Vars(r)
if len(vars[RestProposalID]) == 0 {
err := errors.New("proposalID required but not specified")
err := errors.New(fmt.Sprintf("%s required but not specified", RestProposalID))
rest.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
return
}

View File

@ -34,7 +34,7 @@ func postProposalHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
// Parse and validate url params
vars := mux.Vars(r)
if len(vars[RestCommitteeID]) == 0 {
rest.WriteErrorResponse(w, http.StatusBadRequest, "committeeID required but not specified")
rest.WriteErrorResponse(w, http.StatusBadRequest, fmt.Sprintf("%s required but not specified", RestCommitteeID))
return
}
committeeID, ok := rest.ParseUint64OrReturnBadRequest(w, vars[RestCommitteeID])
@ -78,7 +78,7 @@ func postVoteHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
// Parse and validate url params
vars := mux.Vars(r)
if len(vars[RestProposalID]) == 0 {
rest.WriteErrorResponse(w, http.StatusBadRequest, "proposalID required but not specified")
rest.WriteErrorResponse(w, http.StatusBadRequest, fmt.Sprintf("%s required but not specified", RestProposalID))
return
}
proposalID, ok := rest.ParseUint64OrReturnBadRequest(w, vars[RestProposalID])

View File

@ -61,7 +61,7 @@ func (suite *KeeperTestSuite) TestGetSetDeleteCommittee() {
suite.False(found)
}
func (suite *KeeperTestSuite) TestGetSetProposal() {
func (suite *KeeperTestSuite) TestGetSetDeleteProposal() {
// test setup
prop := types.Proposal{
ID: 12,
@ -86,7 +86,7 @@ func (suite *KeeperTestSuite) TestGetSetProposal() {
suite.False(found)
}
func (suite *KeeperTestSuite) TestGetSetVote() {
func (suite *KeeperTestSuite) TestGetSetDeleteVote() {
// test setup
vote := types.Vote{
ProposalID: 12,

View File

@ -29,7 +29,7 @@ func RegisterModuleCodec(cdc *codec.Codec) {
RegisterAppCodec(cdc)
}
// RegisterCodec registers the necessary types for the module
// RegisterAppCodec registers the necessary types for the module
func RegisterAppCodec(cdc *codec.Codec) {
// Proposals
// The app codec needs the gov.Content type registered. This is done by the gov module.

View File

@ -41,7 +41,7 @@ func (ccp CommitteeChangeProposal) GetTitle() string { return ccp.Title }
// GetDescription returns the description of the proposal.
func (ccp CommitteeChangeProposal) GetDescription() string { return ccp.Description }
// GetDescription returns the routing key of the proposal.
// ProposalRoute returns the routing key of the proposal.
func (ccp CommitteeChangeProposal) ProposalRoute() string { return RouterKey }
// ProposalType returns the type of the proposal.
@ -93,7 +93,7 @@ func (cdp CommitteeDeleteProposal) GetTitle() string { return cdp.Title }
// GetDescription returns the description of the proposal.
func (cdp CommitteeDeleteProposal) GetDescription() string { return cdp.Description }
// GetDescription returns the routing key of the proposal.
// ProposalRoute returns the routing key of the proposal.
func (cdp CommitteeDeleteProposal) ProposalRoute() string { return RouterKey }
// ProposalType returns the type of the proposal.

View File

@ -6,7 +6,6 @@ import (
// Query endpoints supported by the Querier
const (
//QueryParams = "params"
QueryCommittees = "committees"
QueryCommittee = "committee"
QueryProposals = "proposals"