Skip to content

Commit

Permalink
Address @alexanderbez PR comments'
Browse files Browse the repository at this point in the history
  • Loading branch information
jackzampolin committed Jan 21, 2019
1 parent 5b18dc6 commit a73ba9b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion cmd/gaia/cli_test/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ func (f *Fixtures) QueryGovParamTallying() gov.TallyParams {
func (f *Fixtures) QueryGovProposals(flags ...string) gov.Proposals {
cmd := fmt.Sprintf("gaiacli query gov proposals %v", f.Flags())
stdout, stderr := tests.ExecuteT(f.T, addFlags(cmd, flags), "")
if stderr == "ERROR: No matching proposals found" {
if strings.Contains(stderr, "No matching proposals found") {
return gov.Proposals{}
}
require.Empty(f.T, stderr)
Expand Down
11 changes: 4 additions & 7 deletions x/gov/client/utils/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ func NewProposer(proposalID uint64, proposer string) Proposer {
}

func (p Proposer) String() string {
return fmt.Sprintf(`ProposalID: %d
Proposer: %s`, p.ProposalID, p.Proposer)
return fmt.Sprintf("Proposal w/ ID %d was proposed by %s", p.ProposalID, p.Proposer)
}

// QueryDepositsByTxQuery will query for deposits via a direct txs tags query. It
Expand Down Expand Up @@ -211,7 +210,7 @@ func QueryDepositByTxQuery(
// ID.
func QueryProposerByTxQuery(
cdc *codec.Codec, cliCtx context.CLIContext, proposalID uint64,
) (p Proposer, err error) {
) (Proposer, error) {

tags := []string{
fmt.Sprintf("%s='%s'", tags.Action, tags.ActionProposalSubmitted),
Expand All @@ -222,7 +221,7 @@ func QueryProposerByTxQuery(
// support configurable pagination.
infos, err := tx.SearchTxs(cliCtx, cdc, tags, defaultPage, defaultLimit)
if err != nil {
return
return Proposer{}, err
}

for _, info := range infos {
Expand All @@ -234,8 +233,7 @@ func QueryProposerByTxQuery(
}
}
}
err = fmt.Errorf("failed to find the proposer for proposalID %d", proposalID)
return
return Proposer{}, fmt.Errorf("failed to find the proposer for proposalID %d", proposalID)
}

// QueryProposalByID takes a proposalID and returns a proposal
Expand All @@ -247,7 +245,6 @@ func QueryProposalByID(proposalID uint64, cliCtx context.CLIContext, cdc *codec.
return nil, err
}

// Query store
res, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/proposal", queryRoute), bz)
if err != nil {
return nil, err
Expand Down
6 changes: 3 additions & 3 deletions x/gov/depositsvotes.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type Vote struct {
}

func (v Vote) String() string {
return fmt.Sprintf(`Voter %s voted with option %s on proposal %d`, v.Voter, v.Option, v.ProposalID)
return fmt.Sprintf("Voter %s voted with option %s on proposal %d", v.Voter, v.Option, v.ProposalID)
}

// Votes is a collection of Vote
Expand Down Expand Up @@ -49,15 +49,15 @@ type Deposit struct {
}

func (d Deposit) String() string {
return fmt.Sprintf(`Deposit by %s on Proposal %d is for the amount %s`,
return fmt.Sprintf("Deposit by %s on Proposal %d is for the amount %s",
d.Depositor, d.ProposalID, d.Amount)
}

// Deposits is a collection of depoist
type Deposits []Deposit

func (d Deposits) String() string {
out := fmt.Sprintf(`Deposits for Proposal %d:`, d[0].ProposalID)
out := fmt.Sprintf("Deposits for Proposal %d:", d[0].ProposalID)
for _, dep := range d {
out += fmt.Sprintf("\n %s: %s", dep.Depositor, dep.Amount)
}
Expand Down
4 changes: 2 additions & 2 deletions x/staking/types/delegation.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func (d UnbondingDelegation) String() string {
Validator: %s
Entries:`, d.DelegatorAddr, d.ValidatorAddr)
for i, entry := range d.Entries {
out += fmt.Sprintf(` UBD %d:
out += fmt.Sprintf(` Unbonding Delegation %d:
Creation Height: %v
Min time to unbond (unix): %v
Expected balance: %s`, i, entry.CreationHeight,
Expand Down Expand Up @@ -321,7 +321,7 @@ func (d Redelegation) String() string {
Destination Validator: %s
Entries:`, d.DelegatorAddr, d.ValidatorSrcAddr, d.ValidatorDstAddr)
for i, entry := range d.Entries {
out += fmt.Sprintf(` RED %d:
out += fmt.Sprintf(` Redelegation %d:
Creation height: %v
Min time to unbond (unix): %v
Source shares: %s
Expand Down

0 comments on commit a73ba9b

Please sign in to comment.