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