mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-04 04:04:00 +00:00
evidence: replace mock evidence with mocked duplicate vote evidence (#5036)
This commit is contained in:
@@ -154,9 +154,7 @@ func TestReactorWithEvidence(t *testing.T) {
|
||||
// mock the evidence pool
|
||||
// everyone includes evidence of another double signing
|
||||
vIdx := (i + 1) % nValidators
|
||||
pubKey, err := privVals[vIdx].GetPubKey()
|
||||
require.NoError(t, err)
|
||||
evpool := newMockEvidencePool(pubKey.Address())
|
||||
evpool := newMockEvidencePool(privVals[vIdx])
|
||||
|
||||
// Make State
|
||||
blockExec := sm.NewBlockExecutor(stateDB, log.TestingLogger(), proxyAppConnCon, mempool, evpool)
|
||||
@@ -201,9 +199,9 @@ type mockEvidencePool struct {
|
||||
ev []types.Evidence
|
||||
}
|
||||
|
||||
func newMockEvidencePool(val []byte) *mockEvidencePool {
|
||||
func newMockEvidencePool(val types.PrivValidator) *mockEvidencePool {
|
||||
return &mockEvidencePool{
|
||||
ev: []types.Evidence{types.NewMockEvidence(1, time.Now().UTC(), val)},
|
||||
ev: []types.Evidence{types.NewMockDuplicateVoteEvidenceWithValidator(1, time.Now().UTC(), val, config.ChainID())},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ import (
|
||||
|
||||
dbm "github.com/tendermint/tm-db"
|
||||
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/tmhash"
|
||||
"github.com/tendermint/tendermint/libs/bytes"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
@@ -33,16 +32,17 @@ const evidenceChainID = "test_chain"
|
||||
|
||||
func TestEvidencePool(t *testing.T) {
|
||||
var (
|
||||
valAddr = tmrand.Bytes(crypto.AddressSize)
|
||||
val = types.NewMockPV()
|
||||
valAddr = val.PrivKey.PubKey().Address()
|
||||
height = int64(52)
|
||||
stateDB = initializeValidatorState(valAddr, height)
|
||||
stateDB = initializeValidatorState(val, height)
|
||||
evidenceDB = dbm.NewMemDB()
|
||||
blockStoreDB = dbm.NewMemDB()
|
||||
blockStore = initializeBlockStore(blockStoreDB, sm.LoadState(stateDB), valAddr)
|
||||
evidenceTime = time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC)
|
||||
|
||||
goodEvidence = types.NewMockEvidence(height, time.Now(), valAddr)
|
||||
badEvidence = types.NewMockEvidence(1, evidenceTime, valAddr)
|
||||
goodEvidence = types.NewMockDuplicateVoteEvidenceWithValidator(height, evidenceTime, val, evidenceChainID)
|
||||
badEvidence = types.NewMockDuplicateVoteEvidenceWithValidator(1, evidenceTime, val, evidenceChainID)
|
||||
)
|
||||
|
||||
pool, err := NewPool(stateDB, evidenceDB, blockStore)
|
||||
@@ -82,12 +82,12 @@ func TestEvidencePool(t *testing.T) {
|
||||
|
||||
func TestProposingAndCommittingEvidence(t *testing.T) {
|
||||
var (
|
||||
valAddr = tmrand.Bytes(crypto.AddressSize)
|
||||
val = types.NewMockPV()
|
||||
height = int64(1)
|
||||
stateDB = initializeValidatorState(valAddr, height)
|
||||
stateDB = initializeValidatorState(val, height)
|
||||
evidenceDB = dbm.NewMemDB()
|
||||
blockStoreDB = dbm.NewMemDB()
|
||||
blockStore = initializeBlockStore(blockStoreDB, sm.LoadState(stateDB), valAddr)
|
||||
blockStore = initializeBlockStore(blockStoreDB, sm.LoadState(stateDB), val.PrivKey.PubKey().Address())
|
||||
evidenceTime = time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC)
|
||||
)
|
||||
|
||||
@@ -95,7 +95,7 @@ func TestProposingAndCommittingEvidence(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
// evidence not seen yet:
|
||||
evidence := types.NewMockEvidence(height, evidenceTime, valAddr)
|
||||
evidence := types.NewMockDuplicateVoteEvidenceWithValidator(height, evidenceTime, val, evidenceChainID)
|
||||
assert.False(t, pool.IsCommitted(evidence))
|
||||
|
||||
// evidence seen but not yet committed:
|
||||
@@ -117,9 +117,10 @@ func TestProposingAndCommittingEvidence(t *testing.T) {
|
||||
|
||||
func TestAddEvidence(t *testing.T) {
|
||||
var (
|
||||
valAddr = tmrand.Bytes(crypto.AddressSize)
|
||||
val = types.NewMockPV()
|
||||
valAddr = val.PrivKey.PubKey().Address()
|
||||
height = int64(30)
|
||||
stateDB = initializeValidatorState(valAddr, height)
|
||||
stateDB = initializeValidatorState(val, height)
|
||||
evidenceDB = dbm.NewMemDB()
|
||||
blockStoreDB = dbm.NewMemDB()
|
||||
blockStore = initializeBlockStore(blockStoreDB, sm.LoadState(stateDB), valAddr)
|
||||
@@ -145,7 +146,7 @@ func TestAddEvidence(t *testing.T) {
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.evDescription, func(t *testing.T) {
|
||||
ev := types.NewMockEvidence(tc.evHeight, tc.evTime, valAddr)
|
||||
ev := types.NewMockDuplicateVoteEvidence(tc.evHeight, tc.evTime, evidenceChainID)
|
||||
err := pool.AddEvidence(ev)
|
||||
if tc.expErr {
|
||||
assert.Error(t, err)
|
||||
@@ -157,9 +158,10 @@ func TestAddEvidence(t *testing.T) {
|
||||
|
||||
func TestEvidencePoolUpdate(t *testing.T) {
|
||||
var (
|
||||
valAddr = tmrand.Bytes(crypto.AddressSize)
|
||||
val = types.NewMockPV()
|
||||
valAddr = val.PrivKey.PubKey().Address()
|
||||
height = int64(21)
|
||||
stateDB = initializeValidatorState(valAddr, height)
|
||||
stateDB = initializeValidatorState(val, height)
|
||||
evidenceDB = dbm.NewMemDB()
|
||||
blockStoreDB = dbm.NewMemDB()
|
||||
state = sm.LoadState(stateDB)
|
||||
@@ -170,7 +172,7 @@ func TestEvidencePoolUpdate(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
// create new block (no need to save it to blockStore)
|
||||
evidence := types.NewMockEvidence(height, time.Now(), valAddr)
|
||||
evidence := types.NewMockDuplicateVoteEvidence(height, time.Now(), evidenceChainID)
|
||||
lastCommit := makeCommit(height, valAddr)
|
||||
block := types.MakeBlock(height+1, []types.Tx{}, lastCommit, []types.Evidence{evidence})
|
||||
// update state (partially)
|
||||
@@ -186,9 +188,10 @@ func TestEvidencePoolUpdate(t *testing.T) {
|
||||
|
||||
func TestEvidencePoolNewPool(t *testing.T) {
|
||||
var (
|
||||
valAddr = tmrand.Bytes(crypto.AddressSize)
|
||||
val = types.NewMockPV()
|
||||
valAddr = val.PrivKey.PubKey().Address()
|
||||
height = int64(1)
|
||||
stateDB = initializeValidatorState(valAddr, height)
|
||||
stateDB = initializeValidatorState(val, height)
|
||||
evidenceDB = dbm.NewMemDB()
|
||||
blockStoreDB = dbm.NewMemDB()
|
||||
state = sm.LoadState(stateDB)
|
||||
@@ -204,8 +207,9 @@ func TestEvidencePoolNewPool(t *testing.T) {
|
||||
|
||||
func TestAddingAndPruningPOLC(t *testing.T) {
|
||||
var (
|
||||
valAddr = tmrand.Bytes(crypto.AddressSize)
|
||||
stateDB = initializeValidatorState(valAddr, 1)
|
||||
val = types.NewMockPV()
|
||||
valAddr = val.PrivKey.PubKey().Address()
|
||||
stateDB = initializeValidatorState(val, 1)
|
||||
evidenceDB = dbm.NewMemDB()
|
||||
blockStoreDB = dbm.NewMemDB()
|
||||
state = sm.LoadState(stateDB)
|
||||
@@ -221,7 +225,6 @@ func TestAddingAndPruningPOLC(t *testing.T) {
|
||||
}
|
||||
)
|
||||
|
||||
val := types.NewMockPV()
|
||||
voteA := makeVote(1, 1, 0, val.PrivKey.PubKey().Address(), firstBlockID, evidenceTime)
|
||||
vA := voteA.ToProto()
|
||||
err := val.SignVote(evidenceChainID, vA)
|
||||
@@ -267,16 +270,17 @@ func TestAddingAndPruningPOLC(t *testing.T) {
|
||||
|
||||
func TestRecoverPendingEvidence(t *testing.T) {
|
||||
var (
|
||||
valAddr = tmrand.Bytes(crypto.AddressSize)
|
||||
val = types.NewMockPV()
|
||||
valAddr = val.PrivKey.PubKey().Address()
|
||||
height = int64(30)
|
||||
stateDB = initializeValidatorState(valAddr, height)
|
||||
stateDB = initializeValidatorState(val, height)
|
||||
evidenceDB = dbm.NewMemDB()
|
||||
blockStoreDB = dbm.NewMemDB()
|
||||
state = sm.LoadState(stateDB)
|
||||
blockStore = initializeBlockStore(blockStoreDB, state, valAddr)
|
||||
evidenceTime = time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC)
|
||||
goodEvidence = types.NewMockEvidence(height, time.Now(), valAddr)
|
||||
expiredEvidence = types.NewMockEvidence(int64(1), evidenceTime, valAddr)
|
||||
goodEvidence = types.NewMockDuplicateVoteEvidenceWithValidator(height, time.Now(), val, evidenceChainID)
|
||||
expiredEvidence = types.NewMockDuplicateVoteEvidenceWithValidator(int64(1), evidenceTime, val, evidenceChainID)
|
||||
)
|
||||
|
||||
// load good evidence
|
||||
@@ -461,8 +465,14 @@ func TestAddingPotentialAmnesiaEvidence(t *testing.T) {
|
||||
pool.logger.Info("CASE F")
|
||||
// a new amnesia evidence is seen. It has an empty polc so we should extract the potential amnesia evidence
|
||||
// and start our own trial
|
||||
newPe := types.NewPotentialAmnesiaEvidence(voteB, voteD)
|
||||
newAe := types.NewAmnesiaEvidence(newPe, types.NewEmptyPOLC())
|
||||
newPe := &types.PotentialAmnesiaEvidence{
|
||||
VoteA: voteB,
|
||||
VoteB: voteD,
|
||||
}
|
||||
newAe := &types.AmnesiaEvidence{
|
||||
PotentialAmnesiaEvidence: newPe,
|
||||
Polc: types.NewEmptyPOLC(),
|
||||
}
|
||||
err = pool.AddEvidence(newAe)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, 2, len(pool.AllPendingEvidence()))
|
||||
@@ -518,10 +528,10 @@ func initializeStateFromValidatorSet(valSet *types.ValidatorSet, height int64) d
|
||||
return stateDB
|
||||
}
|
||||
|
||||
func initializeValidatorState(valAddr []byte, height int64) dbm.DB {
|
||||
func initializeValidatorState(privVal types.PrivValidator, height int64) dbm.DB {
|
||||
|
||||
pubKey, _ := types.NewMockPV().GetPubKey()
|
||||
validator := &types.Validator{Address: valAddr, VotingPower: 0, PubKey: pubKey}
|
||||
pubKey, _ := privVal.GetPubKey()
|
||||
validator := &types.Validator{Address: pubKey.Address(), VotingPower: 0, PubKey: pubKey}
|
||||
|
||||
// create validator set and state
|
||||
valSet := &types.ValidatorSet{
|
||||
|
||||
@@ -13,9 +13,7 @@ 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"
|
||||
@@ -114,10 +112,10 @@ func _waitForEvidence(
|
||||
wg.Done()
|
||||
}
|
||||
|
||||
func sendEvidence(t *testing.T, evpool *Pool, valAddr []byte, n int) types.EvidenceList {
|
||||
func sendEvidence(t *testing.T, evpool *Pool, val types.PrivValidator, n int) types.EvidenceList {
|
||||
evList := make([]types.Evidence, n)
|
||||
for i := 0; i < n; i++ {
|
||||
ev := types.NewMockEvidence(int64(i+1), time.Now().UTC(), valAddr)
|
||||
ev := types.NewMockDuplicateVoteEvidenceWithValidator(int64(i+1), time.Now().UTC(), val, evidenceChainID)
|
||||
err := evpool.AddEvidence(ev)
|
||||
require.NoError(t, err)
|
||||
evList[i] = ev
|
||||
@@ -136,11 +134,11 @@ func TestReactorBroadcastEvidence(t *testing.T) {
|
||||
|
||||
// create statedb for everyone
|
||||
stateDBs := make([]dbm.DB, N)
|
||||
valAddr := tmrand.Bytes(crypto.AddressSize)
|
||||
val := types.NewMockPV()
|
||||
// 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++ {
|
||||
stateDBs[i] = initializeValidatorState(valAddr, height)
|
||||
stateDBs[i] = initializeValidatorState(val, height)
|
||||
}
|
||||
|
||||
// make reactors from statedb
|
||||
@@ -156,7 +154,7 @@ func TestReactorBroadcastEvidence(t *testing.T) {
|
||||
|
||||
// send a bunch of valid evidence to the first reactor's evpool
|
||||
// and wait for them all to be received in the others
|
||||
evList := sendEvidence(t, reactors[0].evpool, valAddr, numEvidence)
|
||||
evList := sendEvidence(t, reactors[0].evpool, val, numEvidence)
|
||||
waitForEvidence(t, evList, reactors)
|
||||
}
|
||||
|
||||
@@ -171,13 +169,13 @@ func (ps peerState) GetHeight() int64 {
|
||||
func TestReactorSelectiveBroadcast(t *testing.T) {
|
||||
config := cfg.TestConfig()
|
||||
|
||||
valAddr := tmrand.Bytes(crypto.AddressSize)
|
||||
val := types.NewMockPV()
|
||||
height1 := int64(numEvidence) + 10
|
||||
height2 := int64(numEvidence) / 2
|
||||
|
||||
// DB1 is ahead of DB2
|
||||
stateDB1 := initializeValidatorState(valAddr, height1)
|
||||
stateDB2 := initializeValidatorState(valAddr, height2)
|
||||
stateDB1 := initializeValidatorState(val, height1)
|
||||
stateDB2 := initializeValidatorState(val, height2)
|
||||
|
||||
// make reactors from statedb
|
||||
reactors := makeAndConnectReactors(config, []dbm.DB{stateDB1, stateDB2})
|
||||
@@ -196,7 +194,7 @@ func TestReactorSelectiveBroadcast(t *testing.T) {
|
||||
peer.Set(types.PeerStateKey, ps)
|
||||
|
||||
// send a bunch of valid evidence to the first reactor's evpool
|
||||
evList := sendEvidence(t, reactors[0].evpool, valAddr, numEvidence)
|
||||
evList := sendEvidence(t, reactors[0].evpool, val, numEvidence)
|
||||
|
||||
// only ones less than the peers height should make it through
|
||||
waitForEvidence(t, evList[:numEvidence/2], reactors[1:2])
|
||||
|
||||
@@ -218,8 +218,6 @@ func testFreeAddr(t *testing.T) string {
|
||||
// create a proposal block using real and full
|
||||
// mempool and evidence pool and validate it.
|
||||
func TestCreateProposalBlock(t *testing.T) {
|
||||
const minEvSize = 12
|
||||
|
||||
config := cfg.ResetTestRoot("node_create_proposal")
|
||||
defer os.RemoveAll(config.RootDir)
|
||||
cc := proxy.NewLocalClientCreator(kvstore.NewApplication())
|
||||
@@ -231,7 +229,7 @@ func TestCreateProposalBlock(t *testing.T) {
|
||||
logger := log.TestingLogger()
|
||||
|
||||
var height int64 = 1
|
||||
state, stateDB := state(1, height)
|
||||
state, stateDB, privVals := state(1, height)
|
||||
maxBytes := 16384
|
||||
maxEvidence := 10
|
||||
state.ConsensusParams.Block.MaxBytes = int64(maxBytes)
|
||||
@@ -260,7 +258,7 @@ func TestCreateProposalBlock(t *testing.T) {
|
||||
// fill the evidence pool with more evidence
|
||||
// than can fit in a block
|
||||
for i := 0; i <= maxEvidence; i++ {
|
||||
ev := types.NewMockRandomEvidence(height, time.Now(), proposerAddr, tmrand.Bytes(minEvSize))
|
||||
ev := types.NewMockDuplicateVoteEvidenceWithValidator(height, time.Now(), privVals[0], "test-chain")
|
||||
err := evidencePool.AddEvidence(ev)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
@@ -326,14 +324,15 @@ func TestNodeNewNodeCustomReactors(t *testing.T) {
|
||||
assert.Equal(t, customBlockchainReactor, n.Switch().Reactor("BLOCKCHAIN"))
|
||||
}
|
||||
|
||||
func state(nVals int, height int64) (sm.State, dbm.DB) {
|
||||
func state(nVals int, height int64) (sm.State, dbm.DB, []types.PrivValidator) {
|
||||
privVals := make([]types.PrivValidator, nVals)
|
||||
vals := make([]types.GenesisValidator, nVals)
|
||||
for i := 0; i < nVals; i++ {
|
||||
secret := []byte(fmt.Sprintf("test%d", i))
|
||||
pk := ed25519.GenPrivKeyFromSecret(secret)
|
||||
privVal := types.NewMockPV()
|
||||
privVals[i] = privVal
|
||||
vals[i] = types.GenesisValidator{
|
||||
Address: pk.PubKey().Address(),
|
||||
PubKey: pk.PubKey(),
|
||||
Address: privVal.PrivKey.PubKey().Address(),
|
||||
PubKey: privVal.PrivKey.PubKey(),
|
||||
Power: 1000,
|
||||
Name: fmt.Sprintf("test%d", i),
|
||||
}
|
||||
@@ -353,5 +352,5 @@ func state(nVals int, height int64) (sm.State, dbm.DB) {
|
||||
s.LastValidators = s.Validators.Copy()
|
||||
sm.SaveState(stateDB, s)
|
||||
}
|
||||
return s, stateDB
|
||||
return s, stateDB, privVals
|
||||
}
|
||||
|
||||
@@ -7,20 +7,16 @@ import (
|
||||
fmt "fmt"
|
||||
_ "github.com/gogo/protobuf/gogoproto"
|
||||
proto "github.com/gogo/protobuf/proto"
|
||||
_ "github.com/gogo/protobuf/types"
|
||||
github_com_gogo_protobuf_types "github.com/gogo/protobuf/types"
|
||||
keys "github.com/tendermint/tendermint/proto/tendermint/crypto/keys"
|
||||
io "io"
|
||||
math "math"
|
||||
math_bits "math/bits"
|
||||
time "time"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
var _ = time.Kitchen
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
@@ -194,135 +190,6 @@ func (m *AmnesiaEvidence) GetPolc() *ProofOfLockChange {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MockEvidence is used for testing pruposes
|
||||
type MockEvidence struct {
|
||||
EvidenceHeight int64 `protobuf:"varint,1,opt,name=evidence_height,json=evidenceHeight,proto3" json:"evidence_height,omitempty"`
|
||||
EvidenceTime time.Time `protobuf:"bytes,2,opt,name=evidence_time,json=evidenceTime,proto3,stdtime" json:"evidence_time"`
|
||||
EvidenceAddress []byte `protobuf:"bytes,3,opt,name=evidence_address,json=evidenceAddress,proto3" json:"evidence_address,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MockEvidence) Reset() { *m = MockEvidence{} }
|
||||
func (m *MockEvidence) String() string { return proto.CompactTextString(m) }
|
||||
func (*MockEvidence) ProtoMessage() {}
|
||||
func (*MockEvidence) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_6825fabc78e0a168, []int{3}
|
||||
}
|
||||
func (m *MockEvidence) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MockEvidence) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_MockEvidence.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *MockEvidence) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MockEvidence.Merge(m, src)
|
||||
}
|
||||
func (m *MockEvidence) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *MockEvidence) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MockEvidence.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MockEvidence proto.InternalMessageInfo
|
||||
|
||||
func (m *MockEvidence) GetEvidenceHeight() int64 {
|
||||
if m != nil {
|
||||
return m.EvidenceHeight
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *MockEvidence) GetEvidenceTime() time.Time {
|
||||
if m != nil {
|
||||
return m.EvidenceTime
|
||||
}
|
||||
return time.Time{}
|
||||
}
|
||||
|
||||
func (m *MockEvidence) GetEvidenceAddress() []byte {
|
||||
if m != nil {
|
||||
return m.EvidenceAddress
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type MockRandomEvidence struct {
|
||||
EvidenceHeight int64 `protobuf:"varint,1,opt,name=evidence_height,json=evidenceHeight,proto3" json:"evidence_height,omitempty"`
|
||||
EvidenceTime time.Time `protobuf:"bytes,2,opt,name=evidence_time,json=evidenceTime,proto3,stdtime" json:"evidence_time"`
|
||||
EvidenceAddress []byte `protobuf:"bytes,3,opt,name=evidence_address,json=evidenceAddress,proto3" json:"evidence_address,omitempty"`
|
||||
RandBytes []byte `protobuf:"bytes,4,opt,name=rand_bytes,json=randBytes,proto3" json:"rand_bytes,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MockRandomEvidence) Reset() { *m = MockRandomEvidence{} }
|
||||
func (m *MockRandomEvidence) String() string { return proto.CompactTextString(m) }
|
||||
func (*MockRandomEvidence) ProtoMessage() {}
|
||||
func (*MockRandomEvidence) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_6825fabc78e0a168, []int{4}
|
||||
}
|
||||
func (m *MockRandomEvidence) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MockRandomEvidence) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_MockRandomEvidence.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (m *MockRandomEvidence) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MockRandomEvidence.Merge(m, src)
|
||||
}
|
||||
func (m *MockRandomEvidence) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *MockRandomEvidence) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MockRandomEvidence.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MockRandomEvidence proto.InternalMessageInfo
|
||||
|
||||
func (m *MockRandomEvidence) GetEvidenceHeight() int64 {
|
||||
if m != nil {
|
||||
return m.EvidenceHeight
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *MockRandomEvidence) GetEvidenceTime() time.Time {
|
||||
if m != nil {
|
||||
return m.EvidenceTime
|
||||
}
|
||||
return time.Time{}
|
||||
}
|
||||
|
||||
func (m *MockRandomEvidence) GetEvidenceAddress() []byte {
|
||||
if m != nil {
|
||||
return m.EvidenceAddress
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *MockRandomEvidence) GetRandBytes() []byte {
|
||||
if m != nil {
|
||||
return m.RandBytes
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ConflictingHeadersEvidence struct {
|
||||
H1 *SignedHeader `protobuf:"bytes,1,opt,name=h1,proto3" json:"h1,omitempty"`
|
||||
H2 *SignedHeader `protobuf:"bytes,2,opt,name=h2,proto3" json:"h2,omitempty"`
|
||||
@@ -332,7 +199,7 @@ func (m *ConflictingHeadersEvidence) Reset() { *m = ConflictingHeadersEv
|
||||
func (m *ConflictingHeadersEvidence) String() string { return proto.CompactTextString(m) }
|
||||
func (*ConflictingHeadersEvidence) ProtoMessage() {}
|
||||
func (*ConflictingHeadersEvidence) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_6825fabc78e0a168, []int{5}
|
||||
return fileDescriptor_6825fabc78e0a168, []int{3}
|
||||
}
|
||||
func (m *ConflictingHeadersEvidence) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@@ -385,7 +252,7 @@ func (m *LunaticValidatorEvidence) Reset() { *m = LunaticValidatorEviden
|
||||
func (m *LunaticValidatorEvidence) String() string { return proto.CompactTextString(m) }
|
||||
func (*LunaticValidatorEvidence) ProtoMessage() {}
|
||||
func (*LunaticValidatorEvidence) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_6825fabc78e0a168, []int{6}
|
||||
return fileDescriptor_6825fabc78e0a168, []int{4}
|
||||
}
|
||||
func (m *LunaticValidatorEvidence) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@@ -444,7 +311,7 @@ func (m *PhantomValidatorEvidence) Reset() { *m = PhantomValidatorEviden
|
||||
func (m *PhantomValidatorEvidence) String() string { return proto.CompactTextString(m) }
|
||||
func (*PhantomValidatorEvidence) ProtoMessage() {}
|
||||
func (*PhantomValidatorEvidence) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_6825fabc78e0a168, []int{7}
|
||||
return fileDescriptor_6825fabc78e0a168, []int{5}
|
||||
}
|
||||
func (m *PhantomValidatorEvidence) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@@ -495,8 +362,6 @@ type Evidence struct {
|
||||
// *Evidence_PotentialAmnesiaEvidence
|
||||
// *Evidence_AmnesiaEvidence
|
||||
// *Evidence_PhantomValidatorEvidence
|
||||
// *Evidence_MockEvidence
|
||||
// *Evidence_MockRandomEvidence
|
||||
Sum isEvidence_Sum `protobuf_oneof:"sum"`
|
||||
}
|
||||
|
||||
@@ -504,7 +369,7 @@ func (m *Evidence) Reset() { *m = Evidence{} }
|
||||
func (m *Evidence) String() string { return proto.CompactTextString(m) }
|
||||
func (*Evidence) ProtoMessage() {}
|
||||
func (*Evidence) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_6825fabc78e0a168, []int{8}
|
||||
return fileDescriptor_6825fabc78e0a168, []int{6}
|
||||
}
|
||||
func (m *Evidence) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@@ -557,12 +422,6 @@ type Evidence_AmnesiaEvidence struct {
|
||||
type Evidence_PhantomValidatorEvidence struct {
|
||||
PhantomValidatorEvidence *PhantomValidatorEvidence `protobuf:"bytes,6,opt,name=phantom_validator_evidence,json=phantomValidatorEvidence,proto3,oneof" json:"phantom_validator_evidence,omitempty"`
|
||||
}
|
||||
type Evidence_MockEvidence struct {
|
||||
MockEvidence *MockEvidence `protobuf:"bytes,7,opt,name=mock_evidence,json=mockEvidence,proto3,oneof" json:"mock_evidence,omitempty"`
|
||||
}
|
||||
type Evidence_MockRandomEvidence struct {
|
||||
MockRandomEvidence *MockRandomEvidence `protobuf:"bytes,8,opt,name=mock_random_evidence,json=mockRandomEvidence,proto3,oneof" json:"mock_random_evidence,omitempty"`
|
||||
}
|
||||
|
||||
func (*Evidence_DuplicateVoteEvidence) isEvidence_Sum() {}
|
||||
func (*Evidence_ConflictingHeadersEvidence) isEvidence_Sum() {}
|
||||
@@ -570,8 +429,6 @@ func (*Evidence_LunaticValidatorEvidence) isEvidence_Sum() {}
|
||||
func (*Evidence_PotentialAmnesiaEvidence) isEvidence_Sum() {}
|
||||
func (*Evidence_AmnesiaEvidence) isEvidence_Sum() {}
|
||||
func (*Evidence_PhantomValidatorEvidence) isEvidence_Sum() {}
|
||||
func (*Evidence_MockEvidence) isEvidence_Sum() {}
|
||||
func (*Evidence_MockRandomEvidence) isEvidence_Sum() {}
|
||||
|
||||
func (m *Evidence) GetSum() isEvidence_Sum {
|
||||
if m != nil {
|
||||
@@ -622,20 +479,6 @@ func (m *Evidence) GetPhantomValidatorEvidence() *PhantomValidatorEvidence {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Evidence) GetMockEvidence() *MockEvidence {
|
||||
if x, ok := m.GetSum().(*Evidence_MockEvidence); ok {
|
||||
return x.MockEvidence
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Evidence) GetMockRandomEvidence() *MockRandomEvidence {
|
||||
if x, ok := m.GetSum().(*Evidence_MockRandomEvidence); ok {
|
||||
return x.MockRandomEvidence
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// XXX_OneofWrappers is for the internal use of the proto package.
|
||||
func (*Evidence) XXX_OneofWrappers() []interface{} {
|
||||
return []interface{}{
|
||||
@@ -645,8 +488,6 @@ func (*Evidence) XXX_OneofWrappers() []interface{} {
|
||||
(*Evidence_PotentialAmnesiaEvidence)(nil),
|
||||
(*Evidence_AmnesiaEvidence)(nil),
|
||||
(*Evidence_PhantomValidatorEvidence)(nil),
|
||||
(*Evidence_MockEvidence)(nil),
|
||||
(*Evidence_MockRandomEvidence)(nil),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -660,7 +501,7 @@ func (m *EvidenceData) Reset() { *m = EvidenceData{} }
|
||||
func (m *EvidenceData) String() string { return proto.CompactTextString(m) }
|
||||
func (*EvidenceData) ProtoMessage() {}
|
||||
func (*EvidenceData) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_6825fabc78e0a168, []int{9}
|
||||
return fileDescriptor_6825fabc78e0a168, []int{7}
|
||||
}
|
||||
func (m *EvidenceData) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@@ -712,7 +553,7 @@ func (m *ProofOfLockChange) Reset() { *m = ProofOfLockChange{} }
|
||||
func (m *ProofOfLockChange) String() string { return proto.CompactTextString(m) }
|
||||
func (*ProofOfLockChange) ProtoMessage() {}
|
||||
func (*ProofOfLockChange) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_6825fabc78e0a168, []int{10}
|
||||
return fileDescriptor_6825fabc78e0a168, []int{8}
|
||||
}
|
||||
func (m *ProofOfLockChange) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
@@ -759,8 +600,6 @@ func init() {
|
||||
proto.RegisterType((*DuplicateVoteEvidence)(nil), "tendermint.types.DuplicateVoteEvidence")
|
||||
proto.RegisterType((*PotentialAmnesiaEvidence)(nil), "tendermint.types.PotentialAmnesiaEvidence")
|
||||
proto.RegisterType((*AmnesiaEvidence)(nil), "tendermint.types.AmnesiaEvidence")
|
||||
proto.RegisterType((*MockEvidence)(nil), "tendermint.types.MockEvidence")
|
||||
proto.RegisterType((*MockRandomEvidence)(nil), "tendermint.types.MockRandomEvidence")
|
||||
proto.RegisterType((*ConflictingHeadersEvidence)(nil), "tendermint.types.ConflictingHeadersEvidence")
|
||||
proto.RegisterType((*LunaticValidatorEvidence)(nil), "tendermint.types.LunaticValidatorEvidence")
|
||||
proto.RegisterType((*PhantomValidatorEvidence)(nil), "tendermint.types.PhantomValidatorEvidence")
|
||||
@@ -772,65 +611,53 @@ func init() {
|
||||
func init() { proto.RegisterFile("tendermint/types/evidence.proto", fileDescriptor_6825fabc78e0a168) }
|
||||
|
||||
var fileDescriptor_6825fabc78e0a168 = []byte{
|
||||
// 915 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4,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, 0x9f, 0xf2,
|
||||
0x20, 0x1f, 0xdb, 0x2e, 0x8b, 0x06, 0xcb, 0x37, 0xae, 0xc5, 0x63, 0x71, 0x75, 0x5b, 0xbd, 0x8d,
|
||||
0x8d, 0x3b, 0xb2, 0xfe, 0xd1, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x30, 0x98, 0x2f, 0x5c, 0x12,
|
||||
0x0a, 0x00, 0x00,
|
||||
// 733 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0x4f, 0x6f, 0xd3, 0x30,
|
||||
0x1c, 0x6d, 0xd6, 0xae, 0x8c, 0xdf, 0x26, 0x6d, 0x44, 0x1b, 0x44, 0x65, 0xea, 0xb6, 0x70, 0x60,
|
||||
0x9a, 0x46, 0xba, 0x95, 0xc3, 0x24, 0xc4, 0x65, 0xff, 0x50, 0xd1, 0x26, 0x18, 0x99, 0x34, 0x24,
|
||||
0x2e, 0xc1, 0x4d, 0xdc, 0xc4, 0x5b, 0x6a, 0x47, 0x8d, 0x53, 0x54, 0x09, 0x3e, 0x02, 0x12, 0x77,
|
||||
0xbe, 0x01, 0x67, 0x3e, 0xc4, 0x8e, 0x3b, 0x72, 0x42, 0x68, 0xfb, 0x16, 0x9c, 0x50, 0x1c, 0x37,
|
||||
0xed, 0x9a, 0x66, 0x83, 0x0b, 0x97, 0x28, 0xf2, 0xef, 0xf9, 0xbd, 0x67, 0xfb, 0xfd, 0x6c, 0x58,
|
||||
0xe2, 0x98, 0x3a, 0xb8, 0xd3, 0x26, 0x94, 0xd7, 0x78, 0x2f, 0xc0, 0x61, 0x0d, 0x77, 0x89, 0x83,
|
||||
0xa9, 0x8d, 0x8d, 0xa0, 0xc3, 0x38, 0x53, 0xe7, 0x06, 0x00, 0x43, 0x00, 0x2a, 0xf3, 0x2e, 0x73,
|
||||
0x99, 0x28, 0xd6, 0xe2, 0xbf, 0x04, 0x57, 0x59, 0xcc, 0x10, 0x89, 0xaf, 0xac, 0xea, 0x43, 0x55,
|
||||
0xbb, 0xd3, 0x0b, 0x38, 0xab, 0x9d, 0xe1, 0xde, 0x35, 0x8c, 0x1e, 0xc1, 0xc2, 0x5e, 0x14, 0xf8,
|
||||
0xc4, 0x46, 0x1c, 0x9f, 0x30, 0x8e, 0xf7, 0xa5, 0x11, 0xf5, 0x09, 0x94, 0xbb, 0x8c, 0x63, 0x0b,
|
||||
0x69, 0xca, 0xb2, 0xb2, 0x3a, 0x5d, 0xbf, 0x6f, 0x8c, 0x7a, 0x32, 0x62, 0xbc, 0x39, 0x19, 0xa3,
|
||||
0xb6, 0x53, 0x78, 0x53, 0x9b, 0xb8, 0x1d, 0xbe, 0xa3, 0x7f, 0x55, 0x40, 0x3b, 0x62, 0x1c, 0x53,
|
||||
0x4e, 0x90, 0xbf, 0xdd, 0xa6, 0x38, 0x24, 0xe8, 0xff, 0x48, 0xab, 0x2b, 0x30, 0xe3, 0x61, 0xe2,
|
||||
0x7a, 0xdc, 0x0a, 0x39, 0x6a, 0x07, 0x5a, 0x71, 0x59, 0x59, 0x2d, 0x9a, 0xd3, 0xc9, 0xd8, 0x71,
|
||||
0x3c, 0xa4, 0x7f, 0x57, 0x60, 0x76, 0xd4, 0x94, 0x07, 0x95, 0xa0, 0x6f, 0xd8, 0x42, 0x49, 0xd1,
|
||||
0xea, 0x1f, 0x9b, 0x34, 0xba, 0x96, 0x55, 0xce, 0x5b, 0xa4, 0xa9, 0x05, 0x79, 0xcb, 0xdf, 0x82,
|
||||
0x52, 0xc0, 0x7c, 0x5b, 0xae, 0xe6, 0xd1, 0x18, 0xce, 0x0e, 0x63, 0xad, 0xd7, 0xad, 0x43, 0x66,
|
||||
0x9f, 0xed, 0x7a, 0x88, 0xba, 0xd8, 0x14, 0x13, 0xf4, 0x8f, 0x50, 0xd9, 0x65, 0xb4, 0xe5, 0x13,
|
||||
0x9b, 0x13, 0xea, 0x36, 0x30, 0x72, 0x70, 0x27, 0x4c, 0x69, 0x0d, 0x98, 0xf0, 0x36, 0xa5, 0xd1,
|
||||
0x6a, 0x96, 0xf4, 0x98, 0xb8, 0x14, 0x3b, 0xc9, 0x24, 0x73, 0xc2, 0xdb, 0x14, 0xf8, 0xba, 0x34,
|
||||
0x71, 0x3b, 0xbe, 0xae, 0x7f, 0x53, 0x40, 0x3b, 0x8c, 0x28, 0xe2, 0xc4, 0x3e, 0x41, 0x3e, 0x71,
|
||||
0x10, 0x67, 0x9d, 0x54, 0x7c, 0x03, 0xca, 0x9e, 0x80, 0x4a, 0x03, 0x5a, 0x96, 0x50, 0x52, 0x49,
|
||||
0x9c, 0xba, 0x06, 0xa5, 0xf8, 0xbc, 0x6e, 0x39, 0x53, 0x81, 0x51, 0x37, 0x60, 0x9e, 0xd0, 0x6e,
|
||||
0x2c, 0x6a, 0x25, 0xb3, 0xad, 0x16, 0xc1, 0xbe, 0x23, 0x8e, 0xf6, 0xae, 0xa9, 0xca, 0x5a, 0x22,
|
||||
0xf0, 0x22, 0xae, 0xe8, 0x9f, 0xe3, 0xfc, 0x79, 0x88, 0x72, 0xd6, 0xce, 0x9a, 0xed, 0x4b, 0x2b,
|
||||
0x7f, 0x21, 0xbd, 0x0f, 0xcb, 0x3e, 0x0a, 0xb9, 0x25, 0x23, 0xd5, 0xed, 0x93, 0x59, 0x1f, 0x50,
|
||||
0x68, 0x11, 0x6a, 0x85, 0x98, 0x8b, 0x25, 0x14, 0xcd, 0x87, 0x31, 0xae, 0x21, 0x60, 0xa9, 0xe4,
|
||||
0x5b, 0x14, 0xbe, 0xa4, 0xc7, 0x98, 0xeb, 0xbf, 0x4b, 0x30, 0x95, 0xea, 0x23, 0x78, 0xe0, 0xf4,
|
||||
0x7b, 0xd2, 0x12, 0xd1, 0x1e, 0xc9, 0xd9, 0xe3, 0xac, 0xa5, 0xb1, 0x4d, 0xdc, 0x28, 0x98, 0x0b,
|
||||
0xce, 0xd8, 0xee, 0x0e, 0x60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4, 0x3e, 0xc0, 0x3d, 0xb3, 0x1c, 0x44, 0xcd, 0x03, 0xdc, 0xdb, 0x79, 0x73,
|
||||
0x7e, 0x59, 0x55, 0x2e, 0x2e, 0xab, 0xca, 0xaf, 0xcb, 0xaa, 0xf2, 0xe5, 0xaa, 0x5a, 0xb8, 0xb8,
|
||||
0xaa, 0x16, 0x7e, 0x5c, 0x55, 0x0b, 0xef, 0xb6, 0x5c, 0xc2, 0xbd, 0xa8, 0x69, 0xd8, 0xac, 0x5d,
|
||||
0x1b, 0x7e, 0x4b, 0x07, 0xbf, 0xc9, 0x9b, 0x3b, 0xfa, 0xce, 0x36, 0xcb, 0x62, 0xfc, 0xe9, 0x9f,
|
||||
0x00, 0x00, 0x00, 0xff, 0xff, 0xbb, 0x3e, 0xd5, 0x42, 0xcb, 0x07, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *DuplicateVoteEvidence) Marshal() (dAtA []byte, err error) {
|
||||
@@ -979,99 +806,6 @@ func (m *AmnesiaEvidence) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *MockEvidence) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *MockEvidence) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *MockEvidence) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.EvidenceAddress) > 0 {
|
||||
i -= len(m.EvidenceAddress)
|
||||
copy(dAtA[i:], m.EvidenceAddress)
|
||||
i = encodeVarintEvidence(dAtA, i, uint64(len(m.EvidenceAddress)))
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
}
|
||||
n7, err7 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.EvidenceTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.EvidenceTime):])
|
||||
if err7 != nil {
|
||||
return 0, err7
|
||||
}
|
||||
i -= n7
|
||||
i = encodeVarintEvidence(dAtA, i, uint64(n7))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
if m.EvidenceHeight != 0 {
|
||||
i = encodeVarintEvidence(dAtA, i, uint64(m.EvidenceHeight))
|
||||
i--
|
||||
dAtA[i] = 0x8
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *MockRandomEvidence) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *MockRandomEvidence) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *MockRandomEvidence) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.RandBytes) > 0 {
|
||||
i -= len(m.RandBytes)
|
||||
copy(dAtA[i:], m.RandBytes)
|
||||
i = encodeVarintEvidence(dAtA, i, uint64(len(m.RandBytes)))
|
||||
i--
|
||||
dAtA[i] = 0x22
|
||||
}
|
||||
if len(m.EvidenceAddress) > 0 {
|
||||
i -= len(m.EvidenceAddress)
|
||||
copy(dAtA[i:], m.EvidenceAddress)
|
||||
i = encodeVarintEvidence(dAtA, i, uint64(len(m.EvidenceAddress)))
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
}
|
||||
n8, err8 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.EvidenceTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.EvidenceTime):])
|
||||
if err8 != nil {
|
||||
return 0, err8
|
||||
}
|
||||
i -= n8
|
||||
i = encodeVarintEvidence(dAtA, i, uint64(n8))
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
if m.EvidenceHeight != 0 {
|
||||
i = encodeVarintEvidence(dAtA, i, uint64(m.EvidenceHeight))
|
||||
i--
|
||||
dAtA[i] = 0x8
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *ConflictingHeadersEvidence) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
@@ -1371,48 +1105,6 @@ func (m *Evidence_PhantomValidatorEvidence) MarshalToSizedBuffer(dAtA []byte) (i
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
func (m *Evidence_MockEvidence) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *Evidence_MockEvidence) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
if m.MockEvidence != nil {
|
||||
{
|
||||
size, err := m.MockEvidence.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintEvidence(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x3a
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
func (m *Evidence_MockRandomEvidence) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *Evidence_MockRandomEvidence) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
if m.MockRandomEvidence != nil {
|
||||
{
|
||||
size, err := m.MockRandomEvidence.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintEvidence(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x42
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
func (m *EvidenceData) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
@@ -1571,46 +1263,6 @@ func (m *AmnesiaEvidence) Size() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *MockEvidence) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.EvidenceHeight != 0 {
|
||||
n += 1 + sovEvidence(uint64(m.EvidenceHeight))
|
||||
}
|
||||
l = github_com_gogo_protobuf_types.SizeOfStdTime(m.EvidenceTime)
|
||||
n += 1 + l + sovEvidence(uint64(l))
|
||||
l = len(m.EvidenceAddress)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovEvidence(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *MockRandomEvidence) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.EvidenceHeight != 0 {
|
||||
n += 1 + sovEvidence(uint64(m.EvidenceHeight))
|
||||
}
|
||||
l = github_com_gogo_protobuf_types.SizeOfStdTime(m.EvidenceTime)
|
||||
n += 1 + l + sovEvidence(uint64(l))
|
||||
l = len(m.EvidenceAddress)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovEvidence(uint64(l))
|
||||
}
|
||||
l = len(m.RandBytes)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovEvidence(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *ConflictingHeadersEvidence) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
@@ -1749,30 +1401,6 @@ func (m *Evidence_PhantomValidatorEvidence) Size() (n int) {
|
||||
}
|
||||
return n
|
||||
}
|
||||
func (m *Evidence_MockEvidence) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.MockEvidence != nil {
|
||||
l = m.MockEvidence.Size()
|
||||
n += 1 + l + sovEvidence(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
func (m *Evidence_MockRandomEvidence) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.MockRandomEvidence != nil {
|
||||
l = m.MockRandomEvidence.Size()
|
||||
n += 1 + l + sovEvidence(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
func (m *EvidenceData) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
@@ -2211,318 +1839,6 @@ func (m *AmnesiaEvidence) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *MockEvidence) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowEvidence
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: MockEvidence: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MockEvidence: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field EvidenceHeight", wireType)
|
||||
}
|
||||
m.EvidenceHeight = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowEvidence
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.EvidenceHeight |= int64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field EvidenceTime", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowEvidence
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthEvidence
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthEvidence
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.EvidenceTime, dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field EvidenceAddress", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowEvidence
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if byteLen < 0 {
|
||||
return ErrInvalidLengthEvidence
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthEvidence
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.EvidenceAddress = append(m.EvidenceAddress[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.EvidenceAddress == nil {
|
||||
m.EvidenceAddress = []byte{}
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipEvidence(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthEvidence
|
||||
}
|
||||
if (iNdEx + skippy) < 0 {
|
||||
return ErrInvalidLengthEvidence
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *MockRandomEvidence) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowEvidence
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: MockRandomEvidence: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MockRandomEvidence: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field EvidenceHeight", wireType)
|
||||
}
|
||||
m.EvidenceHeight = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowEvidence
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.EvidenceHeight |= int64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field EvidenceTime", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowEvidence
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthEvidence
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthEvidence
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.EvidenceTime, dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field EvidenceAddress", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowEvidence
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if byteLen < 0 {
|
||||
return ErrInvalidLengthEvidence
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthEvidence
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.EvidenceAddress = append(m.EvidenceAddress[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.EvidenceAddress == nil {
|
||||
m.EvidenceAddress = []byte{}
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 4:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field RandBytes", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowEvidence
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if byteLen < 0 {
|
||||
return ErrInvalidLengthEvidence
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthEvidence
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.RandBytes = append(m.RandBytes[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.RandBytes == nil {
|
||||
m.RandBytes = []byte{}
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipEvidence(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthEvidence
|
||||
}
|
||||
if (iNdEx + skippy) < 0 {
|
||||
return ErrInvalidLengthEvidence
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *ConflictingHeadersEvidence) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
@@ -3152,76 +2468,6 @@ func (m *Evidence) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
m.Sum = &Evidence_PhantomValidatorEvidence{v}
|
||||
iNdEx = postIndex
|
||||
case 7:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field MockEvidence", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowEvidence
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthEvidence
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthEvidence
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
v := &MockEvidence{}
|
||||
if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
m.Sum = &Evidence_MockEvidence{v}
|
||||
iNdEx = postIndex
|
||||
case 8:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field MockRandomEvidence", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowEvidence
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthEvidence
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthEvidence
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
v := &MockRandomEvidence{}
|
||||
if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
m.Sum = &Evidence_MockRandomEvidence{v}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipEvidence(dAtA[iNdEx:])
|
||||
|
||||
@@ -4,7 +4,6 @@ package tendermint.types;
|
||||
option go_package = "github.com/tendermint/tendermint/proto/tendermint/types";
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "tendermint/types/types.proto";
|
||||
import "tendermint/crypto/keys/types.proto";
|
||||
|
||||
@@ -27,21 +26,6 @@ message AmnesiaEvidence {
|
||||
ProofOfLockChange polc = 2;
|
||||
}
|
||||
|
||||
// MockEvidence is used for testing pruposes
|
||||
message MockEvidence {
|
||||
int64 evidence_height = 1;
|
||||
google.protobuf.Timestamp evidence_time = 2
|
||||
[(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
|
||||
bytes evidence_address = 3;
|
||||
}
|
||||
message MockRandomEvidence {
|
||||
int64 evidence_height = 1;
|
||||
google.protobuf.Timestamp evidence_time = 2
|
||||
[(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
|
||||
bytes evidence_address = 3;
|
||||
bytes rand_bytes = 4;
|
||||
}
|
||||
|
||||
message ConflictingHeadersEvidence {
|
||||
SignedHeader h1 = 1;
|
||||
SignedHeader h2 = 2;
|
||||
@@ -66,9 +50,6 @@ message Evidence {
|
||||
PotentialAmnesiaEvidence potential_amnesia_evidence = 4;
|
||||
AmnesiaEvidence amnesia_evidence = 5;
|
||||
PhantomValidatorEvidence phantom_validator_evidence = 6;
|
||||
|
||||
MockEvidence mock_evidence = 7;
|
||||
MockRandomEvidence mock_random_evidence = 8;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ func TestBeginBlockByzantineValidators(t *testing.T) {
|
||||
require.Nil(t, err)
|
||||
defer proxyApp.Stop()
|
||||
|
||||
state, stateDB, _ := makeState(2, 12)
|
||||
state, stateDB, privVals := makeState(2, 12)
|
||||
|
||||
prevHash := state.LastBlockID.Hash
|
||||
prevParts := types.PartSetHeader{}
|
||||
@@ -129,8 +129,8 @@ func TestBeginBlockByzantineValidators(t *testing.T) {
|
||||
|
||||
height1, val1 := int64(8), state.Validators.Validators[0].Address
|
||||
height2, val2 := int64(3), state.Validators.Validators[1].Address
|
||||
ev1 := types.NewMockEvidence(height1, time.Now(), val1)
|
||||
ev2 := types.NewMockEvidence(height2, time.Now(), val2)
|
||||
ev1 := types.NewMockDuplicateVoteEvidenceWithValidator(height1, time.Now(), privVals[val1.String()], chainID)
|
||||
ev2 := types.NewMockDuplicateVoteEvidenceWithValidator(height2, time.Now(), privVals[val2.String()], chainID)
|
||||
|
||||
now := tmtime.Now()
|
||||
valSet := state.Validators
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/mock"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/libs/bytes"
|
||||
@@ -238,7 +237,8 @@ func TestValidateBlockEvidence(t *testing.T) {
|
||||
evidence := make([]types.Evidence, 0)
|
||||
// one more than the maximum allowed evidence
|
||||
for i := uint32(0); i <= maxNumEvidence; i++ {
|
||||
evidence = append(evidence, types.NewMockEvidence(height, time.Now(), proposerAddr))
|
||||
evidence = append(evidence, types.NewMockDuplicateVoteEvidenceWithValidator(height, time.Now(),
|
||||
privVals[proposerAddr.String()], chainID))
|
||||
}
|
||||
block, _ := state.MakeBlock(height, makeTxs(height), lastCommit, evidence, proposerAddr)
|
||||
err := blockExec.ValidateBlock(state, block)
|
||||
@@ -254,8 +254,9 @@ func TestValidateBlockEvidence(t *testing.T) {
|
||||
// precisely the amount of allowed evidence
|
||||
for i := int32(0); uint32(i) < maxNumEvidence; i++ {
|
||||
// make different evidence for each validator
|
||||
addr, _ := state.Validators.GetByIndex(i)
|
||||
evidence = append(evidence, types.NewMockEvidence(height, time.Now(), addr))
|
||||
_, val := state.Validators.GetByIndex(i)
|
||||
evidence = append(evidence, types.NewMockDuplicateVoteEvidenceWithValidator(height, time.Now(),
|
||||
privVals[val.Address.String()], chainID))
|
||||
}
|
||||
|
||||
var err error
|
||||
@@ -274,14 +275,17 @@ func TestValidateBlockEvidence(t *testing.T) {
|
||||
|
||||
func TestValidateFailBlockOnCommittedEvidence(t *testing.T) {
|
||||
var height int64 = 1
|
||||
state, stateDB, _ := makeState(2, int(height))
|
||||
addr, _ := state.Validators.GetByIndex(0)
|
||||
addr2, _ := state.Validators.GetByIndex(1)
|
||||
ev := types.NewMockEvidence(height, defaultTestTime, addr)
|
||||
ev2 := types.NewMockEvidence(height, defaultTestTime, addr2)
|
||||
state, stateDB, privVals := makeState(2, int(height))
|
||||
_, val := state.Validators.GetByIndex(0)
|
||||
_, val2 := state.Validators.GetByIndex(1)
|
||||
ev := types.NewMockDuplicateVoteEvidenceWithValidator(height, defaultTestTime,
|
||||
privVals[val.Address.String()], chainID)
|
||||
ev2 := types.NewMockDuplicateVoteEvidenceWithValidator(height, defaultTestTime,
|
||||
privVals[val2.Address.String()], chainID)
|
||||
|
||||
evpool := &mocks.EvidencePool{}
|
||||
evpool.On("IsPending", mock.AnythingOfType("types.MockEvidence")).Return(false)
|
||||
evpool.On("IsPending", ev).Return(false)
|
||||
evpool.On("IsPending", ev2).Return(false)
|
||||
evpool.On("IsCommitted", ev).Return(false)
|
||||
evpool.On("IsCommitted", ev2).Return(true)
|
||||
|
||||
@@ -302,16 +306,19 @@ func TestValidateFailBlockOnCommittedEvidence(t *testing.T) {
|
||||
|
||||
func TestValidateAlreadyPendingEvidence(t *testing.T) {
|
||||
var height int64 = 1
|
||||
state, stateDB, _ := makeState(2, int(height))
|
||||
addr, _ := state.Validators.GetByIndex(0)
|
||||
addr2, _ := state.Validators.GetByIndex(1)
|
||||
ev := types.NewMockEvidence(height, defaultTestTime, addr)
|
||||
ev2 := types.NewMockEvidence(height, defaultTestTime, addr2)
|
||||
state, stateDB, privVals := makeState(2, int(height))
|
||||
_, val := state.Validators.GetByIndex(0)
|
||||
_, val2 := state.Validators.GetByIndex(1)
|
||||
ev := types.NewMockDuplicateVoteEvidenceWithValidator(height, defaultTestTime,
|
||||
privVals[val.Address.String()], chainID)
|
||||
ev2 := types.NewMockDuplicateVoteEvidenceWithValidator(height, defaultTestTime,
|
||||
privVals[val2.Address.String()], chainID)
|
||||
|
||||
evpool := &mocks.EvidencePool{}
|
||||
evpool.On("IsPending", ev).Return(false)
|
||||
evpool.On("IsPending", ev2).Return(true)
|
||||
evpool.On("IsCommitted", mock.AnythingOfType("types.MockEvidence")).Return(false)
|
||||
evpool.On("IsCommitted", ev).Return(false)
|
||||
evpool.On("IsCommitted", ev2).Return(false)
|
||||
|
||||
blockExec := sm.NewBlockExecutor(
|
||||
stateDB, log.TestingLogger(),
|
||||
@@ -330,11 +337,13 @@ func TestValidateAlreadyPendingEvidence(t *testing.T) {
|
||||
|
||||
func TestValidateDuplicateEvidenceShouldFail(t *testing.T) {
|
||||
var height int64 = 1
|
||||
state, stateDB, _ := makeState(1, int(height))
|
||||
addr, _ := state.Validators.GetByIndex(0)
|
||||
addr2, _ := state.Validators.GetByIndex(1)
|
||||
ev := types.NewMockEvidence(height, defaultTestTime, addr)
|
||||
ev2 := types.NewMockEvidence(height, defaultTestTime, addr2)
|
||||
state, stateDB, privVals := makeState(2, int(height))
|
||||
_, val := state.Validators.GetByIndex(0)
|
||||
_, val2 := state.Validators.GetByIndex(1)
|
||||
ev := types.NewMockDuplicateVoteEvidenceWithValidator(height, defaultTestTime,
|
||||
privVals[val.Address.String()], chainID)
|
||||
ev2 := types.NewMockDuplicateVoteEvidenceWithValidator(height, defaultTestTime,
|
||||
privVals[val2.Address.String()], chainID)
|
||||
|
||||
blockExec := sm.NewBlockExecutor(
|
||||
stateDB, log.TestingLogger(),
|
||||
@@ -454,8 +463,7 @@ func TestValidatePrimedAmnesiaEvidence(t *testing.T) {
|
||||
func TestVerifyEvidenceWrongAddress(t *testing.T) {
|
||||
var height int64 = 1
|
||||
state, stateDB, _ := makeState(1, int(height))
|
||||
randomAddr := []byte("wrong address")
|
||||
ev := types.NewMockEvidence(height, defaultTestTime, randomAddr)
|
||||
ev := types.NewMockDuplicateVoteEvidence(height, defaultTestTime, chainID)
|
||||
|
||||
blockExec := sm.NewBlockExecutor(
|
||||
stateDB, log.TestingLogger(),
|
||||
@@ -467,7 +475,7 @@ func TestVerifyEvidenceWrongAddress(t *testing.T) {
|
||||
block.Evidence.Evidence = []types.Evidence{ev}
|
||||
block.EvidenceHash = block.Evidence.Hash()
|
||||
err := blockExec.ValidateBlock(state, block)
|
||||
errMsg := "Invalid evidence: address 77726F6E672061646472657373 was not a validator at height 1"
|
||||
errMsg := "Invalid evidence: address "
|
||||
if assert.Error(t, err) {
|
||||
assert.Equal(t, err.Error()[:len(errMsg)], errMsg)
|
||||
}
|
||||
@@ -477,8 +485,7 @@ func TestVerifyEvidenceExpiredEvidence(t *testing.T) {
|
||||
var height int64 = 4
|
||||
state, stateDB, _ := makeState(1, int(height))
|
||||
state.ConsensusParams.Evidence.MaxAgeNumBlocks = 1
|
||||
addr, _ := state.Validators.GetByIndex(0)
|
||||
ev := types.NewMockEvidence(1, defaultTestTime, addr)
|
||||
ev := types.NewMockDuplicateVoteEvidence(1, defaultTestTime, chainID)
|
||||
err := sm.VerifyEvidence(stateDB, state, ev, nil)
|
||||
errMsg := "evidence from height 1 (created at: 2019-01-01 00:00:00 +0000 UTC) is too old"
|
||||
if assert.Error(t, err) {
|
||||
|
||||
@@ -36,11 +36,11 @@ func TestBlockAddEvidence(t *testing.T) {
|
||||
lastID := makeBlockIDRandom()
|
||||
h := int64(3)
|
||||
|
||||
voteSet, valSet, vals := randVoteSet(h-1, 1, tmproto.PrecommitType, 10, 1)
|
||||
voteSet, _, vals := randVoteSet(h-1, 1, tmproto.PrecommitType, 10, 1)
|
||||
commit, err := MakeCommit(lastID, h-1, 1, voteSet, vals, time.Now())
|
||||
require.NoError(t, err)
|
||||
|
||||
ev := NewMockEvidence(h, time.Now(), valSet.Validators[0].Address)
|
||||
ev := NewMockDuplicateVoteEvidenceWithValidator(h, time.Now(), vals[0], "block-test-chain")
|
||||
evList := []Evidence{ev}
|
||||
|
||||
block := MakeBlock(h, txs, commit, evList)
|
||||
@@ -60,7 +60,7 @@ func TestBlockValidateBasic(t *testing.T) {
|
||||
commit, err := MakeCommit(lastID, h-1, 1, voteSet, vals, time.Now())
|
||||
require.NoError(t, err)
|
||||
|
||||
ev := NewMockEvidence(h, time.Now(), valSet.Validators[0].Address)
|
||||
ev := NewMockDuplicateVoteEvidenceWithValidator(h, time.Now(), vals[0], "block-test-chain")
|
||||
evList := []Evidence{ev}
|
||||
|
||||
testCases := []struct {
|
||||
@@ -125,16 +125,16 @@ func TestBlockMakePartSetWithEvidence(t *testing.T) {
|
||||
lastID := makeBlockIDRandom()
|
||||
h := int64(3)
|
||||
|
||||
voteSet, valSet, vals := randVoteSet(h-1, 1, tmproto.PrecommitType, 10, 1)
|
||||
voteSet, _, vals := randVoteSet(h-1, 1, tmproto.PrecommitType, 10, 1)
|
||||
commit, err := MakeCommit(lastID, h-1, 1, voteSet, vals, time.Now())
|
||||
require.NoError(t, err)
|
||||
|
||||
ev := NewMockEvidence(h, time.Now(), valSet.Validators[0].Address)
|
||||
ev := NewMockDuplicateVoteEvidenceWithValidator(h, time.Now(), vals[0], "block-test-chain")
|
||||
evList := []Evidence{ev}
|
||||
|
||||
partSet := MakeBlock(h, []Tx{Tx("Hello World")}, commit, evList).MakePartSet(512)
|
||||
assert.NotNil(t, partSet)
|
||||
assert.EqualValues(t, 3, partSet.Total())
|
||||
assert.EqualValues(t, 4, partSet.Total())
|
||||
}
|
||||
|
||||
func TestBlockHashesTo(t *testing.T) {
|
||||
@@ -146,7 +146,7 @@ func TestBlockHashesTo(t *testing.T) {
|
||||
commit, err := MakeCommit(lastID, h-1, 1, voteSet, vals, time.Now())
|
||||
require.NoError(t, err)
|
||||
|
||||
ev := NewMockEvidence(h, time.Now(), valSet.Validators[0].Address)
|
||||
ev := NewMockDuplicateVoteEvidenceWithValidator(h, time.Now(), vals[0], "block-test-chain")
|
||||
evList := []Evidence{ev}
|
||||
|
||||
block := MakeBlock(h, []Tx{Tx("Hello World")}, commit, evList)
|
||||
@@ -639,7 +639,7 @@ func TestBlockProtoBuf(t *testing.T) {
|
||||
|
||||
b2 := MakeBlock(h, []Tx{Tx([]byte{1})}, c1, []Evidence{})
|
||||
b2.ProposerAddress = tmrand.Bytes(crypto.AddressSize)
|
||||
evi := NewMockEvidence(b2.Height, time.Now(), tmrand.Bytes(32))
|
||||
evi := NewMockDuplicateVoteEvidence(h, time.Now(), "block-test-chain")
|
||||
b2.Evidence = EvidenceData{Evidence: EvidenceList{evi}}
|
||||
b2.EvidenceHash = b2.Evidence.Hash()
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
"github.com/tendermint/tendermint/crypto/tmhash"
|
||||
tmjson "github.com/tendermint/tendermint/libs/json"
|
||||
tmmath "github.com/tendermint/tendermint/libs/math"
|
||||
tmrand "github.com/tendermint/tendermint/libs/rand"
|
||||
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
|
||||
)
|
||||
|
||||
@@ -150,39 +151,6 @@ func EvidenceToProto(evidence Evidence) (*tmproto.Evidence, error) {
|
||||
}
|
||||
|
||||
return tp, nil
|
||||
|
||||
case MockEvidence:
|
||||
if err := evi.ValidateBasic(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
tp := &tmproto.Evidence{
|
||||
Sum: &tmproto.Evidence_MockEvidence{
|
||||
MockEvidence: &tmproto.MockEvidence{
|
||||
EvidenceHeight: evi.Height(),
|
||||
EvidenceTime: evi.Time(),
|
||||
EvidenceAddress: evi.Address(),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return tp, nil
|
||||
case MockRandomEvidence:
|
||||
if err := evi.ValidateBasic(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
tp := &tmproto.Evidence{
|
||||
Sum: &tmproto.Evidence_MockRandomEvidence{
|
||||
MockRandomEvidence: &tmproto.MockRandomEvidence{
|
||||
EvidenceHeight: evi.Height(),
|
||||
EvidenceTime: evi.Time(),
|
||||
EvidenceAddress: evi.Address(),
|
||||
RandBytes: evi.randBytes,
|
||||
},
|
||||
},
|
||||
}
|
||||
return tp, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("toproto: evidence is not recognized: %T", evi)
|
||||
}
|
||||
@@ -206,23 +174,6 @@ func EvidenceFromProto(evidence *tmproto.Evidence) (Evidence, error) {
|
||||
return AmnesiaEvidenceFromProto(evi.AmnesiaEvidence)
|
||||
case *tmproto.Evidence_PhantomValidatorEvidence:
|
||||
return PhantomValidatorEvidenceFromProto(evi.PhantomValidatorEvidence)
|
||||
case *tmproto.Evidence_MockEvidence:
|
||||
me := MockEvidence{
|
||||
EvidenceHeight: evi.MockEvidence.GetEvidenceHeight(),
|
||||
EvidenceAddress: evi.MockEvidence.GetEvidenceAddress(),
|
||||
EvidenceTime: evi.MockEvidence.GetEvidenceTime(),
|
||||
}
|
||||
return me, me.ValidateBasic()
|
||||
case *tmproto.Evidence_MockRandomEvidence:
|
||||
mre := MockRandomEvidence{
|
||||
MockEvidence: MockEvidence{
|
||||
EvidenceHeight: evi.MockRandomEvidence.GetEvidenceHeight(),
|
||||
EvidenceAddress: evi.MockRandomEvidence.GetEvidenceAddress(),
|
||||
EvidenceTime: evi.MockRandomEvidence.GetEvidenceTime(),
|
||||
},
|
||||
randBytes: evi.MockRandomEvidence.RandBytes,
|
||||
}
|
||||
return mre, mre.ValidateBasic()
|
||||
default:
|
||||
return nil, errors.New("evidence is not recognized")
|
||||
}
|
||||
@@ -1677,7 +1628,7 @@ func AmnesiaEvidenceFromProto(pb *tmproto.AmnesiaEvidence) (*AmnesiaEvidence, er
|
||||
return tp, tp.ValidateBasic()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
//--------------------------------------------------
|
||||
|
||||
// EvidenceList is a list of Evidence. Evidences is not a word.
|
||||
type EvidenceList []Evidence
|
||||
@@ -1712,71 +1663,54 @@ func (evl EvidenceList) Has(evidence Evidence) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
//-------------------------------------------- MOCKING --------------------------------------
|
||||
|
||||
// UNSTABLE
|
||||
type MockRandomEvidence struct {
|
||||
MockEvidence
|
||||
randBytes []byte
|
||||
// unstable - use only for testing
|
||||
|
||||
// assumes the round to be 0 and the validator index to be 0
|
||||
func NewMockDuplicateVoteEvidence(height int64, time time.Time, chainID string) *DuplicateVoteEvidence {
|
||||
val := NewMockPV()
|
||||
return NewMockDuplicateVoteEvidenceWithValidator(height, time, val, chainID)
|
||||
}
|
||||
|
||||
var _ Evidence = &MockRandomEvidence{}
|
||||
func NewMockDuplicateVoteEvidenceWithValidator(height int64, time time.Time,
|
||||
pv PrivValidator, chainID string) *DuplicateVoteEvidence {
|
||||
pubKey, _ := pv.GetPubKey()
|
||||
voteA := makeMockVote(height, 0, 0, pubKey.Address(), randBlockID(), time)
|
||||
vA := voteA.ToProto()
|
||||
_ = pv.SignVote(chainID, vA)
|
||||
voteA.Signature = vA.Signature
|
||||
voteB := makeMockVote(height, 0, 0, pubKey.Address(), randBlockID(), time)
|
||||
vB := voteB.ToProto()
|
||||
_ = pv.SignVote(chainID, vB)
|
||||
voteB.Signature = vB.Signature
|
||||
return NewDuplicateVoteEvidence(voteA, voteB)
|
||||
|
||||
// UNSTABLE
|
||||
func NewMockRandomEvidence(height int64, eTime time.Time, address []byte, randBytes []byte) MockRandomEvidence {
|
||||
return MockRandomEvidence{
|
||||
MockEvidence{
|
||||
EvidenceHeight: height,
|
||||
EvidenceTime: eTime,
|
||||
EvidenceAddress: address}, randBytes,
|
||||
}
|
||||
|
||||
func makeMockVote(height int64, round, index int32, addr Address,
|
||||
blockID BlockID, time time.Time) *Vote {
|
||||
return &Vote{
|
||||
Type: tmproto.SignedMsgType(2),
|
||||
Height: height,
|
||||
Round: round,
|
||||
BlockID: blockID,
|
||||
Timestamp: time,
|
||||
ValidatorAddress: addr,
|
||||
ValidatorIndex: index,
|
||||
}
|
||||
}
|
||||
|
||||
func (e MockRandomEvidence) Hash() []byte {
|
||||
return []byte(fmt.Sprintf("%d-%x", e.EvidenceHeight, e.randBytes))
|
||||
}
|
||||
|
||||
func (e MockRandomEvidence) Equal(ev Evidence) bool { return false }
|
||||
|
||||
// UNSTABLE
|
||||
type MockEvidence struct {
|
||||
EvidenceHeight int64
|
||||
EvidenceTime time.Time
|
||||
EvidenceAddress []byte
|
||||
}
|
||||
|
||||
var _ Evidence = &MockEvidence{}
|
||||
|
||||
// UNSTABLE
|
||||
func NewMockEvidence(height int64, eTime time.Time, address []byte) MockEvidence {
|
||||
return MockEvidence{
|
||||
EvidenceHeight: height,
|
||||
EvidenceTime: eTime,
|
||||
EvidenceAddress: address,
|
||||
func randBlockID() BlockID {
|
||||
return BlockID{
|
||||
Hash: tmrand.Bytes(tmhash.Size),
|
||||
PartSetHeader: PartSetHeader{
|
||||
Total: 1,
|
||||
Hash: tmrand.Bytes(tmhash.Size),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (e MockEvidence) Height() int64 { return e.EvidenceHeight }
|
||||
func (e MockEvidence) Time() time.Time { return e.EvidenceTime }
|
||||
func (e MockEvidence) Address() []byte { return e.EvidenceAddress }
|
||||
func (e MockEvidence) Hash() []byte {
|
||||
return []byte(fmt.Sprintf("%d-%x-%s",
|
||||
e.EvidenceHeight, e.EvidenceAddress, e.EvidenceTime))
|
||||
}
|
||||
func (e MockEvidence) Bytes() []byte {
|
||||
return []byte(fmt.Sprintf("%d-%x-%s",
|
||||
e.EvidenceHeight, e.EvidenceAddress, e.EvidenceTime))
|
||||
}
|
||||
func (e MockEvidence) Verify(chainID string, pubKey crypto.PubKey) error { return nil }
|
||||
func (e MockEvidence) Equal(ev Evidence) bool {
|
||||
return e.EvidenceHeight == ev.Height() &&
|
||||
bytes.Equal(e.EvidenceAddress, ev.Address())
|
||||
}
|
||||
func (e MockEvidence) ValidateBasic() error { return nil }
|
||||
func (e MockEvidence) String() string {
|
||||
return fmt.Sprintf("Evidence: %d/%s/%s", e.EvidenceHeight, e.Time(), e.EvidenceAddress)
|
||||
}
|
||||
|
||||
// mock polc - fails validate basic, not stable
|
||||
func NewMockPOLC(height int64, time time.Time, pubKey crypto.PubKey) ProofOfLockChange {
|
||||
voteVal := NewMockPV()
|
||||
|
||||
@@ -201,16 +201,11 @@ func TestDuplicateVoteEvidenceValidation(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestMockGoodEvidenceValidateBasic(t *testing.T) {
|
||||
goodEvidence := NewMockEvidence(int64(1), time.Now(), []byte{1})
|
||||
func TestMockEvidenceValidateBasic(t *testing.T) {
|
||||
goodEvidence := NewMockDuplicateVoteEvidence(int64(1), time.Now(), "mock-chain-id")
|
||||
assert.Nil(t, goodEvidence.ValidateBasic())
|
||||
}
|
||||
|
||||
func TestMockBadEvidenceValidateBasic(t *testing.T) {
|
||||
badEvidence := NewMockEvidence(int64(1), time.Now(), []byte{1})
|
||||
assert.Nil(t, badEvidence.ValidateBasic())
|
||||
}
|
||||
|
||||
func TestLunaticValidatorEvidence(t *testing.T) {
|
||||
var (
|
||||
blockID = makeBlockIDRandom()
|
||||
|
||||
@@ -139,9 +139,6 @@ func (tm2pb) Evidence(ev Evidence, valSet *ValidatorSet, evTime time.Time) abci.
|
||||
evType = ABCIEvidenceTypeLunatic
|
||||
case *PotentialAmnesiaEvidence:
|
||||
evType = ABCIEvidenceTypePotentialAmnesia
|
||||
case MockEvidence:
|
||||
// XXX: not great to have test types in production paths ...
|
||||
evType = ABCIEvidenceTypeMock
|
||||
default:
|
||||
panic(fmt.Sprintf("Unknown evidence type: %v %v", ev, reflect.TypeOf(ev)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user