All units tests passing

This commit is contained in:
Sergio Mena
2022-11-30 21:19:14 +01:00
parent c3cb29c67b
commit 2aff9782a7
10 changed files with 120 additions and 152 deletions
+3 -3
View File
@@ -148,7 +148,7 @@ func TestValidatorSet_VerifyCommit_CheckAllSignatures(t *testing.T) {
err = vals[3].SignVote("CentaurusA", v)
require.NoError(t, err)
vote.Signature = v.Signature
vote.ExtendedSignature = v.ExtendedSignature
vote.ExtensionSignature = v.ExtensionSignature
commit.Signatures[3] = vote.CommitSig()
err = valSet.VerifyCommit(chainID, blockID, h, commit)
@@ -175,7 +175,7 @@ func TestValidatorSet_VerifyCommitLight_ReturnsAsSoonAsMajorityOfVotingPowerSign
err = vals[3].SignVote("CentaurusA", v)
require.NoError(t, err)
vote.Signature = v.Signature
vote.ExtendedSignature = v.ExtendedSignature
vote.ExtensionSignature = v.ExtensionSignature
commit.Signatures[3] = vote.CommitSig()
err = valSet.VerifyCommitLight(chainID, blockID, h, commit)
@@ -200,7 +200,7 @@ func TestValidatorSet_VerifyCommitLightTrusting_ReturnsAsSoonAsTrustLevelOfVotin
err = vals[2].SignVote("CentaurusA", v)
require.NoError(t, err)
vote.Signature = v.Signature
vote.ExtendedSignature = v.ExtendedSignature
vote.ExtensionSignature = v.ExtensionSignature
commit.Signatures[2] = vote.CommitSig()
err = valSet.VerifyCommitLightTrusting(chainID, commit, tmmath.Fraction{Numerator: 1, Denominator: 3})
+3 -7
View File
@@ -1,7 +1,6 @@
package types
import (
"context"
"testing"
"time"
@@ -13,8 +12,8 @@ import (
"github.com/tendermint/tendermint/crypto/ed25519"
"github.com/tendermint/tendermint/crypto/tmhash"
"github.com/tendermint/tendermint/libs/protoio"
tmtime "github.com/tendermint/tendermint/libs/time"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
tmtime "github.com/tendermint/tendermint/types/time"
)
func examplePrevote() *Vote {
@@ -203,9 +202,6 @@ func TestVoteVerifySignature(t *testing.T) {
// TestVoteExtension tests that the vote verification behaves correctly in each case
// of vote extension being set on the vote.
func TestVoteExtension(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
testCases := []struct {
name string
extension []byte
@@ -244,7 +240,7 @@ func TestVoteExtension(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
height, round := int64(1), int32(0)
privVal := NewMockPV()
pk, err := privVal.GetPubKey(ctx)
pk, err := privVal.GetPubKey()
require.NoError(t, err)
blk := Block{}
ps, err := blk.MakePartSet(BlockPartSizeBytes)
@@ -260,7 +256,7 @@ func TestVoteExtension(t *testing.T) {
}
v := vote.ToProto()
err = privVal.SignVote(ctx, "test_chain_id", v)
err = privVal.SignVote("test_chain_id", v)
require.NoError(t, err)
vote.Signature = v.Signature
if tc.includeSignature {