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>
* Add state sync support
* fix incorrect test tempdir
* proto: move and update Protobuf schemas
* proto: lint fixes
* comment tweaks
* don't use type aliasing
* don't call .Error() when logging errors
* use create terminology instead of take for snapshots
* reuse chunk hasher
* simplify key encoding code
* track chunk index in Manager
* add restoreDone message for Manager
* add a ready channel to Snapshotter.Restore()
* add comment on streaming IO API
* use sdkerrors for error handling
* fix incorrect error
* tweak changelog
* syntax fix
* update test code after merge
* Add height in exported genesis
* +1
* Add test
* Refactor ctx in setupApp
* Use amino in export
* Use tmjson
* Add custom initialVersion (set to 0 for now)
* Add comment
* Add mount in initChainer
* app.LastBlockheight
* InitializeAndSeal in InitChain?
* Revert create store with initial version
* Update to latest iavl
* Check height in test
* Make it work
* Add more tests
* Rename interface
* Use struct isntead of 6 args
* Fix lint
* Remove stray fmt
* Revert go mod/sum
* Install iavl rc3
* Update comments
* Add fee in network
* Typo
* Fix logic in commit
* Fix tests
* Only set initial version on > 1
* Genesis block num = 1
* Fresh chain, genesis block = 0
* Add comments
* Revert Mutable/ImmutableTree
* Allow for zero height
* Fix restart
* Add comments
* Add comments, fix test
* Fix remaining one test
* Add panic test
* Update comment
* Add test for --height
* No cast
* Add check that genesis file exists
* Remove duplicate imports
* Fail early
Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Jack Zampolin <jack.zampolin@gmail.com>
Co-authored-by: Cory <cjlevinson@gmail.com>
* Replaced hardcoded 'cosmos' and 'cosmosvaloper' help references
* Ran make format target
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* create base proto package, move ValAddresses to staking
* move tx, crypto, query proto packages into base; mark module level packages as beta
* new cosmos/base/abci.proto file, refactor some message names
* add comments to TxResponse
* refactor RegisterInterface calls to new proto package names
* fix bug in merge commit
* move missing module proto packages to beta, move cosmos.kv to cosmos.base.kv
* add tx.proto files, holding proto messages for module Msgs
* rm old generated pb.go files
* cosmos/base/base.proto -> cosmos/base/coin.proto
* mark genutil proto package as beta
* Fix conflicts
* Restructure proto files
* Re put signing
* Fix test
* Update slashing genesis
* Ignore confio proto files
* Fix interface register
* Make proto-gen
* Fix lint
* Put tx service into tx.v1beta1
* Use v1beta1 in interface registry
* Remove to cosmos.base.store
* Remove extra confio in buf
Co-authored-by: Amaury Martiny <amaury.martiny@protonmail.com>
Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Noticed during my audit, the code for cache.CommitKVStoreCacheManager.Reset()
discarded the prior on every invocation i.e.
m = make(map[T(key)]T(value))
However, this can be made fast and conserve memory by using the map clearing idiom
that the Go compiler recognizes i.e.
for key := range m {
delete(m, key)
}
and turns into very fast code, instead of the extraneous map discarding.
The speed up generated is:
```shell
$ benchstat before after
name old time/op new time/op delta
Reset-8 204ns ± 2% 66ns ± 9% -67.86% (p=0.000 n=20+20)
name old alloc/op new alloc/op delta
Reset-8 384B ± 0% 0B -100.00% (p=0.000 n=20+20)
name old allocs/op new allocs/op delta
Reset-8 3.00 ± 0% 0.00 -100.00% (p=0.000 n=20+20)
```
Fixes#6681
Noticed during an audit, we've got duplicated code that's unused.
There were 2 type definitions:
* type kvPair types.Pair
* type KVPair types.Pair
and each had a .bytes() and .Bytes() method respectively that
then used some extra code.
This change deletes the duplicated/unnecessary code but also
while here improves the performance by removing the use of a
bytes.Buffer which is unnecessary given that we are only
length prefixed the key, length prefixing the value hence
the various helpers are unnecessary.
The added benchmarks shows the performance boost
```shell
$ benchstat before after
name old time/op new time/op delta
KVPairBytes-8 146µs ± 1% 142µs ± 2% -3.05% (p=0.000 n=18+17)
name old speed new speed delta
KVPairBytes-8 6.84GB/s ± 1% 7.06GB/s ± 2% +3.15% (p=0.000 n=18+17)
name old alloc/op new alloc/op delta
KVPairBytes-8 1.01MB ± 0% 1.01MB ± 0% -0.04% (p=0.000 n=17+20)
name old allocs/op new allocs/op delta
KVPairBytes-8 6.00 ± 0% 1.00 ± 0% -83.33% (p=0.000 n=20+20)
```
Closes: #6688
* Add basic grpc query service for x/evidence
* Add grpc query test for AllEvidences query
* linting
* Add AnyUnpacker to query test helper and some var renaming
* Add test to check Evidence query result
* Update proto/cosmos/evidence/query.proto
Co-authored-by: Amaury Martiny <amaury.martiny@protonmail.com>
* Use table tests
* Use NewQueryEvidenceRequest in place of QueryEvidenceParams
* Remove ConvertEvidence
Co-authored-by: Amaury Martiny <amaury.martiny@protonmail.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
* add ics23-tendermint to sdk
* fix errors and prealloc
* move ics-23 to internal
* minor changes and move maps to internal
* remvoe some usage of tendermint merkle
* fix linter
* dont use named returns
* move internal to store/rootmulti
* fix imports
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
* cleanup using CommitmentProof.Calculate()
* get correct version of confio/ics23
* Update store/types/proof.go
Co-authored-by: colin axner <25233464+colin-axner@users.noreply.github.com>
* revert review commit
Co-authored-by: colin axner <25233464+colin-axner@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* switch iavl store to use ics proof
* fix proofs to return for correct height
* appease linter
* Register commitment op correctly
* Make CommitmentOp generic over all ics23 specs (#6331)
* Make the CommitmentOp generic over all ics23 ProofSpecs, using Type to distinguish
* Register SimpleMerkle ics23 proof op as well
* Addressed linter issues
* move commitment proof to types
* Apply suggestions from code review
Co-authored-by: colin axner <25233464+colin-axner@users.noreply.github.com>
* address review comments:
* Apply suggestions from code review
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
* allow proofs against empty store
* address review comments
* Update store/types/proof.go
Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
* add changelog
Co-authored-by: Ethan Frey <ethanfrey@users.noreply.github.com>
Co-authored-by: colin axner <25233464+colin-axner@users.noreply.github.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Marko <marbar3778@yahoo.com>
* add string method to gas meter
* update changelog
* Update store/types/gas.go
Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
x/staking: Fix all linter warnings.
Fixed warnings across base packages.
New linters:
- unparam
- nolintlint
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
* enable the wsl linter
Fix various wsl-related warnings.
x/ibc/04-channel/keeper/handshake.go: fix missing return statement in ChanOpenTry().
* goimports -w files
* remove unknown linter references
* run make format
* Revert "run make format"
This reverts commit f810b62b9e4993f08506663d4e5f2ec2228a9863.
* run make format
* bring simplehashfrommap from TM
* bring simplemap as well
* rename simplemap to merklemap
* reduce byte to 8
* Update APIs and godoc
Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Aleksandr Bezobchuk <aleks.bezobchuk@gmail.com>
Reintroduce memKVStore to keep track of fwd and reverse mappings.
On reverse mapping, rather than store a mapping to marshalled
capability; we store the index.
capability.Keeper and all scopedKeeper have access to a capability
map that maps index to the capability pointer.
This is done to make sure that all writes to memKVStore get reverted
on a fail tx, while also allowing GetCapability to retrieve the original
memory pointer from the go map.
Go map must be accessed only by first going through the
memKVStore. SInce writes to go map cannot be automatically
reverted on tx failure, it gets cleaned up on failed GetCapability calls.
Closes: #5965