From bfcf45a4611ceaab1b347767cc32484d329f7aec Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Tue, 11 Aug 2020 15:32:32 +0200 Subject: [PATCH] evidence: remove validator index verification (#5225) --- rpc/client/evidence_test.go | 7 ------- types/evidence.go | 19 ------------------- types/evidence_test.go | 1 - 3 files changed, 27 deletions(-) diff --git a/rpc/client/evidence_test.go b/rpc/client/evidence_test.go index 170f087ce..9924fe5db 100644 --- a/rpc/client/evidence_test.go +++ b/rpc/client/evidence_test.go @@ -78,13 +78,6 @@ func makeEvidences( fakes = append(fakes, newEvidence(t, val, &vote, &v, chainID)) } - // different index - { - v := vote2 - v.ValidatorIndex = vote.ValidatorIndex + 1 - fakes = append(fakes, newEvidence(t, val, &vote, &v, chainID)) - } - // different height { v := vote2 diff --git a/types/evidence.go b/types/evidence.go index d5e9c042a..d54195daa 100644 --- a/types/evidence.go +++ b/types/evidence.go @@ -273,15 +273,6 @@ func (dve *DuplicateVoteEvidence) Verify(chainID string, pubKey crypto.PubKey) e ) } - // Index must be the same - if dve.VoteA.ValidatorIndex != dve.VoteB.ValidatorIndex { - return fmt.Errorf( - "validator indices do not match: %d and %d", - dve.VoteA.ValidatorIndex, - dve.VoteB.ValidatorIndex, - ) - } - // BlockIDs must be different if dve.VoteA.BlockID.Equals(dve.VoteB.BlockID) { return fmt.Errorf( @@ -1016,16 +1007,6 @@ func (e *PotentialAmnesiaEvidence) ValidateBasic() error { ) } - // Index must be the same - // https://github.com/tendermint/tendermint/issues/4619 - if e.VoteA.ValidatorIndex != e.VoteB.ValidatorIndex { - return fmt.Errorf( - "duplicateVoteEvidence Error: Validator indices do not match. Got %d and %d", - e.VoteA.ValidatorIndex, - e.VoteB.ValidatorIndex, - ) - } - if e.VoteA.BlockID.IsZero() { return errors.New("first vote is for a nil block - voter hasn't locked on a block") } diff --git a/types/evidence_test.go b/types/evidence_test.go index fb6c6f196..9f3b46cb9 100644 --- a/types/evidence_test.go +++ b/types/evidence_test.go @@ -52,7 +52,6 @@ func TestDuplicateVoteEvidence(t *testing.T) { {vote1, makeVote(t, val, chainID, 0, 10, 2, 1, blockID4, defaultVoteTime), true}, {vote1, makeVote(t, val, chainID, 0, 10, 2, 1, blockID, defaultVoteTime), false}, // wrong block id {vote1, makeVote(t, val, "mychain2", 0, 10, 2, 1, blockID2, defaultVoteTime), false}, // wrong chain id - {vote1, makeVote(t, val, chainID, 1, 10, 2, 1, blockID2, defaultVoteTime), false}, // wrong val index {vote1, makeVote(t, val, chainID, 0, 11, 2, 1, blockID2, defaultVoteTime), false}, // wrong height {vote1, makeVote(t, val, chainID, 0, 10, 3, 1, blockID2, defaultVoteTime), false}, // wrong round {vote1, makeVote(t, val, chainID, 0, 10, 2, 2, blockID2, defaultVoteTime), false}, // wrong step