diff --git a/x/committee/abci_test.go b/x/committee/abci_test.go index adfa501d..f990dd43 100644 --- a/x/committee/abci_test.go +++ b/x/committee/abci_test.go @@ -35,7 +35,7 @@ func (suite *ModuleTestSuite) SetupTest() { func (suite *ModuleTestSuite) TestBeginBlock() { suite.app.InitializeFromGenesisStates() - // TODO replace below with genesis state + normalCom := committee.Committee{ ID: 12, Members: suite.addresses[:2], diff --git a/x/committee/client/cli/query.go b/x/committee/client/cli/query.go index abcf6865..12add284 100644 --- a/x/committee/client/cli/query.go +++ b/x/committee/client/cli/query.go @@ -27,14 +27,13 @@ func GetQueryCmd(queryRoute string, cdc *codec.Codec) *cobra.Command { } govQueryCmd.AddCommand(client.GetCommands( - // GetCmdQueryCommittee(queryRoute, cdc), // TODO is this needed? GetCmdQueryCommittees(queryRoute, cdc), GetCmdQueryProposal(queryRoute, cdc), GetCmdQueryProposals(queryRoute, cdc), GetCmdQueryVotes(queryRoute, cdc), - //TODO GetCmdQueryParams(queryRoute, cdc), + GetCmdQueryProposer(queryRoute, cdc), GetCmdQueryTally(queryRoute, cdc))...) @@ -167,7 +166,7 @@ func GetCmdQueryVotes(queryRoute string, cdc *codec.Codec) *cobra.Command { } // Decode and print results - votes := []types.Vote{} // using empty (not nil) slice so json returns [] instead of null when there's no data // TODO check + votes := []types.Vote{} // using empty (not nil) slice so json returns [] instead of null when there's no data err = cdc.UnmarshalJSON(res, &votes) if err != nil { return err diff --git a/x/committee/client/common/query_proposer.go b/x/committee/client/common/query_proposer.go index 5a44be42..d6f12a56 100644 --- a/x/committee/client/common/query_proposer.go +++ b/x/committee/client/common/query_proposer.go @@ -10,9 +10,11 @@ import ( "github.com/kava-labs/kava/x/committee/types" ) +// Note: QueryProposer is copied in from the gov module + const ( defaultPage = 1 - defaultLimit = 30 // should be consistent with tendermint/tendermint/rpc/core/pipe.go:19 // TODO what is this? + defaultLimit = 30 // should be consistent with tendermint/tendermint/rpc/core/pipe.go:19 ) // Proposer contains metadata of a governance proposal used for querying a proposer. diff --git a/x/committee/client/rest/query.go b/x/committee/client/rest/query.go index 07ec7478..75034884 100644 --- a/x/committee/client/rest/query.go +++ b/x/committee/client/rest/query.go @@ -22,7 +22,6 @@ func registerQueryRoutes(cliCtx context.CLIContext, r *mux.Router) { r.HandleFunc(fmt.Sprintf("/%s/proposals/{%s}/proposer", types.ModuleName, RestProposalID), queryProposerHandlerFn(cliCtx)).Methods("GET") r.HandleFunc(fmt.Sprintf("/%s/proposals/{%s}/tally", types.ModuleName, RestProposalID), queryTallyOnProposalHandlerFn(cliCtx)).Methods("GET") r.HandleFunc(fmt.Sprintf("/%s/proposals/{%s}/votes", types.ModuleName, RestProposalID), queryVotesOnProposalHandlerFn(cliCtx)).Methods("GET") - // TODO r.HandleFunc(fmt.Sprintf("/%s/parameters/{%s}", types.ModuleName, RestParamsType), queryParamsHandlerFn(cliCtx)).Methods("GET") } // ---------- Committees ---------- @@ -289,27 +288,3 @@ func queryTallyOnProposalHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { rest.PostProcessResponse(w, cliCtx, res) } } - -// ---------- Params ---------- - -// TODO -// func queryParamsHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { -// return func(w http.ResponseWriter, r *http.Request) { -// vars := mux.Vars(r) -// paramType := vars[RestParamsType] - -// cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) -// if !ok { -// return -// } - -// res, height, err := cliCtx.QueryWithData(fmt.Sprintf("custom/gov/%s/%s", types.QueryParams, paramType), nil) -// if err != nil { -// rest.WriteErrorResponse(w, http.StatusNotFound, err.Error()) -// return -// } - -// cliCtx = cliCtx.WithHeight(height) -// rest.PostProcessResponse(w, cliCtx, res) -// } -// } diff --git a/x/committee/types/gov_proposal.go b/x/committee/types/gov_proposal.go index 3609b90a..aa201660 100644 --- a/x/committee/types/gov_proposal.go +++ b/x/committee/types/gov_proposal.go @@ -60,7 +60,7 @@ func (ccp CommitteeChangeProposal) ValidateBasic() sdk.Error { // String implements the Stringer interface. func (ccp CommitteeChangeProposal) String() string { - bz, _ := yaml.Marshal(ccp) // TODO test + bz, _ := yaml.Marshal(ccp) return string(bz) } @@ -109,6 +109,6 @@ func (cdp CommitteeDeleteProposal) ValidateBasic() sdk.Error { // String implements the Stringer interface. func (cdp CommitteeDeleteProposal) String() string { - bz, _ := yaml.Marshal(cdp) // TODO test + bz, _ := yaml.Marshal(cdp) return string(bz) } diff --git a/x/committee/types/permissions.go b/x/committee/types/permissions.go index f3ae5640..2481587e 100644 --- a/x/committee/types/permissions.go +++ b/x/committee/types/permissions.go @@ -16,7 +16,6 @@ func init() { } // GodPermission allows any governance proposal. It is used mainly for testing. -// TODO better name? type GodPermission struct{} var _ Permission = GodPermission{} diff --git a/x/committee/types/types.go b/x/committee/types/types.go index 4665a044..a575848e 100644 --- a/x/committee/types/types.go +++ b/x/committee/types/types.go @@ -2,11 +2,11 @@ package types import ( "fmt" - "strings" "time" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov" + "gopkg.in/yaml.v2" ) const MaxCommitteeDescriptionLength int = 5000 @@ -114,17 +114,8 @@ func (p Proposal) HasExpiredBy(time time.Time) bool { // String implements the fmt.Stringer interface, and importantly overrides the String methods inherited from the embedded PubProposal type. func (p Proposal) String() string { - return strings.TrimSpace(fmt.Sprintf(`Proposal: - PubProposal: -%s - ID: %d - Committee ID: %d - Deadline: %s`, - p.PubProposal, - p.ID, - p.CommitteeID, - p.Deadline, - )) + bz, _ := yaml.Marshal(p) + return string(bz) } type Vote struct {