mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-03 11:45:18 +00:00
evidence: introduction of LightClientAttackEvidence and refactor of evidence lifecycle (#5361)
evidence: modify evidence types (#5342) light: detect light client attacks (#5344) evidence: refactor evidence pool (#5345) abci: application evidence prepared by evidence pool (#5354)
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
cryptoenc "github.com/tendermint/tendermint/crypto/encoding"
|
||||
"github.com/tendermint/tendermint/crypto/tmhash"
|
||||
tmrand "github.com/tendermint/tendermint/libs/rand"
|
||||
"github.com/tendermint/tendermint/privval"
|
||||
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
|
||||
"github.com/tendermint/tendermint/rpc/client"
|
||||
@@ -40,7 +41,7 @@ func newEvidence(t *testing.T, val *privval.FilePV,
|
||||
vote2.Signature, err = val.Key.PrivKey.Sign(types.VoteSignBytes(chainID, v2))
|
||||
require.NoError(t, err)
|
||||
|
||||
return types.NewDuplicateVoteEvidence(vote, vote2, defaultTestTime)
|
||||
return types.NewDuplicateVoteEvidence(vote, vote2)
|
||||
}
|
||||
|
||||
func makeEvidences(
|
||||
@@ -56,7 +57,7 @@ func makeEvidences(
|
||||
Type: tmproto.PrevoteType,
|
||||
Timestamp: defaultTestTime,
|
||||
BlockID: types.BlockID{
|
||||
Hash: tmhash.Sum([]byte("blockhash")),
|
||||
Hash: tmhash.Sum(tmrand.Bytes(tmhash.Size)),
|
||||
PartSetHeader: types.PartSetHeader{
|
||||
Total: 1000,
|
||||
Hash: tmhash.Sum([]byte("partset")),
|
||||
@@ -114,13 +115,10 @@ func TestBroadcastEvidence_DuplicateVoteEvidence(t *testing.T) {
|
||||
pv = privval.LoadOrGenFilePV(config.PrivValidatorKeyFile(), config.PrivValidatorStateFile())
|
||||
)
|
||||
|
||||
correct, fakes := makeEvidences(t, pv, chainID)
|
||||
|
||||
for i, c := range GetClients() {
|
||||
correct, fakes := makeEvidences(t, pv, chainID)
|
||||
t.Logf("client %d", i)
|
||||
|
||||
t.Log(correct.Time())
|
||||
|
||||
result, err := c.BroadcastEvidence(correct)
|
||||
require.NoError(t, err, "BroadcastEvidence(%s) failed", correct)
|
||||
assert.Equal(t, correct.Hash(), result.Hash, "expected result hash to match evidence hash")
|
||||
|
||||
Reference in New Issue
Block a user