diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index 6debf176bebc..c7467fcabc87 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -305,6 +305,9 @@ func (app *BaseApp) MountStores(keys ...storetypes.StoreKey) { case *storetypes.MemoryStoreKey: app.MountStore(key, storetypes.StoreTypeMemory) + case *storetypes.ObjectStoreKey: + app.MountStore(key, storetypes.StoreTypeObject) + default: panic(fmt.Sprintf("Unrecognized store key type :%T", key)) } diff --git a/runtime/module.go b/runtime/module.go index 488bc6c93b8e..388d5f7209bc 100644 --- a/runtime/module.go +++ b/runtime/module.go @@ -99,6 +99,7 @@ func init() { ProvideKVStoreFactory, ProvideTransientStoreKey, ProvideMemoryStoreKey, + ProvideObjectStoreKey, ProvideGenesisTxHandler, ProvideEnvironment, ProvideTransientStoreService, @@ -242,6 +243,12 @@ func ProvideMemoryStoreKey( return storeKey } +func ProvideObjectStoreKey(key depinject.ModuleKey, app *AppBuilder) *storetypes.ObjectStoreKey { + storeKey := storetypes.NewObjectStoreKey(fmt.Sprintf("object:%s", key.Name())) + registerStoreKey(app, storeKey) + return storeKey +} + func ProvideModuleManager(modules map[string]appmodule.AppModule) *module.Manager { return module.NewManagerFromMap(modules) } diff --git a/store/prefix/store.go b/store/prefix/store.go index ffbce1effa3b..adfcf05b7e82 100644 --- a/store/prefix/store.go +++ b/store/prefix/store.go @@ -86,8 +86,11 @@ func (s GStore[V]) CacheWrap() types.CacheWrap { } // CacheWrapWithTrace implements the KVStore interface. -func (s Store) CacheWrapWithTrace(w io.Writer, tc types.TraceContext) types.CacheWrap { - return cachekv.NewStore(tracekv.NewStore(s, w, tc)) +func (s GStore[V]) CacheWrapWithTrace(w io.Writer, tc types.TraceContext) types.CacheWrap { + if store, ok := any(s).(*GStore[[]byte]); ok { + return cachekv.NewGStore(tracekv.NewStore(store, w, tc), store.isZero, store.valueLen) + } + return s.CacheWrap() } // Get implements KVStore diff --git a/tests/go.mod b/tests/go.mod index d80a680ea27a..388f24fefee1 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -256,6 +256,7 @@ replace ( cosmossdk.io/runtime/v2 => ../runtime/v2 cosmossdk.io/server/v2/appmanager => ../server/v2/appmanager cosmossdk.io/server/v2/stf => ../server/v2/stf + cosmossdk.io/store => ../store cosmossdk.io/store/v2 => ../store/v2 cosmossdk.io/tools/benchmark => ../tools/benchmark cosmossdk.io/x/accounts => ../x/accounts @@ -285,7 +286,6 @@ replace ( replace ( // We always want to test against the latest version of the simapp. cosmossdk.io/simapp => ../simapp - cosmossdk.io/store => ../store github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 // We always want to test against the latest version of the SDK. github.com/cosmos/cosmos-sdk => ../.