Skip to content

Commit

Permalink
chore: Rename store/v2 -> store/v2alpha1 (#11392)
Browse files Browse the repository at this point in the history
## Description

Closes: #11378 



---

### Author Checklist

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

- [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] added `!` to the type prefix if API or client breaking change
- [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [ ] provided a link to the relevant issue or specification
- [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules)
- [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [ ] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] updated the relevant documentation or specification
- [ ] reviewed "Files changed" and left comments if necessary
- [ ] confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed 
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
  • Loading branch information
likhita-809 authored Mar 16, 2022
1 parent d3163b8 commit 4081bc3
Show file tree
Hide file tree
Showing 29 changed files with 35 additions and 35 deletions.
6 changes: 3 additions & 3 deletions api/cosmos/orm/v1alpha1/schema.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ NOTE: modules will be able to use a special commitment and their own DBs. For ex

To ease the transition to this new interface for users, we can create a shim which wraps a `CommitMultiStore` but provides a `CommitRootStore` interface, and expose functions to safely create and access the underlying `CommitMultiStore`.

The new `RootStore` and supporting types can be implemented in a `store/v2` package to avoid breaking existing code.
The new `RootStore` and supporting types can be implemented in a `store/v2alpha1` package to avoid breaking existing code.

#### Merkle Proofs and IBC

Expand Down
6 changes: 3 additions & 3 deletions docs/core/store.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ Additional information about state streaming configuration can be found in the [

When `KVStore.Set` or `KVStore.Delete` methods are called, `listenkv.Store` automatically writes the operations to the set of `Store.listeners`.

## New Store package (`store/v2`)
## New Store package (`store/v2alpha1`)

The SDK is in the process of transitioning to use the types listed here as the default interface for state storage. At the time of writing, these cannot be used within an application and are not directly compatible with the `CommitMultiStore` and related types.

Expand Down Expand Up @@ -266,15 +266,15 @@ A minimal interface that only allows accessing substores. Note: substores return

### Implementation (`root.Store`)

The canonical implementation of `MultiStore` is in `store/v2/root`. It internally decouples the concerns of state storage and state commitment: values are stored in, and read directly from, the backing key-value database (state storage, or *SS*), but are also mapped in a logically separate database which generates cryptographic proofs (for state-commitment or *SC*).
The canonical implementation of `MultiStore` is in `store/v2alpha1/root`. It internally decouples the concerns of state storage and state commitment: values are stored in, and read directly from, the backing key-value database (state storage, or *SS*), but are also mapped in a logically separate database which generates cryptographic proofs (for state-commitment or *SC*).

The state-commitment component of each substore is implemented as an independent `smt.Store` (see below). Internally, each substore is allocated in a logically separate partition within the same backing DB, such that commits apply to the state of all substores. Therefore, views of past versions also include the state of all substores (including *SS* and *SC* data).

This store can optionally be configured to use a different backend database instance for *SC* (e.g., `badgerdb` for the state storage DB and `memdb` for the state-commitment DB; see `StoreConfig.StateCommitmentDB`).

## SMT Store

`store/v2/smt.Store` maps values into a Sparse Merkle Tree (SMT), and supports a `BasicKVStore` interface as well as methods for cryptographic proof generation.
`store/v2alpha1/smt.Store` maps values into a Sparse Merkle Tree (SMT), and supports a `BasicKVStore` interface as well as methods for cryptographic proof generation.

## Next {hide}

Expand Down
6 changes: 3 additions & 3 deletions proto/cosmos/orm/v1alpha1/schema.proto
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ enum StorageType {
// STORAGE_TYPE_DEFAULT_UNSPECIFIED indicates the persistent
// KV-storage where primary key entries are stored in merkle-tree
// backed commitment storage and indexes and seqs are stored in
// fast index storage. Note that the Cosmos SDK before store/v2
// fast index storage. Note that the Cosmos SDK before store/v2alpha1
// does not support this.
STORAGE_TYPE_DEFAULT_UNSPECIFIED = 0;

Expand All @@ -61,15 +61,15 @@ enum StorageType {

// STORAGE_TYPE_INDEX indicates persistent storage which is not backed
// by a merkle-tree and won't affect the app hash. Note that the Cosmos SDK
// before store/v2 does not support this.
// before store/v2alpha1 does not support this.
STORAGE_TYPE_INDEX = 3;

// STORAGE_TYPE_INDEX indicates persistent storage which is backed by
// a merkle-tree. With this type of storage, both primary and index keys
// will affect the app hash and this is generally less efficient
// than using STORAGE_TYPE_DEFAULT_UNSPECIFIED which separates index
// keys into index storage. Note that modules built with the
// Cosmos SDK before store/v2 must specify STORAGE_TYPE_COMMITMENT
// Cosmos SDK before store/v2alpha1 must specify STORAGE_TYPE_COMMITMENT
// instead of STORAGE_TYPE_DEFAULT_UNSPECIFIED or STORAGE_TYPE_INDEX
// because this is the only type of persistent storage available.
STORAGE_TYPE_COMMITMENT = 4;
Expand Down
4 changes: 2 additions & 2 deletions store/transient/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (

"github.com/stretchr/testify/require"

types "github.com/cosmos/cosmos-sdk/store/v2"
"github.com/cosmos/cosmos-sdk/store/v2/transient"
types "github.com/cosmos/cosmos-sdk/store/v2alpha1"
"github.com/cosmos/cosmos-sdk/store/v2alpha1/transient"
)

var k, v = []byte("hello"), []byte("world")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"github.com/stretchr/testify/require"

"github.com/cosmos/cosmos-sdk/store/cachekv"
types "github.com/cosmos/cosmos-sdk/store/v2"
"github.com/cosmos/cosmos-sdk/store/v2/dbadapter"
types "github.com/cosmos/cosmos-sdk/store/v2alpha1"
"github.com/cosmos/cosmos-sdk/store/v2alpha1/dbadapter"
mocks "github.com/cosmos/cosmos-sdk/tests/mocks/db"
)

Expand Down
2 changes: 1 addition & 1 deletion store/v2/mem/store.go → store/v2alpha1/mem/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
dbm "github.com/cosmos/cosmos-sdk/db"
"github.com/cosmos/cosmos-sdk/db/memdb"
"github.com/cosmos/cosmos-sdk/store/types"
"github.com/cosmos/cosmos-sdk/store/v2/dbadapter"
"github.com/cosmos/cosmos-sdk/store/v2alpha1/dbadapter"
)

var (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (

"github.com/stretchr/testify/require"

types "github.com/cosmos/cosmos-sdk/store/v2"
"github.com/cosmos/cosmos-sdk/store/v2/mem"
types "github.com/cosmos/cosmos-sdk/store/v2alpha1"
"github.com/cosmos/cosmos-sdk/store/v2alpha1/mem"
)

func TestStore(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package multi

import (
"github.com/cosmos/cosmos-sdk/store/cachekv"
types "github.com/cosmos/cosmos-sdk/store/v2"
types "github.com/cosmos/cosmos-sdk/store/v2alpha1"
)

// GetKVStore implements BasicMultiStore.
Expand Down
2 changes: 1 addition & 1 deletion store/v2/multi/doc.go → store/v2alpha1/multi/doc.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This package provides concrete implementations of the store/v2 "MultiStore" types, including
// This package provides concrete implementations of the store/v2alpha1 "MultiStore" types, including
// CommitMultiStore, CacheMultiStore, and BasicMultiStore (as read-only stores at past versions).
//
// Substores are declared as part of a schema within StoreOptions.
Expand Down
4 changes: 2 additions & 2 deletions store/v2/multi/proof.go → store/v2alpha1/multi/proof.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/tendermint/tendermint/crypto/merkle"
tmcrypto "github.com/tendermint/tendermint/proto/tendermint/crypto"

types "github.com/cosmos/cosmos-sdk/store/v2"
"github.com/cosmos/cosmos-sdk/store/v2/smt"
types "github.com/cosmos/cosmos-sdk/store/v2alpha1"
"github.com/cosmos/cosmos-sdk/store/v2alpha1/smt"
)

// DefaultProofRuntime returns a ProofRuntime supporting SMT and simple merkle proofs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
abci "github.com/tendermint/tendermint/abci/types"

"github.com/cosmos/cosmos-sdk/db/memdb"
"github.com/cosmos/cosmos-sdk/store/v2/smt"
"github.com/cosmos/cosmos-sdk/store/v2alpha1/smt"
)

// We hash keys produce SMT paths, so reflect that here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/cosmos/cosmos-sdk/snapshots"
snapshottypes "github.com/cosmos/cosmos-sdk/snapshots/types"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
types "github.com/cosmos/cosmos-sdk/store/v2"
types "github.com/cosmos/cosmos-sdk/store/v2alpha1"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)

Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions store/v2/multi/store.go → store/v2alpha1/multi/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import (
"github.com/cosmos/cosmos-sdk/store/listenkv"
"github.com/cosmos/cosmos-sdk/store/prefix"
"github.com/cosmos/cosmos-sdk/store/tracekv"
types "github.com/cosmos/cosmos-sdk/store/v2"
"github.com/cosmos/cosmos-sdk/store/v2/mem"
"github.com/cosmos/cosmos-sdk/store/v2/smt"
"github.com/cosmos/cosmos-sdk/store/v2/transient"
types "github.com/cosmos/cosmos-sdk/store/v2alpha1"
"github.com/cosmos/cosmos-sdk/store/v2alpha1/mem"
"github.com/cosmos/cosmos-sdk/store/v2alpha1/smt"
"github.com/cosmos/cosmos-sdk/store/v2alpha1/transient"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/kv"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
codecTypes "github.com/cosmos/cosmos-sdk/codec/types"
dbm "github.com/cosmos/cosmos-sdk/db"
"github.com/cosmos/cosmos-sdk/db/memdb"
types "github.com/cosmos/cosmos-sdk/store/v2"
types "github.com/cosmos/cosmos-sdk/store/v2alpha1"
"github.com/cosmos/cosmos-sdk/types/kv"
)

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"github.com/cosmos/cosmos-sdk/store/cachekv"
"github.com/cosmos/cosmos-sdk/store/listenkv"
"github.com/cosmos/cosmos-sdk/store/tracekv"
types "github.com/cosmos/cosmos-sdk/store/v2"
"github.com/cosmos/cosmos-sdk/store/v2/smt"
types "github.com/cosmos/cosmos-sdk/store/v2alpha1"
"github.com/cosmos/cosmos-sdk/store/v2alpha1/smt"
)

var ErrReadOnly = errors.New("cannot modify read-only store")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/assert"

"github.com/cosmos/cosmos-sdk/db/memdb"
store "github.com/cosmos/cosmos-sdk/store/v2/smt"
store "github.com/cosmos/cosmos-sdk/store/v2alpha1/smt"
)

