Skip to content

Commit

Permalink
Expose parent on CacheKV (#352)
Browse files Browse the repository at this point in the history
## Describe your changes and provide context
For EVM getProof endpoint, we'd need to call functions on the underlying
iavl store, so we'd need a way to expose the parent store from a cachekv

## Testing performed to validate your change
  • Loading branch information
codchen committed Jan 11, 2024
1 parent 66364a5 commit fa168e6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions store/cachekv/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,3 +359,7 @@ func (store *Store) isDeleted(key string) bool {
_, ok := store.deleted.Load(key)
return ok
}

func (store *Store) GetParent() types.KVStore {
return store.parent
}
3 changes: 3 additions & 0 deletions store/cachekv/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ func TestCacheKVStore(t *testing.T) {
st.Write()
require.Empty(t, st.Get(keyFmt(1)), "Expected `key1` to be empty")
require.Empty(t, mem.Get(keyFmt(1)), "Expected `key1` to be empty")

// GetParent returns parent store
require.NotNil(t, st.GetParent())
}

func TestCacheKVStoreNoNilSet(t *testing.T) {
Expand Down

0 comments on commit fa168e6

Please sign in to comment.