From 71b9114bf6f59fd8439db37dcd7fd1d8b55073e7 Mon Sep 17 00:00:00 2001 From: HuangYi Date: Wed, 15 Jan 2025 11:16:45 +0800 Subject: [PATCH] fix cyclic dependency --- store/cachekv/store.go | 6 +----- store/tracekv/store.go | 3 ++- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/store/cachekv/store.go b/store/cachekv/store.go index 084adef7cd79..de06fe908a54 100644 --- a/store/cachekv/store.go +++ b/store/cachekv/store.go @@ -5,7 +5,6 @@ import ( "cosmossdk.io/store/cachekv/internal" "cosmossdk.io/store/internal/btree" - "cosmossdk.io/store/tracekv" "cosmossdk.io/store/types" ) @@ -133,10 +132,7 @@ func (store *GStore[V]) CacheWrap() types.CacheWrap { // CacheWrapWithTrace implements the CacheWrapper interface. func (store *GStore[V]) CacheWrapWithTrace(w io.Writer, tc types.TraceContext) types.CacheWrap { - if store, ok := any(store).(*GStore[[]byte]); ok { - return NewStore(tracekv.NewStore(store, w, tc)) - } - return store.CacheWrap() + panic("cannot CacheWrapWithTrace a cachekv Store") } //---------------------------------------- diff --git a/store/tracekv/store.go b/store/tracekv/store.go index b0960cdb51e8..06f486f97786 100644 --- a/store/tracekv/store.go +++ b/store/tracekv/store.go @@ -6,6 +6,7 @@ import ( "io" "cosmossdk.io/errors" + "cosmossdk.io/store/cachekv" "cosmossdk.io/store/types" ) @@ -163,7 +164,7 @@ func (tkv *Store) GetStoreType() types.StoreType { // CacheWrap implements CacheWrapper. func (tkv *Store) CacheWrap() types.CacheWrap { - return tkv.parent.CacheWrap() + return cachekv.NewStore(tkv) } // CacheWrapWithTrace implements the KVStore interface. It panics as a