store: proto migration (#4974)

## Description

migrate store to protobuf

Closes: #XXX
This commit is contained in:
Marko
2020-06-08 08:43:29 +02:00
committed by GitHub
parent 6cfbe1eb5c
commit f9f4916bc3
11 changed files with 225 additions and 132 deletions

View File

@@ -10,6 +10,8 @@ import (
dbm "github.com/tendermint/tm-db"
"github.com/tendermint/tendermint/crypto"
tmrand "github.com/tendermint/tendermint/libs/rand"
tmproto "github.com/tendermint/tendermint/proto/types"
sm "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/store"
@@ -26,7 +28,7 @@ func TestMain(m *testing.M) {
func TestEvidencePool(t *testing.T) {
var (
valAddr = []byte("val1")
valAddr = tmrand.Bytes(crypto.AddressSize)
height = int64(52)
stateDB = initializeValidatorState(valAddr, height)
evidenceDB = dbm.NewMemDB()
@@ -75,7 +77,7 @@ func TestEvidencePool(t *testing.T) {
func TestProposingAndCommittingEvidence(t *testing.T) {
var (
valAddr = []byte("validator_address")
valAddr = tmrand.Bytes(crypto.AddressSize)
height = int64(1)
lastBlockTime = time.Now()
stateDB = initializeValidatorState(valAddr, height)
@@ -111,7 +113,7 @@ func TestProposingAndCommittingEvidence(t *testing.T) {
func TestAddEvidence(t *testing.T) {
var (
valAddr = []byte("val1")
valAddr = tmrand.Bytes(crypto.AddressSize)
height = int64(30)
stateDB = initializeValidatorState(valAddr, height)
evidenceDB = dbm.NewMemDB()
@@ -151,7 +153,7 @@ func TestAddEvidence(t *testing.T) {
func TestEvidencePoolUpdate(t *testing.T) {
var (
valAddr = []byte("validator_address")
valAddr = tmrand.Bytes(crypto.AddressSize)
height = int64(21)
stateDB = initializeValidatorState(valAddr, height)
evidenceDB = dbm.NewMemDB()
@@ -186,7 +188,7 @@ func TestEvidencePoolUpdate(t *testing.T) {
func TestEvidencePoolNewPool(t *testing.T) {
var (
valAddr = []byte("validator_address")
valAddr = tmrand.Bytes(crypto.AddressSize)
height = int64(1)
stateDB = initializeValidatorState(valAddr, height)
evidenceDB = dbm.NewMemDB()
@@ -204,7 +206,7 @@ func TestEvidencePoolNewPool(t *testing.T) {
func TestAddingAndPruningPOLC(t *testing.T) {
var (
valAddr = []byte("validator_address")
valAddr = tmrand.Bytes(crypto.AddressSize)
stateDB = initializeValidatorState(valAddr, 1)
evidenceDB = dbm.NewMemDB()
blockStoreDB = dbm.NewMemDB()
@@ -252,7 +254,7 @@ func TestAddingAndPruningPOLC(t *testing.T) {
func TestRecoverPendingEvidence(t *testing.T) {
var (
valAddr = []byte("val1")
valAddr = tmrand.Bytes(crypto.AddressSize)
height = int64(30)
stateDB = initializeValidatorState(valAddr, height)
evidenceDB = dbm.NewMemDB()

View File

@@ -13,7 +13,9 @@ import (
dbm "github.com/tendermint/tm-db"
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/libs/log"
tmrand "github.com/tendermint/tendermint/libs/rand"
"github.com/tendermint/tendermint/p2p"
sm "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/types"
@@ -134,7 +136,7 @@ func TestReactorBroadcastEvidence(t *testing.T) {
// create statedb for everyone
stateDBs := make([]dbm.DB, N)
valAddr := []byte("myval")
valAddr := tmrand.Bytes(crypto.AddressSize)
// we need validators saved for heights at least as high as we have evidence for
height := int64(numEvidence) + 10
for i := 0; i < N; i++ {
@@ -169,7 +171,7 @@ func (ps peerState) GetHeight() int64 {
func TestReactorSelectiveBroadcast(t *testing.T) {
config := cfg.TestConfig()
valAddr := []byte("myval")
valAddr := tmrand.Bytes(crypto.AddressSize)
height1 := int64(numEvidence) + 10
height2 := int64(numEvidence) / 2