Andrei Ivasko
8997074028
Use module accounts in MsgSend and MsgMultiSend tests in bank module ( #9075 )
...
* first draft
* unable to cast to simtypes.Account
* fix test
* add for loop in TestSimulateModuleAccountMsgSend
* TestSimulateModuleAccountMsgMultiSend
* refactoring, r4r
* change fromSimAcc, toSimAcc to from,to respectively
* Update x/bank/simulation/operations.go
Co-authored-by: Robert Zaremba <robert@zaremba.ch>
* Update x/bank/simulation/operations.go
Co-authored-by: Robert Zaremba <robert@zaremba.ch>
* getModuleAccounts
* fix for loop
* applied reviewers suggestions, r4r
* Update x/bank/simulation/operations.go
Co-authored-by: Robert Zaremba <robert@zaremba.ch>
* minor changes
* fix typo
* all simulation package tests pass, r4r
Co-authored-by: anilCSE <anil@vitwit.com>
Co-authored-by: Robert Zaremba <robert@zaremba.ch>
Co-authored-by: Cory <cjlevinson@gmail.com>
Co-authored-by: Aaron Craelius <aaron@regen.network>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-05-13 13:51:21 +00:00
Amaury
56c0595f32
Remove migration scripts <=0.38 ( #9291 )
...
* Remove migration scripts <=0.38
* Add changelog
* remove more
* remove more stuff
* Fix test
* Relase wording
* Add comment
* Include migratio wording
2021-05-11 14:01:13 +00:00
technicallyty
709ab089c1
x/bank v0.43 Audit updates ( #9271 )
...
* add godoc to keeper functions
* re-add ValidateBasic to MsgSend CLI tx
* add comment to reflect new return value on method
* remove unecessary variable
* cleanup key comments
* typo
* unused param
* update messages spec
* move event emission to end of method
* update keeper spec
* update proto message to point correct path to interface
* keeper spec typos
* fix test for event emission being moved
* change to blocklist
* rename SendEnabledCoin(s) -> IsSendEnabledCoins
* typo
* remove unecessary check
* move changelog line
Co-authored-by: technicallyty <48813565+tytech3@users.noreply.github.com>
2021-05-10 12:17:55 -04:00
Robert Zaremba
1986104ef4
ADR-30 (authz) update based on authz audit ( #9270 )
...
* ADR-30 (authz) update based on authz audit
* changelog and comment update
* fix linter issue
* Apply suggestions from code review
Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
* Update MsgGrant to reuse the Grant type
* Update docs/architecture/adr-030-authz-module.md
Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>
Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
Co-authored-by: Aaron Craelius <aaron@regen.network>
2021-05-07 19:38:43 +00:00
Amaury
56ab4e4c93
Cleanup remains of ServiceMsg ( #9236 )
...
* Remove ServiceMsgClientConn from CLI
* Cleanup Operations
* Remove some legacytx.LegacyMsg
* Update CL
* Remove mentions of ServiceMsg
* Simply reflection MsgDescriptor
* Simplify more
* Add code comment
Co-authored-by: technicallyty <48813565+technicallyty@users.noreply.github.com>
2021-05-07 09:31:20 +00:00
Robert Zaremba
59810f3286
x/authz: audit updates ( #9042 )
...
* x/authz: audit updates
* audit with Aaron
* authz: Update Authorization.Accept method
* authz: add event proto definitions
* update query service
* authz: use typed events
* refactore and rename query authorizations
* remve Authorization infix from proto services
* renames wip
* refactoring
* update tests
* fix compilation
* fixing gRPC query tests
* fix simulation tests
* few renames
* more refactore
* add missing file
* moving export genesis to keeper
* Update docs
* update tests
* rename event Msg attribute to MsgTypeURL
* Upate Authorization interface
* rollback Makefile changes
* fix tests
* Apply suggestions from code review
Co-authored-by: Aaron Craelius <aaron@regen.network>
* renames
* refactore authz/exported
* lint fix
* authz/types refactore
* comment update
* conflict updates
* Apply suggestions from code review
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
* authz: move storage keys to keeper
* review updates
* docs update
* Update x/authz/client/cli/query.go
Co-authored-by: Aaron Craelius <aaron@regen.network>
* move codec to the root package
* authz CMD info update
* comment update
* update imports and build flags
* fix functional tests
* update proto comment
* fix tests
* fix test
Co-authored-by: Aaron Craelius <aaron@regen.network>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
2021-05-06 18:23:48 +00:00
Cuong Manh Le
42a4e4b432
x/bank/types: speedy up by singly sort balances without having to re-iterate ( #9260 )
...
The speed is the same as old implementation, but the new one uses slightly
less memory and make the code easier to maintain.
name old time/op new time/op delta
SanitizeBalances500-8 933µs ± 1% 935µs ± 1% ~ (p=0.400 n=9+10)
SanitizeBalances1000-8 1.91ms ± 0% 1.92ms ± 0% +0.58% (p=0.000 n=10+10)
name old alloc/op new alloc/op delta
SanitizeBalances500-8 588kB ± 0% 556kB ± 0% -5.41% (p=0.000 n=9+9)
SanitizeBalances1000-8 1.18MB ± 0% 1.12MB ± 0% -5.37% (p=0.000 n=9+9)
name old allocs/op new allocs/op delta
SanitizeBalances500-8 5.02k ± 0% 4.02k ± 0% -19.94% (p=0.000 n=10+10)
SanitizeBalances1000-8 10.0k ± 0% 8.0k ± 0% -19.93% (p=0.000 n=9+10)
Fixes #9259
2021-05-05 14:36:25 +00:00
Amaury
d19791be89
Rename clientCtx.JSONMarshaler to JSONCodec ( #9251 )
...
* Rename clientCtx.JSONMarshaler to JSONCodec
* change md files
* Fix lint
2021-05-03 14:45:47 +00:00
atheeshp
f04b5dcb96
fix zero coins ( #9229 )
...
* fix zero coins issue
* fix tests
* udpate tests
* Review change
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
* add change log
* review changes
* review changes
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2021-04-30 16:54:08 +00:00
Amaury
dfe3e7a8d7
Remove ServiceMsgs from ADR-031 ( #9139 )
...
* wip
* wip
* wip
* wip on refactoring adr 031 type URLs
* Fix msg_service_router
* Fix gov client queries
* Fix some modules tests
* Remove all instances of "*.Msg/*"
* Uncomment code
* Remove commented code
* // simulation.NewWeightedOperation(
* Fix CopyTx
* Fix more tests
* Fix x/gov test
* proto.MessageName->sdk.MsgName
* Fix authz tests
* Use MsgRoute in feegrant and staking/authz
* Fix more tests
* Fix sims?
* Add norace tag
* Add CL
* rebuild rosetta api test data
* Update ADR
* Rename MsgRoute -> MsgTypeURL
* Fix codec registration
* Remove sdk.GetLegacySignBytes
* Update types/tx_msg.go
* Update x/authz/simulation/operations.go
* Move LegacyMsg to legacytx
* Update CHANGELOG.md
Co-authored-by: Aaron Craelius <aaron@regen.network>
* Remove NewAnyWithCustomTypeURL
* Keep support for ServiceMsgs
* Fix TxBody UnpackInterfaces
* Fix test
* Address review
* Remove support for ServiceMsg typeURLs
* Fix lint
* Update changelog
* Fix tests
* Use sdk.MsgTypeURL everywhere
* Fix tests
* Fix rosetta, run make rosetta-data
* Fix rosetta thanks to froydi
* Address reviews
* Fix test
* Remove stray log
* Update CL
Co-authored-by: Aaron Craelius <aaronc@users.noreply.github.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Aaron Craelius <aaron@regen.network>
2021-04-30 11:00:47 +00:00
Robert Zaremba
be4a965599
codec: Rename codec and marshaler interfaces ( #9226 )
...
* codec: Rename codec and marshaler interfaces, ref: 8413
* codec: remove BinaryBare
* changelog update
* Update comments and documentation
* adding doc string comments
* Update CHANGELOG.md
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
* Update codec/codec.go
Co-authored-by: Marko <marbar3778@yahoo.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
Co-authored-by: Marko <marbar3778@yahoo.com>
2021-04-29 10:46:22 +00:00
Aaron Craelius
3c65c3dacd
Make integration test suites reusable by apps ( #6711 )
...
* WIP on refactoring new integration tests.
* godocs
* godocs
* Fix ineff assign
* Updates
* Updates
* fix test
* refactor crisis, distr testsuites
* fix import issue
* refactor x/auth
* refactor x/authz
* refactor x/evidence
* refactor x/feegrant
* refactor x/genutil
* refactor x/gov
* refactor x/mint
* refactor x/params
* refactor x/{auth_vesting, slashing, staking}
* fix lint
* fix tests & lint
* fix lint
* fix tests
* lint
* lint
* fix lint memory
* add missing `norace` build flag
* update feegrant cfg
* fix lint
Co-authored-by: atheesh <atheesh@vitwit.com>
Co-authored-by: atheeshp <59333759+atheeshp@users.noreply.github.com>
2021-04-23 14:49:49 -04:00
Riccardo Montagnin
96fe999343
Set proper default command output ( #8628 )
...
* Set proper default command output
* Removed duplicated cmd.SetErr(cmd.ErrOrStderr()) and cmd.SetOut(cmd.OutOrStdout())
* Moved command initialization and added CHANGELOG
* fix: groom all uses of cmd.Print*
* Ran make format
Co-authored-by: Michael FIG <mfig@agoric.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
2021-04-17 00:21:32 +00:00
Cuong Manh Le
ef69863f46
x/bank/types: fix AddressFromBalancesStore address length overflow ( #9112 )
...
addrLen is encoded in a byte, so it's an uint8. The code in
AddressFromBalancesStore cast it to int for bound checking, but wrongly uses "addrLen+1", which can be overflow.
To fix this, just cast addrLen once and use it in all places.
Found by fuzzing added in #9060 .
Fixes #9111
2021-04-15 00:13:55 -07:00
Sunny Aggarwal
10b2b08ece
Merge branch 'master' into powerreduction_param
2021-04-10 16:26:50 -04:00
MD Aleem
8a376a41c9
x/authz charge gas for expensive authorizations ( #8995 )
...
* WIP
* Add consume gas
* update authz.go
* add build flag
* Update x/staking/types/authz.go
* Update x/staking/types/authz.go
* add tests docs
* review changes
* fix operations
* Update x/authz/types/msgs.go
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
* review changes
* update gas cost
* review changes
Co-authored-by: SaReN <sahithnarahari@gmail.com>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
2021-04-09 12:33:27 +00:00
Alessio Treglia
6e26ee9805
bump tendermint core ( #9081 )
2021-04-08 20:22:00 +01:00
Gianguido Sora
93965e0bcc
Write back account changes after tracking delegation/undelegation for vesting accounts ( #8865 )
...
Delegations and undelegations calculations performed during
accounting operations for vesting accounts were correct but
were not written back to the account store.
closes : #8601
closes : #8812
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Jonathan Gimeno <jgimeno@gmail.com>
Co-authored-by: Frojdi Dymylja <frojdi.dymylja@gmail.com>
Co-authored-by: Adam Bozanich <adam.boz@gmail.com>
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
Co-authored-by: SaReN <sahithnarahari@gmail.com>
2021-04-08 16:20:29 +01:00
Sunny Aggarwal
61b608f4bc
Merge branch 'master' into powerreduction_param
2021-04-07 13:59:49 -04:00
Cuong Manh Le
3a5550a938
x/bank/types: fix AddressFromBalancesStore panics with invalid keys ( #9061 )
...
Currently, AddressFromBalancesStore uses the input key without any
validation, so an empty key or an invalid key length cause it panics.
This commit fixes the problem, by returning an error in case of invalid
key was passed.
Found by fuzzing added in #9060 .
Fixed #9062
2021-04-07 16:20:38 +00:00
Frojdi Dymylja
29ff333007
cosmos-reflection: extend to support writing by reflection clients ( #8965 )
...
Co-authored-by: SaReN <sahithnarahari@gmail.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2021-04-07 00:33:54 +01:00
Sunny Aggarwal
05e2e45010
merged in master
2021-04-06 19:19:59 -04:00
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
Amaury
cc946d2f1f
Fix migrations bug discovered with manual tests ( #8998 )
...
* Fix migrations bugs discovered with manual tests
* Update slashing version
* Move supply interface to legacy
* Fix lint
* Fix test
2021-03-29 11:56:45 +00:00
Aleksandr Bezobchuk
04246efaa2
x/bank: doc & spec updates ( #8999 )
...
* x/bank: update constructor godoc
* x/bank: spec++
* Update x/bank/spec/02_keepers.md
Co-authored-by: Barrie Byron <barrie.byron@tendermint.com>
* Update x/bank/spec/02_keepers.md
Co-authored-by: Barrie Byron <barrie.byron@tendermint.com>
* Update x/bank/spec/02_keepers.md
Co-authored-by: Barrie Byron <barrie.byron@tendermint.com>
* Update x/bank/spec/02_keepers.md
Co-authored-by: Barrie Byron <barrie.byron@tendermint.com>
* Update x/bank/keeper/keeper.go
Co-authored-by: Barrie Byron <barrie.byron@tendermint.com>
* Update x/bank/spec/02_keepers.md
Co-authored-by: Barrie Byron <barrie.byron@tendermint.com>
* Update x/bank/spec/02_keepers.md
Co-authored-by: Barrie Byron <barrie.byron@tendermint.com>
Co-authored-by: Barrie Byron <barrie.byron@tendermint.com>
2021-03-26 13:10:02 +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
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
Aaron Craelius
e9e978d543
Fix genesis supply handling ( #8930 )
...
* Fix genesis supply handling
* Add test
* Fix nit
Co-authored-by: Amaury M <1293565+amaurym@users.noreply.github.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-03-22 18:15:29 +00:00
Sunny Aggarwal
83efad3c30
fixing merge conflicts
2021-03-21 19:18:46 -04:00
Sunny Aggarwal
1f99aa3fb2
merged in master
2021-03-21 16:37:06 -04:00
Emmanuel T Odeke
b9f3db1be8
all: skip noisy/faulty benchmarks + add b.ReportAllocs for every benchmark ( #8856 )
...
* Skips very noisy benchmarks that end up running only for b.N=1 because
their entire time is spent in setup, and varying parameters doesn't change
much given that the number of stores is what dominates the expense. To
ensure we can provide reliable benchmarks, progressively for the project,
skip these until there is a proper re-work of what the benchmarks need to do
* Previously sub-benchmarks: b.Run(...) did not b.ReportAllocs() due to a faulty
assumption that invoking b.ReportAllocs() at the top would be inherited by
all sub-benchmarks. This change fixes that
Fixes #8779
Fixes #8855
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-03-11 15:59:13 +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
Jonathan Gimeno
280ee4f15e
Fix SendToModuleAccountTest ( #8857 )
2021-03-11 14:20:32 +00:00
Amaury
6ac8898fec
Move all migration scripts to v043 ( #8814 )
...
* Move all migration scripts to v043
* Fix permaling
* Fix test
* Fix test again
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-03-08 22:36:06 +00:00
Amaury
6520997668
Supply by denom Migrations ( #8780 )
...
* Add back supply proto
* Add migration for supply
* Fix lint
* Update x/bank/spec/01_state.md
* Fix test
* Proto gen
* Update x/bank/spec/01_state.md
* Make proto gen
Co-authored-by: Jonathan Gimeno <jgimeno@gmail.com>
2021-03-05 14:11:19 +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
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
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
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
Alessio Treglia
f2ee972e31
various linter fixes ( #8666 )
2021-02-23 08:46:01 +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
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
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
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
Alessio Treglia
8001e3ca3a
bank: don't ignore errors returned by Balance.GetAddress() ( #8531 )
...
Closes : #8530
2021-02-06 21:51:26 +00:00
psaradev
cc4ef50d2a
Merge cosmos-sdk master
2021-02-03 22:36:29 +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
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
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
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
psaradev
4f476d6890
on-chain power reduction param conversion basic work
2021-01-27 20:24:00 +10: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
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
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
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
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
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
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
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
Aleksandr Bezobchuk
521380abd6
x/auth: atlas manifest ( #8140 )
2020-12-10 17:02:29 +01:00
Aleksandr Bezobchuk
9104a72d50
x/bank: update atlas manifest ( #8137 )
2020-12-10 16:12:09 +01: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
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
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
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
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
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
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
Aleksandr Bezobchuk
4be5cd3454
docs: x/bank: Atlas Doc ( #7961 )
2020-11-19 11:57:10 -05:00
Sunny Aggarwal
479ad6be45
Merge branch 'master' into fix_power_reduction_test_cast_int64
2020-11-16 12:19:39 -04:00
yihuang
54201d11e6
cli: convert coins to smallest unit registered ( #7777 )
...
* cli: convert coins to smallest unit registered
fixes : #7623
- test order of decimal operations
- support both int and decimal coins, truncate when normalizing to
base unit
* Update types/coin_test.go
* Update types/coin_test.go
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-11-16 11:34:54 +00:00
antstalepresh
4515b8782d
Merge branch 'master' of github.com:cosmos/cosmos-sdk into fix_power_reduction_test_cast_int64
2020-11-12 02:52:59 +10:00
antstalepresh
67b3f9071c
fix build issues && telemetry.SetGaugeWithLabels int64 range validation
2020-11-11 02:07:40 +10:00
Marie Gauthier
90e9370bd8
Replace tmcrypto.PubKey by our own cryptotypes.PubKey ( #7419 )
...
* WIP on removing tm pub/privkey
* Fix part of crypto tests
* Add PrivKeyLedgerSecp256K1 proto type
* Use BasePrivKey for ledger priv key type
* Refacto continued
* First round
* x/staking
* Continue porting
* x/* done
* Make build pass
* More conversion
* Remove IntoTmPubKey
* Fix test
* Remove crypto.PubKey in some other places
* Revert ledger changes
* Fix comment
* Remove useless function
* Add To/FromTmPublicKey
* Add migrate tests
* Fix test
* Fix another test
* Rename tm conversion functions
* Less code
* Rename BasePrivKey to LedgerPrivKey
* Add changelog
* Rename functions
Co-authored-by: Amaury Martiny <amaury.martiny@protonmail.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2020-11-09 16:01:43 +00:00
Robert Zaremba
c201963e41
Update x/banking and x/crisis InitChain re slow Gaia startup ( #7764 )
...
* add more logs during the initialization process
* initializtion: move profiling to the top of the startProcess function
* x/bank InitGenesis: remove k.ValidateBalance
* debug: add logs and telemetry to x/bank and x/crisis
* make x/crisis AssertInvariants optional during InitGenesis
* Add module init flags mechanism
* update changelog
* remove debug fmt.Print
* fix testutil/network/
* fix log message
* update test NewApp calls
* review changes
Co-authored-by: Aaron Craelius <aaron@regen.network>
2020-11-02 19:10:14 +00:00
Cory
536eb689dc
Add Deprecation headers for legacy rest endpoints ( #7686 )
...
* add deprecation headers for legacy rest endpoints
* add deprecation headers for missing tx routes
* rm handler-level deprecation headers
* switch to middleware Route.Use method for setting deprecation Headers
* set deprecation headers using subrouter
* cleanup gofmt
* goimports
* Update client/rest/rest.go
* update deprecation headers to be set on each module individually
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-10-29 11:37:46 +00:00
Amaury Martiny
82f15f306e
RegisterInterfaces registers service Msg type_urls ( #7671 )
...
* Add RegisterMsgServiceDesc
* Refactor newSendTxMsgServiceCmd
* Add test
* Register in all modules
* Remove RegisterMsgServiceDesc from baseapp
* Add explicit error message
* Add comment
* Update comment
* Add test
* Update comment
* Remove duplicate import
* Fix lint
* Forgot vesting
* Fix lint
* Fix test
* Put in types/module
* Put in types/msgservice
* Add comment about panic
* Update baseapp/msg_service_router.go
Co-authored-by: Robert Zaremba <robert@zaremba.ch>
* Update baseapp/msg_service_router.go
Co-authored-by: Robert Zaremba <robert@zaremba.ch>
* Update baseapp/msg_service_router.go
Co-authored-by: Robert Zaremba <robert@zaremba.ch>
* Add comment
* Add better test
* Update baseapp/msg_service_router.go
Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>
Co-authored-by: Robert Zaremba <robert@zaremba.ch>
Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-10-28 19:20:45 +00:00
Anil Kumar Kammari
51ac6f876b
Rename RegisterGRPCRoutes ( #7696 )
...
* Rename
* Fix missing
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-10-28 11:39:49 +00:00
Robert Zaremba
9bd42ace6b
simapp: rename MakeEncodingConfig to MakeTestEncodingConfig ( #7681 )
...
* simapp: rename MakeEncodingConfig to MakeTestEncodingConfig
* Updating the Changelog
+ Adding DEPRECATED attribute.
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-10-27 11:33:48 +00:00
Marie Gauthier
eba4c8a264
Handle nil *Any in UnpackAny and add panic handler for tx decoding ( #7594 )
...
* Handle nil any in UnpackAny
* Add test
* Add flag back
* Update runTx signature
* Update Simulate signature
* Update calls to Simulate
* Add txEncoder in baseapp
* Fix TestTxWithoutPublicKey
* Wrap errors
* Use amino in baseapp tests
* Add txEncoder arg to Check & Deliver
* Fix gas in test
* Fix remaining base app tests
* Rename to amionTxEncoder
* Update codec/types/interface_registry.go
Co-authored-by: Aaron Craelius <aaron@regen.network>
* golangci-lint fix
Co-authored-by: Amaury Martiny <amaury.martiny@protonmail.com>
Co-authored-by: Aaron Craelius <aaron@regen.network>
Co-authored-by: Cory Levinson <cjlevinson@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-10-19 18:04:44 +00:00
Aaron Craelius
9e7eb0da00
Add MsgServer to Configurator for ADR 031 wiring ( #7584 )
...
* Add MsgServer to Configurator for ADR 031 wiring
* Add docs, wire up evidence & staking
* Add integration test
* Add comments
* Doc strings
* Update types/module/configurator.go
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
* Update types/module/configurator.go
Co-authored-by: Cory <cjlevinson@gmail.com>
* Wire up vesting
* Update CHANGELOG.md
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Amaury Martiny <amaury.martiny@protonmail.com>
Co-authored-by: Cory <cjlevinson@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-10-19 17:46:10 +00:00
Amaury Martiny
58eabcb71f
Refactor x/evidence to ADR-031 ( #7538 )
...
* Refactor x/evidence to ADR-031
* Add hash in response
* Update changelog
* Update x/evidence/keeper/keeper.go
* Update proto/cosmos/evidence/v1beta1/tx.proto
Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>
* Use msgServer struct
Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>
2020-10-16 16:05:25 +00:00
Amaury Martiny
69e2b7df16
docs: Revert SPEC-SPEC and update x/{auth,bank,evidence,slashing} ( #7407 )
...
* Revert some changes from #7404
* Update x/slashing
* Address review comments
* Small tweak
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-10-16 12:42:48 +00:00
Amaury Martiny
55242a659c
Add ADR 031 BaseApp and codec infrastructure ( #7519 )
...
* Refactor RegisterQueryServices -> RegisterServices
* Cleaner proto files
* Fix tests
* Add MsgServer
* Fix lint
* Remove MsgServer from configurator for now
* Remove useless file
* Fix build
* typo
* Add router
* Fix test
* WIP
* Add router
* Remove test helper
* Add beginning of test
* Move test to simapp?
* ServiceMsg implement sdk.Msg
* Add handler by MsgServiceRouter
* Correct signature
* Add full test
* use TxEncoder
* Update baseapp/msg_service_router.go
Co-authored-by: Aaron Craelius <aaron@regen.network>
* Push changes
* WIP on ServiceMsg unpacking
* Make TestMsgService test pass
* Fix tests
* Tidying up
* Tidying up
* Tidying up
* Add JSON test
* Add comments
* Tidying
* Lint
* Register MsgRequest interface
* Rename
* Fix tests
* RegisterCustomTypeURL
* Add changelog entries
* Put in features
* Update baseapp/msg_service_router.go
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
* Update baseapp/msg_service_router.go
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
* Update baseapp/msg_service_router.go
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
* Update baseapp/msg_service_router.go
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
* Update baseapp/msg_service_router.go
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
* Update baseapp/msg_service_router.go
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
* Update baseapp/msg_service_router.go
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
* Address review comments
* Address nit
* Fix lint
* Update codec/types/interface_registry.go
Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>
* godoc
Co-authored-by: Aaron Craelius <aaronc@users.noreply.github.com>
Co-authored-by: Aaron Craelius <aaron@regen.network>
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>
2020-10-15 13:07:59 +00:00
Aaron Craelius
9be15a42b9
Refactor x/bank according to ADR 031 ( #7520 )
...
* Refactor x/bank according to ADR 031
* Add comment
* Update comment
* Add comment
* Add tests, address edge cases
* Imports
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-10-13 09:05:46 +00:00
Aaron Craelius
228728cce2
Refactor RegisterQueryServices -> RegisterServices ( #7518 )
...
* Refactor RegisterQueryServices -> RegisterServices
* Fix tests
2020-10-12 16:31:51 +00:00
Amaury Martiny
c14a3a7cb2
CLI `migrate` command follow-up: decode & re-encode ( #7464 )
...
* Migrate staking module
* Add gov legacy
* Add comments
* Add x/distrib
* x/crisis
* x/mint
* Fix test
* migrate x/genutil
* Fix lint
* Fix staking constants
* Fix test
* Update x/genutil/legacy/v040/migrate.go
Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>
* Add migrate script instead of change BondStatus constants
* Fix test
* Fix another test
Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>
Co-authored-by: Cory <cjlevinson@gmail.com>
2020-10-09 19:09:43 +00:00
Amaury Martiny
d9ede6551a
0.39->0.40 CLI `migrate` command ( #6839 )
...
* WIP on BaseAccount protobuf pub_key
* WIP on BaseAccount.PubKey
* Migrate supply
* Change validator_slash_event
* Add evidence
* Add evidence to genutil migrate
* Fix lint
* Add println
* No _ in package name
* Add slashing migrate
* Add tests for slashing
* Add capacity to array
* stray fmt.Prinlnt
* WIP on BaseAccount pub key
* Put current types in v0_40
* Add evidence old types
* Remove useless impl
* Add RegisterInterface
* Add clientCtx to argument
* Register evidence interfaces
* Update PubKey
* Update Account
* Docs
* WIP on protobuf keys
* Use Type() and Bytes() in sr25519 pub key Equals
* Add tests
* Add few more tests
* Update other pub/priv key types Equals
* Fix PrivKey's Sign method
* Rename variables in tests
* Fix infinite recursive calls
* Use tm ed25519 keys
* Add Sign and VerifySignature tests
* Remove ed25519 and sr25519 references
* proto linting
* Add proto crypto file
* Implement some of the new multisig proto type methods
* Add tests for MultisigThresholdPubKey
* Add tests for pubkey pb/amino conversion functions
* Move crypto types.go and register new proto pubkeys
* Add missing pointer ref
* Address review comments
* panic in MultisigThresholdPubKey VerifySignature
* Fix compile errors
* Remove pk conversion in ante handler
* Use internal crypto.PubKey in multisig
* Add tests for MultisigThresholdPubKey VerifyMultisignature
* Only keep LegacyAminoMultisigThresholdPubKey and move to proto keys to v1
* Remove conversion functions and introduce internal PubKey type
* Override Amino marshaling for proto pubkeys
* Merge master
* Make proto-gen
* Start removal of old PubKeyMultisigThreshold references
* Fix tests
* Fix solomachine
* Fix ante handler tests
* Pull latest go-amino
* Remove ed25519
* Remove old secp256k1 PubKey and PrivKey
* Uncomment test case
* Fix linting issues
* More linting
* Revert tests keys values
* Add Amino overrides to proto keys
* Add pubkey test
* Fix tests
* Use threshold isntead of K
* Standardize Type
* Revert standardize types commit
* Fix build
* Fix lint
* Fix lint
* Add comment
* Register crypto.PubKey
* Add empty key in BuildSimTx
* Simplify proto names
* Unpack interfaces for signing desc
* Fix IBC tests?
* Format proto
* Use secp256k1 in ibc
* Fixed merge issues
* Uncomment tests
* Update x/ibc/testing/solomachine.go
* UnpackInterfaces for solomachine types
* Remove old multisig
* Add amino marshal for multisig
* Fix lint
* Correctly register amino
* One test left!
* Remove old struct
* Fix test
* Fix test
* Unpack into tmcrypto
* Remove old threshold pubkey tests
* Fix register amino
* Fix lint
* Use sdk crypto PubKey in multisig UnpackInterfaces
* Potential fix?
* Register LegacyAminoPubKey
* Register our own PubKey
* Register tmcrypto PubKey
* Register both PubKeys
* Register interfaces in test
* Refactor fiels
* Add comments
* Remove old cosmos-sdk/crypto/keys reference
* Use anil's suggestion
* Add norace back
* Use our own ed25519
* Fix pubkey types
* Fix network tests
* Fix more tests
* Make ibc work?
* Use TM pubkey in NewValidator
* Fix lint
* Put interface in tpyes
* rerun CI
* Better name register
* Remove stray code
* Add ed25519 tests
* Check nil
* Correct interface impl assert
* rerun CI
* Add fix for Bech32
* Address comments
* FIx lint
* Add tests for solomachine unpack interfaces
* Fix query tx by hash
* Better name in amino register
* Fix lint
* Add back ed25519 test (fixes #7352 )
* go mod tidy
* Fix merge issues
* Sort import
* Add test for backwards-compatibility
* Fix tests
* Fix merge issue
* Fix merge issues
* Fix tests build
* Fix tests
* Marshal to proto
* Fix 040 marshalling
* Remove dontcover
* Fix equivocation
* Add vesting
* Fix vesting
* Fix slashing test
* Fix evidence test
* Remove pb.go files
* Fix legacy auth tests
* deterministic tests help
* Fix auth tests
* Remove useless code
* Small cleanups
* Add comment
* Fix migrate hub
* fmt.Println
* No need to marshal indent
* Update proto comment
* Fix merge issues
* Support nil pubkey
* Use protobuf empty
* Address comments
* Fix tests
* Unify legacy package names
Co-authored-by: Aaron Craelius <aaronc@users.noreply.github.com>
Co-authored-by: Aaron Craelius <aaron@regen.network>
Co-authored-by: blushi <marie.gauthier63@gmail.com>
Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
Co-authored-by: Zaki Manian <zaki@manian.org>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2020-10-05 21:28:14 +00:00