mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-10 10:05:18 +00:00
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:
parent
5dcbe73c62
commit
73dc488239
@ -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",
|
||||
|
@ -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"}},
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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])
|
||||
|
@ -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,
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -6,7 +6,6 @@ import (
|
||||
|
||||
// Query endpoints supported by the Querier
|
||||
const (
|
||||
//QueryParams = "params"
|
||||
QueryCommittees = "committees"
|
||||
QueryCommittee = "committee"
|
||||
QueryProposals = "proposals"
|
||||
|
Loading…
Reference in New Issue
Block a user