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

R4R: Support query txs' TotalCount in GET /txs #4214

Merged
merged 11 commits into from
May 4, 2019
Merged

R4R: Support query txs' TotalCount in GET /txs #4214

merged 11 commits into from
May 4, 2019

Conversation

yangyanqing
Copy link
Contributor

@yangyanqing yangyanqing commented Apr 27, 2019

close: #3942
replace: #3995

  • Linked to github-issue with discussion and accepted design OR link to spec that describes this work.
  • Wrote tests
  • Updated relevant documentation (docs/)
  • Added a relevant changelog entry: sdkch add [section] [stanza] [message]
  • rereviewed Files changed in the github PR explorer

For Admin Use:

  • Added appropriate labels to PR (ex. wip, ready-for-review, docs)
  • Reviewers Assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

Copy link
Collaborator

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments only, otherwise LGTM

types/result.go Outdated Show resolved Hide resolved
types/result.go Show resolved Hide resolved
types/result.go Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Apr 27, 2019

Codecov Report

Merging #4214 into master will decrease coverage by 0.02%.
The diff coverage is 38.46%.

@@            Coverage Diff             @@
##           master    #4214      +/-   ##
==========================================
- Coverage   60.16%   60.13%   -0.03%     
==========================================
  Files         212      212              
  Lines       15188    15197       +9     
==========================================
+ Hits         9138     9139       +1     
- Misses       5421     5429       +8     
  Partials      629      629

@codecov
Copy link

codecov bot commented Apr 27, 2019

Codecov Report

Merging #4214 into master will decrease coverage by 0.01%.
The diff coverage is 0%.

@@            Coverage Diff             @@
##           master    #4214      +/-   ##
==========================================
- Coverage   59.14%   59.12%   -0.02%     
==========================================
  Files         217      217              
  Lines       14587    14595       +8     
==========================================
+ Hits         8627     8629       +2     
- Misses       5322     5328       +6     
  Partials      638      638

Copy link
Collaborator

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to mention that we also need to update the documentation (swagger and the gaiacli docs)

@yangyanqing
Copy link
Contributor Author

I forgot to mention that we also need to update the documentation (swagger and the gaiacli docs)

Sorry, I forgot it and had updated swagger.
But gaiacli doc had nothing with detail of rest endpoint.

@fedekunze

Copy link
Collaborator

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK, Thanks !

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor nit, but otherwise LGTM.

client/lcd/swagger-ui/swagger.yaml Outdated Show resolved Hide resolved
.pending/breaking/gaiarest/3942-Support-query-t Outdated Show resolved Hide resolved
client/lcd/swagger-ui/swagger.yaml Outdated Show resolved Hide resolved
@@ -249,6 +250,27 @@ func (r TxResponse) Empty() bool {
return r.TxHash == "" && r.Logs == nil
}