func TestProofICS23(t *testing.T) {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/require"

"github.com/cosmos/cosmos-sdk/db/memdb"
smtstore "github.com/cosmos/cosmos-sdk/store/v2/smt"
smtstore "github.com/cosmos/cosmos-sdk/store/v2alpha1/smt"
"github.com/lazyledger/smt"
)

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/stretchr/testify/assert"

"github.com/cosmos/cosmos-sdk/db/memdb"
store "github.com/cosmos/cosmos-sdk/store/v2/smt"
store "github.com/cosmos/cosmos-sdk/store/v2alpha1/smt"
)

func TestGetSetHasDelete(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
dbm "github.com/cosmos/cosmos-sdk/db"
"github.com/cosmos/cosmos-sdk/db/memdb"
"github.com/cosmos/cosmos-sdk/store/types"
"github.com/cosmos/cosmos-sdk/store/v2/dbadapter"
"github.com/cosmos/cosmos-sdk/store/v2alpha1/dbadapter"
)

var (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/stretchr/testify/require"

"github.com/cosmos/cosmos-sdk/store/types"
"github.com/cosmos/cosmos-sdk/store/v2/transient"
"github.com/cosmos/cosmos-sdk/store/v2alpha1/transient"
)

var k, v = []byte("hello"), []byte("world")
Expand Down
File renamed without changes.

0 comments on commit 4081bc3

Please sign in to comment.