Fix build, make UTs pass

This commit is contained in:
Sergio Mena
2022-12-22 20:05:42 +01:00
parent ef9496b2da
commit 950618dab7
9 changed files with 25 additions and 25 deletions
+3 -3
View File
@@ -223,7 +223,7 @@ func TestByzantinePrevoteEquivocation(t *testing.T) {
proposerAddr := lazyProposer.privValidatorPubKey.Address()
block, err := lazyProposer.blockExec.CreateProposalBlock(
ctx, lazyProposer.Height, lazyProposer.state, extCommit, proposerAddr)
context.TODO() /**/, lazyProposer.Height, lazyProposer.state, extCommit, proposerAddr)
require.NoError(t, err)
blockParts, err := block.MakePartSet(types.BlockPartSizeBytes)
require.NoError(t, err)
@@ -471,7 +471,7 @@ func byzantineDecideProposalFunc(t *testing.T, height int64, round int32, cs *St
// Avoid sending on internalMsgQueue and running consensus state.
// Create a new proposal block from state/txs from the mempool.
block1, err := cs.createProposalBlock()
block1, err := cs.createProposalBlock(context.TODO() /**/)
require.NoError(t, err)
blockParts1, err := block1.MakePartSet(types.BlockPartSizeBytes)
require.NoError(t, err)
@@ -488,7 +488,7 @@ func byzantineDecideProposalFunc(t *testing.T, height int64, round int32, cs *St
deliverTxsRange(t, cs, 0, 1)
// Create a new proposal block from state/txs from the mempool.
block2, err := cs.createProposalBlock()
block2, err := cs.createProposalBlock(context.TODO() /**/)
require.NoError(t, err)
blockParts2, err := block2.MakePartSet(types.BlockPartSizeBytes)
require.NoError(t, err)
+1 -1
View File
@@ -219,7 +219,7 @@ func decideProposal(
round int32,
) (proposal *types.Proposal, block *types.Block) {
cs1.mtx.Lock()
block, err := cs1.createProposalBlock(ctx)
block, err := cs1.createProposalBlock(context.TODO() /**/)
require.NoError(t, err)
blockParts, err := block.MakePartSet(types.BlockPartSizeBytes)
require.NoError(t, err)
+1 -1
View File
@@ -364,7 +364,7 @@ func TestSwitchToConsensusVoteExtensions(t *testing.T) {
cs.state.LastValidators = cs.state.Validators.Copy()
cs.state.ConsensusParams.ABCI.VoteExtensionsEnableHeight = testCase.initialRequiredHeight
propBlock, err := cs.createProposalBlock()
propBlock, err := cs.createProposalBlock(context.TODO() /**/)
require.NoError(t, err)
// Consensus is preparing to do the next height after the stored height.
+4 -4
View File
@@ -358,7 +358,7 @@ func setupChainWithChangingValidators(t *testing.T, name string, nBlocks int) (*
newValidatorTx1 := kvstore.MakeValSetChangeTx(valPubKey1ABCI, testMinPower)
err = assertMempool(css[0].txNotifier).CheckTx(newValidatorTx1, nil, mempool.TxInfo{})
assert.NoError(t, err)
propBlock, err := css[0].createProposalBlock(ctx) // changeProposer(t, cs1, vs2)
propBlock, err := css[0].createProposalBlock(context.TODO() /**/) // changeProposer(t, cs1, vs2)
require.NoError(t, err)
propBlockParts, err := propBlock.MakePartSet(partSize)
require.NoError(t, err)
@@ -390,7 +390,7 @@ func setupChainWithChangingValidators(t *testing.T, name string, nBlocks int) (*
updateValidatorTx1 := kvstore.MakeValSetChangeTx(updatePubKey1ABCI, 25)
err = assertMempool(css[0].txNotifier).CheckTx(updateValidatorTx1, nil, mempool.TxInfo{})
assert.NoError(t, err)
propBlock, err = css[0].createProposalBlock(ctx) // changeProposer(t, cs1, vs2)
propBlock, err = css[0].createProposalBlock(context.TODO() /**/) // changeProposer(t, cs1, vs2)
require.NoError(t, err)
propBlockParts, err = propBlock.MakePartSet(partSize)
require.NoError(t, err)
@@ -429,7 +429,7 @@ func setupChainWithChangingValidators(t *testing.T, name string, nBlocks int) (*
newValidatorTx3 := kvstore.MakeValSetChangeTx(newVal3ABCI, testMinPower)
err = assertMempool(css[0].txNotifier).CheckTx(newValidatorTx3, nil, mempool.TxInfo{})
assert.NoError(t, err)
propBlock, err = css[0].createProposalBlock(ctx) // changeProposer(t, cs1, vs2)
propBlock, err = css[0].createProposalBlock(context.TODO() /**/) // changeProposer(t, cs1, vs2)
require.NoError(t, err)
propBlockParts, err = propBlock.MakePartSet(partSize)
require.NoError(t, err)
@@ -506,7 +506,7 @@ func setupChainWithChangingValidators(t *testing.T, name string, nBlocks int) (*
removeValidatorTx3 := kvstore.MakeValSetChangeTx(newVal3ABCI, 0)
err = assertMempool(css[0].txNotifier).CheckTx(removeValidatorTx3, nil, mempool.TxInfo{})
assert.NoError(t, err)
propBlock, err = css[0].createProposalBlock(ctx) // changeProposer(t, cs1, vs2)
propBlock, err = css[0].createProposalBlock(context.TODO() /**/) // changeProposer(t, cs1, vs2)
require.NoError(t, err)
propBlockParts, err = propBlock.MakePartSet(partSize)
require.NoError(t, err)
+3 -3
View File
@@ -1176,7 +1176,7 @@ func (cs *State) defaultDecideProposal(height int64, round int32) {
} else {
// Create a new proposal block from state/txs from the mempool.
var err error
block, err = cs.createProposalBlock(ctx)
block, err = cs.createProposalBlock(context.TODO())
if err != nil {
cs.Logger.Error("unable to create proposal block", "error", err)
return
@@ -2132,7 +2132,7 @@ func (cs *State) addVote(vote *types.Vote, peerID p2p.ID) (added bool, err error
return false, err
}
if err = cs.blockExec.VerifyVoteExtension(ctx, vote); err != nil {
if err = cs.blockExec.VerifyVoteExtension(context.TODO(), vote); err != nil {
return false, err
}
}
@@ -2314,7 +2314,7 @@ func (cs *State) signVote(
// if the signedMessage type is for a non-nil precommit, add
// VoteExtension
if extEnabled {
ext, err := cs.blockExec.ExtendVote(ctx, vote)
ext, err := cs.blockExec.ExtendVote(context.TODO(), vote)
if err != nil {
return nil, err
}
+2 -2
View File
@@ -195,7 +195,7 @@ func TestStateBadProposal(t *testing.T) {
proposalCh := subscribe(cs1.eventBus, types.EventQueryCompleteProposal)
voteCh := subscribe(cs1.eventBus, types.EventQueryVote)
propBlock, err := cs1.createProposalBlock(ctx) // changeProposer(t, cs1, vs2)
propBlock, err := cs1.createProposalBlock(context.TODO() /**/) // changeProposer(t, cs1, vs2)
require.NoError(t, err)
// make the second validator the proposer by incrementing round
@@ -262,7 +262,7 @@ func TestStateOversizedBlock(t *testing.T) {
timeoutProposeCh := subscribe(cs1.eventBus, types.EventQueryTimeoutPropose)
voteCh := subscribe(cs1.eventBus, types.EventQueryVote)
propBlock, err := cs1.createProposalBlock(ctx)
propBlock, err := cs1.createProposalBlock(context.TODO() /**/)
require.NoError(t, err)
propBlock.Data.Txs = []types.Tx{tmrand.Bytes(2001)}
propBlock.Header.DataHash = propBlock.Data.Hash()
+2 -2
View File
@@ -335,7 +335,7 @@ func TestCreateProposalBlock(t *testing.T) {
extCommit := &types.ExtendedCommit{Height: height - 1}
block, err := blockExec.CreateProposalBlock(
ctx,
context.TODO(), /**/
height,
state,
extCommit,
@@ -422,7 +422,7 @@ func TestMaxProposalBlockSize(t *testing.T) {
extCommit := &types.ExtendedCommit{Height: height - 1}
block, err := blockExec.CreateProposalBlock(
ctx,
context.TODO(), /**/
height,
state,
extCommit,
+2 -2
View File
@@ -301,7 +301,7 @@ func (blockExec *BlockExecutor) ExtendVote(ctx context.Context, vote *types.Vote
Height: vote.Height,
}
resp, err := blockExec.proxyApp.ExtendVote(context.TODO(), &req)
resp, err := blockExec.proxyApp.ExtendVote(ctx, &req)
if err != nil {
panic(fmt.Errorf("ExtendVote call failed: %w", err))
}
@@ -316,7 +316,7 @@ func (blockExec *BlockExecutor) VerifyVoteExtension(ctx context.Context, vote *t
VoteExtension: vote.Extension,
}
resp, err := blockExec.proxyApp.VerifyVoteExtension(context.TODO(), &req)
resp, err := blockExec.proxyApp.VerifyVoteExtension(ctx, &req)
if err != nil {
panic(fmt.Errorf("VerifyVoteExtension call failed: %w", err))
}
+7 -7
View File
@@ -733,7 +733,7 @@ func TestEmptyPrepareProposal(t *testing.T) {
pa, _ := state.Validators.GetByIndex(0)
commit, _, err := makeValidCommit(height, types.BlockID{}, state.Validators, privVals)
require.NoError(t, err)
_, err = blockExec.CreateProposalBlock(height, state, commit, pa)
_, err = blockExec.CreateProposalBlock(context.TODO() /**/, height, state, commit, pa)
require.NoError(t, err)
}
@@ -776,7 +776,7 @@ func TestPrepareProposalTxsAllIncluded(t *testing.T) {
pa, _ := state.Validators.GetByIndex(0)
commit, _, err := makeValidCommit(height, types.BlockID{}, state.Validators, privVals)
require.NoError(t, err)
block, err := blockExec.CreateProposalBlock(height, state, commit, pa)
block, err := blockExec.CreateProposalBlock(context.TODO() /**/, height, state, commit, pa)
require.NoError(t, err)
for i, tx := range block.Data.Txs {
@@ -829,7 +829,7 @@ func TestPrepareProposalReorderTxs(t *testing.T) {
pa, _ := state.Validators.GetByIndex(0)
commit, _, err := makeValidCommit(height, types.BlockID{}, state.Validators, privVals)
require.NoError(t, err)
block, err := blockExec.CreateProposalBlock(height, state, commit, pa)
block, err := blockExec.CreateProposalBlock(context.TODO() /**/, height, state, commit, pa)
require.NoError(t, err)
for i, tx := range block.Data.Txs {
require.Equal(t, txs[i], tx)
@@ -884,7 +884,7 @@ func TestPrepareProposalErrorOnTooManyTxs(t *testing.T) {
pa, _ := state.Validators.GetByIndex(0)
commit, _, err := makeValidCommit(height, types.BlockID{}, state.Validators, privVals)
require.NoError(t, err)
block, err := blockExec.CreateProposalBlock(height, state, commit, pa)
block, err := blockExec.CreateProposalBlock(context.TODO() /**/, height, state, commit, pa)
require.Nil(t, block)
require.ErrorContains(t, err, "transaction data size exceeds maximum")
@@ -933,7 +933,7 @@ func TestPrepareProposalErrorOnPrepareProposalError(t *testing.T) {
pa, _ := state.Validators.GetByIndex(0)
commit, _, err := makeValidCommit(height, types.BlockID{}, state.Validators, privVals)
require.NoError(t, err)
block, err := blockExec.CreateProposalBlock(height, state, commit, pa)
block, err := blockExec.CreateProposalBlock(context.TODO() /**/, height, state, commit, pa)
require.Nil(t, block)
require.ErrorContains(t, err, "an injected error")
@@ -1026,10 +1026,10 @@ func TestCreateProposalAbsentVoteExtensions(t *testing.T) {
stripSignatures(lastCommit)
if testCase.expectPanic {
require.Panics(t, func() {
blockExec.CreateProposalBlock(testCase.height, state, lastCommit, pa) //nolint:errcheck
blockExec.CreateProposalBlock(context.TODO() /**/, testCase.height, state, lastCommit, pa) //nolint:errcheck
})
} else {
_, err = blockExec.CreateProposalBlock(testCase.height, state, lastCommit, pa)
_, err = blockExec.CreateProposalBlock(context.TODO() /**/, testCase.height, state, lastCommit, pa)
require.NoError(t, err)
}
})