diff --git a/CHANGELOG.md b/CHANGELOG.md index cdd0215b0519..42d32a0cab8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (store) [\#10040](https://github.com/cosmos/cosmos-sdk/pull/10040) Bump IAVL to v0.17.1 which includes performance improvements on a batch load. * (types) [\#10021](https://github.com/cosmos/cosmos-sdk/pull/10021) Speedup coins.AmountOf(), by removing many intermittent regex calls. +* [\#10077](https://github.com/cosmos/cosmos-sdk/pull/10077) Remove telemetry on `GasKV` and `CacheKV` store Get/Set operations, significantly improving their performance. * (store) [\#10026](https://github.com/cosmos/cosmos-sdk/pull/10026) Improve CacheKVStore datastructures / algorithms, to no longer take O(N^2) time when interleaving iterators and insertions. ### Bug Fixes diff --git a/store/cachekv/store.go b/store/cachekv/store.go index c5aa3566ad3f..8efbc305eeed 100644 --- a/store/cachekv/store.go +++ b/store/cachekv/store.go @@ -69,7 +69,10 @@ func (store *Store) Get(key []byte) (value []byte) { } // Set implements types.KVStore. -func (store *Store) Set(key, value []byte) { +func (store *Store) Set(key []byte, value []byte) { + store.mtx.Lock() + defer store.mtx.Unlock() + types.AssertValidKey(key) types.AssertValidValue(value) diff --git a/store/gaskv/store.go b/store/gaskv/store.go index 41242d49284b..b2ee043b9a86 100644 --- a/store/gaskv/store.go +++ b/store/gaskv/store.go @@ -43,8 +43,8 @@ func (gs *Store) Get(key []byte) (value []byte) { return value } -// Set implements KVStore. -func (gs *Store) Set(key, value []byte) { +// Implements KVStore. +func (gs *Store) Set(key []byte, value []byte) { types.AssertValidKey(key) types.AssertValidValue(value) gs.gasMeter.ConsumeGas(gs.gasConfig.WriteCostFlat, types.GasWriteCostFlatDesc)