From b09d61e177b819f9c2c6244eeafa7450bc0e4c85 Mon Sep 17 00:00:00 2001 From: mmsqe Date: Mon, 16 Dec 2024 22:25:14 +0800 Subject: [PATCH] Apply suggestions from code review --- baseapp/baseapp.go | 10 ++++------ store/CHANGELOG.md | 4 ++++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index c9bdf6c348ae..6debf176bebc 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -4,8 +4,9 @@ import ( "context" "errors" "fmt" + "maps" "math" - "sort" + "slices" "strconv" "sync" @@ -13,7 +14,6 @@ import ( cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" "github.com/cometbft/cometbft/crypto/tmhash" "github.com/cosmos/gogoproto/proto" - "golang.org/x/exp/maps" "google.golang.org/protobuf/reflect/protoreflect" "cosmossdk.io/core/header" @@ -336,8 +336,7 @@ func (app *BaseApp) MountTransientStores(keys map[string]*storetypes.TransientSt // MountMemoryStores mounts all in-memory KVStores with the BaseApp's internal // commit multi-store. func (app *BaseApp) MountMemoryStores(keys map[string]*storetypes.MemoryStoreKey) { - skeys := maps.Keys(keys) - sort.Strings(skeys) + skeys := slices.Sorted(maps.Keys(keys)) for _, key := range skeys { memKey := keys[key] app.MountStore(memKey, storetypes.StoreTypeMemory) @@ -347,8 +346,7 @@ func (app *BaseApp) MountMemoryStores(keys map[string]*storetypes.MemoryStoreKey // MountObjectStores mounts all transient object stores with the BaseApp's internal // commit multi-store. func (app *BaseApp) MountObjectStores(keys map[string]*storetypes.ObjectStoreKey) { - skeys := maps.Keys(keys) - sort.Strings(skeys) + skeys := slices.Sorted(maps.Keys(keys)) for _, key := range skeys { memKey := keys[key] app.MountStore(memKey, storetypes.StoreTypeObject) diff --git a/store/CHANGELOG.md b/store/CHANGELOG.md index 4d170bff0edc..63e4848a718c 100644 --- a/store/CHANGELOG.md +++ b/store/CHANGELOG.md @@ -31,6 +31,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +### Features + +* [#22893](https://github.com/cosmos/cosmos-sdk/pull/22893) Support mount object store in baseapp, add `ObjectStore` api in context. + ## v1.10.0 (December 13, 2024) ### Improvements