Fix MountStoreWithDB(); Bump to 0.15.0-rc0
This commit is contained in:
parent
eb25943c58
commit
d530ee2abc
|
@ -215,8 +215,8 @@
|
|||
[[projects]]
|
||||
name = "github.com/spf13/pflag"
|
||||
packages = ["."]
|
||||
revision = "e57e3eeb33f795204c1ca35f56c44f83227c6e66"
|
||||
version = "v1.0.0"
|
||||
revision = "583c0c0531f06d5278b7d917446061adc344b5cd"
|
||||
version = "v1.0.1"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/spf13/viper"
|
||||
|
@ -342,8 +342,8 @@
|
|||
"types/priv_validator",
|
||||
"version"
|
||||
]
|
||||
revision = "dcd00b0e688f133b9634aee513f8bf856e659356"
|
||||
version = "v0.19.0-rc4"
|
||||
revision = "d0beaba7e8a5652506a34b5fab299cc2dc274c02"
|
||||
version = "v0.19.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/tendermint/tmlibs"
|
||||
|
@ -360,8 +360,8 @@
|
|||
"pubsub",
|
||||
"pubsub/query"
|
||||
]
|
||||
revision = "2e24b64fc121dcdf1cabceab8dc2f7257675483c"
|
||||
version = "v0.8.1"
|
||||
revision = "737154202faf75c70437f59ba5303f2eb09f5636"
|
||||
version = "0.8.2-rc1"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
@ -377,7 +377,7 @@
|
|||
"ripemd160",
|
||||
"salsa20/salsa"
|
||||
]
|
||||
revision = "b2aa35443fbc700ab74c586ae79b81c171851023"
|
||||
revision = "d6449816ce06963d9d136eee5a56fca5b0616e7e"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
@ -424,7 +424,7 @@
|
|||
branch = "master"
|
||||
name = "google.golang.org/genproto"
|
||||
packages = ["googleapis/rpc/status"]
|
||||
revision = "ce84044298496ef4b54b4a0a0909ba593cc60e30"
|
||||
revision = "51d0944304c3cbce4afe9e5247e21100037bff78"
|
||||
|
||||
[[projects]]
|
||||
name = "google.golang.org/grpc"
|
||||
|
@ -459,6 +459,6 @@
|
|||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "ad499422ee60cf89fd9d61e232e33d0a17f7b43e0ff7aff0c0a22949901096e8"
|
||||
inputs-digest = "b6b2d696a242e715ddb8b25c93b3c8f7e7cabc9292eab29dffe935eddbd35fb8"
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
|
|
|
@ -70,11 +70,11 @@
|
|||
|
||||
[[constraint]]
|
||||
name = "github.com/tendermint/tendermint"
|
||||
version = "0.19.0-rc4"
|
||||
version = "0.19.0"
|
||||
|
||||
[[constraint]]
|
||||
[[override]]
|
||||
name = "github.com/tendermint/tmlibs"
|
||||
version = "~0.8.1"
|
||||
version = "~0.8.2-rc1"
|
||||
|
||||
[prune]
|
||||
go-tests = true
|
||||
|
|
|
@ -64,7 +64,7 @@ func GetChainHeight() (int64, error) {
|
|||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
height := status.LatestBlockHeight
|
||||
height := status.SyncInfo.LatestBlockHeight
|
||||
return height, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ func NodeSyncingRequestHandler(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
syncing := status.Syncing
|
||||
syncing := status.SyncInfo.Syncing
|
||||
if err != nil {
|
||||
w.WriteHeader(500)
|
||||
w.Write([]byte(err.Error()))
|
||||
|
|
|
@ -247,7 +247,7 @@ func parsePath(path string) (storeName string, subpath string, err sdk.Error) {
|
|||
func (rs *rootMultiStore) loadCommitStoreFromParams(id CommitID, params storeParams) (store CommitStore, err error) {
|
||||
var db dbm.DB
|
||||
if params.db != nil {
|
||||
db = dbm.NewPrefixDB(rs.db, []byte("s/_/"))
|
||||
db = dbm.NewPrefixDB(params.db, []byte("s/_/"))
|
||||
} else {
|
||||
db = dbm.NewPrefixDB(rs.db, []byte("s/k:"+params.key.Name()+"/"))
|
||||
}
|
||||
|
@ -379,10 +379,11 @@ func commitStores(version int64, storeMap map[StoreKey]CommitStore) commitInfo {
|
|||
storeInfos = append(storeInfos, si)
|
||||
}
|
||||
|
||||
return commitInfo{
|
||||
ci := commitInfo{
|
||||
Version: version,
|
||||
StoreInfos: storeInfos,
|
||||
}
|
||||
return ci
|
||||
}
|
||||
|
||||
// Gets commitInfo from disk.
|
||||
|
|
|
@ -11,17 +11,22 @@ import (
|
|||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
const useDebugDB = false
|
||||
|
||||
func TestMultistoreCommitLoad(t *testing.T) {
|
||||
db := dbm.NewMemDB()
|
||||
var db dbm.DB = dbm.NewMemDB()
|
||||
if useDebugDB {
|
||||
db = dbm.NewDebugDB("CMS", db)
|
||||
}
|
||||
store := newMultiStoreWithMounts(db)
|
||||
err := store.LoadLatestVersion()
|
||||
assert.Nil(t, err)
|
||||
|
||||
// new store has empty last commit
|
||||
// New store has empty last commit.
|
||||
commitID := CommitID{}
|
||||
checkStore(t, store, commitID, commitID)
|
||||
|
||||
// make sure we can get stores by name
|
||||
// Make sure we can get stores by name.
|
||||
s1 := store.getStoreByName("store1")
|
||||
assert.NotNil(t, s1)
|
||||
s3 := store.getStoreByName("store3")
|
||||
|
@ -29,7 +34,7 @@ func TestMultistoreCommitLoad(t *testing.T) {
|
|||
s77 := store.getStoreByName("store77")
|
||||
assert.Nil(t, s77)
|
||||
|
||||
// make a few commits and check them
|
||||
// Make a few commits and check them.
|
||||
nCommits := int64(3)
|
||||
for i := int64(0); i < nCommits; i++ {
|
||||
commitID = store.Commit()
|
||||
|
@ -37,19 +42,19 @@ func TestMultistoreCommitLoad(t *testing.T) {
|
|||
checkStore(t, store, expectedCommitID, commitID)
|
||||
}
|
||||
|
||||
// Load the latest multistore again and check version
|
||||
// Load the latest multistore again and check version.
|
||||
store = newMultiStoreWithMounts(db)
|
||||
err = store.LoadLatestVersion()
|
||||
assert.Nil(t, err)
|
||||
commitID = getExpectedCommitID(store, nCommits)
|
||||
checkStore(t, store, commitID, commitID)
|
||||
|
||||
// commit and check version
|
||||
// Commit and check version.
|
||||
commitID = store.Commit()
|
||||
expectedCommitID := getExpectedCommitID(store, nCommits+1)
|
||||
checkStore(t, store, expectedCommitID, commitID)
|
||||
|
||||
// Load an older multistore and check version
|
||||
// Load an older multistore and check version.
|
||||
ver := nCommits - 1
|
||||
store = newMultiStoreWithMounts(db)
|
||||
err = store.LoadVersion(ver)
|
||||
|
@ -62,8 +67,8 @@ func TestMultistoreCommitLoad(t *testing.T) {
|
|||
expectedCommitID = getExpectedCommitID(store, ver+1)
|
||||
checkStore(t, store, expectedCommitID, commitID)
|
||||
|
||||
// XXX: confirm old commit is overwritten and
|
||||
// we have rolled back LatestVersion
|
||||
// XXX: confirm old commit is overwritten and we have rolled back
|
||||
// LatestVersion
|
||||
store = newMultiStoreWithMounts(db)
|
||||
err = store.LoadLatestVersion()
|
||||
assert.Nil(t, err)
|
||||
|
@ -104,23 +109,23 @@ func TestMultiStoreQuery(t *testing.T) {
|
|||
|
||||
cid := multi.Commit()
|
||||
|
||||
// make sure we can get by name
|
||||
// Make sure we can get by name.
|
||||
garbage := multi.getStoreByName("bad-name")
|
||||
assert.Nil(t, garbage)
|
||||
|
||||
// set and commit data in one store
|
||||
// Set and commit data in one store.
|
||||
store1 := multi.getStoreByName("store1").(KVStore)
|
||||
store1.Set(k, v)
|
||||
|
||||
// and another
|
||||
// ... and another.
|
||||
store2 := multi.getStoreByName("store2").(KVStore)
|
||||
store2.Set(k2, v2)
|
||||
|
||||
// commit the multistore
|
||||
// Commit the multistore.
|
||||
cid = multi.Commit()
|
||||
ver := cid.Version
|
||||
|
||||
// bad path
|
||||
// Test bad path.
|
||||
query := abci.RequestQuery{Path: "/key", Data: k, Height: ver}
|
||||
qres := multi.Query(query)
|
||||
assert.Equal(t, uint32(sdk.CodeUnknownRequest), qres.Code)
|
||||
|
@ -129,25 +134,25 @@ func TestMultiStoreQuery(t *testing.T) {
|
|||
qres = multi.Query(query)
|
||||
assert.Equal(t, uint32(sdk.CodeUnknownRequest), qres.Code)
|
||||
|
||||
// invalid store name
|
||||
// Test invalid store name.
|
||||
query.Path = "/garbage/key"
|
||||
qres = multi.Query(query)
|
||||
assert.Equal(t, uint32(sdk.CodeUnknownRequest), qres.Code)
|
||||
|
||||
// valid query with data
|
||||
// Test valid query with data.
|
||||
query.Path = "/store1/key"
|
||||
qres = multi.Query(query)
|
||||
assert.Equal(t, uint32(sdk.CodeOK), qres.Code)
|
||||
assert.Equal(t, v, qres.Value)
|
||||
|
||||
// valid but empty
|
||||
// Test valid but empty query.
|
||||
query.Path = "/store2/key"
|
||||
query.Prove = true
|
||||
qres = multi.Query(query)
|
||||
assert.Equal(t, uint32(sdk.CodeOK), qres.Code)
|
||||
assert.Nil(t, qres.Value)
|
||||
|
||||
// store2 data
|
||||
// Test store2 data.
|
||||
query.Data = k2
|
||||
qres = multi.Query(query)
|
||||
assert.Equal(t, uint32(sdk.CodeOK), qres.Code)
|
||||
|
|
|
@ -9,7 +9,7 @@ const Maj = "0"
|
|||
const Min = "15"
|
||||
const Fix = "0"
|
||||
|
||||
const Version = "0.15.0-rc1"
|
||||
const Version = "0.15.0-rc0"
|
||||
|
||||
// GitCommit set by build flags
|
||||
var GitCommit = ""
|
||||
|
|
Loading…
Reference in New Issue