mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-13 21:31:23 +00:00
fixes from rebase
This commit is contained in:
@ -261,9 +261,8 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
NUM_BLOCKS = 6 // number of blocks in the test_data/many_blocks.cswal
|
mempool = types.MockMempool{}
|
||||||
mempool = types.MockMempool{}
|
evpool = types.MockEvidencePool{}
|
||||||
evpool = types.MockEvidencePool{}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
//---------------------------------------
|
//---------------------------------------
|
||||||
|
@ -66,7 +66,8 @@ func WALWithNBlocks(numBlocks int) (data []byte, err error) {
|
|||||||
}
|
}
|
||||||
defer eventBus.Stop()
|
defer eventBus.Stop()
|
||||||
mempool := types.MockMempool{}
|
mempool := types.MockMempool{}
|
||||||
consensusState := NewConsensusState(config.Consensus, state.Copy(), proxyApp.Consensus(), blockStore, mempool)
|
evpool := types.MockEvidencePool{}
|
||||||
|
consensusState := NewConsensusState(config.Consensus, state.Copy(), proxyApp.Consensus(), blockStore, mempool, evpool)
|
||||||
consensusState.SetLogger(logger)
|
consensusState.SetLogger(logger)
|
||||||
consensusState.SetEventBus(eventBus)
|
consensusState.SetEventBus(eventBus)
|
||||||
if privValidator != nil {
|
if privValidator != nil {
|
||||||
|
@ -3,14 +3,13 @@ package evidence
|
|||||||
import (
|
import (
|
||||||
"github.com/tendermint/tmlibs/log"
|
"github.com/tendermint/tmlibs/log"
|
||||||
|
|
||||||
cfg "github.com/tendermint/tendermint/config"
|
|
||||||
"github.com/tendermint/tendermint/types"
|
"github.com/tendermint/tendermint/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// EvidencePool maintains a pool of valid evidence
|
// EvidencePool maintains a pool of valid evidence
|
||||||
// in an EvidenceStore.
|
// in an EvidenceStore.
|
||||||
type EvidencePool struct {
|
type EvidencePool struct {
|
||||||
config *cfg.EvidenceConfig
|
params types.EvidenceParams
|
||||||
logger log.Logger
|
logger log.Logger
|
||||||
|
|
||||||
state types.State
|
state types.State
|
||||||
@ -19,9 +18,9 @@ type EvidencePool struct {
|
|||||||
evidenceChan chan types.Evidence
|
evidenceChan chan types.Evidence
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewEvidencePool(config *cfg.EvidenceConfig, evidenceStore *EvidenceStore, state types.State) *EvidencePool {
|
func NewEvidencePool(params types.EvidenceParams, evidenceStore *EvidenceStore, state types.State) *EvidencePool {
|
||||||
evpool := &EvidencePool{
|
evpool := &EvidencePool{
|
||||||
config: config,
|
params: params,
|
||||||
logger: log.NewNopLogger(),
|
logger: log.NewNopLogger(),
|
||||||
evidenceStore: evidenceStore,
|
evidenceStore: evidenceStore,
|
||||||
state: state,
|
state: state,
|
||||||
|
@ -6,14 +6,13 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
cfg "github.com/tendermint/tendermint/config"
|
|
||||||
"github.com/tendermint/tendermint/types"
|
"github.com/tendermint/tendermint/types"
|
||||||
dbm "github.com/tendermint/tmlibs/db"
|
dbm "github.com/tendermint/tmlibs/db"
|
||||||
)
|
)
|
||||||
|
|
||||||
type mockState struct{}
|
type mockState struct{}
|
||||||
|
|
||||||
func (m mockState) VerifyEvidence(ev types.Evidence) (int, error) {
|
func (m mockState) VerifyEvidence(ev types.Evidence) (int64, error) {
|
||||||
err := ev.Verify("")
|
err := ev.Verify("")
|
||||||
return 10, err
|
return 10, err
|
||||||
}
|
}
|
||||||
@ -21,10 +20,10 @@ func (m mockState) VerifyEvidence(ev types.Evidence) (int, error) {
|
|||||||
func TestEvidencePool(t *testing.T) {
|
func TestEvidencePool(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
config := &cfg.EvidenceConfig{}
|
params := types.EvidenceParams{}
|
||||||
store := NewEvidenceStore(dbm.NewMemDB())
|
store := NewEvidenceStore(dbm.NewMemDB())
|
||||||
state := mockState{}
|
state := mockState{}
|
||||||
pool := NewEvidencePool(config, store, state)
|
pool := NewEvidencePool(params, store, state)
|
||||||
|
|
||||||
goodEvidence := newMockGoodEvidence(5, 1, []byte("val1"))
|
goodEvidence := newMockGoodEvidence(5, 1, []byte("val1"))
|
||||||
badEvidence := MockBadEvidence{goodEvidence}
|
badEvidence := MockBadEvidence{goodEvidence}
|
||||||
|
@ -9,7 +9,6 @@ import (
|
|||||||
wire "github.com/tendermint/go-wire"
|
wire "github.com/tendermint/go-wire"
|
||||||
"github.com/tendermint/tmlibs/log"
|
"github.com/tendermint/tmlibs/log"
|
||||||
|
|
||||||
cfg "github.com/tendermint/tendermint/config"
|
|
||||||
"github.com/tendermint/tendermint/p2p"
|
"github.com/tendermint/tendermint/p2p"
|
||||||
"github.com/tendermint/tendermint/types"
|
"github.com/tendermint/tendermint/types"
|
||||||
)
|
)
|
||||||
@ -24,15 +23,13 @@ const (
|
|||||||
// EvidenceReactor handles evpool evidence broadcasting amongst peers.
|
// EvidenceReactor handles evpool evidence broadcasting amongst peers.
|
||||||
type EvidenceReactor struct {
|
type EvidenceReactor struct {
|
||||||
p2p.BaseReactor
|
p2p.BaseReactor
|
||||||
config *cfg.EvidenceConfig
|
|
||||||
evpool *EvidencePool
|
evpool *EvidencePool
|
||||||
eventBus *types.EventBus
|
eventBus *types.EventBus
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewEvidenceReactor returns a new EvidenceReactor with the given config and evpool.
|
// NewEvidenceReactor returns a new EvidenceReactor with the given config and evpool.
|
||||||
func NewEvidenceReactor(config *cfg.EvidenceConfig, evpool *EvidencePool) *EvidenceReactor {
|
func NewEvidenceReactor(evpool *EvidencePool) *EvidenceReactor {
|
||||||
evR := &EvidenceReactor{
|
evR := &EvidenceReactor{
|
||||||
config: config,
|
|
||||||
evpool: evpool,
|
evpool: evpool,
|
||||||
}
|
}
|
||||||
evR.BaseReactor = *p2p.NewBaseReactor("EvidenceReactor", evR)
|
evR.BaseReactor = *p2p.NewBaseReactor("EvidenceReactor", evR)
|
||||||
|
@ -37,11 +37,11 @@ func makeAndConnectEvidenceReactors(config *cfg.Config, N int) []*EvidenceReacto
|
|||||||
logger := evidenceLogger()
|
logger := evidenceLogger()
|
||||||
for i := 0; i < N; i++ {
|
for i := 0; i < N; i++ {
|
||||||
|
|
||||||
config := &cfg.EvidenceConfig{}
|
params := types.EvidenceParams{}
|
||||||
store := NewEvidenceStore(dbm.NewMemDB())
|
store := NewEvidenceStore(dbm.NewMemDB())
|
||||||
state := mockState{}
|
state := mockState{}
|
||||||
pool := NewEvidencePool(config, store, state)
|
pool := NewEvidencePool(params, store, state)
|
||||||
reactors[i] = NewEvidenceReactor(config, pool)
|
reactors[i] = NewEvidenceReactor(pool)
|
||||||
reactors[i].SetLogger(logger.With("validator", i))
|
reactors[i].SetLogger(logger.With("validator", i))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ func _waitForEvidence(t *testing.T, wg *sync.WaitGroup, evs types.EvidenceList,
|
|||||||
func sendEvidence(t *testing.T, evpool *EvidencePool, n int) types.EvidenceList {
|
func sendEvidence(t *testing.T, evpool *EvidencePool, n int) types.EvidenceList {
|
||||||
evList := make([]types.Evidence, n)
|
evList := make([]types.Evidence, n)
|
||||||
for i := 0; i < n; i++ {
|
for i := 0; i < n; i++ {
|
||||||
ev := newMockGoodEvidence(i, 2, []byte("val"))
|
ev := newMockGoodEvidence(int64(i), 2, []byte("val"))
|
||||||
err := evpool.AddEvidence(ev)
|
err := evpool.AddEvidence(ev)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
evList[i] = ev
|
evList[i] = ev
|
||||||
|
@ -32,7 +32,7 @@ Schema for indexing evidence (note you need both height and hash to find a piece
|
|||||||
|
|
||||||
type EvidenceInfo struct {
|
type EvidenceInfo struct {
|
||||||
Committed bool
|
Committed bool
|
||||||
Priority int
|
Priority int64
|
||||||
Evidence types.Evidence
|
Evidence types.Evidence
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,15 +47,15 @@ func keyLookup(evidence types.Evidence) []byte {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// big endian padded hex
|
// big endian padded hex
|
||||||
func be(h int) string {
|
func be(h int64) string {
|
||||||
return fmt.Sprintf("%0.16X", h)
|
return fmt.Sprintf("%0.16X", h)
|
||||||
}
|
}
|
||||||
|
|
||||||
func keyLookupFromHeightAndHash(height int, hash []byte) []byte {
|
func keyLookupFromHeightAndHash(height int64, hash []byte) []byte {
|
||||||
return _key("%s/%s/%X", baseKeyLookup, be(height), hash)
|
return _key("%s/%s/%X", baseKeyLookup, be(height), hash)
|
||||||
}
|
}
|
||||||
|
|
||||||
func keyOutqueue(evidence types.Evidence, priority int) []byte {
|
func keyOutqueue(evidence types.Evidence, priority int64) []byte {
|
||||||
return _key("%s/%s/%s/%X", baseKeyOutqueue, be(priority), be(evidence.Height()), evidence.Hash())
|
return _key("%s/%s/%s/%X", baseKeyOutqueue, be(priority), be(evidence.Height()), evidence.Hash())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ func (store *EvidenceStore) ListEvidence(prefixKey string) (evidence []types.Evi
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetEvidence fetches the evidence with the given height and hash.
|
// GetEvidence fetches the evidence with the given height and hash.
|
||||||
func (store *EvidenceStore) GetEvidence(height int, hash []byte) *EvidenceInfo {
|
func (store *EvidenceStore) GetEvidence(height int64, hash []byte) *EvidenceInfo {
|
||||||
key := keyLookupFromHeightAndHash(height, hash)
|
key := keyLookupFromHeightAndHash(height, hash)
|
||||||
val := store.db.Get(key)
|
val := store.db.Get(key)
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ func (store *EvidenceStore) GetEvidence(height int, hash []byte) *EvidenceInfo {
|
|||||||
|
|
||||||
// AddNewEvidence adds the given evidence to the database.
|
// AddNewEvidence adds the given evidence to the database.
|
||||||
// It returns false if the evidence is already stored.
|
// It returns false if the evidence is already stored.
|
||||||
func (store *EvidenceStore) AddNewEvidence(evidence types.Evidence, priority int) bool {
|
func (store *EvidenceStore) AddNewEvidence(evidence types.Evidence, priority int64) bool {
|
||||||
// check if we already have seen it
|
// check if we already have seen it
|
||||||
ei_ := store.GetEvidence(evidence.Height(), evidence.Hash())
|
ei_ := store.GetEvidence(evidence.Height(), evidence.Hash())
|
||||||
if ei_ != nil && ei_.Evidence != nil {
|
if ei_ != nil && ei_.Evidence != nil {
|
||||||
|
@ -19,7 +19,7 @@ func TestStoreAddDuplicate(t *testing.T) {
|
|||||||
db := dbm.NewMemDB()
|
db := dbm.NewMemDB()
|
||||||
store := NewEvidenceStore(db)
|
store := NewEvidenceStore(db)
|
||||||
|
|
||||||
priority := 10
|
priority := int64(10)
|
||||||
ev := newMockGoodEvidence(2, 1, []byte("val1"))
|
ev := newMockGoodEvidence(2, 1, []byte("val1"))
|
||||||
|
|
||||||
added := store.AddNewEvidence(ev, priority)
|
added := store.AddNewEvidence(ev, priority)
|
||||||
@ -42,7 +42,7 @@ func TestStoreMark(t *testing.T) {
|
|||||||
assert.Equal(0, len(priorityEv))
|
assert.Equal(0, len(priorityEv))
|
||||||
assert.Equal(0, len(pendingEv))
|
assert.Equal(0, len(pendingEv))
|
||||||
|
|
||||||
priority := 10
|
priority := int64(10)
|
||||||
ev := newMockGoodEvidence(2, 1, []byte("val1"))
|
ev := newMockGoodEvidence(2, 1, []byte("val1"))
|
||||||
|
|
||||||
added := store.AddNewEvidence(ev, priority)
|
added := store.AddNewEvidence(ev, priority)
|
||||||
@ -90,7 +90,7 @@ func TestStorePriority(t *testing.T) {
|
|||||||
// sorted by priority and then height
|
// sorted by priority and then height
|
||||||
cases := []struct {
|
cases := []struct {
|
||||||
ev MockGoodEvidence
|
ev MockGoodEvidence
|
||||||
priority int
|
priority int64
|
||||||
}{
|
}{
|
||||||
{newMockGoodEvidence(2, 1, []byte("val1")), 17},
|
{newMockGoodEvidence(2, 1, []byte("val1")), 17},
|
||||||
{newMockGoodEvidence(5, 2, []byte("val2")), 15},
|
{newMockGoodEvidence(5, 2, []byte("val2")), 15},
|
||||||
@ -122,16 +122,16 @@ var _ = wire.RegisterInterface(
|
|||||||
)
|
)
|
||||||
|
|
||||||
type MockGoodEvidence struct {
|
type MockGoodEvidence struct {
|
||||||
Height_ int
|
Height_ int64
|
||||||
Address_ []byte
|
Address_ []byte
|
||||||
Index_ int
|
Index_ int
|
||||||
}
|
}
|
||||||
|
|
||||||
func newMockGoodEvidence(height, index int, address []byte) MockGoodEvidence {
|
func newMockGoodEvidence(height int64, index int, address []byte) MockGoodEvidence {
|
||||||
return MockGoodEvidence{height, address, index}
|
return MockGoodEvidence{height, address, index}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e MockGoodEvidence) Height() int { return e.Height_ }
|
func (e MockGoodEvidence) Height() int64 { return e.Height_ }
|
||||||
func (e MockGoodEvidence) Address() []byte { return e.Address_ }
|
func (e MockGoodEvidence) Address() []byte { return e.Address_ }
|
||||||
func (e MockGoodEvidence) Index() int { return e.Index_ }
|
func (e MockGoodEvidence) Index() int { return e.Index_ }
|
||||||
func (e MockGoodEvidence) Hash() []byte {
|
func (e MockGoodEvidence) Hash() []byte {
|
||||||
|
@ -210,16 +210,15 @@ func NewNode(config *cfg.Config,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make Evidence Reactor
|
// Make Evidence Reactor
|
||||||
evidenceConfig := &cfg.EvidenceConfig{} // TODO
|
|
||||||
evidenceDB, err := dbProvider(&DBContext{"evidence", config})
|
evidenceDB, err := dbProvider(&DBContext{"evidence", config})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
evidenceLogger := logger.With("module", "evidence")
|
evidenceLogger := logger.With("module", "evidence")
|
||||||
evidenceStore := evidence.NewEvidenceStore(evidenceDB)
|
evidenceStore := evidence.NewEvidenceStore(evidenceDB)
|
||||||
evidencePool := evidence.NewEvidencePool(evidenceConfig, evidenceStore, state)
|
evidencePool := evidence.NewEvidencePool(state.ConsensusParams.EvidenceParams, evidenceStore, state)
|
||||||
evidencePool.SetLogger(evidenceLogger)
|
evidencePool.SetLogger(evidenceLogger)
|
||||||
evidenceReactor := evidence.NewEvidenceReactor(evidenceConfig, evidencePool)
|
evidenceReactor := evidence.NewEvidenceReactor(evidencePool)
|
||||||
evidenceReactor.SetLogger(evidenceLogger)
|
evidenceReactor.SetLogger(evidenceLogger)
|
||||||
|
|
||||||
// Make ConsensusReactor
|
// Make ConsensusReactor
|
||||||
|
@ -309,7 +309,7 @@ func (s *State) validateBlock(b *types.Block) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, ev := range block.Evidence.Evidence {
|
for _, ev := range b.Evidence.Evidence {
|
||||||
if _, err := s.VerifyEvidence(ev); err != nil {
|
if _, err := s.VerifyEvidence(ev); err != nil {
|
||||||
return types.NewEvidenceInvalidErr(ev, err)
|
return types.NewEvidenceInvalidErr(ev, err)
|
||||||
}
|
}
|
||||||
|
@ -388,9 +388,9 @@ func (s *State) GetValidators() (last *types.ValidatorSet, current *types.Valida
|
|||||||
// It returns the priority of this evidence, or an error.
|
// It returns the priority of this evidence, or an error.
|
||||||
// NOTE: return error may be ErrNoValSetForHeight, in which case the validator set
|
// NOTE: return error may be ErrNoValSetForHeight, in which case the validator set
|
||||||
// for the evidence height could not be loaded.
|
// for the evidence height could not be loaded.
|
||||||
func (s *State) VerifyEvidence(evidence types.Evidence) (priority int, err error) {
|
func (s *State) VerifyEvidence(evidence types.Evidence) (priority int64, err error) {
|
||||||
evidenceAge := s.LastBlockHeight - evidence.Height()
|
evidenceAge := s.LastBlockHeight - evidence.Height()
|
||||||
maxAge := s.Params.EvidenceParams.MaxAge
|
maxAge := s.ConsensusParams.EvidenceParams.MaxAge
|
||||||
if evidenceAge > maxAge {
|
if evidenceAge > maxAge {
|
||||||
return priority, fmt.Errorf("Evidence from height %d is too old. Min height is %d",
|
return priority, fmt.Errorf("Evidence from height %d is too old. Min height is %d",
|
||||||
evidence.Height(), s.LastBlockHeight-maxAge)
|
evidence.Height(), s.LastBlockHeight-maxAge)
|
||||||
@ -416,7 +416,7 @@ func (s *State) VerifyEvidence(evidence types.Evidence) (priority int, err error
|
|||||||
return priority, fmt.Errorf("Address %X was validator %d at height %d, not %d", addr, valIdx, height, idx)
|
return priority, fmt.Errorf("Address %X was validator %d at height %d, not %d", addr, valIdx, height, idx)
|
||||||
}
|
}
|
||||||
|
|
||||||
priority = int(val.VotingPower)
|
priority = val.VotingPower
|
||||||
return priority, nil
|
return priority, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
func TestValidateBlock(t *testing.T) {
|
func TestValidateBlock(t *testing.T) {
|
||||||
txs := []Tx{Tx("foo"), Tx("bar")}
|
txs := []Tx{Tx("foo"), Tx("bar")}
|
||||||
lastID := makeBlockID()
|
lastID := makeBlockIDRandom()
|
||||||
h := int64(3)
|
h := int64(3)
|
||||||
|
|
||||||
voteSet, _, vals := randVoteSet(h-1, 1, VoteTypePrecommit,
|
voteSet, _, vals := randVoteSet(h-1, 1, VoteTypePrecommit,
|
||||||
@ -58,7 +58,18 @@ func TestValidateBlock(t *testing.T) {
|
|||||||
require.Error(t, err)
|
require.Error(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeBlockID() BlockID {
|
func makeBlockIDRandom() BlockID {
|
||||||
blockHash, blockPartsHeader := crypto.CRandBytes(32), PartSetHeader{123, crypto.CRandBytes(32)}
|
blockHash, blockPartsHeader := crypto.CRandBytes(32), PartSetHeader{123, crypto.CRandBytes(32)}
|
||||||
return BlockID{blockHash, blockPartsHeader}
|
return BlockID{blockHash, blockPartsHeader}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func makeBlockID(hash string, partSetSize int, partSetHash string) BlockID {
|
||||||
|
return BlockID{
|
||||||
|
Hash: []byte(hash),
|
||||||
|
PartsHeader: PartSetHeader{
|
||||||
|
Total: partSetSize,
|
||||||
|
Hash: []byte(partSetHash),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -28,7 +28,7 @@ func (err *ErrEvidenceInvalid) Error() string {
|
|||||||
|
|
||||||
// Evidence represents any provable malicious activity by a validator
|
// Evidence represents any provable malicious activity by a validator
|
||||||
type Evidence interface {
|
type Evidence interface {
|
||||||
Height() int // height of the equivocation
|
Height() int64 // height of the equivocation
|
||||||
Address() []byte // address of the equivocating validator
|
Address() []byte // address of the equivocating validator
|
||||||
Index() int // index of the validator in the validator set
|
Index() int // index of the validator in the validator set
|
||||||
Hash() []byte // hash of the evidence
|
Hash() []byte // hash of the evidence
|
||||||
@ -104,7 +104,7 @@ func (dve *DuplicateVoteEvidence) String() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Height returns the height this evidence refers to.
|
// Height returns the height this evidence refers to.
|
||||||
func (dve *DuplicateVoteEvidence) Height() int {
|
func (dve *DuplicateVoteEvidence) Height() int64 {
|
||||||
return dve.VoteA.Height
|
return dve.VoteA.Height
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ type voteData struct {
|
|||||||
valid bool
|
valid bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeVote(val *PrivValidatorFS, chainID string, valIndex, height, round, step int, blockID BlockID) *Vote {
|
func makeVote(val *PrivValidatorFS, chainID string, valIndex int, height int64, round, step int, blockID BlockID) *Vote {
|
||||||
v := &Vote{
|
v := &Vote{
|
||||||
ValidatorAddress: val.PubKey.Address(),
|
ValidatorAddress: val.PubKey.Address(),
|
||||||
ValidatorIndex: valIndex,
|
ValidatorIndex: valIndex,
|
||||||
@ -28,17 +28,6 @@ func makeVote(val *PrivValidatorFS, chainID string, valIndex, height, round, ste
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeBlockID(hash string, partSetSize int, partSetHash string) BlockID {
|
|
||||||
return BlockID{
|
|
||||||
Hash: []byte(hash),
|
|
||||||
PartsHeader: PartSetHeader{
|
|
||||||
Total: partSetSize,
|
|
||||||
Hash: []byte(partSetHash),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestEvidence(t *testing.T) {
|
func TestEvidence(t *testing.T) {
|
||||||
_, tmpFilePath := cmn.Tempfile("priv_validator_")
|
_, tmpFilePath := cmn.Tempfile("priv_validator_")
|
||||||
val := GenPrivValidatorFS(tmpFilePath)
|
val := GenPrivValidatorFS(tmpFilePath)
|
||||||
|
@ -40,7 +40,7 @@ type BlockGossip struct {
|
|||||||
|
|
||||||
// EvidenceParams determine how we handle evidence of malfeasance
|
// EvidenceParams determine how we handle evidence of malfeasance
|
||||||
type EvidenceParams struct {
|
type EvidenceParams struct {
|
||||||
MaxAge int `json:"max_age"` // only accept new evidence more recent than this
|
MaxAge int64 `json:"max_age"` // only accept new evidence more recent than this
|
||||||
}
|
}
|
||||||
|
|
||||||
// DefaultConsensusParams returns a default ConsensusParams.
|
// DefaultConsensusParams returns a default ConsensusParams.
|
||||||
|
@ -76,7 +76,7 @@ type BlockStore interface {
|
|||||||
// State defines the stateful interface used to verify evidence.
|
// State defines the stateful interface used to verify evidence.
|
||||||
// UNSTABLE
|
// UNSTABLE
|
||||||
type State interface {
|
type State interface {
|
||||||
VerifyEvidence(Evidence) (priority int, err error)
|
VerifyEvidence(Evidence) (priority int64, err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user