Commit Graph

3141 Commits

Author SHA1 Message Date
Robert Zaremba a18f0b111a
Enable secp256r1 (#8786)
* enable secp256r1 in antehandlers

* Add sig verification benchamrk to find a sigverify fee

* adjust the gas fee

* enable secp256r1 in antehandlers

* Add sig verification benchamrk to find a sigverify fee

* adjust the gas fee

* Update the secp256r1 fee factor

* Update changelog

* regenerate docs
2021-03-04 21:31:42 +00:00
SaReN 72fb8b3ca3
revert unintended skip test (#8789)
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2021-03-04 21:12:17 +00:00
Marko 82aedba11e
logging (#8785)
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-03-04 20:40:01 +00:00
colin axnér da064e13d5
Remove IBC from the SDK (#8735) 2021-03-04 13:11:34 +00:00
Amaury eef8d4dc5d
Fix typo in querying events (#8773) 2021-03-03 18:13:16 +00:00
colin axnér a9b034b5f3
Emit header in MsgUpdateClient events (#8624)
* emit header in update client msg

* update CHANGELOG

* update spec

* fix nil header bug

* use JSON encoding for emitting header

* Update x/ibc/core/spec/06_events.md

* use proto for encoding

* add tests

* encode to hex before emitting header in event

* add comment addressing reasoning for hex encoding

* Update CHANGELOG.md

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

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2021-03-03 16:40:05 +00:00
SaReN eb8aaf9395
Index supply by denom (#8517)
* temp commit

* remove supply

* update tests

* revert proto script

* fix lint

* update tests

* remove decoder

* fix lint

* update set supply

* add changelog

Co-authored-by: Jonathan Gimeno <jgimeno@gmail.com>
2021-03-03 09:58:16 +00:00
Amaury 30f58b5662
Weighted votes migrate in-place migrations (#8663)
* Weighted votes migrate in-place migrations

* Rename to pb.go

* Fix some lint

* Fix lint

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-03-02 22:22:02 +00:00
Marko 810605689d
further reduce logging (#8752) 2021-03-02 15:39:46 +00:00
Emmanuel T Odeke 585ffd6cff
x/staking: add ValidateGenesis benchmark (#8746)
This benchmark examines how ValidateGenesis behaves.
In a follow-up issue, I'll show how it reveals an inefficiency
that'll affect trying to load repeatedly retrieve Validators'
ConsAddress values.

Updates #8744
2021-03-02 01:01:05 -08:00
colin axnér 1c6e267964
Remove IBC logic from x/upgrade (#8673)
* add zeroed custom fields check to tm client

* remove custom fields function from x/upgrade and fix tests

* use []byte in x/upgrade, move abci to 02-client

* remove x/ibc from types

* whoops, delete testing files

* fix upgrade tests

* fix tm tests

* fix tests

* update CHANGELOG

* revert proto breakage, use reserved field cc @amaurym

* add IBC Upgrade Proposal type

* remove IBC from upgrade types

* add IBC upgrade logic to 02-client

* fix all tests for x/upgrade

* Add CLI for IBC Upgrade Proposal

* Update x/ibc/core/02-client/types/proposal_test.go

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

* add gRPC for upgraded client state

* test fixes

* add HandleUpgradeProposal tests

* update docs and remove unnecessary code

* self review bug and test fixes

* neatness

* construct empty rest handler

* fix tests

* fix stringer tests

* Update docs/core/proto-docs.md

Co-authored-by: Christopher Goes <cwgoes@pluranimity.org>

* add key in ibc store tracking ibc upgrade heights

Add a new Key to the IBC client store to track the IBC Upgrade Height. This allows IBC upgrades to correctly remove old IBC upgrade states

* update abci and tests

* revert key storage after discussion with @AdityaSripal

Revert using a key to track IBC upgrades. By clearing any IBC state using an old plan in ScheduleUpgrade, IBC upgrades do not need to be tracked by IBC. This reduces code complexity and reduces potential for bugs.

* clear IBC states on cancelled upgrades

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Christopher Goes <cwgoes@pluranimity.org>
2021-03-01 16:28:54 +00:00
Amaury a93edeef4c
Move QueryTx functions to x/auth/tx (#8734)
* Use x/auth/client for querying Txs

* Fix lint

* Fix small test

* Update todos

* Move QueryTx functions to x/auth/tx

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2021-03-01 15:57:28 +00:00
Damian Nolan 0792db78b8
minor channel fixes (#8665)
* Consolidating codec.go registrations. Moving Acknowledgement result/error to its own file

* Updating CHANGELOG.md with #7949 improvement as requested

* revert removing acknowledgement proto to its own file

* update changelog

* remove unnecessary pb.go file

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
2021-03-01 15:13:37 +01:00
Amaury 3832860263
Allow REST endpoint to query txs with multisig (#8730)
* Fix unpack stdtx

* Add test for multisig

* remove println

* Add changelog

* Better UnpackInterfaces

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2021-03-01 13:01:05 +00: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
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
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
Rikard Hjort d51875b07e
Updates and clarifications to the staking specs (#8675) 2021-02-25 14:42:41 +00: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
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
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
Alessio Treglia f2ee972e31
various linter fixes (#8666) 2021-02-23 08:46:01 +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
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
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
Jack Zampolin e577378497
Add failing address to multisig validation (#8518)
* Add helper to multisig validation

* Added bech32 address output

* Fix test

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-19 15:23:52 +00:00
Alessio Treglia 9b7a12f7db
run make format (#8642)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-02-19 15:02:53 +00:00
Amaury 73e38e4009
Use service Msgs in CLI tx commands (#8512)
* Use service Msgs in CLI tx commands

* Update comment

* Gracefully support amino signing

* CLI to use svc msg

* Fix lint

* Use fq method name in events

* Update tests

* Fix quering events

* Add docs

* Fix test build

* Fix events

* Fix search for events

* Handle old andd new event quering

* Use merge events

* Better encCfg

* Add page in search

* Fix tests

* Update test and comments

* Update x/auth/legacy/legacytx/stdsign.go

Co-authored-by: atheeshp <59333759+atheeshp@users.noreply.github.com>

* Fix conflict for weighted vote

* Make CopyTx actually run

* Fix CopyTx

* Fix test

* Add changelog entry

* Remove useless code

* Add msgs tests

* Remove testing proto Msg via CLI

* Fix lint

* Fix test

* Implement GetSignBytes on ServiceMsg

* Fix %T

Co-authored-by: atheeshp <59333759+atheeshp@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-02-18 18:00:19 +00:00
Federico Kunze 53637b607f
bank: additional denom metadata test case (#8612) 2021-02-17 23:57:28 +00:00
Jonathan Gimeno abb3dfefa0
[Bank] Remove the unsafe balance changing API (#8473)
* temp commit

* setbalance now is internal

* remove set balances in genesis

* feedback test commit

* update tests

* fix: genesis panic message

* fix not bonded pool

* fix(staking): genesis test

* fix(simapp): rollback state fix change

* fix(staking): genesis large val set test

* [Bank Refactor] Frojdi jonathan/remove setsupply (#8491)

* init supply in a different way

* remove external usage of set supply

* change(staking): replace SetSupply with MintCoins in tests

* change(evidence): replace SetSupply with MintCoins in tests

* change(crisis): remove SetSupply in tests

* change(bank): remove set supply from genesis tests

* change(bank): remove set supply from keeper tests

* change(bank): remove remaining set supply usage from keeper tests

* change(bank): remove set supply usage from grpc query and querier tests

* change(bank): remove SetSupply from keeper interface

Co-authored-by: Frojdi Dymylja <frojdi.dymylja@gmail.com>

* remove setbalances from genesis in gov

* remove keyring

* add init genesis state

* change(staking): make genesis checks coherent and add tests

* remove setbalances on distribution

* fix(staking): genesis tests

* [Bank Refactor]: Remove SetBalances usage from the code and tests (#8509)

* change(distribution): remove SetBalances usage from keeper tests

* add(simapp): FundAccount utility function

* chore(staking): use FundAccount in keeper tests

* change(staking): remove usage of SetBalance in allocation tests

* change(staking): remove usage of SetBalance in delegation tests

* change(staking): remove usage of SetBalance in proposal handler tests

* change(staking): remove usage of SetBalances in grpc query tests

* change(staking): remove usage of SetBalances in operations tests

* change(distribution): remove usage of SetBalances in genesis

* change(authz): remove usage of SetBalances keeper and operations test

* fix(authz): TestKeeperFees failing test

* change(slashing): remove SetBalances from expected BankKeeper

* change(slashing): remove usage of SetBalances in tests

* change(distribution): remove SetBalances from expected BankKeeper

* change(genutil): remove usage of SetBalances from tests

* change(gov): remove SetBalances from expected BankKeeper

* change(gov): remove usage of SetBalances from tests

* change(staking): remove usage of SetBalances from slash tests

* change(staking): remove SetBalances from expected BankKeeper

* change(staking): remove usage of SetBalances from delegation tests

* change(staking): remove usage of SetBalances from operations tests

* change(staking): remove usage of SetBalances from validator tests

* change(bank): remove usage of SetBalances from app tests

* change(bank): remove usage of SetBalances from bench tests

* change(bank): remove usage of SetBalances from querier tests

* change(bank): remove usage of SetBalances from grpc query tests

* change(bank): remove usage of SetBalances from operations tests

* change(bank): partially remove usage of SetBalances from keeper tests

* change(bank): finalize removal of usage of SetBalances from keeper tests

* change(auth): remove usage of SetBalances from verify tests

* change(auth): partially remove usage of SetBalances from tests

* [Bank refactor]: finalize removal of setbalances from auth (#8527)

* add tests with is check tx

* temp commit

* fix test

* fix other test and remove setbalances

* change(auth): remove usage of SetBalances is vesting tests

Co-authored-by: Jonathan Gimeno <jgimeno@gmail.com>

* change(types): remove usage of SetBalances in queries

* fix(types): pagination tests

* [Bank refactor] fix pagination tests (#8550)

* fix tests

* lint

* change(bank): remove SetBalances from keeper public API

Co-authored-by: Jonathan Gimeno <jgimeno@gmail.com>
Co-authored-by: SaReN <sahithnarahari@gmail.com>

* change(bank): remove SubtractCoins from keeper public API

* change(ibc/transfer): remove AddCoins from relay tests

* change(bank): remove AddCoins from public keeper API

* fix imports

* remove set balances

* fix fee test

* remove set balances

* fix(staking): remove dependency on minter authorization for staking pools

* chore: update CHANGELOG.md

* update: x/distribution/keeper/keeper_test.go

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

* Update simapp/test_helpers.go

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

* Update x/staking/genesis_test.go

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

* fix(simapp): FundAccount amount variable name

* fix some PR issues

Co-authored-by: Frojdi Dymylja <frojdi.dymylja@gmail.com>
Co-authored-by: Frojdi Dymylja <33157909+fdymylja@users.noreply.github.com>
Co-authored-by: SaReN <sahithnarahari@gmail.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Robert Zaremba <robert@zaremba.ch>
2021-02-17 18:20:33 +00:00
Emmanuel T Odeke d56de85a54
x/gov/simulation: fix wrong NewDecodeStore Proposal decoding + proper tests (#8603)
The code in NewDecodeStore decoded the wrong proposal due
to a typographical error, but the tests used the exact same
value for the key value pairs hence the typo could never be caught.
I noticed it during an audit of the code, and I've fixed the
tests to pass in varying values for the various key value pairs.

Fixes #8570

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2021-02-17 03:04:43 -08:00
colin axnér 47dd07d4ff
Modify IBC client governance unfreezing to reflect ADR changes (#8405)
* update proto files

* make proto-gen

* update clienttypes

* update localhost and solo machine

* refactor tm client proposal handling

* copy metadata

* self review fixes

* update 02-client keeper tests

* fix 02-client type tests

* fix localhost and solomachine tests

* begin updating tm tests

* partially fix tm tests

* increase codecov

* add more tests

* add changelog

* update specs

* add docs

* fix test

* modify adr

* allow modified chain-ids

* add CLI command

* fix typos

* fix lint

* Apply suggestions from code review

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

* update docs, rm example

* Update docs/ibc/proposals.md

Co-authored-by: Christopher Goes <cwgoes@pluranimity.org>

* update height checks to reflect chain-id changes cc @AdityaSripal

* Apply suggestions from code review

Co-authored-by: Christopher Goes <cwgoes@pluranimity.org>

* Apply suggestions from code review

Co-authored-by: Aditya <adityasripal@gmail.com>

* address most of @AdityaSripal suggestions

* update docs per review suggestions

* Update x/ibc/core/02-client/types/proposal.go

* add proposal handler

* register proposal type

* register proposal on codec

* fix routing

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Christopher Goes <cwgoes@pluranimity.org>
Co-authored-by: Aditya <adityasripal@gmail.com>
2021-02-16 15:31:40 +00:00
Prathyusha Lakkireddy d3e51cf8a7
Improve create proposal code (#8586)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-02-15 15:43:09 +00:00
Robert Zaremba adbf5a71e6
adr-028 address generation (#8415)
* Optimize secp256k1 hashing

* Add ADR-028 related functions

* Update ed25519

* fix errors/handle

* fix build

* fix build

* Add tests and update function names

* wip

* Use LengthPrefix for composed addresses

* add tests for NewComposed

* add module hash function

* fix append

* rollback ed25519 ADR-28 update

* rollback ed25519 ADR-28 test

* Adding Module tests and convert tests to test suite

* convert store_key_test.go to test suite

* rollback test check comment

* Rename assert.Panic and add comment

* add note to ed25519 about SDK support with regards to ADR-28

* Update ed25519 TestAddress

* Adding Deprecated notes for ed25519.PrivKey

* Update crypto/keys/ed25519/ed25519.go

Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>

* Update types/address/hash_test.go

Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>

* solve linter issues

* linter: remove gocritic

Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>
2021-02-15 15:32:51 +00:00
Marko b4690d8ec6
atlas: evidence (#8561)
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
2021-02-15 13:51:42 +00:00
Sunny Aggarwal 188a8a2e15 import hygiene 2021-02-12 12:27:07 -05:00
Sunny Aggarwal 8847157a73
Update x/gov/client/utils/utils.go
Co-authored-by: Marko <markobaricevic3778@gmail.com>
2021-02-12 12:19:14 -05:00
Sunny Aggarwal 47f7502e72
Merge branch 'master' into gov_split_vote_weighted_vote 2021-02-12 11:07:27 -05:00
Sunny Aggarwal ac16c90e5c remove legacy rest endpoints as per @anilCSE 2021-02-12 11:06:45 -05:00
Prathyusha Lakkireddy e4b2d75dc4
ibc : replace strings.Contains to bytes.Contains (#8574)
Co-authored-by: SaReN <sahithnarahari@gmail.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2021-02-12 13:32:03 +00:00
Riccardo Montagnin 090411a7b5
Removed GetValidator caching to fix concurrency error (#8546)
* Removed GetValidator caching to fix concurrency error

* Fixed linting and added CHANGELOG entry

* Moved benchmark test into its own file

* Moved CHANGELOG entry to bug fix

* Update CHANGELOG.md

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

Co-authored-by: Amaury <amaury.martiny@protonmail.com>
Co-authored-by: Cory <cjlevinson@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-02-12 11:52:03 +00:00
MD Aleem 2154815f4c
x/authz specs (#8499)
* init

* init

* add events

* add state & messages

* WIP

* update Readme

* WIP

* Update x/README.md

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

* Update x/authz/spec/README.md

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

* Update x/authz/spec/02_state.md

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

* Update x/authz/spec/01_concepts.md

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

* review changes

* Update x/authz/spec/01_concepts.md

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

* Update x/authz/spec/02_state.md

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

* Update x/authz/spec/01_concepts.md

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

* Update x/authz/spec/04_events.md

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

* Update x/authz/spec/04_events.md

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

* Update x/authz/spec/README.md

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

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Amaury <amaury.martiny@protonmail.com>
Co-authored-by: Cory <cjlevinson@gmail.com>
2021-02-11 16:56:37 +00:00
Amaury dfc8dd813e
Add in-place store migrations (#8485)
* 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

Co-authored-by: Robert Zaremba <robert@zaremba.ch>
Co-authored-by: Aaron Craelius <aaron@regen.network>
2021-02-10 17:49:31 +00:00
Sunny Aggarwal 065c1b39ce
Apply suggestions from code review
Co-authored-by: Anil Kumar Kammari <anil@vitwit.com>
2021-02-10 12:27:06 -05:00
Sunny Aggarwal 157a24681c
Merge branch 'master' into gov_split_vote_weighted_vote 2021-02-09 15:18:53 -05:00
Alessio Treglia 8001e3ca3a
bank: don't ignore errors returned by Balance.GetAddress() (#8531)
Closes: #8530
2021-02-06 21:51:26 +00:00
SaReN c5c049a045
Persist evidence in equivocation handler (#8502)
* Persist evidence in handler

* update docs

* update docs

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-02-05 15:35:03 +00:00
antstalepresh 46d6fa0ecc fix simulation test, marshal json process 2021-02-06 01:21:22 +10:00
antstalepresh 404dc4f356 Merge branch 'master' of github.com:sikkatech/cosmos-sdk into gov_split_vote_weighted_vote 2021-02-06 01:03:32 +10:00
antstalepresh b55913ddad fix comments and add CHANGELOG 2021-02-06 00:57:12 +10:00
atheeshp 0af248b95b
Add specs for feegrant (#8496)
* add specs

* address review comments

* Address review changes

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

* review changes

* address review changes

Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>

Co-authored-by: Amaury <amaury.martiny@protonmail.com>
Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>
2021-02-04 13:38:16 +00:00
Alessio Treglia 2e04f2778f
snapshots: document use of ioutil.TempDir() (#8508)
Document with inline comments the changes introduced
in https://github.com/cosmos/cosmos-sdk/pull/8475.

Run make format.
2021-02-04 09:54:01 +00:00
psaradev 2a43a2d8a4 reduce legacy code 2021-02-03 23:15:42 +10:00
psaradev 36bc29a993 golang-ci lint 2021-02-03 23:06:02 +10:00
psaradev 71305449d6 regen staking.pb.go 2021-02-03 22:43:27 +10:00
psaradev 0e6b9a613a
Merge branch 'master' into issue#8365/staking_power_reduction_chain_param 2021-02-03 22:40:05 +10:00
psaradev cc4ef50d2a Merge cosmos-sdk master 2021-02-03 22:36:29 +10:00
psaradev 2ce6d4bcba increase gas limit for redelegation only 2021-02-03 20:14:37 +10:00
psaradev 5acdc07df4 reduce power reduction var name 2021-02-03 19:59:37 +10:00
Andrei Ivasko d37c590e90
Limit context background (#8093)
* limit context background

* update

* fixed minor issues

* fixed TestStatusCommand

* Fix keyring import from older versions. (#8436)

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: sahith-narahari <sahithnarahari@gmail.com>

* Add changelog (#8490)

* fix: tendermint subcommands should not create missing files (#8481)

If the user specifies an incorrect `--home`, then the old behaviour
would automatically populate it with fresh values, but we should
fail instead.

* limit context background

* update

* fixed minor issues

* fixed TestStatusCommand

* statik.go

* replaced static.go

Co-authored-by: Jonathan Gimeno <jgimeno@gmail.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: sahith-narahari <sahithnarahari@gmail.com>
Co-authored-by: Michael FIG <mfig@agoric.com>
2021-02-03 09:47:25 +00:00
psaradev 1c1e67fa51 Less function to not use default power reduction 2021-02-02 13:12:05 +10:00
psaradev 7b5cf61eef remove dependency between min deposit tokens and power reduction 2021-02-02 00:11:33 +10:00
psaradev 60c6c0a3c0 legacy genesis migration test and feedbacks 2021-02-02 00:00:45 +10:00
Amaury c1b567f44c
Refactor store keys for variable-length addresses (#8363)
* Change account store key in x/bank

* Fix pagination test

* Fix merge master

* Fix staking keys.go

* Use bech32 in val state change map

* Fix sortNoLongerBonded

* Use length-prefix function

* Use length prefix function

* Fix test accountStore

* Fix ExamplePaginate

* Fix staking keys

* Use shorter balances prefix

* Do slashing keys

* Fix gov keys

* Fix x/gov tests

* Fix x/distrib

* Address reviews

* add change log entry

* Add changelog

* Fix failing tests

* Fix sim tests

* fix after-export sim

* Fix lint

* Address review

* Fix x/authz

* Fix global config in test

* Update x/staking/keeper/val_state_change.go

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

* Address comments

* Fix comments

* Address review

* Fix authz test

* Update comment

* Rename to LengthPrefixedAddressStoreKey

* Use variable

* Rename function

* Fix test build

* chore: update rosetta CI (#8453)

* Rename again

* Rename yet again

* Update feegrant keys

* Add function to create prefix

Co-authored-by: Robert Zaremba <robert@zaremba.ch>
Co-authored-by: Frojdi Dymylja <33157909+fdymylja@users.noreply.github.com>
Co-authored-by: Aaron Craelius <aaron@regen.network>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-02-01 13:17:44 +00:00
Ethan Frey 17d7e9a8d5
Add packet_connection attribute to packet lifecycle methods (#8458)
* Add packet_connection attribute to packet lifecycle methods

Added to:
  * SendPacket
  * ReceivePacket
  * WriteAcknowledgement
  * AcknowledgePacket

* Add CHANGELOG

* Update CHANGELOG.md

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
2021-02-01 14:01:53 +01:00
Amaury 896eee213a
docs: Update x/staking spec (#8395)
* Finish updating state

* Add messages

* Update events

* proto-gen

* Update proto/cosmos/staking/v1beta1/staking.proto

Co-authored-by: Anil Kumar Kammari <anil@vitwit.com>

* progo-gen

* Update Msg with slash

* Rerun proto docs

Co-authored-by: Anil Kumar Kammari <anil@vitwit.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-02-01 12:35:18 +00:00
Federico Kunze 1d75e0e984
bank: additional client metadata validation (#8479)
* bank: additional client metadata validation

* changelog and comment

* fix tab
2021-01-29 23:48:26 -03:00
yihuang d6e4a2e9bc
fix bech32 prefix in evidence (#8461)
Co-authored-by: Tomas Tauber <2410580+tomtau@users.noreply.github.com>

Co-authored-by: Tomas Tauber <2410580+tomtau@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-01-29 20:05:24 +00:00
atheeshp d97e7907f1
Add fee grant module (#8061)
* Add docs

* Add BasicFeeAllowance implementation

* Add expiration structs and complete basic fee

* Add delegation messages, add validation logic

* Add keeper and helper structs

* Add alias and handler to top level

* Add delegation module

* Add basic querier

* Add types tests

* Add types tests

* More internal test coverage

* Solid internal test coverage

* Expose Querier to top level module

* Add FeeAccount to auth/types, like StdTx, SignDoc

* Fix all tests in x/auth

* All tests pass

* Appease the Golang Linter

* Add fee-account command line flag

* Start on DelegatedDeductFeeDecorator

* Cleanup the Decorator

* Wire up delegation module in simapp

* add basic test for decorator (no delegation)

* Table tests for deduct fees

* Table tests over all conditions of delegated fee decorator

* Build full ante handler stack and test it

* Start genesis

* Implement Genesis

* Rename package delegation to subkeys

* Clarify antes test cases, handle empty account w/o fees

* Allow paying delegated fees with no account

* Pull mempool into delegated ante, for control on StdFee

* Use custom DelegatedTx, DelegatedFee for subkeys

* Revert all changes to x/auth.StdTx

* Appease scopelint

* Register DelegatedTx with codec

* Address PR comments

* Remove unnecessary DelegatedMempoolFeeDecorator

* Cleaned up errors in querier

* Clean up message sign bytes

* Minor PR comments

* Replace GetAllFees... with Iterator variants

* PrepareForExport adjusts grant expiration height

* Panic on de/serialization error in keeper

* Move custom ante handler chain to tests, update docs

* More cleanup

* More doc cleanup

* Renamed subkeys module to fee_grant

* Rename subkeys/delegation to fee grant in all strings

* Modify Msg and Keeper methods to use Grant not Delegate

* Add PeriodicFeeAllowance

* Update aliases

* Cover all accept cases for PeriodicFeeAllowance

* Et tu scopelint?

* Update docs as requested

* Remove error return from GetFeeGrant

* Code cleanup as requested by PR

* Updated all errors to use new sdk/errors package

* Use test suite for keeper tests

* Clean up alias.go file

* Define expected interfaces in exported, rather than importing from account

* Remove dependency on auth/ante

* Improve godoc, Logger

* Cleaned up ExpiresAt

* Improve error reporting with UseGrantedFee

* Enforce period limit subset of basic limit

* Add events

* Rename fee_grant to feegrant

* Ensure KeeperTestSuite actually runs

* Move types/tx to types

* Update alias file, include ante

* I do need nolint in alias.go

* Properly emit events in the handler. Use cosmos-sdk in amino types

* Update godoc

* Linting...

* Update errors

* Update pkg doc and fix ante-handler order

* Merge PR #5782: Migrate x/feegrant to proto

* fix errors

* proto changes

* proto changes

* fix errors

* fix errors

* genesis state changed to proto

* fix keeper tests

* fix test

* fixed tests

* fix tests

* updated expected keepers

* updated ante tests

* lint

* deleted alias.go

* tx updated to proto tx

* remove explicit signmode

* tests

* Added `cli/query.go`

* Added tx.go in cli

* updated `module.go`

* resolve errors in tx.go

* Add fee payer gentx func

* updated tx

* fixed error

* WIP: cli tests

* fix query error

* fix tests

* Unused types and funcs

* fix tests

* rename helper func to create tx

* remove unused

* update tx cfg

* fix cli tests

* added simulations

* Add `decoder.go`

* fix build fail

* added init genesis code

* update tx.go

* fixed LGTM alert

* modified cli

* remove gogoproto extensions

* change acc address type to string

* lint

* fix simulations

* Add gen simulations

* remove legacy querier

* remove legacy code

* add grpc queries tests

* fix simulations

* update module.go

* lint

* register feegrant NewSimulationManager

* fix sims

* fix sims

* add genesis test

* add periodic grant

* updated cmd

* changed times

* updated flags

* removed days as period clock

* added condition for period and exp

* add periodic fee cli tests

* udpated tests

* fix lint

* fix tests

* fix sims

* renaming to `fee_grant`

* review changes

* fix test

* add condition for duplicate grants

* fix tests

* add `genTxWithFeeGranter` in tests

* fix simulation

* one of changes & test fixes

* fix test

* fix lint

* changed package name `feegrant` to `fee_grant`

* review comments

* review changes

* review change

* review changes

* added fee-account in flags

* address review changes

* read fee granter from cli

* updated create account with mnemonic

* Address review comments

* move `simapp/ante` file to `feegrant/ante`

* update keeper logic to create account

* update docs

* fix tests

* update `serviceMsgClientConn` from `msgservice`

* review changes

* add test case for using more fees than allowed

* eliminate panic checks from keeper

* fix lint

* change store keys string to bytes

* fix tests

* review changes

* review changes

* udpate docs

* make spend limit optional

* fix tests

* fix tests

* review changes

* add norace tag

* proto-docs

* add docs

Co-authored-by: Ethan Frey <ethanfrey@users.noreply.github.com>
Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Aleksandr Bezobchuk <aleks.bezobchuk@gmail.com>
Co-authored-by: SaReN <sahithnarahari@gmail.com>
Co-authored-by: aleem1413 <aleem@vitwit.com>
Co-authored-by: MD Aleem <72057206+aleem1314@users.noreply.github.com>
Co-authored-by: Anil Kumar Kammari <anil@vitwit.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-01-29 19:54:51 +00:00
psaradev 86844b24d9 comment update 2021-01-28 23:59:16 +10:00
psaradev cb17feddc0 use on-chain params on tests + fix tests + add new tests for power reduction change 2021-01-28 23:54:39 +10:00
Emmanuel T Odeke 784a9a69a1
all: ensure b.ReportAllocs() in all the benchmarks (#8460)
With this change, we'll get details on the number of
allocations performed by code. Later on when we have
continuous benchmarking infrastructure, this change
will prove useful to flag regressions.

Fixes #8459

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2021-01-27 23:52:08 -08:00
Riccardo Montagnin e2f510afcc
Compatibility with the ARM architecture (#8396)
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Jonathan Gimeno <jgimeno@gmail.com>
2021-01-27 11:07:45 +00:00
psaradev 4f476d6890 on-chain power reduction param conversion basic work 2021-01-27 20:24:00 +10:00
Jun Kimura fd04f41e23
ibc-transfer: fix non-deterministic attribute value (#8442)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-01-27 10:19:04 +00:00
psaradev fec543d4f8 power reduction as on-chain param 2021-01-26 23:28:34 +10:00
colin axnér 09b8f7783a
ibc: MsgTransfer amino JSON, commits from @fedekunze (#8437) 2021-01-26 09:03:21 -03:00
vincent 50b4be9110
Fix query signing infos command (#8427)
* fix query signing infos command

* add changelog
2021-01-26 09:32:05 +00:00
MD Aleem c95de9c417
implement x/authz module (#7629)
* WIP: Msg authorization module added

* fixing errors

* fixed errors

* fixed module.go

* Add msg_tests

* fixes compile issues

* fix test

* fix test

* Add msg types tests

* Fix Getmsgs

* fixed codec issue

* Fix syntax issues

* Fix keeper

* fixed proto issues

* Fix keeper tests

* fixed router in keeper

* Fix query proto

* Fix cli txs

* Add grpc query client implementation

* Add grpc-keeper test

* Add grpc query tests
Add revoke and exec authorization cli commands

* Fix linting issues

* Fix cli query

* fix lint errors

* Add Genesis state

* Fix query authorization

* Review changes

* Fix grant authorization handler

* Add cli tests

* Add cli tests

* Fix genesis test

* Fix issues

* update module to use proto msg services

* Add simultion tests

* Fix lint

* fix lint

* WIP simulations

* WIP simulations

* add msg tests

* Fix simulation

* Fix errors

* fix genesis import export

* fix sim tests

* fix sim

* fix test

* Register RegisterMsgServer

* WIP

* WIP

* Update keeper test

* change msg_authorization module name to authz

* changed type conversion for serviceMsg

* serviceMsg change to any

* Fix issues

* fix msg tests

* fix errors

* proto format

* remove LegacyQuerierHandler

* Use MsgServiceRouter

* fix keeper-test

* fix query authorizations

* fix NewCmdSendAs

* fix simtests

* fix error

* fix lint

* fix lint

* add tests for generic authorization

* fix imports

* format

* Update error message

* remove println

* add query all grants

* Add pagination for queries

* format

* fix lint

* review changes

* fix grpc tests

* add pagination to cli query

* review changes

* replace panic with error

* lint

* fix errors

* fix tests

* remove gogoproto extensions

* update function doc

* review changes

* fix errors

* fix query flags

* fix grpc query test

* init service-msg

* remove unsed field

* add proto-codec for simulations

* fix codec issue

* update authz simulations

* change msgauth to authz

* add check for invalid msg-type

* change expiration flag to Unix

* doc

* update module.go

* fix sims

* fix grant-authorization sims

* fix error

* fix error

* add build flag

* fix codec issue

* rename

* review changes

* format

* review changes

* go.mod

* refactor

* proto-gen

* Update x/authz/keeper/grpc_query_test.go

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

* Update x/authz/keeper/grpc_query_test.go

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

* Update x/authz/keeper/grpc_query_test.go

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

* Fix review comments

* fix protogen

* Follow Msg...Request style for msg requests

* update comment

* Fix error codes

* fix review comment

* improve msg validations

* Handle error in casting msgs

* rename actor => grantStoreKey

* add godoc

* add godoc

* Fix simulations

* Fix cli, cli_tests

* Fix simulations

* rename to GetOrRevokeAuthorization

* Move events to keeper

* Fix fmt

* Update x/authz/client/cli/tx.go

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

* rename actor

* fix lint

Co-authored-by: atheesh <atheesh@vitwit.com>
Co-authored-by: atheeshp <59333759+atheeshp@users.noreply.github.com>
Co-authored-by: Amaury Martiny <amaury.martiny@protonmail.com>
Co-authored-by: MD Aleem <72057206+aleem1413@users.noreply.github.com>
Co-authored-by: Anil Kumar Kammari <anil@vitwit.com>
2021-01-25 16:41:30 +00:00
Sunny Aggarwal b125fccfd2 MsgWeightedVote -> MsgVoteWeighted 2021-01-24 20:54:25 -05:00
Sunny Aggarwal 56ed27ad9c use @aaronc's suggested proto upgrade method 2021-01-24 20:25:43 -05:00
Federico Kunze 7d4f7f93fe
x/bank: balance and metadata validation (#8417)
* x/bank: balance validation

* metadata validation

* minor change

* balance and metadata tests

* changelog

* check for empty coins

* genesis test
2021-01-22 21:44:54 -03:00
colin axnér f9ee39f0b2
Reorder IBC channel callbacks (#8404)
* reorder chan callbacks

* add changelog

* Update CHANGELOG.md

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2021-01-21 15:10:07 +00:00
SaReN 57f5e96570
Rosetta API implementation (#7695)
Ref: #7492

Co-authored-by: Jonathan Gimeno <jgimeno@gmail.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Frojdi Dymylja <33157909+fdymylja@users.noreply.github.com>
Co-authored-by: Robert Zaremba <robert@zaremba.ch>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2021-01-21 09:33:02 +00:00
Sunny Aggarwal e94018acf9 fix merge bugs 2021-01-19 17:08:09 -05:00
Sunny Aggarwal cc15a2dfca GetClientContextFromCmd -> GetClientTxContext 2021-01-19 17:08:09 -05:00
colin axnér 116769be0b Add missing unpack interfaces functions to IBC (#8359)
* add missing UnpackInterfaces functions

* fix build

* add tests cc @fedekunze

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2021-01-19 17:08:09 -05:00
Federico Kunze 48006b435d x/bank: client denom metadata gRPC (#8317)
* deps: bump tendermint to v0.34.2

* x/bank: denom metadata gRPC

* cli: add cmd and tests

* gRPC test'

* changelog

* fix test

* Apply suggestions from code review

Co-authored-by: Robert Zaremba <robert@zaremba.ch>
Co-authored-by: Aditya <adityasripal@gmail.com>

* fix panic

* use cmd.Context()

* update tests

* Update x/bank/types/errors.go

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* test fix

Co-authored-by: Robert Zaremba <robert@zaremba.ch>
Co-authored-by: Aditya <adityasripal@gmail.com>
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-01-19 17:08:09 -05:00
Sunny Aggarwal 99c7a2cb31 Merge branch 'master' into gov_split_vote_weighted_vote 2021-01-19 15:25:36 -05:00
colin axnér 99aaa5cd79
Add missing unpack interfaces functions to IBC (#8359)
* add missing UnpackInterfaces functions

* fix build

* add tests cc @fedekunze

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2021-01-18 17:15:25 -03:00
Federico Kunze 01eec66d28
x/bank: client denom metadata gRPC (#8317)
* deps: bump tendermint to v0.34.2

* x/bank: denom metadata gRPC

* cli: add cmd and tests

* gRPC test'

* changelog

* fix test

* Apply suggestions from code review

Co-authored-by: Robert Zaremba <robert@zaremba.ch>
Co-authored-by: Aditya <adityasripal@gmail.com>

* fix panic

* use cmd.Context()

* update tests

* Update x/bank/types/errors.go

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* test fix

Co-authored-by: Robert Zaremba <robert@zaremba.ch>
Co-authored-by: Aditya <adityasripal@gmail.com>
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-01-18 18:15:16 +00:00
Marko ce5db9e4bd
fix proto generation (#8361)
* fix proto generation

* merge grpc_gateway into gocosmos_out

* change env variable names
2021-01-18 12:41:34 -03:00
Segue 411b04d3aa
Fix ibc client (#8341)
* fix-ibc-client

* add changelog
2021-01-18 11:45:06 +00:00
Robert Zaremba d39c42c987
Robert/docs slashing (#8329)
* update slashing docs

* x/slashing docs general audit & cleanup

* Update x/slashing/spec/02_state.md

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

* Update x/slashing/spec/05_hooks.md

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

* use code insertion widget

* review update

* Update x/slashing/spec/05_hooks.md

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

* update link and location for fee distribution spec

Co-authored-by: Amaury <amaury.martiny@protonmail.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2021-01-16 00:03:08 +01:00
Aaron Craelius 2521964d50
Update gogo proto deps with v1.3.2 security fixes (#8350)
* Update gogo proto deps with v1.3.2 security fixes

* Regenerate proto files
2021-01-15 19:45:34 +00:00
Marie Gauthier 1b1dbf8ab7
x/params docs general audit & cleanup (#8295)
* Update doc.go

* Update spec/

* More updates

* Update README

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-01-15 13:30:17 +00:00
Sunny Aggarwal ba96bbebdd
Merge branch 'master' into gov_split_vote_weighted_vote 2021-01-13 13:16:44 -05:00
atheeshp eafd1bc945
x/gov docs basic cleanup (#8279)
* update docs

* review changes

* review changes

* review changes

* review changes

* review changes

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-01-13 11:55:51 +00:00
Sunny Aggarwal a517c6bdf7
Merge branch 'master' into gov_split_vote_weighted_vote 2021-01-12 13:51:36 -05:00
SaReN 9d67526dd7
Fix sequence value in auth sign signature only (#8287)
* fix signature only

* add test, changelog

* update test

* Update CHANGELOG.md

* address suggestions

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2021-01-12 07:47:47 +00:00
MD Aleem a64bd8cd90
[docs] x/crisis - general audit and cleanup (#8269)
* update docs

* review changes

Co-authored-by: atheeshp <59333759+atheeshp@users.noreply.github.com>
2021-01-11 12:51:42 +00:00
atheeshp 8ac3bd2642
x/{auth, bank, distr} docs basic cleanup (#8268)
* basic code clean up

* revert MsgVerifyInvariant

* review changes

* review changes

* review changes

* review changes

* review changes

* review changes

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-01-11 12:11:22 +00:00
Sunny Aggarwal 81bc4479c0 Merge branch 'master' into gov_split_vote_weighted_vote 2021-01-10 00:27:20 -05:00
Robert Zaremba 2c611b5706
8058 fix zero time checks (#8282)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-01-09 12:08:46 +00:00
colin axnér 0df0626604
Generic 02-client cli cmds, removes light client specific ones (#8259)
* remove old light client cli cmds and replace with generic ones housed in client

* remove print and add client cli getter cmds

* use any as arguments

* revert back to single pub key

* fix tests

* typo

* remove todo

* add upgrade cli cmd cc @AdityaSripal

* register upgrade cmd
2021-01-08 13:00:07 +00:00
MD Aleem 2e8f5e52bd
[docs] x/mint - general audit and cleanup (#8267)
* update docs

* update docs

* review changes

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-01-08 11:48:04 +00:00
MD Aleem 51e7e913fb
fix GET /upgrade/current query (#8280)
* fix cli queries

* fix codec issue

* revert cli

Co-authored-by: SaReN <sahithnarahari@gmail.com>
2021-01-08 09:52:33 +00:00
Robert Zaremba 7fc5e3e6ab
codecs: rename MakeCodecs rename and docs update (#8245)
* codecs: rename MakeCodecs to MakeTestCodecs

* update changelog

* remove MakeTestCodecs

* typo
2021-01-07 21:50:52 +00:00
Marie Gauthier 0ba839a738
x/evidence doc general audit & cleanup (#8277)
* Update x/evidence doc

* Update x/evidence spec
2021-01-07 16:12:54 +00:00
colin axnér 7d6345a3f9
ibc: add proto message to Header and Misbehaviour (#8278)
* add proto message to Header and Misbehaviour

* format
2021-01-07 10:05:34 -03:00
Cory c840261cb0
Revert "Fix upgrade tx commands not showing up in CLI" (#8262)
* Revert "Fix upgrade tx commands not showing up in CLI (#8261)"

This reverts commit 893f2262a7.

* Update x/upgrade/client/cli/tx.go

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2021-01-06 22:16:20 -08:00
Robert Zaremba 85b5fa9b71
appcreator: Reuse encoding config instead of recreating it (#8250)
* appcreator: Reuse encoding config instead of recreating it

* Update tests

* merge tests

* fix export_test.go

* fix genesis_test.go

* fix withGenesis flag

* fix setup parameters

* Update server/README.md

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

* Update server/README.md

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

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2021-01-06 15:20:12 +00:00
Cory 893f2262a7
Fix upgrade tx commands not showing up in CLI (#8261)
* add upgrade tx subcommands to cli

* update CLI help to direct to cosmovisor repo
2021-01-05 19:52:49 -03:00
Robert Zaremba e481f13ff3
docs: cache-wrapping and virtual store (#8102)
* docs: cache-wrapping and virtual store

* Finish the docs update

* Update docs/building-modules/msg-services.md

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

* Update docs/building-modules/msg-services.md

Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>

Co-authored-by: Amaury <amaury.martiny@protonmail.com>
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
2021-01-05 15:57:33 +00:00
Amaury 46b697ca23
Fix gentx command setting wrong amount (#8255)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-01-05 15:08:56 +00:00
Aditya f67eac6840
Fix ConsensusStates grpc query (#8246)
* fix consensus states grpc query

* Update x/ibc/core/02-client/keeper/grpc_query.go

* simplify
2021-01-04 15:03:11 +00:00
Anil Kumar Kammari 6a9b0caa57
Add grpc gateway missing endpoints to swagger docs (#8232)
* Add missing endpoints

* Fix swagger gen

* update

* Update static.go

* Fix format

* Fix tests
2021-01-01 13:45:09 -03:00
MD Aleem ed7bd245b8
Add script to generate proto-docs (#8238)
* init protobuf-docs

* update template

* update docs/core/README.md

* update proto files

* update template

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-12-31 16:10:13 +00:00
vincent faad49688e
x/distribution: fix setting withdraw address (#8240) 2020-12-31 12:04:28 -03:00
Prathyusha Lakkireddy 91774980a5
x/ibc: minor channel fixes (#8229) 2020-12-23 15:54:23 -03:00
Prathyusha Lakkireddy f9dc082059
simulation: close opened files and check for error while creating files (#8217)
* Read gentx amount as argument

* Update gentx command usage

* Update gentx tests

* Update docs of gentx

* Close opened files and check for error while creating files

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Anil Kumar Kammari <anil@vitwit.com>
2020-12-22 13:46:42 +00:00
colin axnér 25bb17db8a
fix timeout bug (#8200) 2020-12-18 19:01:01 +00:00
Anil Kumar Kammari 4e7c5e9291
update x/upgrade docs (#8196) 2020-12-18 15:06:18 +00:00
Robert Zaremba b18a033a17
Clean Any interface (#8167)
* Clean Any interface

+ removed Any.Pack method. This method is not needed, because we have specialized
  functions for createing new Any values. It could be used inappropriately with existing
  Any objects.

* removed deprecated PackAny function

* fix linter issue

* update nil handling

* NewAnyWithValue returns error on nil instead of panic

* NewMsgCreateValidator: handle nil pubkey

* Remove AsAny and tx builder workarounds

* fix linter issue

* Add AsAny methods to TxBuilder and StdTxConfig, but keep intoAny interface private

* remove tx.PubKeyToAny

* cosmetic updates

* fix method interface

* move ProtoTxProvider to x/auth/tx
2020-12-18 14:55:25 +00:00
Jack Zampolin 75bc312ffd
Update default historical header number for stargate (#8178)
* Update default historical header number

* Update x/staking/types/params.go

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

* fix tests

* duh

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Amaury <amaury.martiny@protonmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Federico Kunze <federico.kunze94@gmail.com>
2020-12-17 19:50:03 +00:00
Aditya 731be71379
Fix IBC upgrade: manually tested (#8187)
* commit at plan.Height key

* fix upgrade tests

* remove debugging prints

* Update x/ibc/light-clients/07-tendermint/types/upgrade.go

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
2020-12-17 17:32:19 +00:00
Prathyusha Lakkireddy be573cb0ce
change gentx cmd amount field to arg from flag (#8183)
* Read gentx amount as argument

* Update gentx command usage

* Update gentx tests

* Update docs of gentx

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2020-12-17 17:27:30 +01:00
Jordan Sexton 3781028e85
docs: typo fix (#8172)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-12-16 13:44:34 +00:00
Federico Kunze 1c6881def8
x/ibc: fix ClientUpdateProposal unpacker (#8170)
* x/ibc: fix ClientUpdateProposal unpacker

* rm duplicate line
2020-12-16 10:41:20 +01:00
colin axnér 829e068545
x/upgrade: fix software upgrade proposals from automatically failing, add unpackinterfaces function (#8169)
* fix unpack interfaces bug

* remove unnecessary ;
2020-12-15 19:06:09 +01:00
Jun Kimura 039036f1cd
add Increment method to Height interface (#8157)
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
2020-12-15 12:26:43 +00:00
Amaury cf86c567c7
Add msg on CLI for migrating GenesisDoc (#8164)
* Add msg on CLI for migrating GenesisDoc

* Fix build

* Better indentation

* Add table tests

* typo

* Rename variables

* Fix validate tests

* Add warning println

Co-authored-by: Cory <cjlevinson@gmail.com>
2020-12-14 22:51:23 +00:00
Robert Zaremba a3ae6e3704
Combine client.ReadTxCommandFlags with GetClientContextFromCmd (#8155)
* Update codebase to simplify clientCtx loading from cmd

* make ReadTxCommandFlags and ReadQueryCommandFlags private

* fix build error

* fix conflicts
2020-12-14 22:09:51 +00:00
Robert Zaremba 3a9e696bbf
fix: Signature only flag bug on tx sign command 7632 (#8106)
* fix: Signature only flag bug on tx sign command 7632

* Update client/context.go

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

* Update client/context.go

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

* use named return value and closure (#8111)

This is to correctly handle deferred Close()
calls on writable files.

* set the right 'append' logic for signing transactions

* cleanup

* update tx.Sign interface by adding overwrite option

* Update Changelog

* sign command cleanup

* implementation and changelog update

* fix SignTx and tx.Sign calls

* fix: sign didn't write to a file

* update flags description

* Add tx.Sign tests

* fix grpc/server_test.go

* Update client/tx/tx.go

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

* changelog update

* Add test to verify matching signatures

* cli_test: add integration tests for sign CMD

* add output-file flag test

* add flagAmino test

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

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

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

* update amino serialization test

* TestSign: adding unit test for signing with different modes

* Add test with Multi Signers into Robert's TxSign PR (#8142)

* Add test with Multi Signers

* remove true false

* Use SIGN_MODE_DIRECT

* Fix litn

* Use correct pubkeys

* Correct accNum and seq

* Use amino

* cleanups

* client.Sign: raise error when signing tx with multiple signers in Direct

+ added more unit tests

* add more tests

* Update client/tx/tx_test.go

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

* fix TestGetBroadcastCommand_WithoutOfflineFlag

* Any.UnsafeSetCachedValue

* fix note packed messages in tx builder

* reorder unit tests

* Changelog update

* cleaning / linting

* cli_tes: copy validator object instead of modifying it's shared codec

* x/auth cli_test: remove custom codec creation in tests

* Update CHANGELOG.md

* updates to CHANGELOG.md

* remove unused method

* add new instance of transaction builder for TestSign

Co-authored-by: Cory <cjlevinson@gmail.com>
Co-authored-by: SaReN <sahithnarahari@gmail.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Amaury <amaury.martiny@protonmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-12-14 21:44:15 +00:00
Aditya 5aaae12b6d
support upgrade on same revision (#8165)
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
2020-12-14 19:31:45 +00:00
Andrey Kuprianov a821fe4a61
Model-based tests for relay functions of ICS-20 token transfer (#8145)
* start on MBT for ICS20: setting and checking bank balances

* add bank struct for subtracting banks

* reconstruct ibc denominations in the bank

* add some static tests with bank changes tracking

* small fixes

* better error handling

* add Jsonatr transform from Apalache conterexample into OnRecvPacket test

* add example Apalache CE and transformed test

* changed apalache-to-recv-test.json to output arrays instead of records

* add datastructures for parsing TLA+ tests

* remove accidentally committed code

* add conversion from TLA+ structs to Go structs

* encode abstract ids into addresses via hashes

* first run of auto-generated MBT tests

* first run of auto-generated MBT tests: fix ports and channels

* fix small inconsistencies

* fix mbt_relay_test by not setting the bank balances in every iteration

* add test for onTimeoutPacket

* add handling of OnRecvAcknowledgement to mbt relay test

* add handling of SendTransfer

* add relay-test.json

* revert manual changes in relay-test.json

* fix handling of denominations for SendTransfer

* setup two test channels A-B, B-C; fix escrow address encoding

* a test for all handlers passing

* generalize denom handling to arbitrary length + failing denom test

* rename test function

* MBT test for unsecrow tokens

* add model-based generated tests

* add model-based tests (prev commit: addded model)

* transformed json tests with jsonatr

* modify mbt_relay_test.go to execute all MBT tests

* cleanup

* move jsonatr transforms into another dir

* add MBT_README.md

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-12-11 17:35:44 +00:00
Amaury bce5da0e84
Use SignModeLegacyAminoJSON when signer is ledger key (#8136)
* Use SignModeLegacyAminoJSON when signer is ledger key

* Fix tests

* Fix lint

* Fix tests

* Add warning message

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2020-12-11 13:54:50 +00:00
Aleksandr Bezobchuk 521380abd6
x/auth: atlas manifest (#8140) 2020-12-10 17:02:29 +01:00
Aleksandr Bezobchuk 10f846217d
atlas: x/auth v0.39.1 (#7996) 2020-12-10 10:40:42 -05:00
Aleksandr Bezobchuk 9104a72d50
x/bank: update atlas manifest (#8137) 2020-12-10 16:12:09 +01:00
Alessio Treglia 056f416d2b
use testutil in test cases (#8130)
Also replace defer calls with
testing.T.Cleanup()
2020-12-10 12:56:55 +00:00
Anil Kumar Kammari e321317c20
add page flags for staking validators (#8103)
* add page flags for staking validators

* add test

* fix test

* add build flag

Co-authored-by: aleem1413 <aleem@vitwit.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-12-10 12:26:44 +00:00
Alessio Treglia f51f5e6784
testutil: new TempFile function, simplify WriteToNewTempFile (#8123)
Files returned by WriteToNewTempFile are cleaned up
automatically at the end of a test case execution.
WriteToNewTempFile now relies on the TB.TempDir()
function provided by the testing std package.

TempFile returns a temporary file that can be used
within a test case and is automatically removed
at the end of the test execution.
2020-12-09 18:27:20 +00:00
colin axnér af401359eb
fix ibc-transfer receiving denom bug (#8119)
* fix receiving denom bug

* Update x/ibc/applications/transfer/keeper/relay.go

* add testing sending 2 hops and back one

Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
2020-12-09 15:02:59 +00:00
Amaury 58491a5660
Add UnpackInterfaces to BroadcastReq (#8118)
* add test case for decoding & re-encoding a full transaction using amino

* drop equal assertion for tx and txRequest

* Fix BroadcastReq UnpackInterfaces

* Remove unrelated files

* order imports

* sort imports again

Co-authored-by: Cory Levinson <cjlevinson@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-12-09 11:05:12 +00:00
Robert Zaremba fe41718047
Robert/api clientctx (#8107)
* rename clientCtx.PrintOutput to PrintObject

* rename clientCtx.PrintOutputLegacy to PrintObjectLegacy

* Changelog update

* Rename PrintObject to PrintProto
2020-12-08 20:17:40 +00:00
Riccardo Montagnin e843878920
Recover private validator key (#8099)
* Recover private validator key
Added the ability to recover the private validator key from a given mnemonic when initializing the node

* Added CHANGELOG entry

* Reverted dependencies

* Added tests

* Fixed mnemonic checking as suggested and added tests

* Run make format and fixed go.sum checksum

* Run make format

* fix imports

* fix TestInitializeNodeValidatorFilesFromMnemonic

* Update CHANGELOG.md

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

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Alessio Treglia <quadrispro@ubuntu.com>
2020-12-08 17:22:43 +00:00
Emmanuel T Odeke e38a6df9cd
x/ibc/light-clients: simplify max time comparison (#8089)
The prior code that tried to get the newest/larger time
between the too performed:
* 2 time.Time.UnixNano() retrievals: 2 multiplications, 2 additions
* 1 math.Max comparison
* 1 time.Unix(0, minTime) creation

but really this code could just use native operations on:
time.Time.After() simply.

This now becomes a single operation, single comparison for the same effect.
2020-12-08 13:47:20 +01:00
Robert Zaremba b219c54c2d
Move and update codec.MarshalAny functions to codec.Marshaler interface (#8080)
* Changelog update

* Rename codec.MarshalAny

* move codec.MarshalInterface to codec.Marshaler

* fix tests

* Update amino_codec for compliance with MarshalerInterface

* update tests and comments

* add tests

* change order of args in UnmarshalInterface to a canonical one

* uplift MarshalInterface to take ProtoMessage as an argument

* wip

* add nil check

* make tests working

* tests cleanup

* add support for *JSON methods

* Update changelog

* linter fixes

* fix test types

* update evidence genesis_test

* adding test

* review updates

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-12-08 09:27:08 +00:00
Sunny Aggarwal da6b7f7755
removed gov docs bug (#8105) 2020-12-07 21:33:27 +00:00
Emmanuel T Odeke 291d966fe9
x/ibc/core/23-commitment/types: fix MerkleProof.Empty comparisons (#8092)
* x/ibc/core/23-commitment/types: fix MerkleProof.Empty comparisons

Fixes invalid pointer creation, reduces on unnecessary allocations
inside MerkleProof.Empty, and changes the method to a pointer; the
invalid pointer creation was symptomatic of broad use of values.

With this change we have improvements whose benchmarks produce:

```shell
name     old time/op    new time/op    delta
Empty-8     311ns ± 5%     232ns ± 5%  -25.49%  (p=0.000 n=20+19)

name     old alloc/op   new alloc/op   delta
Empty-8     56.0B ± 0%      8.0B ± 0%  -85.71%  (p=0.000 n=20+20)

name     old allocs/op  new allocs/op  delta
Empty-8      3.00 ± 0%      1.00 ± 0%  -66.67%  (p=0.000 n=20+20)
```

Fixes #8091

* Move Empty godoc to right place + add comments for blank*
2020-12-07 20:57:15 +00:00
Aditya 971d253214
Implement Connection-specified delay (#8069)
* start with initialization and metadata

* start by fixing delay period during connection handshake

* fix connection handshake tests

* add delay period logic to packet verification

* proto format

* fix err issue

* appease linter

* document upgrade special case

* Update x/ibc/light-clients/07-tendermint/types/client_state.go

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* Update x/ibc/light-clients/07-tendermint/types/store.go

* add sanity check

* fix build

* fix tests

Co-authored-by: colin axnér <25233464+colin-axner@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>
Co-authored-by: Colin Axner <colinaxner@berkeley.edu>
2020-12-07 12:13:06 +00:00
Mark Jackson de114773ee
fix typo (#8097)
Co-authored-by: Jonathan Gimeno <jgimeno@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-12-07 11:26:09 +00:00
Emmanuel T Odeke a8c3b4414d
x/bank/keeper: fix a missing gRPC error in AllBalances (#8085)
* x/bank/keeper: fix a missing gRPC error in AllBalances

Fixes an incoherent return which had:
    (non-nil value, non-nil-non-grpc error)
to
    (nil value, non-nil-gRPC error)

and it is a follow-up of PR #7814.

* types/query: fix pagination test (#8096)

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2020-12-07 01:32:59 -08:00
colin axnér c8a9da1d27
increase ibc basic genesis validation (#8081)
* increase client basic genesis validation

* add connection/channel genesis validation

* fix tests

* apply @AdityaSripal suggestion

Co-authored-by: Christopher Goes <cwgoes@pluranimity.org>
2020-12-05 21:10:15 +00:00
Anil Kumar Kammari 4a233b8dcf
Rename GRPCRouter (#8079)
* rename GRPCRouter

* Update store/types/store.go

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

* Fix gofmt

Co-authored-by: Robert Zaremba <robert@zaremba.ch>
2020-12-04 15:06:50 +00:00
Frojdi Dymylja 7ec3bcd23a
fix: bank gRPC error status codes (#7814)
Co-authored-by: SaReN <sahithnarahari@gmail.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2020-12-04 12:19:29 +00:00
Amaury 1b00c01b70
Audit through legacy endpoints to find breaking changes (#8037)
* Add error msg on staking

* Add tests for legacy staking and gov

* Add test for encode

* Fix broadcast too

* Add comments

* update changelog

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-12-03 23:33:32 +00:00
Aleksandr Bezobchuk 5291a8ff31
Refactor Logging using Zerolog (#8072)
* init commit

* server: use flags

* server: godoc++

* updates

* baseapp: update logging

* logging updates

* x/bank: update logging

* logging updates

* lint++

* logging updates

* logging updates

* logging updates

* logging updates

* cl++
2020-12-03 23:17:21 +00:00
SaReN 183593ff6d
Update signbatch multisig to work online (#7801)
* add test for signbatch multisig

* update test

* fix sign batch multisig

* update offline usage

* address comments

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2020-12-03 09:48:17 +00:00
Robert Zaremba 6040d1b88b
fix: Metadata is not initialized in x/bank InitGenesis #7951 (#8065)
* fix: Metadata is not initialized in x/bank InitGenesis #7951

* remove commented code

Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
2020-12-03 08:39:11 +00:00
Aleksandr Bezobchuk bac31becb3
evidence: fix query command (#8066)
* evidence: fix query command

* evidence: add CLI tests

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-12-02 18:08:16 +00:00
MD Aleem b6c8d5ea9f
Add tx broadcast gRPC endpoint (#7852)
* WIP tx/broadcast grpc endpoint

* fix lint

* fix proto lint

* Update service.proto

* resolve conflicts

* update service.proto

* Update service.proto

* review changes

* proto lint

* Switch to txraw

* Add check breaking at the end

* Fix broadcast

* Send Msg on SetupSuite

* Remove proto-check-breaking

* 1 validator in test

* Add grpc server tests for broadcast

* Fix grpc server tests

* Add some changes

* Add ress comments

* Add table tests for tx service

* Add test for mode

* Add simulate tests

* Add build flag back

* Revert custom stringer for enum

* Remove stray logs

* Use /txs/{hash}

Co-authored-by: Amaury Martiny <amaury.martiny@protonmail.com>
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
2020-12-02 17:50:40 +00:00
MD Aleem a51eac4f15
Fix QueryByEvents with multiple events and empty pagination request (#8029)
* fix pagination issue

* Fix querying with multiple events

* reuse ParsePagination

* update tests

* change event type to array

* fix test

* review changes

* add test case for escape params

* review changes

* resolve conflicts

* fix test

* fix test

Co-authored-by: anilCSE <anil@vitwit.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-12-01 04:18:35 +00:00
Amaury 7ad2aab2c4
Add panic handler on queries (#8039)
* Add test that panics

* Add panic in abci query

* Move proto gen files to correct place

* Add panic handler in grpc server

* Fix test

* Fix build

* Use %v

* Better panic message

* Fix tests

Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
2020-11-30 16:59:35 +00:00
colin axnér bcb3240d06
Use generated client identifiers (#8034)
* add client identifier generation

* update proto and start fixing tests

* fix ibc tests

* fix auth rest test

* update spec

* fix lint

* add parsing tests and fix bugs

* fix regexp

* add godoc

* address @AdityaSripal review suggestions for identifier parsing

* address rest of @AdityaSripal's review comments

* remove unnecessary comment

* typos

* fix lint

* Apply suggestions from code review

Co-authored-by: Aditya <adityasripal@gmail.com>

* add more heigh tests as per @AdityaSripal suggestion

Co-authored-by: Aditya <adityasripal@gmail.com>
2020-11-30 15:52:45 +00:00
Sunny Aggarwal 9635a99e2f
Merge branch 'master' into gov_split_vote_weighted_vote 2020-11-26 13:54:24 -05:00
colin axnér ed9fc058f1
Add an IBC prefix to transfer escrow addresses (#7967)
* add IBC prefix to escrow addresses

* use ADR 028 AddressHash construction

* remove extra space

* apply @AdityaSripal suggestion; prefix from ibc -> ibc-transfer-escrow-prefix

* Use alternative 1 proposed by @andrey-kuprianov

* anticpate necessary build fix

* add escrow address issue link into module.go

* Update x/ibc/applications/transfer/types/keys.go

Co-authored-by: Andrey Kuprianov <59489470+andrey-kuprianov@users.noreply.github.com>

* Update x/ibc/applications/transfer/types/keys.go

Co-authored-by: Andrey Kuprianov <59489470+andrey-kuprianov@users.noreply.github.com>

* apply @andrey-kuprianov review suggestions

Deduplicate code into a helper function as suggested. Add unit tests for max transfer channels test.

Co-authored-by: Andrey Kuprianov <59489470+andrey-kuprianov@users.noreply.github.com>
2020-11-26 13:44:54 +00:00
yihuang 512b533242
cli: ParseCoin doesn't do normalize (#7954)
follow up on https://github.com/cosmos/cosmos-sdk/pull/7777
ParseCoin need to be treated similarly.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-11-25 18:02:10 +00:00
Amaury a9dd334c34
Fix legacy querying tx ("unregistered type" bug) (#7992)
* Add tests for query txs

* Add test for IBC

* Refactor checkSignModeError

* Fix lint

* Add successful IBC test

* Remove logs

* break

* Remove known errors

* Update error message

* Better comments

* Revert variable renaming

* Fix lint

* Add mention of gRPC as TODO
2020-11-25 12:02:31 +00:00
Amaury 1b3ce2c1d1
CLI `migrate` command for x/{upgrade,params} proposals (#7875)
* Add v038 upgrade types

* Add migrate x/upgrade

* remove nolint

* Add ParameterChangeProposal

* Revert change

* Don't register crypto twice

Co-authored-by: Anil Kumar Kammari <anil@vitwit.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-11-24 23:32:32 +00:00
Aditya c15884a204
Rename Version to Revision in IBC Height (#8020)
* rename Version to Revision in ibc Height

* lint

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-11-24 15:38:24 +00:00
colin axnér 88e03e4f40
Deterministic connection and channel identifiers (#7993)
* add generate identifier functions for connection and channel

* update proto types and begin open init changes

remove unnecessary field from open init msgs. Update connectionopeninit handshake, begin updating channel handshake

* finish connection handshake chanes and some channel handshake changes

Finish updating connection handshake changes, update genesis for connection and channel, some channel handshake changes, fix build for tests but still failing

* finish channel handshake changes

* fix more tests

* fix connection handshake tests

* fix more tests

* fix build

* changes from self review

* address @fedekunze review suggestions

* update spec

* fix build

* fix tests

* Update x/ibc/testing/chain.go

Co-authored-by: Aditya <adityasripal@gmail.com>

* Update x/ibc/core/03-connection/types/msgs.go

Co-authored-by: Aditya <adityasripal@gmail.com>

* address @AdityaSripal comments

* reflect spec changes

* address @AdityaSripal review suggestions

* nit

* add connection/channel identifier parsing and validation as per @AdityaSripal suggestion, cc @fedekunze

* Fix auth rest test

Change dummy channel id to a valid channel id given the updated stricter channel identifier checks cc @amaurymartiny

Co-authored-by: Aditya <adityasripal@gmail.com>
2020-11-24 15:28:20 +00:00
Amaury 13bc504bec
docs: Add REST endpoints migration guide (#8011)
* Add REST endpoints migration guide

* add bank, distrib, evidence

* Add slashing, mint

* Add staking

* Add query

* Add todo

* Typos

* Add link to interact node

* grammar

* Better wording

* Update docs/migrations/rest.md

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

* Update docs/migrations/rest.md

* Add footnote

Co-authored-by: Robert Zaremba <robert@zaremba.ch>
2020-11-24 14:34:20 +00:00
Aditya 53294f5269
check clients against params and consensus against clients (#8016)
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
2020-11-24 12:27:35 +00:00
Aditya def3c5ba71
Add ConsensusState to IBC Upgrades (#7919)
* upgrade progress

* fix build minus cli

* write state at block before upgrade height

* refix build

* Apply suggestions from code review

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* fix upgrade and start with tests

* fix tendermint tests

* add tests and remove unnecessary relayer options on upgradedClient

* fix all tests except weird msg panic

* add invalid final client test and codec stuff

* fix everything but msg issue

* remove problematic test for now

* safer self validation

* upgrade fixes

* proto-linting

* remove unnecessary last height

* add timestamp to committed upgrade consensus state

* address final nits

* address nit

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-11-24 11:45:33 +00:00
Amaury 74435137e9
Show height on legacy REST endpoints (#7997)
* Fix showing height in rest endpoints

* Fix query height

* Manually inject req.Height

* Small tweaks

* Use withHeight

Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-11-24 10:28:12 +00:00
colin axnér 966e26d23d
Fix tendermint misbehaviour trusted consensus state age check (#8006)
* use TrustingPeriod instead of UnbondingPeriod when verifying the age of the trusted consensus state

* update comment
2020-11-23 16:10:25 +01:00
Aleksandr Bezobchuk a7296d3d4e
Bump Tendermint v0.34.0 (#7995)
* init commit

* ibc: remove redundant casting

* ci: attempt fix liveness job
2020-11-20 19:00:11 +01:00
SaReN 07cfed4178
Merge branch 'master' into robert/bech32-pubkey-slashing 2020-11-20 01:23:54 +05:30
Aleksandr Bezobchuk 4be5cd3454
docs: x/bank: Atlas Doc (#7961) 2020-11-19 11:57:10 -05:00
Robert Zaremba a4130f5821 remove unused function 2020-11-19 02:19:19 +01:00
Robert Zaremba 0034e48458 Bech32 PubKey: use protobuf in slashing keeper 2020-11-19 01:10:11 +01:00
Federico Kunze 87315a6aab
ibc: commit packet and hash (#7808)
* ibc: commit packet and hash

* minor changes

* fix build

* update err msgs

* don't use Any

* update commitment hash to used fixed length preimage

The commitment hash will now use 8 bytes timeout timestamp + 8 bytes timeout height version number + 8 bytes timeout height version height + sha 256 hash of data

* remove error from CommitPacket return values

* update godoc

* rm proto-tools-stamp

Co-authored-by: Colin Axner <colinaxner@berkeley.edu>
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-11-18 19:01:22 +00:00
colin axnér f02a46263f
update transfer error messages (#7968)
* update transfer err messages

* apply @AdityaSripal review suggestion
2020-11-18 14:56:26 +01:00
Marie Gauthier 1cc8af8d9b
[docs]: update building modules section to reflect ADR31 (#7702)
* Revert "Revert "Update old ref of RegisterQueryService""

This reverts commit 03e4c56de53938ccbf025a441e54b9842f7c4544.

* Update intro, module-manager and messages-and-queries

* Update messages-and-queries

* Update handler

* Update structure

* Add doc related to RegisterMsgServiceDesc

* Update docs/building-modules/handler.md

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

* Update docs/building-modules/handler.md

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

* Update docs/building-modules/handler.md

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

* Update docs/building-modules/messages-and-queries.md

* Update handler.md

* Rename handler.md to msg-services.md

* Update legacy msgs wording

* Update messages-and-queries.md

* Update docs/building-modules/msg-services.md

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

* Update docs/building-modules/intro.md

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

* Remove handler mention from intro.md

* Update docs/building-modules/messages-and-queries.md

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

* Update docs/building-modules/messages-and-queries.md

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

* Update docs/building-modules/msg-services.md

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

* Update docs/building-modules/keeper.md

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

* Update docs/building-modules/msg-services.md

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

* Address review comments

* Use tag

* Update docs/building-modules/intro.md

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

* Update docs/building-modules/intro.md

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

* Update docs/building-modules/messages-and-queries.md

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

* Update docs/building-modules/messages-and-queries.md

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

* Update docs/building-modules/messages-and-queries.md

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

* Update docs/core/transactions.md

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

* Update docs/building-modules/messages-and-queries.md

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

* Update docs/building-modules/messages-and-queries.md

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

* Update docs/building-modules/messages-and-queries.md

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

* Update docs/building-modules/messages-and-queries.md

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

* Remove framework related explanation from docs

* Update docs/building-modules/messages-and-queries.md

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

* Update docs/building-modules/module-manager.md

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

* Update docs/building-modules/module-manager.md

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

* Update docs/building-modules/msg-services.md

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

* Update docs/building-modules/msg-services.md

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

* Update docs/building-modules/msg-services.md

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

* Update docs/building-modules/msg-services.md

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

* Update docs/building-modules/msg-services.md

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

* Update docs/building-modules/msg-services.md

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

* Update docs/building-modules/msg-services.md

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

* Update docs/core/baseapp.md

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

* Update docs/core/baseapp.md

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

* Update beginblock-endblock.md

* Update docs/core/baseapp.md

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

* Update docs/core/transactions.md

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

* Add deprecated notice

* Update tx-lifecycle.md

Co-authored-by: Robert Zaremba <robert@zaremba.ch>
Co-authored-by: Amaury Martiny <amaury.martiny@protonmail.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>
2020-11-17 20:41:43 +00:00
colin axnér 03c8fb313d
add domain separation between port and channel (#7960)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-11-17 15:37:20 +00:00
colin axnér a7435d03eb
fix validate basic check (#7962)
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-11-17 15:18:16 +00:00
colin axnér 715933b5f3
reduce redundancy (#7959)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-11-17 15:01:34 +00:00
atheeshp ab7104865d
improve error messages for legacy rest endpoints (#7856)
* improve error messages for legacy rest endpoints

* add test

* review changes

* review changes

* refactor

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

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
2020-11-17 14:46:24 +00:00
Emmanuel T Odeke 9369a00557
x/simulation: make signals channel buffered to avoid missing signals (#7952)
Invoking:

    c := make(chan os.Signal)
    signal.Notify(c, signals...)

is explicitly called out as a bug in the os/signal docs
and should instead make that channel buffered lest
a signal could be lost.

Fixes #7950

Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
2020-11-17 14:27:12 +00:00
colin axnér 0647d897f5
add is frozen client state check to send packet (#7957)
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-11-17 12:55:33 +00:00
colin axnér e93b18e60e
self height uses GTE in self client check (#7945)
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-11-17 11:40:12 +00:00
Jun Kimura f962f3a28c
Fix int64 overflow error for height comparison (#7944)
* fix int64 overflow for height comparison

* apply suggestions from review

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-11-17 10:42:06 +00:00
Sunny Aggarwal 479ad6be45
Merge branch 'master' into fix_power_reduction_test_cast_int64 2020-11-16 12:19:39 -04:00