diff --git a/internal/consensus/byzantine_test.go b/internal/consensus/byzantine_test.go index f08a63d52..7a04e4613 100644 --- a/internal/consensus/byzantine_test.go +++ b/internal/consensus/byzantine_test.go @@ -97,7 +97,9 @@ func TestByzantinePrevoteEquivocation(t *testing.T) { require.NoError(t, err) // set private validator pv := privVals[i] - cs.updateStateFromStore(ctx) + if err := cs.updateStateFromStore(ctx); err != nil { + t.Fatal(err) + } cs.SetPrivValidator(ctx, pv) cs.SetTimeoutTicker(tickerFunc()) diff --git a/internal/consensus/common_test.go b/internal/consensus/common_test.go index 9e0a0207b..6517ee639 100644 --- a/internal/consensus/common_test.go +++ b/internal/consensus/common_test.go @@ -504,7 +504,9 @@ func newStateWithConfigAndBlockStore( if err != nil { t.Fatal(err) } - cs.updateStateFromStore(ctx) + if err := cs.updateStateFromStore(ctx); err != nil { + t.Fatal(err) + } cs.SetPrivValidator(ctx, pv) return cs @@ -554,7 +556,10 @@ func makeState(ctx context.Context, t *testing.T, args makeStateArgs) (*State, [ vss := make([]*validatorStub, validators) cs := newState(ctx, t, args.logger, state, privVals[0], app) - cs.updateStateFromStore(ctx) + + if err := cs.updateStateFromStore(ctx); err != nil { + t.Fatal(err) + } for i := 0; i < validators; i++ { vss[i] = newValidatorStub(privVals[i], int32(i)) @@ -826,7 +831,11 @@ func makeConsensusState( l := logger.With("validator", i, "module", "consensus") css[i] = newStateWithConfigAndBlockStore(ctx, t, l, thisConfig, state, privVals[i], app, blockStore) - css[i].updateStateFromStore(ctx) + + if err := css[i].updateStateFromStore(ctx); err != nil { + t.Fatal(err) + } + css[i].SetTimeoutTicker(tickerFunc()) } diff --git a/internal/consensus/pbts_test.go b/internal/consensus/pbts_test.go index 75fa63aa5..232b30c3c 100644 --- a/internal/consensus/pbts_test.go +++ b/internal/consensus/pbts_test.go @@ -118,7 +118,9 @@ func newPBTSTestHarness(ctx context.Context, t *testing.T, tc pbtsTestConfigurat if err := cs.Start(ctx); err != nil { t.Fatal(err) } - cs.updateStateFromStore(ctx) + if err := cs.updateStateFromStore(ctx); err != nil { + t.Fatal(err) + } vss := make([]*validatorStub, validators) for i := 0; i < validators; i++ { diff --git a/internal/consensus/reactor_test.go b/internal/consensus/reactor_test.go index e3abc67c0..3daf09dfe 100644 --- a/internal/consensus/reactor_test.go +++ b/internal/consensus/reactor_test.go @@ -523,7 +523,9 @@ func TestReactorWithEvidence(t *testing.T) { cs.SetPrivValidator(ctx, pv) cs.SetTimeoutTicker(tickerFunc()) - cs.updateStateFromStore(ctx) + if err := cs.updateStateFromStore(ctx); err != nil { + t.Fatal(err) + } states[i] = cs } @@ -531,7 +533,6 @@ func TestReactorWithEvidence(t *testing.T) { rts := setup(ctx, t, n, states, 100) // buffer must be large enough to not deadlock for _, reactor := range rts.reactors { - reactor.state.updateStateFromStore(ctx) reactor.SwitchToConsensus(ctx, reactor.state.state, false) } diff --git a/internal/consensus/replay_file.go b/internal/consensus/replay_file.go index 737ffb66e..1c241f463 100644 --- a/internal/consensus/replay_file.go +++ b/internal/consensus/replay_file.go @@ -150,7 +150,9 @@ func (pb *playback) replayReset(ctx context.Context, count int, newStepSub event if err != nil { return err } - newCS.updateStateFromStore(ctx) + if err := newCS.updateStateFromStore(ctx); err != nil { + return err + } newCS.startForReplay() if err := pb.fp.Close(); err != nil { diff --git a/internal/consensus/state_test.go b/internal/consensus/state_test.go index 32cb84a9c..03935511a 100644 --- a/internal/consensus/state_test.go +++ b/internal/consensus/state_test.go @@ -178,7 +178,9 @@ func TestStateEnterProposeYesPrivValidator(t *testing.T) { defer cancel() cs, _ := makeState(ctx, t, makeStateArgs{config: config, validators: 1}) - cs.updateStateFromStore(ctx) + if err := cs.updateStateFromStore(ctx); err != nil { + t.Fatal(err) + } height, round := cs.Height, cs.Round // Listen for propose timeout event @@ -707,7 +709,9 @@ func TestStateLock_POLUpdateLock(t *testing.T) { // Generate a new proposal block. cs2 := newState(ctx, t, logger, cs1.state, vs2, kvstore.NewApplication()) - cs2.updateStateFromStore(ctx) + if err := cs2.updateStateFromStore(ctx); err != nil { + t.Fatal(err) + } require.NoError(t, err) propR1, propBlockR1 := decideProposal(ctx, t, cs2, vs2, vs2.Height, vs2.Round) @@ -1001,7 +1005,10 @@ func TestStateLock_PrevoteNilWhenLockedAndDifferentProposal(t *testing.T) { incrementRound(vs2, vs3, vs4) round++ cs2 := newState(ctx, t, logger, cs1.state, vs2, kvstore.NewApplication()) - cs2.updateStateFromStore(ctx) + if err := cs2.updateStateFromStore(ctx); err != nil { + t.Fatal(err) + } + propR1, propBlockR1 := decideProposal(ctx, t, cs2, vs2, vs2.Height, vs2.Round) propBlockR1Parts, err := propBlockR1.MakePartSet(types.BlockPartSizeBytes) require.NoError(t, err) @@ -1109,7 +1116,10 @@ func TestStateLock_POLDoesNotUnlock(t *testing.T) { round++ incrementRound(vs2, vs3, vs4) cs2 := newState(ctx, t, logger, cs1.state, vs2, kvstore.NewApplication()) - cs2.updateStateFromStore(ctx) + if err := cs2.updateStateFromStore(ctx); err != nil { + t.Fatal(err) + } + prop, propBlock := decideProposal(ctx, t, cs2, vs2, vs2.Height, vs2.Round) propBlockParts, err := propBlock.MakePartSet(types.BlockPartSizeBytes) require.NoError(t, err) diff --git a/internal/consensus/wal_generator.go b/internal/consensus/wal_generator.go index c510fcb71..e7f8cd39d 100644 --- a/internal/consensus/wal_generator.go +++ b/internal/consensus/wal_generator.go @@ -85,7 +85,10 @@ func WALGenerateNBlocks(ctx context.Context, t *testing.T, logger log.Logger, wr if err != nil { t.Fatal(err) } - consensusState.updateStateFromStore(ctx) + + if err := consensusState.updateStateFromStore(ctx); err != nil { + t.Fatal(err) + } if privValidator != nil && privValidator != (*privval.FilePV)(nil) { consensusState.SetPrivValidator(ctx, privValidator)