Commit Graph

760 Commits

Author SHA1 Message Date
SaReN 0effd3a9d3
Paginate supply queries (#8798)
* paginate grpc query

* fix lint

* update tests

* remove GetTotalSupply

* fix test

* remove GetTotalSupply

* add changelog

* update changelog

* update rosetta data

* update limit

* update genesis

* add max limit to query

* fix lint

* go imports

* Update types/query/pagination.go

* update supply

Co-authored-by: Marko <marbar3778@yahoo.com>
2021-04-06 14:43:08 +00:00
SaReN 4b2fc3bd43
Store supply as Int bytes rather than string bytes (#9051)
* store supply as int bytes

* update migrate

* update migrate tests

* add error context

* fix lint

* update spec

* add changelog

Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Jonathan Gimeno <jgimeno@gmail.com>
2021-04-06 14:01:57 +00:00
colin axnér 5247a557d5
revert 8909 (#8960)
* revert 8909

* remove entry from CHANGELOG

* fix test
2021-04-06 11:40:17 +00:00
technicallyty e3a0148bf6
x/upgrade: protocol version tracking (#8897)
* -added consensus version tracking to x/upgrade

* -added interface to module manager -added e2e test for migrations using consensus version store in x/upgrade -cleaned up x/upgrade Keeper -handler in apply upgrade now handles errors and setting consensus versions -cleaned up migration map keys -removed init chainer method -simapp now implements GetConsensusVersions to assist with testing

* protocol version p1

* add protocol version to baseapp

* rebase against master

* add test

* added test case

* cleanup

* docs and change to bigendian

* changelog

* cleanup keeper

* swap appVersion and version

* cleanup

* change interface id

* update keeper field name to versionSetter

* reorder keys and docs

* -move interface into exported folder

* typo

* typo2

* docs on keeper fields

* docs for upgrade NewKeeper

* cleanup

* NewKeeper docs

Co-authored-by: technicallyty <48813565+tytech3@users.noreply.github.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2021-04-02 07:11:58 -07:00
Amaury 413938c5ed
Add ledger/multisig detection in SignTx functions (#9026)
* Add ledger/multisig detection in SignTx functions

* Fix tests

* Update CHANGELOG.md

* update cl

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2021-03-31 09:25:23 +00:00
Ian Norden feed37dc56
ADR-038 Part 1: WriteListener, listen.KVStore, MultiStore and KVStore updates (#8551)
* StoreKVPair protobuf message definition and generated go types

* store WriteListener

* update MultiStore, CacheWrap, CacheWrapper interfaces

* adjust KVStores to fit new CacheWrapper interface

* new ListenKVStore

* adjust multistores to fit new MultiStore interface and enable wrapping returned KVStores with the new ListenKVStore

* typo fixes in adr

* ListenKV Store test

* update server mock KVStore and MultiStore

* multistore unit test; fix multistore constructor

* update changelog

* fix bug identified in CI

* improve codecov, minor fixes/adjustments

* review fixes

* review updates; flip set to delete in KVStorePair, updated proto-docs from running 'make proto-gen'
2021-03-30 16:13:51 -04:00
MD Aleem 636e6598b9
fix: grpc-gateway error codes (#9015)
* update grpc query handler

* try fix http response error codes

* add test

* add changelog

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
2021-03-29 13:42:43 +00:00
Robert Zaremba 7568b6680a
Remove bech32 PubKey support (#7477)
* Move PubKey bech32 to legacy package and migrate the usage where possible

* update /server

* wip

* move proto json encoding helper functions to internal

* update internal/marshal

* wip

* update sections which needs legacybech32

* update validators output

* fix conflicts

* slashing update

* add more tests and helper function for ANY JSON serialization

* update slashing

* Update function documentation

* Rename code any-marshal helper functions

* Update pubkey unpacking test

* Update test comments

* solve TestDecodeStore

* solve legacytx issues

* all code compiles

* keyring tests

* keyring cleanup

* remove AssertMsg

* fix some tests

* fix add_ledger_test.go

* update cli tests

* debug cli test

* rename clashed bech32 names

* linter fixes

* update tmservice tests

* linter: update legacy deprecated checks

* fix names

* linting

* legacybech32 pubkey type rename

* fix staking client

* fix test compilation

* fix TestGetCmdQuerySigningInfo

* rename NewIfcJSONAnyMarshaler

* keyring: remove duplicated information from multinfo structure

* todo cleanups

* Update Changelog

* remove some legacybech32 from tests

* remove todos

* remove printlnJSON from /server CLI and amino encoding

* remove protocdc.MarshalJSON

* client/show remove duplicated function

* remove protocdc package

* comment update

* remove legacybech32.MustMarshalPubKey from a test

* add todo

* fix TestPublicKeyUnsafe test

* review update

* fix bech32 UnmarshalPubKey

* Use codec.MarshalIfcJSON

* fix linter issues

* merging conflict: fix codec.Unmarshal calls

* cleanups

* Update CHANGELOG.md

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

* Reword changelog updates

* use pubkey.String for comparison in Test_runAddCmdLedgerWithCustomCoinType

* Update GetCmdQuerySigningInfo example

* cli: update keys add docs

* Add errors AsOf and errors.ErrIO type

* restore multisigPubKeyInfo structure bring it back to multiInfo struct

* Update codec/proto_codec.go

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

* Update crypto/keys/ed25519/ed25519_test.go

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

* Update codec/proto_codec.go

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

* move pubkey any marshaling tests

* Apply suggestions from code review

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

* review updates

* adding missing return

* errors: use IsOf instead of AsOf

* keyring: add a correct check for key not found in keyring.Get

* add checkKeyNotFound

* fix linter issues

* fix: keyring key not found check

* fix keyring tests

* fix linting issues

* cli tests

* fix: 'simd keys show <key> -p'

* fix: TestVerifyMultisignature

* rename keyring Bech32... functions to Mk...

* fix RunAddCmd

* Update pubkey display

* wip

* add more tests

* udate keyring output tests

* remove todo from ledger tests

* rename MkKeyOutput

* Changelog update

* solve liner issues

* add link to github issue

Co-authored-by: Aaron Craelius <aaron@regen.network>
Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>
2021-03-25 14:53:22 +00:00
Amaury 1fa2c22d8a
Prefer sending tx_bytes to Simulate gRPC endpoint (#8926)
* First run

* Remove dead code

* Make test pass

* Proto gen

* Fix lint

* Add changelog

* Fix tests

* Fix test

* Update x/auth/tx/service.go

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

* Remove protoTxProvider

* Add grpc-gateway test

* Add comment

* move to api breaking

* lesser diff

* remove conflict

* empty commit to rerun CI

* empty commit to rerun CI

Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-03-25 10:52:54 +00:00
Jonathan Gimeno 7ac436d2f7
Improve set supply (#8950)
* temp commit

* remove set supply

* fix supply

* remove keys

* improve supply set

* update changelog

* improve linter

* update setSupply to get only one coin

* update genesis

* remove dirt

* save only supply

* go fmt

* update rosetta test bootstrap

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Frojdi Dymylja <33157909+fdymylja@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-03-25 10:03:13 +00:00
Hanjun Kim 8ee9da775e
types: add Abs() method to sdk.Int (#8963)
Fixes #8962

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2021-03-24 16:33:55 +00:00
Aleksandr Bezobchuk 56c312a979
Merge pull request from GHSA-2f3p-6gfj-jccq
* x/bank: update SendCoinsFromModuleToAccount

* x/bank: add TestSendCoinsFromModuleToAccount_Blacklist

* CL++

* fix tests

* godoc++
2021-03-24 12:05:33 -04:00
Alessio Treglia fa39793034
merge changelogs from v0.42.1 and v0.42.2 (#8968) 2021-03-24 07:51:27 +00:00
MD Aleem a78f777ea8
add reverse iteration to pagination (#8875)
* WIP

* add tests

* add tests

* fix lint

* fix pagination

* add proto message doc

* fix filtered_pagination

* fix test

* cleanup

* add reverse flag to pagination

* changelog

* Update client/flags/flags.go

* Update CHANGELOG.md

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2021-03-23 09:28:20 +00:00
atheeshp 025d226099
move feegrant ante to auth ante (#8682)
* move feegrant ante to auth ante

* update ante builder

* remove commented code

* review changes

* fix lint

* review changes

* review changes

* review changes

* review changes

* fix ante builder

* review changes

* update ante builder with options struct

* review changes

* review changes

* add changelog

Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
Co-authored-by: Aaron Craelius <aaron@regen.network>
2021-03-23 07:31:09 +00:00
Frojdi Dymylja ac48ffe748
gRPC: fix server reflection (#8945)
* add: gogoreflection

* fix: server reflection

* fix: make tests resolve imports in a transitive way

* chore: cleanup getMessageType

* chore: lint

* add: extensions reflection

* chore: update interact-node.md docs

* chore: update CHANGELOG.md

* Update server/grpc/gogoreflection/fix_registration.go

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

Co-authored-by: Jonathan Gimeno <jgimeno@gmail.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Robert Zaremba <robert@zaremba.ch>
2021-03-22 19:40:34 +00:00
colin axnér 8a37ba04a4
CreateValidator self delegation must be at least one consensus power (#8909)
* update MsgCreateValidator ValidateBasic to enforce self delegation minimum

MsgCreateValidator ValidateBasic requires a self delegation of at least one consensus power, this prevents a common, but hard to debug error

* add changelog

* Update CHANGELOG.md

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

* fix simulation tests

Construct successfuly MsgCreateValidator to use a self delegation which is greater than the PowerReduction

* fix cli tests

* fix cli tests

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Marko <marbar3778@yahoo.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-03-22 12:41:27 +00:00
Amaury 3f52d5a44f
Add 0.43 CLI JSON `migrate` command (#8880)
* Add aadr-037 json migration

* Add 0.43 to CLI migraet command

* Add comment

* Don't cover .pb.go

* Bez says (2)

* Reviews

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2021-03-22 11:30:26 +00:00
technicallyty 5bd93bfe7b
x/upgrade: added consensus version tracking (part of ADR-041) (#8743)
* -added consensus version tracking to x/upgrade

* -added interface to module manager -added e2e test for migrations using consensus version store in x/upgrade -cleaned up x/upgrade Keeper -handler in apply upgrade now handles errors and setting consensus versions -cleaned up migration map keys -removed init chainer method -simapp now implements GetConsensusVersions to assist with testing

* Changed MigrationMap identifier to VersionMap
removed module_test

* updated docs

* forgot this

* added line to changelog for this PR

* Change set consensus version function to match adr 041 spec

* add documentation

* remove newline from changelog

unnecessary newline removed

* updated example in simapp for RunMigrations, SetCurrentConsensusVersions now returns an error

* switch TestMigrations to use Require instead of t.Fatal

* Update CHANGELOG.md

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

* docs for SetVersionManager

* -init genesis method added -removed panics/fails from setting consensus versions

* update identifiers to be more go-like

* update docs and UpgradeHandler fnc sig

* Upgrade Keeper now takes a VersionMap instead of a VersionManager interface

* upgrade keeper transition to Version Map

* cleanup, added versionmap return to RunMigrations

* quick fix

* Update docs/architecture/adr-041-in-place-store-migrations.md

Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>

* remove support for versionmap field on upgrade keeper

* cleanup

* rename get/set version map keeper functions

* update adr doc to match name changes

* remove redudant line

Co-authored-by: technicallyty <48813565+tytech3@users.noreply.github.com>
Co-authored-by: Aaron Craelius <aaron@regen.network>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-03-19 22:01:29 +00:00
Amaury d4d27e1c0c
Fix multisig LegacyAminoPubKey Amino marshaling (#8841)
* Use v034auth RegisterCrypto

* Add custom amino for LegacyAminoPubKey

* Fix registercrypto

* Revert old PR

* revert some genutil stuff

* Add comment

* Add changelog

* Remove binary marshalling

* Fix lint

* Fix lint again

* Fix lint, 3rd time's a charm

* ignore wrong linter warning

* Fix UnmarshalAmioJSON

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Anil Kumar Kammari <anil@vitwit.com>
2021-03-15 12:42:10 +00:00
colin axnér a4b7f76110
update CHANGELOG to remove x/ibc notions (#8863)
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2021-03-15 10:03:18 +00:00
technicallyty c6af0ed87e
x/upgrade: remove support for time based upgrades (#8849)
* remove time based upgrades

* cleanup

* cleanup evidence of time based upgrades

* cleanup docs referring to time based upgrades

* forgot one

* added line to changelog deprecated section

* Update proto/cosmos/upgrade/v1beta1/upgrade.proto

Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>

* update changelog line to correct section

* update buf config to allow reserved fields

Co-authored-by: technicallyty <48813565+tytech3@users.noreply.github.com>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
Co-authored-by: SaReN <sahithnarahari@gmail.com>
Co-authored-by: Aaron Craelius <aaron@regen.network>
2021-03-14 01:03:01 +00:00
MD Aleem adf5f625c1
add orderBy parameter to TxsByEvents (#8815)
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Jonathan Gimeno <jgimeno@gmail.com>
2021-03-12 18:47:10 +00:00
Frojdi Dymylja 288f8dda4b
[rosetta] implement balance tracking and redo tx construction (#8729)
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Robert Zaremba <robert@zaremba.ch>
2021-03-11 15:01:29 +00:00
Alessio Treglia 4b4768d242
merge v0.42.0 changelog (#8836)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-03-10 10:57:16 +00:00
Robert Zaremba 8f7cdafc32
update SigVerifiableTx.GetPubKeys to return an error (#8828)
closes: #8129
2021-03-10 07:16:04 +00:00
Albert Chon a65f838eb1
reduce gas costs by 10x for transient store operations (#8790)
* reduce gas costs by 10x for transient store operations

* fix TestTransientGasConfig for ReadCostFlat

* added changelog entry

* fix changelog

* fix changelog

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2021-03-05 16:25:19 +00:00
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
Robert Zaremba c66f1f7efe
crypto: add secp256r1 (#8559)
* 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

* any.pb.go update

* generated proto files

* wip

* renames

* wip2

* add String method to PBBytes

* wip3

* add pubkey tests

* adding cryptotypes.PrivKey methods

* re-enable test

* fix equals test

* fix ecdsa object receiver

* add ProtoMarshaler implementation and tests

* move code to init and add interface registry

* add bytes tests

* merge Unmarshal with UnmarshalAmino

* implement ProtoMarshaler to ecdsaSK

* remove bytes.go

* add private key marshaling tests

* break tests into 2 suites

* add signature tests

* remove TODO

* remove bytes.proto

* adding changelog

* Update CHANGELOG.md

* Update crypto/keys/ecdsa/ecdsa_privkey.go

* Update crypto/keys/ecdsa/ecdsa_pubkey.go

* comments: add dot (.) at the end

* update comments

* update commented code

* rename files

* remove Amino methods

* use 2 spaces in protocgen.sh

* rollback changes in protocgen.sh

* add MessageName

* rework ecdsa proto structure

* move ecdsa to internal package

* add secp256r1 proto

* refactore proto definition for secp256r1

* fix err check

* update comments

* create const for fieldSize+1

* simplify the PubKey.String test

* Apply suggestions from code review

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

* Update doc comments: SDK Interface -> sdk.Interface

* rename init.go to doc.go

* Add PubKey.Type() test

* Revert "Update doc comments: SDK Interface -> sdk.Interface"

This reverts commit 01f2b4f5efcd79a452483bcda152db54a8fbfee2.

* Use cryptotypes.Address instead of tmcrypto

* Revert "Use cryptotypes.Address instead of tmcrypto"

This reverts commit 15b866ae67bdb7ca4872f4089fcab19f9e2e3608.
This issue will be solved in https://github.com/cosmos/cosmos-sdk/issues/8775

* add link to ANSI X9.62

* move init.go -> doc.go

* use proto.MessageName()

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Jonathan Gimeno <jgimeno@gmail.com>
2021-03-04 12:29:48 +00:00
Alessio Treglia be48479310
update changelog against v0.41.4 (#8771) 2021-03-03 17:09:18 +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
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
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
SaReN b1c72fda7f
crypto/keyring: fix offline keys migration (#8639)
Fix `keys migrate` command (#8703)

crypto/keyring: reinstate the InfoImporter interface

InfoImporter is implemented by those Keyring implementations
that support import of Info objects.

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Jonathan Gimeno <jgimeno@gmail.com>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
2021-03-01 12:41:49 +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
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
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
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
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
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
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
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
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
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