Skip to content

Commit

Permalink
Update single signer test
Browse files Browse the repository at this point in the history
  • Loading branch information
agouin committed Jan 9, 2024
1 parent 1965316 commit 71b0045
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
17 changes: 17 additions & 0 deletions signer/single_signer_validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,21 @@ func TestSingleSignerValidator(t *testing.T) {
// signing higher block now should succeed
_, _, _, err = validator.Sign(ctx, testChainID, ProposalToBlock(testChainID, &proposal))
require.NoError(t, err)

precommit := cometproto.Vote{
Height: 2,
Round: 0,
Type: cometproto.PrecommitType,
Timestamp: time.Now(),
Extension: []byte("test"),
}

block = VoteToBlock(testChainID, &precommit)
sig, voteExtSig, _, err := validator.Sign(ctx, testChainID, block)
require.NoError(t, err)

require.True(t, privateKey.PubKey().VerifySignature(block.SignBytes, sig), "signature verification failed")

require.True(t, privateKey.PubKey().VerifySignature(block.VoteExtensionSignBytes, voteExtSig), "vote extension signature verification failed")

Check failure on line 124 in signer/single_signer_validator_test.go

View workflow job for this annotation

GitHub Actions / lint

line is 143 characters (lll)

}
6 changes: 3 additions & 3 deletions signer/threshold_validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func testThresholdValidator(t *testing.T, threshold, total uint8) {
}

if !pubKey.VerifySignature(block.SignBytes, sig) {
return fmt.Errorf("vote extension signature verification failed")
return fmt.Errorf("signature verification failed")
}

if !pubKey.VerifySignature(block.VoteExtensionSignBytes, voteExtSig) {
Expand All @@ -299,7 +299,7 @@ func testThresholdValidator(t *testing.T, threshold, total uint8) {
}

if !pubKey.VerifySignature(block.SignBytes, sig) {
return fmt.Errorf("vote extension signature verification failed")
return fmt.Errorf("signature verification failed")
}

if !pubKey.VerifySignature(block.VoteExtensionSignBytes, voteExtSig) {
Expand All @@ -318,7 +318,7 @@ func testThresholdValidator(t *testing.T, threshold, total uint8) {
}

if !pubKey.VerifySignature(block.SignBytes, sig) {
return fmt.Errorf("vote extension signature verification failed")
return fmt.Errorf("signature verification failed")
}

if !pubKey.VerifySignature(block.VoteExtensionSignBytes, voteExtSig) {
Expand Down

0 comments on commit 71b0045

Please sign in to comment.