Browse Source

fix lint

pull/8127/head
tycho garen 3 years ago
committed by M. J. Fromberger
parent
commit
c64d7c5b0a
7 changed files with 42 additions and 13 deletions
  1. +3
    -1
      internal/consensus/byzantine_test.go
  2. +12
    -3
      internal/consensus/common_test.go
  3. +3
    -1
      internal/consensus/pbts_test.go
  4. +3
    -2
      internal/consensus/reactor_test.go
  5. +3
    -1
      internal/consensus/replay_file.go
  6. +14
    -4
      internal/consensus/state_test.go
  7. +4
    -1
      internal/consensus/wal_generator.go

+ 3
- 1
internal/consensus/byzantine_test.go View File

@ -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())


+ 12
- 3
internal/consensus/common_test.go View File

@ -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())
}


+ 3
- 1
internal/consensus/pbts_test.go View File

@ -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++ {


+ 3
- 2
internal/consensus/reactor_test.go View File

@ -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)
}


+ 3
- 1
internal/consensus/replay_file.go View File

@ -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 {


+ 14
- 4
internal/consensus/state_test.go View File

@ -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)


+ 4
- 1
internal/consensus/wal_generator.go View File

@ -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)


Loading…
Cancel
Save