Skip to content

Commit

Permalink
fix cyclic dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Jan 15, 2025
1 parent 504b7b9 commit 71b9114
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 1 addition & 5 deletions store/cachekv/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (

"cosmossdk.io/store/cachekv/internal"
"cosmossdk.io/store/internal/btree"
"cosmossdk.io/store/tracekv"
"cosmossdk.io/store/types"
)

Expand Down Expand Up @@ -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")
}

//----------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion store/tracekv/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"io"

"cosmossdk.io/errors"
"cosmossdk.io/store/cachekv"
"cosmossdk.io/store/types"
)

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 71b9114

Please sign in to comment.