privval: add ctx to privval interface (#6240)

## Description

- Add `context.Context` to Privval interface

This pr does not introduce context into our custom privval connection protocol because this will be removed in the next release. When this pr is released.
This commit is contained in:
Marko
2021-03-16 14:41:03 +00:00
committed by GitHub
parent fa781e6bb7
commit efd2fde474
43 changed files with 297 additions and 219 deletions

View File

@@ -2,6 +2,7 @@ package state_test
import (
"bytes"
"context"
"fmt"
"math"
"math/big"
@@ -363,7 +364,7 @@ func TestProposerFrequency(t *testing.T) {
votePower := int64(tmrand.Int()%maxPower) + 1
totalVotePower += votePower
privVal := types.NewMockPV()
pubKey, err := privVal.GetPubKey()
pubKey, err := privVal.GetPubKey(context.Background())
require.NoError(t, err)
val := types.NewValidator(pubKey, votePower)
val.ProposerPriority = tmrand.Int64()

View File

@@ -1,6 +1,7 @@
package state_test
import (
"context"
"testing"
"time"
@@ -199,7 +200,7 @@ func TestValidateBlockCommit(t *testing.T) {
)
require.NoError(t, err, "height %d", height)
bpvPubKey, err := badPrivVal.GetPubKey()
bpvPubKey, err := badPrivVal.GetPubKey(context.Background())
require.NoError(t, err)
badVote := &types.Vote{
@@ -215,9 +216,9 @@ func TestValidateBlockCommit(t *testing.T) {
g := goodVote.ToProto()
b := badVote.ToProto()
err = badPrivVal.SignVote(chainID, g)
err = badPrivVal.SignVote(context.Background(), chainID, g)
require.NoError(t, err, "height %d", height)
err = badPrivVal.SignVote(chainID, b)
err = badPrivVal.SignVote(context.Background(), chainID, b)
require.NoError(t, err, "height %d", height)
goodVote.Signature, badVote.Signature = g.Signature, b.Signature