Placate linter

This commit is contained in:
Sergio Mena
2022-12-22 20:36:41 +01:00
parent 5fcee2c345
commit 021dd53ee2
3 changed files with 18 additions and 18 deletions

View File

@@ -354,7 +354,7 @@ func TestByzantineConflictingProposalsWithPartition(t *testing.T) {
css[i].privValidator.(types.MockPV).DisableChecks()
css[i].decideProposal = func(j int32) func(int64, int32) {
return func(height int64, round int32) {
byzantineDecideProposalFunc(t, ctx, height, round, css[j], switches[j])
byzantineDecideProposalFunc(ctx, t, height, round, css[j], switches[j])
}
}(int32(i))
// We are setting the prevote function to do nothing because the prevoting
@@ -473,7 +473,7 @@ func TestByzantineConflictingProposalsWithPartition(t *testing.T) {
//-------------------------------
// byzantine consensus functions
func byzantineDecideProposalFunc(t *testing.T, ctx context.Context, height int64, round int32, cs *State, sw *p2p.Switch) {
func byzantineDecideProposalFunc(ctx context.Context, t *testing.T, height int64, round int32, cs *State, sw *p2p.Switch) {
// byzantine user should create two proposals and try to split the vote.
// Avoid sending on internalMsgQueue and running consensus state.

View File

@@ -212,13 +212,13 @@ func startTestRound(cs *State, height int64, round int32) {
// Create proposal block from cs1 but sign it with vs.
func decideProposal(
t *testing.T,
ctx context.Context,
t *testing.T,
cs1 *State,
vs *validatorStub,
height int64,
round int32,
) (proposal *types.Proposal, block *types.Block) {
) (*types.Proposal, *types.Block) {
cs1.mtx.Lock()
block, err := cs1.createProposalBlock(ctx)
require.NoError(t, err)
@@ -233,7 +233,7 @@ func decideProposal(
// Make proposal
polRound, propBlockID := validRound, types.BlockID{Hash: block.Hash(), PartSetHeader: blockParts.Header()}
proposal = types.NewProposal(height, round, polRound, propBlockID)
proposal := types.NewProposal(height, round, polRound, propBlockID)
p := proposal.ToProto()
if err := vs.SignProposal(chainID, p); err != nil {
panic(err)
@@ -241,7 +241,7 @@ func decideProposal(
proposal.Signature = p.Signature
return
return proposal, block
}
func addVotes(to *State, votes ...*types.Vote) {

View File

@@ -573,7 +573,7 @@ func TestStateLockNoPOL(t *testing.T) {
cs2, _ := randState(2) // needed so generated block is different than locked block
// before we time out into new round, set next proposal block
prop, propBlock := decideProposal(t, ctx, cs2, vs2, vs2.Height, vs2.Round+1)
prop, propBlock := decideProposal(ctx, t, cs2, vs2, vs2.Height, vs2.Round+1)
if prop == nil || propBlock == nil {
t.Fatal("Failed to create proposal block with vs2")
}
@@ -675,7 +675,7 @@ func TestStateLockPOLRelock(t *testing.T) {
// before we timeout to the new round set the new proposal
cs2 := newState(cs1.state, vs2, kvstore.NewInMemoryApplication())
prop, propBlock := decideProposal(t, ctx, cs2, vs2, vs2.Height, vs2.Round+1)
prop, propBlock := decideProposal(ctx, t, cs2, vs2, vs2.Height, vs2.Round+1)
if prop == nil || propBlock == nil {
t.Fatal("Failed to create proposal block with vs2")
}
@@ -777,7 +777,7 @@ func TestStateLockPOLUnlock(t *testing.T) {
signAddVotes(cs1, tmproto.PrecommitType, theBlockHash, theBlockParts, vs3)
// before we time out into new round, set next proposal block
prop, propBlock := decideProposal(t, ctx, cs1, vs2, vs2.Height, vs2.Round+1)
prop, propBlock := decideProposal(ctx, t, cs1, vs2, vs2.Height, vs2.Round+1)
propBlockParts, err := propBlock.MakePartSet(partSize)
require.NoError(t, err)
@@ -869,7 +869,7 @@ func TestStateLockPOLUnlockOnUnknownBlock(t *testing.T) {
// before we timeout to the new round set the new proposal
cs2 := newState(cs1.state, vs2, kvstore.NewInMemoryApplication())
prop, propBlock := decideProposal(t, ctx, cs2, vs2, vs2.Height, vs2.Round+1)
prop, propBlock := decideProposal(ctx, t, cs2, vs2, vs2.Height, vs2.Round+1)
if prop == nil || propBlock == nil {
t.Fatal("Failed to create proposal block with vs2")
}
@@ -915,7 +915,7 @@ func TestStateLockPOLUnlockOnUnknownBlock(t *testing.T) {
// before we timeout to the new round set the new proposal
cs3 := newState(cs1.state, vs3, kvstore.NewInMemoryApplication())
prop, propBlock = decideProposal(t, ctx, cs3, vs3, vs3.Height, vs3.Round+1)
prop, propBlock = decideProposal(ctx, t, cs3, vs3, vs3.Height, vs3.Round+1)
if prop == nil || propBlock == nil {
t.Fatal("Failed to create proposal block with vs2")
}
@@ -1003,7 +1003,7 @@ func TestStateLockPOLSafety1(t *testing.T) {
t.Log("### ONTO ROUND 1")
prop, propBlock := decideProposal(t, ctx, cs1, vs2, vs2.Height, vs2.Round+1)
prop, propBlock := decideProposal(ctx, t, cs1, vs2, vs2.Height, vs2.Round+1)
propBlockHash := propBlock.Hash()
propBlockParts, err := propBlock.MakePartSet(partSize)
require.NoError(t, err)
@@ -1103,7 +1103,7 @@ func TestStateLockPOLSafety2(t *testing.T) {
// the block for R0: gets polkad but we miss it
// (even though we signed it, shhh)
_, propBlock0 := decideProposal(t, ctx, cs1, vss[0], height, round)
_, propBlock0 := decideProposal(ctx, t, cs1, vss[0], height, round)
propBlockHash0 := propBlock0.Hash()
propBlockParts0, err := propBlock0.MakePartSet(partSize)
require.NoError(t, err)
@@ -1113,7 +1113,7 @@ func TestStateLockPOLSafety2(t *testing.T) {
prevotes := signVotes(tmproto.PrevoteType, propBlockHash0, propBlockParts0.Header(), vs2, vs3, vs4)
// the block for round 1
prop1, propBlock1 := decideProposal(t, ctx, cs1, vs2, vs2.Height, vs2.Round+1)
prop1, propBlock1 := decideProposal(ctx, t, cs1, vs2, vs2.Height, vs2.Round+1)
propBlockHash1 := propBlock1.Hash()
propBlockParts1, err := propBlock1.MakePartSet(partSize)
require.NoError(t, err)
@@ -1370,7 +1370,7 @@ func TestSetValidBlockOnDelayedProposal(t *testing.T) {
ensurePrevote(voteCh, height, round)
validatePrevote(t, cs1, round, vss[0], nil)
prop, propBlock := decideProposal(t, ctx, cs1, vs2, vs2.Height, vs2.Round+1)
prop, propBlock := decideProposal(ctx, t, cs1, vs2, vs2.Height, vs2.Round+1)
propBlockHash := propBlock.Hash()
propBlockParts, err := propBlock.MakePartSet(partSize)
require.NoError(t, err)
@@ -2025,7 +2025,7 @@ func TestEmitNewValidBlockEventOnCommitWithoutBlock(t *testing.T) {
newRoundCh := subscribe(cs1.eventBus, types.EventQueryNewRound)
validBlockCh := subscribe(cs1.eventBus, types.EventQueryValidBlock)
_, propBlock := decideProposal(t, ctx, cs1, vs2, vs2.Height, vs2.Round)
_, propBlock := decideProposal(ctx, t, cs1, vs2, vs2.Height, vs2.Round)
propBlockHash := propBlock.Hash()
propBlockParts, err := propBlock.MakePartSet(partSize)
require.NoError(t, err)
@@ -2062,7 +2062,7 @@ func TestCommitFromPreviousRound(t *testing.T) {
validBlockCh := subscribe(cs1.eventBus, types.EventQueryValidBlock)
proposalCh := subscribe(cs1.eventBus, types.EventQueryCompleteProposal)
prop, propBlock := decideProposal(t, ctx, cs1, vs2, vs2.Height, vs2.Round)
prop, propBlock := decideProposal(ctx, t, cs1, vs2, vs2.Height, vs2.Round)
propBlockHash := propBlock.Hash()
propBlockParts, err := propBlock.MakePartSet(partSize)
require.NoError(t, err)
@@ -2211,7 +2211,7 @@ func TestResetTimeoutPrecommitUponNewHeight(t *testing.T) {
ensureNewBlockHeader(newBlockHeader, height, theBlockHash)
prop, propBlock := decideProposal(t, ctx, cs1, vs2, height+1, 0)
prop, propBlock := decideProposal(ctx, t, cs1, vs2, height+1, 0)
propBlockParts, err := propBlock.MakePartSet(partSize)
require.NoError(t, err)