diff --git a/config/config.go b/config/config.go index e34d9b959..6395c60fd 100644 --- a/config/config.go +++ b/config/config.go @@ -451,7 +451,7 @@ func TestConsensusConfig() *ConsensusConfig { config.TimeoutCommit = 10 config.SkipTimeoutCommit = true config.PeerGossipSleepDuration = 5 - config.PeerQueryMaj23SleepDuration = 50 + config.PeerQueryMaj23SleepDuration = 250 return config } diff --git a/consensus/byzantine_test.go b/consensus/byzantine_test.go index 2f5f3f76c..38df1ecc1 100644 --- a/consensus/byzantine_test.go +++ b/consensus/byzantine_test.go @@ -33,7 +33,9 @@ func TestByzantine(t *testing.T) { css := randConsensusNet(N, "consensus_byzantine_test", newMockTickerFunc(false), newCounter) // give the byzantine validator a normal ticker - css[0].SetTimeoutTicker(NewTimeoutTicker()) + ticker := NewTimeoutTicker() + ticker.SetLogger(css[0].Logger) + css[0].SetTimeoutTicker(ticker) switches := make([]*p2p.Switch, N) p2pLogger := logger.With("module", "p2p") diff --git a/consensus/common_test.go b/consensus/common_test.go index 40a320e42..c27b50c4f 100644 --- a/consensus/common_test.go +++ b/consensus/common_test.go @@ -267,7 +267,7 @@ func newConsensusStateWithConfigAndBlockStore(thisConfig *cfg.Config, state sm.S stateDB := dbm.NewMemDB() blockExec := sm.NewBlockExecutor(stateDB, log.TestingLogger(), proxyAppConnCon, mempool, evpool) cs := NewConsensusState(thisConfig.Consensus, state, blockExec, blockStore, mempool, evpool) - cs.SetLogger(log.TestingLogger()) + cs.SetLogger(log.TestingLogger().With("module", "consensus")) cs.SetPrivValidator(pv) eventBus := types.NewEventBus() @@ -285,14 +285,6 @@ func loadPrivValidator(config *cfg.Config) *types.PrivValidatorFS { return privValidator } -func fixedConsensusStateDummy(config *cfg.Config, logger log.Logger) *ConsensusState { - state, _ := sm.MakeGenesisStateFromFile(config.GenesisFile()) - privValidator := loadPrivValidator(config) - cs := newConsensusState(state, privValidator, dummy.NewDummyApplication()) - cs.SetLogger(logger) - return cs -} - func randConsensusState(nValidators int) (*ConsensusState, []*validatorStub) { // Get State state, privVals := randGenesisState(nValidators, false, 10) @@ -300,7 +292,6 @@ func randConsensusState(nValidators int) (*ConsensusState, []*validatorStub) { vss := make([]*validatorStub, nValidators) cs := newConsensusState(state, privVals[0], counter.NewCounterApplication(true)) - cs.SetLogger(log.TestingLogger()) for i := 0; i < nValidators; i++ { vss[i] = NewValidatorStub(privVals[i], i) @@ -346,7 +337,7 @@ func consensusLogger() log.Logger { } } return term.FgBgColor{} - }) + }).With("module", "consensus") } func randConsensusNet(nValidators int, testName string, tickerFunc func() TimeoutTicker, appFunc func() abci.Application, configOpts ...func(*cfg.Config)) []*ConsensusState { @@ -366,8 +357,8 @@ func randConsensusNet(nValidators int, testName string, tickerFunc func() Timeou app.InitChain(abci.RequestInitChain{Validators: vals}) css[i] = newConsensusStateWithConfig(thisConfig, state, privVals[i], app) - css[i].SetLogger(logger.With("validator", i)) css[i].SetTimeoutTicker(tickerFunc()) + css[i].SetLogger(logger.With("validator", i, "module", "consensus")) } return css } @@ -395,8 +386,8 @@ func randConsensusNetWithPeers(nValidators, nPeers int, testName string, tickerF app.InitChain(abci.RequestInitChain{Validators: vals}) css[i] = newConsensusStateWithConfig(thisConfig, state, privVal, app) - css[i].SetLogger(logger.With("validator", i)) css[i].SetTimeoutTicker(tickerFunc()) + css[i].SetLogger(logger.With("validator", i, "module", "consensus")) } return css } diff --git a/consensus/reactor_test.go b/consensus/reactor_test.go index c1e2a4621..0fb8ecd6b 100644 --- a/consensus/reactor_test.go +++ b/consensus/reactor_test.go @@ -35,7 +35,7 @@ func startConsensusNet(t *testing.T, css []*ConsensusState, N int) ([]*Consensus /*logger, err := tmflags.ParseLogLevel("consensus:info,*:error", logger, "info") if err != nil { t.Fatal(err)}*/ reactors[i] = NewConsensusReactor(css[i], true) // so we dont start the consensus states - reactors[i].SetLogger(css[i].Logger.With("validator", "i", "module", "consensus")) + reactors[i].SetLogger(css[i].Logger) // eventBus is already started with the cs eventBuses[i] = css[i].eventBus