// SearchTxsResult defines a structure for querying txs pageable
type SearchTxsResult struct {
TotalCount int `json:"total_count"` // Count of all txs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to returned with every transaction search query? Should this be it's own query?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think any query which does not return all items one time should be pageable. This is friendly to the user. @jackzampolin

types/result.go Outdated Show resolved Hide resolved
@fedekunze
Copy link
Collaborator

it seems the tests are failing now

@yangyanqing
Copy link
Contributor Author

yangyanqing commented May 3, 2019

Branch master's CI was fail, so this PR was fail after rebasing master just now. @fedekunze

@alessio
Copy link
Contributor

alessio commented May 3, 2019

This should do it: #4264

@alessio
Copy link
Contributor

alessio commented May 3, 2019

@yangyanqing please rebase again

@yangyanqing
Copy link
Contributor Author

yangyanqing commented May 3, 2019

It's ok on my local workspace, but still fail on circle. I have remove go.sum and build/ before run test.

➜  cosmos-sdk git:(frank/3942-support-TotalCount-in-GET-txs-master) ✗ make test_cli       
go build -mod=readonly -tags "netgo ledger" -ldflags '-X github.com/cosmos/cosmos-sdk/version.Name=gaia -X github.com/cosmos/cosmos-sdk/version.Version=0.34.0-hashgard-84-g16dd2f533 -X github.com/cosmos/cosmos-sdk/version.Commit=16dd2f533015a039b703ca44b7146a693e4baec4 -X "github.com/cosmos/cosmos-sdk/version.BuildTags=netgo ledger" -X github.com/cosmos/cosmos-sdk/version.GoSumHash=c4e937a993d3a6f251c77a73a959408b907c393098cc05e3ae5abb49d0a50aa7' -o build/gaiad ./cmd/gaia/cmd/gaiad
go build -mod=readonly -tags "netgo ledger" -ldflags '-X github.com/cosmos/cosmos-sdk/version.Name=gaia -X github.com/cosmos/cosmos-sdk/version.Version=0.34.0-hashgard-84-g16dd2f533 -X github.com/cosmos/cosmos-sdk/version.Commit=16dd2f533015a039b703ca44b7146a693e4baec4 -X "github.com/cosmos/cosmos-sdk/version.BuildTags=netgo ledger" -X github.com/cosmos/cosmos-sdk/version.GoSumHash=c4e937a993d3a6f251c77a73a959408b907c393098cc05e3ae5abb49d0a50aa7' -o build/gaiacli ./cmd/gaia/cmd/gaiacli
go build -mod=readonly -tags "netgo ledger" -ldflags '-X github.com/cosmos/cosmos-sdk/version.Name=gaia -X github.com/cosmos/cosmos-sdk/version.Version=0.34.0-hashgard-84-g16dd2f533 -X github.com/cosmos/cosmos-sdk/version.Commit=16dd2f533015a039b703ca44b7146a693e4baec4 -X "github.com/cosmos/cosmos-sdk/version.BuildTags=netgo ledger" -X github.com/cosmos/cosmos-sdk/version.GoSumHash=c4e937a993d3a6f251c77a73a959408b907c393098cc05e3ae5abb49d0a50aa7' -o build/gaiareplay ./cmd/gaia/cmd/gaiareplay

ok      github.com/cosmos/cosmos-sdk/cmd/gaia/cli_test  181.706s
➜  cosmos-sdk git:(frank/3942-support-TotalCount-in-GET-txs-master) ✗ make test_sim_gaia_nondeterminism
......
Selected randomly generated distribution parameters:
        {FeePool:{CommunityPool:} CommunityTax:0.200000000000000000 BaseProposerReward:0.110000000000000000 BonusProposerReward:0.180000000000000000 WithdrawAddrEnabled:false DelegatorWithdrawInfos:[] PreviousProposer: OutstandingRewards:[] ValidatorAccumulatedCommissions:[] ValidatorHistoricalRewards:[] ValidatorCurrentRewards:[] DelegatorStartingInfos:[] ValidatorSlashEvents:[]}
Simulating... block 50/50, operation 0/0. . . 
Simulation complete; Final height (blocks): 51, final time (seconds): 2410-01-12 09:02:40 +0800 CST, operations ran: 2867
Event statistics: 
                                         /no-operation/failure => 184
                                       auth/deduct_fee/failure => 1
                                            auth/deduct_fee/ok => 17
                                        bank/multisend/failure => 4
                                             bank/multisend/ok => 26
                                             bank/send/failure => 20
                                                  bank/send/ok => 335
                                           beginblock/evidence => 9
                                     beginblock/signing/missed => 3767
                                     beginblock/signing/signed => 3526
                            distr/set_withdraw_address/failure => 163
                       distr/withdraw_delegator_reward/failure => 146
                            distr/withdraw_delegator_reward/ok => 4
                   distr/withdraw_validator_commission/failure => 151
                               endblock/validatorupdates/added => 49
                              endblock/validatorupdates/kicked => 49
                             endblock/validatorupdates/updated => 342
                                           gov/deposit/failure => 306
                                                gov/deposit/ok => 16
                                   gov/submit_proposal/failure => 3
                                        gov/submit_proposal/ok => 33
                                       slashing/unjail/failure => 335
                              staking/begin_redelegate/failure => 250
                                   staking/begin_redelegate/ok => 2
                              staking/create_validator/failure => 272
                                      staking/delegate/failure => 159
                                           staking/delegate/ok => 419
                                staking/edit_validator/failure => 1
                                     staking/edit_validator/ok => 20
--- PASS: TestAppStateDeterminism (164.59s)
PASS
ok      github.com/cosmos/cosmos-sdk/cmd/gaia/app       164.648s

@fedekunze @alessio

@yangyanqing
Copy link
Contributor Author

It's clear. @fedekunze @alessio

@alessio alessio merged commit 1cfc868 into cosmos:master May 4, 2019
@yangyanqing yangyanqing deleted the frank/3942-support-TotalCount-in-GET-txs-master branch May 4, 2019 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support query txs' TotalCount in GET /txs
5 participants