privval: migrate to protobuf (#4985)

This commit is contained in:
Marko
2020-06-11 11:54:02 +02:00
committed by GitHub
parent 31a361d119
commit f6243d8b9e
49 changed files with 3215 additions and 642 deletions

View File

@@ -25,10 +25,14 @@ func newEvidence(t *testing.T, val *privval.FilePV,
chainID string) *types.DuplicateVoteEvidence {
var err error
vote.Signature, err = val.Key.PrivKey.Sign(vote.SignBytes(chainID))
v := vote.ToProto()
v2 := vote2.ToProto()
vote.Signature, err = val.Key.PrivKey.Sign(types.VoteSignBytes(chainID, v))
require.NoError(t, err)
vote2.Signature, err = val.Key.PrivKey.Sign(vote2.SignBytes(chainID))
vote2.Signature, err = val.Key.PrivKey.Sign(types.VoteSignBytes(chainID, v2))
require.NoError(t, err)
return types.NewDuplicateVoteEvidence(vote, vote2)
@@ -197,8 +201,12 @@ func TestBroadcastEvidence_ConflictingHeadersEvidence(t *testing.T) {
Type: tmproto.PrecommitType,
BlockID: h2.Commit.BlockID,
}
signBytes, err := pv.Key.PrivKey.Sign(vote.SignBytes(chainID))
v := vote.ToProto()
signBytes, err := pv.Key.PrivKey.Sign(types.VoteSignBytes(chainID, v))
require.NoError(t, err)
vote.Signature = v.Signature
h2.Commit.Signatures[0] = types.NewCommitSigForBlock(signBytes, pv.Key.Address, h2.Time)
t.Logf("h1 AppHash: %X", h1.AppHash)