Commit Graph

6855 Commits

Author SHA1 Message Date
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
Jonathan Gimeno 6ceedc9e4f
Remove TxBuilder references to viper. (#6653)
Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2020-07-10 11:05:35 +02:00
Alessio Treglia 255ed06eb4
testutil: add ApplyMockIODiscardOutErr, simplify existing functions (#6665) 2020-07-10 08:55:48 +02:00
Al d269eaf74c
Document types/context.go code (#6654)
* document context.go code

* update CHANGELOG.md unreleased

* creates -> returns

* Update CHANGELOG.md

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

* Apply suggestions from code review

Co-authored-by: Alessio Treglia <quadrispro@ubuntu.com>

* Update types/context.go

Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Alessio Treglia <quadrispro@ubuntu.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-07-09 19:14:18 +00:00
Emmanuel T Odeke 2da1a63288
Merge PR #6667: codec: remove unused, untested and expensive MarshalIndentFromJSON 2020-07-09 14:28:27 -04:00
colin axner 03fdc9d744
x/ibc: update error messages (#6659)
* update errors in 02-client

* update errors in 03-connection

* update 04-channel errors + fixes to 03 changes

* update ibc handler errors

* tm, commitment, and verify error updates

* update ics20

* remove unnecessary wrapping

* fix various build issues
2020-07-09 12:06:08 -04:00
Alessio Treglia a940214a49
testutil cleanup and reorg (#6658)
Prepare migrating testing auxiliary functions from tests
to testutil.

Remove local duplicates on testutil.WriteToNewTempFile().

Always favor testutil.NewTestCaseDir() over ioutil.TempDir().

Add test cases for the testing auxiliary functions.
2020-07-09 14:21:20 +02:00
Amaury Martiny f8df05f6f1
x/upgrade: Refactor CLI to use protobuf query (#6623)
* x/upgrade: Refactor CLI to use protobuf query

* Import lint

* Use table tests

* Small tweak in setup

* Address bez cli refactor

* Address fede's review

* Remove useless func args

* Add back clientCtx to tx command

* Update comments

* Update docs

* Small refactor

* remove Init()

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-08 22:00:56 +00:00
Jonathan Gimeno a417b38926
Remove viper in Staking module. (#6631) 2020-07-08 22:00:34 +02:00
Alexander Bezobchuk b25e3fc76d
Merge PR #6651: More CLI cleanup 2020-07-08 13:57:45 -04:00
Ira Miller 589c1a531e
Enable/disable coin transfers by denom (#6527)
* initial implementation of per denom sendenabled

* Fix for accidentally removed keyword

* Validate individual param in param array

* Lint fix

* Refactor bank params to use protobuf
Modified SendEnabled property to be part of generic Params object
Updated genesis functions to use default params structure

* Refactor simulation genesis for clarity

* update changelog for bank sendenable per denom

* fix NoOpMsg type in multisend test

* Add a coin denom send check utility function

* Additional godoc comments and clarification

* Add default send enabled parameter to bank.
Remove empty denom capability from SendEnabled parameters
Update simulation to exercise both configuration options independently

* Minor suggested improvements.

* simulation fix

* bank proto sendenabled package name removed

* Remove extra gogo proto yaml tags

* Params rename IsSendEnabled to SendEnabledDenom

* Refactor to SendEnabledCoin(s)

* update slashing test to use bank params

* Clean up change log entry for feature.

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
2020-07-08 17:43:08 +00:00
Marko a459b785d6
run sims on master (#6648) 2020-07-08 17:50:01 +02:00
Akhil Kumar P 674845c7f6
x/params: query gRPC service (#6585)
* Add grpc queries in x/params

* Modify grpc query tests format

* Modify query request and revert changes in querier

* Fix protobuf lint issues
2020-07-08 15:33:55 +00:00
Federico Kunze 3fc5a4dfc6
x/ibc: update CLI queries (#6647) 2020-07-08 10:57:42 -04:00
Alessio Treglia 67be012e3f
x/genutil: use HomeDir stored in ClientCtx (#6646)
Follow-up of #6636
2020-07-08 16:41:46 +02:00
Alexander Bezobchuk 33decc9779
Remove context param (#6645) 2020-07-08 14:25:02 +00:00
Marko a9da918f98
ci: codecov revert to 1.0.7 (#6642)
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2020-07-08 13:18:54 +02:00
Akhil Kumar P 4536ca22bb
x/auth: gRPC query service (#6565)
Co-authored-by: sahith-narahari <sahithnarahari@gmail.com>
Co-authored-by: Anil Kumar Kammari <anil@vitwit.com>
2020-07-08 13:12:38 +02:00
Federico Kunze e6bb2e7ed7
x/ibc: refactor CLI (#6639)
* x/ibc: refactor CLI

* refactor client CLI

* rename version ClientName

* Update x/ibc/09-localhost/client/cli/cli.go

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

* address comments from review

Co-authored-by: Amaury Martiny <amaury.martiny@protonmail.com>
2020-07-08 05:57:59 -04:00
Marko e50c8df10c
ci: bump codecov (#6638) 2020-07-08 11:03:23 +02:00