Commit Graph

7894 Commits

Author SHA1 Message Date
dependabot[bot] 0bec60e39f
build(deps): bump github.com/prometheus/common from 0.17.0 to 0.18.0 (#8727)
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.17.0 to 0.18.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Commits](https://github.com/prometheus/common/compare/v0.17.0...v0.18.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-01 08:27:13 +00:00
Sunny Aggarwal 1ba0d78fcb
Merge pull request #8569 from sikkatech/adr-epoched-staking
ADR Epoched Staking
2021-02-28 17:22:12 -05:00
Sunny Aggarwal c7da188b42
Merge branch 'master' into adr-epoched-staking 2021-02-28 16:48:22 -05:00
Emmanuel T Odeke dbb9923917
store/cachekv, x/bank/types: algorithmically fix pathologically slow code (#8719)
After continuously profiling InitGensis with 100K accounts, it showed
pathologically slow code, that was the result of a couple of patterns:
* Unconditional and not always necessary map lookups
* O(n^2) sdk.AccAddressFromBech32 retrievals when the code is expensive,
during a quicksort

The remedy involved 4 parts:
* O(n) sdk.AccAddressFromBech32 invocations, down from O(n^2) in the quicksort
* Only doing map lookups when the domain key check has passed
* Using a black magic compiler technique of the map clearing idiom
* Zero allocation []byte<->string conversion

With 100K accounts, this brings InitGenesis down to ~6min, instead of
20+min, it reduces the sort code from ~7sec down to 50ms.

Also some simple benchmark reflect the change:
```shell
name                    old time/op    new time/op    delta
SanitizeBalances500-8     19.3ms ±10%     1.5ms ± 5%  -92.46%  (p=0.000 n=20+20)
SanitizeBalances1000-8    41.9ms ± 8%     3.0ms ±12%  -92.92%  (p=0.000 n=20+20)

name                    old alloc/op   new alloc/op   delta
SanitizeBalances500-8     9.05MB ± 6%    0.56MB ± 0%  -93.76%  (p=0.000 n=20+18)
SanitizeBalances1000-8    20.2MB ± 3%     1.1MB ± 0%  -94.37%  (p=0.000 n=20+19)

name                    old allocs/op  new allocs/op  delta
SanitizeBalances500-8      72.4k ± 6%      4.5k ± 0%  -93.76%  (p=0.000 n=20+20)
SanitizeBalances1000-8      162k ± 3%        9k ± 0%  -94.40%  (p=0.000 n=20+20)
```

The CPU profiles show the radical change as per
https://github.com/cosmos/cosmos-sdk/issues/7766#issuecomment-786671734

Later on, we shall do more profiling and fixes but for now this brings
down the run-time for InitGenesis.

Fixes #7766

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2021-02-27 07:26:22 -08:00
Barrie Byron 68e7a3adf7
fix: per 8711 fix typo and minor command text edit for multi sign batch command (#8718)
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2021-02-27 09:39:08 +00:00
Dev Ojha a4ff0ef93e
Merge branch 'master' into adr-epoched-staking 2021-02-26 09:50:31 -06:00
Marko a786830bb4
auth: allow 0 coin accounts in genesis (#8714)
* allow zero accounts

* fix test

* fix test
2021-02-26 15:41:48 +00:00
Marko 2139212050
docker m1 (#8710) 2021-02-26 11:25:48 +00:00
Marko fd482a27bf
update ed25519 (#8690)
* update ed25519

* add changelog and doc.go

* add comment

* add note about tendermint
2021-02-26 10:09:05 +00:00
Segue 92bc2904d3
Fix legacy rest api (#8434) 2021-02-26 08:28:48 +00:00
Dev Ojha c0fd863ef1
Merge branch 'master' into adr-epoched-staking 2021-02-25 21:48:57 -06:00
Cory b19ac2c4f8
Add warning notice in changelog for v0.41.x bug (ref: #8461) (#8707)
* add disclaimer for v0.41 series for non-hub SDK chains due to #8461

* update issue link

* update issue link, pt2

* fix bad issue link
2021-02-25 16:48:21 -08:00
Robert Zaremba 70089844f7
scripts: indent multiline commands (#8706) 2021-02-25 20:57:41 +00:00
Frojdi Dymylja ef9968debd
[bank]: add balance tracking events (#8656)
* change(bank): add utxo events and simplify logic

* add(bank): balance and supply tracking test

* chore(bank): fix balance tracking test comment

* fix(grpc): service test

* fix(bank): sub unlocked coins to use less gas

* fix(auth): cli test gas

* fix(rest): grpc gas test

* fix(staking/cli): increase delegation required gas

* add: burn events, fix tests

* fix(auth/tx): grpc test

* add(bank): coin events in delegate

* fix(bank): add amt check in delegate coins back

* change(bank): add coin spent and coin recv events in burn and mint

* change(bank): revert sub coin function

* change(auth): revert cli test

* change(auth): revert service test

* chore(auth): fix events comment in service_test.go

* chore: update CHANGELOG.md

* remove(bank): balanceError func

* chore(bank): address lint warnings

* chore(bank): update events spec

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-02-25 18:15:02 +00:00
Amaury 19e79e00d6
ADR-019/020 cleanups: HybridCodec, Pubkey (#8683)
* wip adr019

* Remove hybrid codec

* Change date

* Update docs/architecture/adr-019-protobuf-state-encoding.md

Co-authored-by: Robert Zaremba <robert@zaremba.ch>

* Update pubkey interface

Co-authored-by: Robert Zaremba <robert@zaremba.ch>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-02-25 15:40:04 +00:00
Alessio Treglia 5d3f29b089
update tendermint to v0.34.8 (#8701) 2021-02-25 14:58:12 +00:00
Rikard Hjort d51875b07e
Updates and clarifications to the staking specs (#8675) 2021-02-25 14:42:41 +00:00
dependabot[bot] 96587cf3c2
build(deps): bump google.golang.org/grpc from 1.35.0 to 1.36.0 (#8696)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.35.0 to 1.36.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.35.0...v1.36.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-02-25 12:59:36 +00:00
Emmanuel T Odeke 929b62cd46
types: intern AccAddress.String() to gut wasted expensive recomputations (#8694)
Given that AccAddress is a []byte type, and its .String() method is
quite expensive, continuously invoking the method doesn't easily provide
a way for the result to be memoized. In memory profiles from
benchmarking OneBankSendTxPerBlock and run for a while, it showed >2GiB burnt
and SendCoins consuming a bunch of memory: >2GiB.

This change introduces a simple global cache with a map to intern
AccAddress values, so that we quickly look up the expensively computed
values. With it, the prior memory profiles are erased, and benchmarks
show improvements:

```shell
$ benchstat before.txt after.txt
name                     old time/op    new time/op    delta
OneBankSendTxPerBlock-8    1.94ms ± 9%    1.92ms ±11%   -1.34%  (p=0.011 n=58+57)

name                     old alloc/op   new alloc/op   delta
OneBankSendTxPerBlock-8     428kB ± 0%     365kB ± 0%  -14.67%  (p=0.000 n=58+54)

name                     old allocs/op  new allocs/op  delta
OneBankSendTxPerBlock-8     6.34k ± 0%     5.90k ± 0%   -7.06%  (p=0.000 n=58+57)
```

Fixes #8693

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2021-02-25 03:01:03 -08:00
Amaury ba74a7c737
x{stake,slash,gov,distrib} In-place Store Migrations (#8504)
* Add 1st version of migrate

* Put migration logic into Configurator

* add test to bank store migration

* add test for configurator

* Error if no migration found

* Remove RunMigrations from Configurator interface

* Update spec

* Rename folders

* copy-paste from keys.go

* Fix nil map

* rename function

* Update simapp/app.go

Co-authored-by: Robert Zaremba <robert@zaremba.ch>

* Update simapp/app_test.go

Co-authored-by: Robert Zaremba <robert@zaremba.ch>

* Adderss reviews

* Fix tests

* Update testutil/context.go

Co-authored-by: Robert Zaremba <robert@zaremba.ch>

* Update docs for ConsensusVersion

* Rename to forVersion

* Fix tests

* Check error early

* Return 1 for intiial version

* Use MigrationKeeper

* Fix test

* Revert adding marshaler to Configurator

* Godoc updates

* Update docs

* Add distrib legacy folder

* Add tests for distrib migration

* Add gov migrations

* Copy paste whole keys file

* Add gov migrations

* Add staking

* Fix staking tests

* Update spec and module.go

* Update to latest changes

* Update migration scripts

* capability to 1

* Fix tests

* Add package godoc

* Remove whitespace

* Remove global

* Use Migrator

* Remove 042 keys files

* Fix build

* Unlambda

* Rename to Migrate1to2

Co-authored-by: Robert Zaremba <robert@zaremba.ch>
2021-02-25 10:43:31 +00:00
Amaury eeb3eabdc6
docs: Add mention to use gRPC v1.33.2 (#8658)
Co-authored-by: Marko <marbar3778@yahoo.com>
2021-02-25 07:57:06 +00:00
Kimura Yu 115096b09d
change dir '.appd' to '.app' (#8695) 2021-02-25 07:52:17 +00:00
Federico Kunze 149bed48fd
bank: name and symbol metadata fields (#8677)
* bank: name and symbol metadata fields

* cli test

* changelog
2021-02-24 20:06:04 -03:00
SaReN 77668a3c23
Add multisign batch command (#7787)
* initial commit

* update signing data

* Update signature

* code cleanup

* code cleanup

* Add test for ms batch

* update test

* add build flag

* update flags

* update tests

* add test for signbatch multisig

* update test

* fix sign batch multisig

* add test

* update offline usage

* update with sign batch fix

* fix lint

* update tests

* update test

* update tests

* fix signature only

* update seq

* fix conflicts

* update multisign

* revert unintended

* fix tests

* rename flags

* code refactor

* fix typo

* update docs

* update test

* Update x/auth/client/cli/tx_multisign.go

* use named return values and explicit return

* Update x/auth/client/cli/tx_multisign.go

Co-authored-by: Robert Zaremba <robert@zaremba.ch>

* Update x/auth/client/cli/tx_multisign.go

Co-authored-by: Robert Zaremba <robert@zaremba.ch>

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Jonathan Gimeno <jonathan@tendermint.com>
Co-authored-by: Jonathan Gimeno <jgimeno@gmail.com>
Co-authored-by: Robert Zaremba <robert@zaremba.ch>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-02-24 19:56:10 +00:00
Marko 2c18d8a28b
add tm version to makefile (#8689) 2021-02-24 19:43:12 +00:00
MD Aleem 897f20b1d1
fix REST endpoints in migration docs (#8648)
* fix endpoints

* update docs

* fix routes

* update docs

Co-authored-by: Anil Kumar Kammari <anil@vitwit.com>
2021-02-24 15:03:27 +00:00
Amaury 2539acd6f7
simapp InitChainer: use json instead of tmjson (#7523)
* simapp InitChainer: use json instead of tmjson

* First run for test

* Revert export_test

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2021-02-24 14:49:34 +00:00
Robert Zaremba 7969135abc
rework unsafe string -> bytes conversion #8674 (#8684)
Changing the unsafe string -> bytes conversion to fix
a security concern.

Closes: #8670

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2021-02-24 12:47:32 +00:00
Robert Zaremba 06ababdf36
ADR-033 cosmetic updates (#8676)
* ADR-033 cosmetic updates

* Apply suggestions from code review

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

* remove invoker middleware framing

* Update NewFooMsgServer

* Update docs/architecture/adr-033-protobuf-inter-module-comm.md

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

* Update docs/architecture/adr-033-protobuf-inter-module-comm.md

Co-authored-by: Cory <cjlevinson@gmail.com>

* Update docs/architecture/adr-033-protobuf-inter-module-comm.md

Co-authored-by: Cory <cjlevinson@gmail.com>

Co-authored-by: Aaron Craelius <aaron@regen.network>
Co-authored-by: Cory <cjlevinson@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-02-24 11:45:21 +00:00
Cory 09c4dc0074
add mergify config for automated launchpad backports (#8667) 2021-02-24 07:22:19 +00:00
Federico Kunze cc70749b07
keyring: remove hardcoded default passphrase on NewMnemonic (#8662)
* keyring: remove hardcoded default passphrase on NewMnemonic

* minor changes

* changelog

* address @alessio's comment

* Update CHANGELOG.md

* test fixes

* update comment and test

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Jonathan Gimeno <jgimeno@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-02-23 16:49:09 +00:00
Robert Zaremba 8dd6c325ba
multisig checks and optimization (#8600)
* Add Equal method to the CompactBitArray

* optimize NumTrueBitsBefore

* fix compact_bit_array

* add more tests and update comments

* add check for unique keys

* add unit tests

* LegacyAminoPubKey: rollback pubkey uniqueness check

* comment update

* Bechmark NumTrueBitsBefore

* Adding one more test

* changelog update

* Update crypto/types/compact_bit_array.go

Co-authored-by: Alessio Treglia <alessio@tendermint.com>

* change iff to if and only if

* add comment to NumTrueBitsBefore

* merge conflict

* Changelog cosmetic update

* Update CHANGELOG.md

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2021-02-23 15:55:06 +00:00
Robert Zaremba 8db9bbba04
linter: ignore false positives in types/address (#8674) 2021-02-23 13:38:37 +00:00
Cyrus Goh 4c70268c9b
docs: update master docs (#8353)
* bump docs theme to 1.0.180

* add v0.40 to config.js versions

* Fix code snippet link

* reorganize order of versions
* 0.39, 0.41, master
* defaulting to 0.41

Co-authored-by: billy rennekamp <billy.rennekamp@gmail.com>
Co-authored-by: Amaury Martiny <amaury.martiny@protonmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-02-23 10:57:04 +00:00
Alessio Treglia f2ee972e31
various linter fixes (#8666) 2021-02-23 08:46:01 +00:00
ValarDragon d880d74498 Fix accidentally committed files 2021-02-22 17:39:50 -06:00
ValarDragon 649a4e603a Add section for parameterizing the epoch length 2021-02-22 15:37:53 -06:00
ValarDragon e858c51799 Missed a comment 2021-02-22 14:38:08 -06:00
ValarDragon 846cede5bf Repsond to comments, improve descriptions 2021-02-22 14:33:47 -06:00
Alessio Treglia 39b816ebb3
ci: update golangci-lint (#8660) 2021-02-22 15:50:58 +00:00
Riccardo Montagnin f49e1554e6
Deprecate SetFullFundraiserPath in favor of SetPurpose and SetCoinType (#8629)
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2021-02-22 15:14:09 +00:00
Riccardo Montagnin c2be53a447
auth: query all accounts stored via gRPC (#8522)
* Added the ability to query all accounts stored using gRPC

* Added CHANGELOG entry

* Fixed linting errors

* Update CHANGELOG.md

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

* Update proto/cosmos/auth/v1beta1/query.proto

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

* Run make proto-all

* Merged origin/master

* Applied suggestions

* Added CLI command

* Updated CHANGELOG

* Fixed merge conflicts

Co-authored-by: Amaury <amaury.martiny@protonmail.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-02-22 14:21:46 +00:00
Alessio Treglia 3e6fb55e00
merge changelogs (#8661) 2021-02-22 14:09:03 +00:00
dependabot[bot] 0b3af0e4e0
build(deps): bump github.com/prometheus/client_golang from 1.8.0 to 1.9.0 (#8180)
* build(deps): bump github.com/prometheus/client_golang

Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.8.0 to 1.9.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.8.0...v1.9.0)

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

* go mod tidy

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Robert Zaremba <robert@zaremba.ch>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Amaury M <1293565+amaurym@users.noreply.github.com>
2021-02-22 12:34:58 +00:00
Aleksandr Bezobchuk 2f069c90b3
server: fix interceptConfigs (#8641)
* server: fix interceptConfigs

* cl++

* revert call

* update error message

* revise TestInterceptConfigsPreRunHandlerDoesNotMixConfigFiles

* remove TestInterceptConfigsPreRunHandlerDoesNotMixConfigFiles

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-02-22 11:51:35 +00:00
MD Aleem 81cc5c1194
gRPC gateway issue with colons in the account url path (#8649)
* add allow_colon_final_segments flag

* add test

* Update x/auth/client/rest/rest_test.go

Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-02-22 11:30:45 +00:00
dependabot[bot] 7b527673cc
build(deps): bump github.com/prometheus/common from 0.16.0 to 0.17.0 (#8637)
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.16.0 to 0.17.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Commits](https://github.com/prometheus/common/compare/v0.16.0...v0.17.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-22 10:35:23 +00:00
dependabot[bot] a846e4e4f9
build(deps): bump github.com/otiai10/copy from 1.4.2 to 1.5.0 (#8655)
Bumps [github.com/otiai10/copy](https://github.com/otiai10/copy) from 1.4.2 to 1.5.0.
- [Release notes](https://github.com/otiai10/copy/releases)
- [Commits](https://github.com/otiai10/copy/compare/v1.4.2...v1.5.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-22 09:10:38 +00:00
Afanti 2f426136bd
typo fix (#8647)
Co-authored-by: Marko <marbar3778@yahoo.com>
2021-02-20 09:48:39 +00:00
MD Aleem 7df79b55f0
x/authz: Add DelegateAuthorization, UndelegateAuthorization (#8472)
* add proto msgs

* add delegate authorization

* add delegate authorization tests

* add delegate authorization to cli

* fix lint

* add cli tests

* made max_tokens optional

* add tests

* add table tests

* resolve conflicts

* add undelegate authorization

* proto-gen

* fix errors

* fix lint

* resolve conflicts

* fix imports

* add allow & deny lists to delegate authorization

* refactor authorizations

* proto-docs

* fix lint

* review changes

* golint

* proto lint

* review changes

* add staking authorization

* review changes

* fix protos

* review changes

* review changes

* clean docs

* proto-docs

* proto-gen

* proto-docs
2021-02-20 06:57:57 +00:00