Commit Graph

6874 Commits

Author SHA1 Message Date
atheeshp c37f683cc1
x/staking: cli migration to use gRPC query client (#6728)
* migrated to use gRPC query client

* removed codecs usage

* review change

* added read command flags

* added pagination flags

* fixed limit issue

* added helper function for default pagination flags

* review changes

* review change

* review changes

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-07-17 15:23:42 +00:00
Jonathan Gimeno cdcb51a922
Merge PR #6750: Revert to allow to set DefaultNodeHome as a param in genutil CLI cmds 2020-07-17 10:20:31 -04:00
Cory d3056a9d64
Reset stale job to only mark PRs as stale (#6757)
* reset stalebot to only mark PRs as stale

* Update .github/workflows/stale.yml

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
2020-07-17 14:06:56 +00:00
daoleno f208b9b9fe
Update cn document (#6753)
* Formatting documents

* Fixing typos

* Update the intro document to the latest version

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-07-17 10:53:39 +00:00
colin axner 10783f27d0
remove unnecessary func (#6746) 2020-07-16 14:31:06 +00:00
dauTT ebc3ad6843
x/evidence/simulation/genesis.go: add unit tests (#6740)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-07-16 09:42:06 +00:00
atheeshp 28269908d9
x/gov: gRPC query Service (#6491)
* WIP: adding gRPC for gov

* removed passing new store

* fixed error

* added register query service in module

* order of imports changed

* order of imports changed

* Fix proto file

* added get all proposals grpc

* added more tests

* added doc in tests

* added grpc for votes

* Added grpc for Deposits

* updated protos

* added grpc for proposal, vote, deposit, tally

* WIP: adding params grpc

* added params in gRPC

* updated error messages

* fixed error check

* added more tests

* updated tests

* added yaml types

* review changes and lint issues

* updated tests

* code cleanup

* removed cosmos.gov prefixes

* added more checks

* added more test checks

* added filtered pagination

* removed test check

* added tests for filtered pagination

* Fix Proposals

* lint

* fixed error in tests

* lint issues

* Add nil check for params

* Added unpacker

* removed casttypes

* review changes

* use suite in grpc query tests

* migrated tests to use suite

* fix non-determinism

* tests migrated to table driven tests

* fixed doc typo

* revert change

* Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/5921-grpc-x-gov

* review changes

* review changes

* review changes

* review change

* review changes

* docs updated

* review change

* review changes

* review changes

* review changes

* Update x/gov/keeper/keeper_test.go

Co-authored-by: sahith-narahari <sahithnarahari@gmail.com>
Co-authored-by: Anil Kumar Kammari <anil@vitwit.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-07-16 09:16:23 +00:00
dauTT ab162a6d38
x/gov/simulation/proposals.go: add unit tests (#6737)
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-07-16 08:56:18 +00:00
dauTT ffff6a21cd
x/gov/simulation/genesis.go: add unit tests (#6739)
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-07-16 08:45:45 +00:00
Marko de08dc4288
bump versiion of ci linter fix (#6743) 2020-07-16 08:38:29 +00:00
dependabot-preview[bot] ac6e26ce7d
build(deps): [security] bump lodash from 4.17.15 to 4.17.19 in /docs (#6742)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19. **This update includes a security fix.**
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-07-16 04:19:33 -04:00
Marko e35fa15214
bump version of ci linter (#6741) 2020-07-16 09:51:10 +02:00
Emmanuel T Odeke 1d711f537c
x/auth/signing/direct: increase test coverage to 100% from 83.3% (#6731)
Ensure that all known routes for GetSignBytes are explored for
DirectHandler.
2020-07-16 03:48:36 -04:00
colin axner a65bcdd7e5
add custom relative and absolute timeouts to ibc-transfer (#6724)
* add custom relative and absolute timeouts

* fix misspell

* Update x/ibc-transfer/client/cli/tx.go

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-07-15 13:32:09 +00:00
dauTT 6f928e1c4d
x/gov/simulation/operations.go: add unit tests (#6723)
* Rename SimulateSubmitProposal to SimulateMsgSubmitProposal to keep naming convention the same as in other similar cases

* x/gov/simulation/operations.go: add unit tests

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2020-07-15 05:44:53 -04:00
Alexander Bezobchuk 44f14828d4
x/params: CLI Refactor & In-Process Tests (#6720)
ref: #6423
2020-07-14 22:52:31 +02:00
Jonathan Gimeno 351192aa0b
x/auth: in-process test refactor (#6573)
* remove unused functions

* create helper func to send tx

* refactor to use test help to send tx by client

* Commit before getting backend.

* Temporal commit

* temp commit

* remove the creation of txbuilder from cli

* fix imports

* update changelog

* Remove unused function.

* Add flag home into tx sign command.

* migrade TestCLIValidateSignatures to use new test suite

* migrate test one

* Add changes to make sign batch.

* make test pass

* refactor common logic

* First part of cli sign.

* Add test for sign batch.

* refactor a little and improve the test

* migrate broadcast command

* fix linter

* Remove printf for debug in bank module.

* Fix unused err var.

* fix linter

* fix test

* fix tests client

* Fix linter.

* Temp commit signature.

* encode tx

* migrate tests

* Fix imports.

* Remove changelog

* fix tests

* Fix tests.

* Update x/bank/client/testutil/cli_helpers.go

* Remove alias.

* Remove wait for N block func.

* export callCmd function into its own file.

* fix imports

* bring back to inner functions

* apply mock io

* the helpers use mockio

* fix bug

* Add Helpers.

* return to put the function in testutil package

* return BufferWriter in ExecTestCLICmd

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
2020-07-14 18:37:14 +00:00
SaReN 5656e8647b
x/staking: gRPC query Service (#6490)
* Add types for staking grpc

* Update module.go

* Update staking query types

* Add grpc query methods

* Add delegation response to proto

* Add queriers for delegations

* Add queriers for unbonding

* Add queriers for redelegations

* Add cases for redelegations

* Add test for grpc validators

* Update staking types to proto

* Update staking query proto

* Add tests for grpc

* Add tests for grpc pool, parameters

* Fix lint issues

* Add grpc redelegation tests

* Add more tests

* Add docs for query proto

* Add docs for query types

* Modify redel querier

* Add debugging statements

* Revert debugging

* Fix proto lint errors

* Add wrapper for keeper

* Embed keeper in querier

* Add more tests

* Add tests for validator unbondings

* Add redel tests

* fix queryRedelegationsFromSrcValidator

* Fix Redelegation tests

* update godoc

* Update args

* Update tests with suite

* Fix lint

* Remove redundant types

* Refactor tests

* fix test

* refactor query proto

* Fix tests

* address review comments

* lint staking proto

* add godoc

* Update tests to table driven tests

* add debugging

* Fix grpc tests

* address comments

* address whitespace suggestions

* Add more tests

* add tests for invalid redels

* update error messages

* address review suggestions

* add tests

* move suite to keeper_test

Co-authored-by: Aaron Craelius <aaronc@users.noreply.github.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-07-14 17:41:30 +00:00
SaReN b9f86dd7fe
Update simapp helpers to use Tx generator (#6655)
* update helpers to use tx generator

* update modules to use tx generator

* add todo

* update ibc to use txG

* fix lint

* Eliminate panics from Gentx

* update module ops

* fix lgtm alert

* update ibc with txG

* Remove todo

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* move simapp/helpers to test_helpers

* revert simapp/helpers to test_helpers

* revert renaming

* address suggestion

Co-authored-by: Aaron Craelius <aaron@regen.network>

* fix tests

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Aaron Craelius <aaron@regen.network>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-07-14 17:33:31 +00:00
Alexander Bezobchuk 6bd36c8719
Merge PR #6702: x/slashing: In-Process CLI Integration Tests 2020-07-14 11:55:19 -04:00
dauTT 3b2edb75d6
x/mint/simulation/genesis.go: add unit tests (#6706)
* x/mint/simulation/gemesis.go: add unit tests

* Rename file

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-07-14 15:00:12 +00:00
Federico Kunze eb72ee042a
x/staking: wrap denom error (#6718) 2020-07-14 10:38:35 -04:00
colin axner 5dfc4a2ec9
Standardize connection versioning + channel versioning docs (#6640)
* update connection versions with feature set flag

* make connection version modular to support channel versioning and registering

* revert IBCVersion renaming, add channel versioning logic

* fix channel version flag

* remove unnecessary godoc

* remove unused func

* fix lint and version test

* add test and fix error

* revert changes

* update docs

* remove unnecessary godoc

* Apply suggestions from code review

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* update doc

* add test cases for unchecked lines

* go fmt

* begin migration to standardized version

* revert proto changes

* restructure versioning to go from string to proto

* update versionStr to encodedVersion naming

* fix version test build

* fix keeper tests

* fix various tests

* fixes from self review

* update docs

* fix lint

* add more code cov

* rename ToString funcs to Encode/DecodeVersion + GetCompatibleEncodedVersions renaming

* update spec docs

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-07-14 08:43:26 +00:00
Alessio Treglia 839ee4f5e7
Stable Releases: Definition and Process (#6394)
Closes: #1728
Related to #6522
2020-07-14 10:28:53 +02:00
dauTT 56ba2d8672
x/ibc/simulation/genesis_test.go: add unit tests (#6712)
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2020-07-14 04:09:36 -04:00
dauTT 8a62e1ab81
x/mint/simulation/params.go: add unit tests (#6708)
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2020-07-13 22:40:32 +00:00
atheeshp be111ef036
x/distribution: gRPC query service (#6600)
* WIP: adding grpc

* added grpc for query withdraw address

* Fix outstanding rewards query

* added inteerface registry

* added gRPC for delegation rewards

* added remaining commands

* lint issue

* added tests

* added test for community pool

* fixed error

* added test for delegator validators

* updated to use test suite

* updated tests

* more test checks added

* updated tests

* Add sdk wrap

* removed pagination for outstanding rewards

* fixed distr tests issue

* fixed slashes issue

* migrated tests to table driven tests

* docs updated

* review changes

* review changes

* review changes

* Update x/distribution/keeper/grpc_query.go

Co-authored-by: sahith-narahari <sahithnarahari@gmail.com>
Co-authored-by: anilCSE <anil@vitwit.com>
Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-07-13 20:01:16 +00:00
dauTT 7678f8a913
x/ibc-transfer/simulation/genesis.go: add unit tests (#6709) 2020-07-13 15:54:43 -04:00
dauTT 666527170c
Merge PR #6705: x/params/simulation/proposals.go: add unit tests 2020-07-13 14:10:34 -04:00
billy rennekamp a6ac7f496e
Tiny change to flag help description for gas-prices (#6701)
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2020-07-13 08:36:34 -04:00
dauTT f5c274f076
x/slashing/simulation/genesis.go: add unit tests (#6696)
* x/slashing/simulation/genesis.go: add unit tests

* rename variable stakingGenesis to slashingGenesis

Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Marko <marbar3778@yahoo.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-07-13 11:08:24 +00:00
dauTT 1caf9174ae
x/slashing/simulation/params.go: add unit tests (#6698)
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-07-13 11:01:45 +00:00
dauTT 946383e1fe
x/params/simulation/operations.go: add unit tests (#6699)
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-07-13 10:55:33 +00:00
Emmanuel T Odeke d36c6be529
store/cache: speed up + conserve memory by using map clearing idiom in Reset (#6700)
Noticed during my audit, the code for cache.CommitKVStoreCacheManager.Reset()
discarded the prior on every invocation i.e.

    m = make(map[T(key)]T(value))

However, this can be made fast and conserve memory by using the map clearing idiom
that the Go compiler recognizes i.e.

    for key := range m {
        delete(m, key)
    }

and turns into very fast code, instead of the extraneous map discarding.

The speed up generated is:

```shell
$ benchstat before after
name     old time/op    new time/op    delta
Reset-8     204ns ± 2%      66ns ± 9%   -67.86%  (p=0.000 n=20+20)

name     old alloc/op   new alloc/op   delta
Reset-8      384B ± 0%        0B       -100.00%  (p=0.000 n=20+20)

name     old allocs/op  new allocs/op  delta
Reset-8      3.00 ± 0%      0.00       -100.00%  (p=0.000 n=20+20)
```

Fixes #6681
2020-07-13 12:49:09 +02:00
Alexander Bezobchuk 5d50e13425
cleanup x/bank and x/crisis (#6697) 2020-07-13 06:55:58 +00:00
dauTT c80ebf3ab7
x/slashing/simulation/operations.go: add unit tests (#6695)
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
2020-07-12 14:56:53 +00:00
Alessio Treglia 2ba21d33ab
types: better Dec.MarshalTo's performance (#6691)
Use big.Int.Cmp() and compare against zeroInt instead
of checking Bytes() against a 0-length byte slice.

Closes: #6680
Thanks: @odeke-em for the patch.

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-07-12 13:26:51 +00:00
Alessio Treglia ba6a2f57c2
crypto/hd: update godoc for ComputerMastersFromSeed (#6694)
Closes: #5338
2020-07-12 09:17:59 -04:00
dauTT 2de851d5bd
Merge PR #6693: x/staking/simulation/params.go: add unit tests 2020-07-11 22:26:38 -04:00
dauTT d6e0888ea6
Merge PR #6692: x/staking/simulation/genesis.go: add unit tests 2020-07-11 22:15:31 -04:00
dauTT 3ab823c587
x/staking/simulation/operations.go: add unit tests (#6690) 2020-07-12 01:56:28 +00:00
Emmanuel T Odeke 152ac24931
rootmulti/internal/maps: remove duplicated code, simplify and speed up KVPair (#6689)
Noticed during an audit, we've got duplicated code that's unused.
There were 2 type definitions:
* type kvPair types.Pair
* type KVPair types.Pair

and each had a .bytes() and .Bytes() method respectively that
then used some extra code.

This change deletes the duplicated/unnecessary code but also
while here improves the performance by removing the use of a
bytes.Buffer which is unnecessary given that we are only
length prefixed the key, length prefixing the value hence
the various helpers are unnecessary.

The added benchmarks shows the performance boost
```shell
$ benchstat before after
name           old time/op    new time/op    delta
KVPairBytes-8     146µs ± 1%     142µs ± 2%   -3.05%  (p=0.000 n=18+17)

name           old speed      new speed      delta
KVPairBytes-8  6.84GB/s ± 1%  7.06GB/s ± 2%   +3.15%  (p=0.000 n=18+17)

name           old alloc/op   new alloc/op   delta
KVPairBytes-8    1.01MB ± 0%    1.01MB ± 0%   -0.04%  (p=0.000 n=17+20)

name           old allocs/op  new allocs/op  delta
KVPairBytes-8      6.00 ± 0%      1.00 ± 0%  -83.33%  (p=0.000 n=20+20)
```

Closes: #6688
2020-07-11 13:44:10 +02:00
Alexander Bezobchuk e7554bb3b0
Fix Gas Flag Usage + CLI Flag APIs (#6685)
* Use new APIs

* fix usage

* fix usage of gas flag

* tests: TestParseGasSetting
2020-07-11 08:13:46 +00:00
Alexander Bezobchuk e1476c1f9d
x/distribution: CLI & Module Tweaks (#6684)
* init commit

* cleanup methods

* fix
2020-07-10 19:59:26 +00:00
Alexander Bezobchuk 400c3cb08e
Merge PR #6652: x/distribution: In-Process Testing & CLI Refactor 2020-07-10 10:45:46 -04:00
Marie 1e23679066
x/evidence: gRPC query service (#6593)
* Add basic grpc query service for x/evidence

* Add grpc query test for AllEvidences query

* linting

* Add AnyUnpacker to query test helper and some var renaming

* Add test to check Evidence query result

* Update proto/cosmos/evidence/query.proto

Co-authored-by: Amaury Martiny <amaury.martiny@protonmail.com>

* Use table tests

* Use NewQueryEvidenceRequest in place of QueryEvidenceParams

* Remove ConvertEvidence

Co-authored-by: Amaury Martiny <amaury.martiny@protonmail.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-07-10 13:52:59 +00:00
Emmanuel T Odeke 59cd0659a5
codec: remove unused and untest ProtoMarshalJSONIndent (#6668)
Noticed from coverage reports and from offline consultation
with Alexander and Aaron, that this function can be removed.
2020-07-10 14:33:35 +02:00
Emmanuel T Odeke c9ec4be3a8
codec: add as much visible coverage (#6670)
As part of an audit, adds as much visible coverage from
73.4% to about 84.2%, but after #6668 is merged, we'll
have it about 88.X% and the coverage report seems to show
only missing cases of not common scenarios, e.g. a case that'll
make jsonpb.Marshaling to fail, and which will return an error
anyways.
2020-07-10 13:01:25 +02:00
Emmanuel T Odeke 7f69b088d9
types: fix invalid int->string conversion in benchmarks (#6678)
Fixes an invalid int->string conversion that will become
a vet error for Go1.15. The correct conversion was to use

    fmt.Sprintf("COINZ_%d", i)

instead of

    "COINZ_" + string(i)

Noticed during a coverage audit.
2020-07-10 12:34:43 +02:00
Amaury Martiny d23c779b87
Fix godocs for NewTxBuilderFromFlags (#6676) 2020-07-10 11:55:17 +02:00