diff --git a/types/block_test.go b/types/block_test.go index a02491dbac..50b8929ca9 100644 --- a/types/block_test.go +++ b/types/block_test.go @@ -242,7 +242,11 @@ func TestCommit(t *testing.T) { require.NotNil(t, extCommit.BitArray()) assert.Equal(t, bits.NewBitArray(10).Size(), extCommit.BitArray().Size()) - assert.Equal(t, voteSet.GetByIndex(0), extCommit.GetByIndex(0)) + vote1, err := voteSet.GetByIndex(0) + require.NoError(t, err) + vote2, err := extCommit.GetByIndex(0) + require.NoError(t, err) + assert.Equal(t, vote1, vote2) assert.True(t, extCommit.IsCommit()) } @@ -564,7 +568,8 @@ func TestVoteSetToExtendedCommit(t *testing.T) { ec := voteSet.MakeExtendedCommit(p) for i := int32(0); int(i) < len(vals); i++ { - vote1 := voteSet.GetByIndex(i) + vote1, err := voteSet.GetByIndex(i) + require.NoError(t, err) vote2 := ec.GetExtendedVote(i) vote1bz, err := vote1.ToProto().Marshal() @@ -614,7 +619,8 @@ func TestExtendedCommitToVoteSet(t *testing.T) { if !testCase.includeExtension { for i := 0; i < len(vals); i++ { - v := voteSet.GetByIndex(int32(i)) + v, err := voteSet.GetByIndex(int32(i)) + require.NoError(t, err) v.Extension = nil v.ExtensionSignature = nil extCommit.ExtendedSignatures[i].Extension = nil @@ -631,8 +637,10 @@ func TestExtendedCommitToVoteSet(t *testing.T) { } for i := int32(0); int(i) < len(vals); i++ { - vote1 := voteSet.GetByIndex(i) - vote2 := voteSet2.GetByIndex(i) + vote1, err := voteSet.GetByIndex(i) + require.NoError(t, err) + vote2, err := voteSet2.GetByIndex(i) + require.NoError(t, err) vote3 := extCommit.GetExtendedVote(i) vote1bz, err := vote1.ToProto().Marshal() diff --git a/types/validation_test.go b/types/validation_test.go index 71fc131774..3161fe9bd4 100644 --- a/types/validation_test.go +++ b/types/validation_test.go @@ -166,7 +166,8 @@ func TestValidatorSet_VerifyCommit_CheckAllSignatures(t *testing.T) { require.NoError(t, valSet.VerifyCommit(chainID, blockID, h, commit)) // malleate 4th signature - vote := voteSet.GetByIndex(3) + vote, err := voteSet.GetByIndex(3) + require.NoError(t, err) v := vote.ToProto() err = vals[3].SignVote("CentaurusA", v, true) require.NoError(t, err) @@ -197,7 +198,8 @@ func TestValidatorSet_VerifyCommitLight_ReturnsAsSoonAsMajOfVotingPowerSignedIff require.NoError(t, err) // malleate 4th signature (3 signatures are enough for 2/3+) - vote := voteSet.GetByIndex(3) + vote, err := voteSet.GetByIndex(3) + require.NoError(t, err) v := vote.ToProto() err = vals[3].SignVote("CentaurusA", v, true) require.NoError(t, err) @@ -232,7 +234,8 @@ func TestValidatorSet_VerifyCommitLightTrusting_ReturnsAsSoonAsTrustLevelSignedI require.NoError(t, err) // malleate 3rd signature (2 signatures are enough for 1/3+ trust level) - vote := voteSet.GetByIndex(2) + vote, err := voteSet.GetByIndex(2) + require.NoError(t, err) v := vote.ToProto() err = vals[2].SignVote("CentaurusA", v, true) require.NoError(t, err)