all: update tm-db to 0.6.5

This commit is contained in:
Tess Rinearson
2021-08-06 11:46:34 +02:00
parent 823f2acb14
commit 97fd8f136e
46 changed files with 243 additions and 245 deletions
+5 -4
View File
@@ -10,6 +10,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
abcicli "github.com/tendermint/tendermint/abci/client"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/internal/evidence"
@@ -23,7 +24,7 @@ import (
sm "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/store"
"github.com/tendermint/tendermint/types"
dbm "github.com/tendermint/tm-db"
"github.com/tendermint/tm-db/memdb"
)
// Byzantine node sends two different prevotes (nil and blockID) to the same
@@ -43,7 +44,7 @@ func TestByzantinePrevoteEquivocation(t *testing.T) {
for i := 0; i < nValidators; i++ {
func() {
logger := consensusLogger().With("test", "byzantine", "validator", i)
stateDB := dbm.NewMemDB() // each state needs its own db
stateDB := memdb.NewDB() // each state needs its own db
stateStore := sm.NewStore(stateDB)
state, err := sm.MakeGenesisState(genDoc)
require.NoError(t, err)
@@ -57,7 +58,7 @@ func TestByzantinePrevoteEquivocation(t *testing.T) {
vals := types.TM2PB.ValidatorUpdates(state.Validators)
app.InitChain(abci.RequestInitChain{Validators: vals})
blockDB := dbm.NewMemDB()
blockDB := memdb.NewDB()
blockStore := store.NewBlockStore(blockDB)
// one for mempool, one for consensus
@@ -73,7 +74,7 @@ func TestByzantinePrevoteEquivocation(t *testing.T) {
}
// Make a full instance of the evidence pool
evidenceDB := dbm.NewMemDB()
evidenceDB := memdb.NewDB()
evpool, err := evidence.NewPool(logger.With("module", "evidence"), evidenceDB, stateStore, blockStore)
require.NoError(t, err)
+4 -5
View File
@@ -16,8 +16,6 @@ import (
"path"
dbm "github.com/tendermint/tm-db"
abcicli "github.com/tendermint/tendermint/abci/client"
"github.com/tendermint/tendermint/abci/example/kvstore"
abci "github.com/tendermint/tendermint/abci/types"
@@ -36,6 +34,7 @@ import (
sm "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/store"
"github.com/tendermint/tendermint/types"
"github.com/tendermint/tm-db/memdb"
)
const (
@@ -397,7 +396,7 @@ func newStateWithConfig(
pv types.PrivValidator,
app abci.Application,
) *State {
blockStore := store.NewBlockStore(dbm.NewMemDB())
blockStore := store.NewBlockStore(memdb.NewDB())
return newStateWithConfigAndBlockStore(thisConfig, state, pv, app, blockStore)
}
@@ -423,7 +422,7 @@ func newStateWithConfigAndBlockStore(
evpool := sm.EmptyEvidencePool{}
// Make State
stateDB := dbm.NewMemDB()
stateDB := memdb.NewDB()
stateStore := sm.NewStore(stateDB)
if err := stateStore.Save(state); err != nil { // for save height 1's validators info
panic(err)
@@ -721,7 +720,7 @@ func randConsensusState(
configRootDirs := make([]string, 0, nValidators)
for i := 0; i < nValidators; i++ {
blockStore := store.NewBlockStore(dbm.NewMemDB()) // each state needs its own db
blockStore := store.NewBlockStore(memdb.NewDB()) // each state needs its own db
state, err := sm.MakeGenesisState(genDoc)
require.NoError(t, err)
thisConfig := ResetConfig(fmt.Sprintf("%s_%d", testName, i))
+5 -6
View File
@@ -11,14 +11,13 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
dbm "github.com/tendermint/tm-db"
"github.com/tendermint/tendermint/abci/example/code"
abci "github.com/tendermint/tendermint/abci/types"
mempl "github.com/tendermint/tendermint/internal/mempool"
sm "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/store"
"github.com/tendermint/tendermint/types"
"github.com/tendermint/tm-db/memdb"
)
// for testing
@@ -124,8 +123,8 @@ func TestMempoolTxConcurrentWithCommit(t *testing.T) {
config := configSetup(t)
state, privVals := randGenesisState(config, 1, false, 10)
stateStore := sm.NewStore(dbm.NewMemDB())
blockStore := store.NewBlockStore(dbm.NewMemDB())
stateStore := sm.NewStore(memdb.NewDB())
blockStore := store.NewBlockStore(memdb.NewDB())
cs := newStateWithConfigAndBlockStore(config, state, privVals[0], NewCounterApplication(), blockStore)
err := stateStore.Save(state)
require.NoError(t, err)
@@ -151,8 +150,8 @@ func TestMempoolRmBadTx(t *testing.T) {
state, privVals := randGenesisState(config, 1, false, 10)
app := NewCounterApplication()
stateStore := sm.NewStore(dbm.NewMemDB())
blockStore := store.NewBlockStore(dbm.NewMemDB())
stateStore := sm.NewStore(memdb.NewDB())
blockStore := store.NewBlockStore(memdb.NewDB())
cs := newStateWithConfigAndBlockStore(config, state, privVals[0], app, blockStore)
err := stateStore.Save(state)
require.NoError(t, err)
+3 -3
View File
@@ -31,7 +31,7 @@ import (
statemocks "github.com/tendermint/tendermint/state/mocks"
"github.com/tendermint/tendermint/store"
"github.com/tendermint/tendermint/types"
dbm "github.com/tendermint/tm-db"
"github.com/tendermint/tm-db/memdb"
)
var (
@@ -328,7 +328,7 @@ func TestReactorWithEvidence(t *testing.T) {
logger := consensusLogger()
for i := 0; i < n; i++ {
stateDB := dbm.NewMemDB() // each state needs its own db
stateDB := memdb.NewDB() // each state needs its own db
stateStore := sm.NewStore(stateDB)
state, err := sm.MakeGenesisState(genDoc)
require.NoError(t, err)
@@ -342,7 +342,7 @@ func TestReactorWithEvidence(t *testing.T) {
app.InitChain(abci.RequestInitChain{Validators: vals})
pv := privVals[i]
blockDB := dbm.NewMemDB()
blockDB := memdb.NewDB()
blockStore := store.NewBlockStore(blockDB)
// one for mempool, one for consensus
+1 -2
View File
@@ -10,8 +10,6 @@ import (
"strconv"
"strings"
dbm "github.com/tendermint/tm-db"
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/libs/log"
tmos "github.com/tendermint/tendermint/libs/os"
@@ -20,6 +18,7 @@ import (
sm "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/store"
"github.com/tendermint/tendermint/types"
dbm "github.com/tendermint/tm-db/metadb"
)
const (
+8 -7
View File
@@ -17,7 +17,6 @@ import (
"github.com/gogo/protobuf/proto"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
dbm "github.com/tendermint/tm-db"
"github.com/tendermint/tendermint/abci/example/kvstore"
abci "github.com/tendermint/tendermint/abci/types"
@@ -36,6 +35,8 @@ import (
sf "github.com/tendermint/tendermint/state/test/factory"
"github.com/tendermint/tendermint/store"
"github.com/tendermint/tendermint/types"
dbm "github.com/tendermint/tm-db"
"github.com/tendermint/tm-db/memdb"
)
// These tests ensure we can always recover from failure at any part of the consensus process.
@@ -59,7 +60,7 @@ func startNewStateAndWaitForBlock(t *testing.T, consensusReplayConfig *cfg.Confi
state, err := sm.MakeGenesisStateFromFile(consensusReplayConfig.GenesisFile())
require.NoError(t, err)
privValidator := loadPrivValidator(consensusReplayConfig)
blockStore := store.NewBlockStore(dbm.NewMemDB())
blockStore := store.NewBlockStore(memdb.NewDB())
cs := newStateWithConfigAndBlockStore(
consensusReplayConfig,
state,
@@ -148,8 +149,8 @@ LOOP:
// create consensus state from a clean slate
logger := log.NewNopLogger()
blockDB := dbm.NewMemDB()
stateDB := dbm.NewMemDB()
blockDB := memdb.NewDB()
stateDB := memdb.NewDB()
stateStore := sm.NewStore(stateDB)
blockStore := store.NewBlockStore(blockDB)
state, err := sm.MakeGenesisStateFromFile(consensusReplayConfig.GenesisFile())
@@ -691,7 +692,7 @@ func testHandshakeReplay(t *testing.T, sim *simulatorTestSuite, nBlocks int, mod
if testValidatorsChange {
testConfig := ResetConfig(fmt.Sprintf("%s_%v_m", t.Name(), mode))
defer func() { _ = os.RemoveAll(testConfig.RootDir) }()
stateDB = dbm.NewMemDB()
stateDB = memdb.NewDB()
genesisState = sim.GenesisState
config = sim.Config
@@ -745,7 +746,7 @@ func testHandshakeReplay(t *testing.T, sim *simulatorTestSuite, nBlocks int, mod
// run nBlocks against a new client to build up the app state.
// use a throwaway tendermint state
proxyApp := proxy.NewAppConns(clientCreator2)
stateDB1 := dbm.NewMemDB()
stateDB1 := memdb.NewDB()
stateStore := sm.NewStore(stateDB1)
err := stateStore.Save(genesisState)
require.NoError(t, err)
@@ -1155,7 +1156,7 @@ func stateAndStore(
config *cfg.Config,
pubKey crypto.PubKey,
appVersion uint64) (dbm.DB, sm.State, *mockBlockStore) {
stateDB := dbm.NewMemDB()
stateDB := memdb.NewDB()
stateStore := sm.NewStore(stateDB)
state, _ := sm.MakeGenesisStateFromFile(config.GenesisFile())
state.Version.Consensus.App = appVersion
+2 -2
View File
@@ -11,7 +11,6 @@ import (
"time"
"github.com/stretchr/testify/require"
db "github.com/tendermint/tm-db"
"github.com/tendermint/tendermint/abci/example/kvstore"
cfg "github.com/tendermint/tendermint/config"
@@ -21,6 +20,7 @@ import (
sm "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/store"
"github.com/tendermint/tendermint/types"
"github.com/tendermint/tm-db/memdb"
)
// WALGenerateNBlocks generates a consensus WAL. It does this by spinning up a
@@ -50,7 +50,7 @@ func WALGenerateNBlocks(t *testing.T, wr io.Writer, numBlocks int) (err error) {
if err != nil {
return fmt.Errorf("failed to read genesis file: %w", err)
}
blockStoreDB := db.NewMemDB()
blockStoreDB := memdb.NewDB()
stateDB := blockStoreDB
stateStore := sm.NewStore(stateDB)
state, err := sm.MakeGenesisState(genDoc)