From ac3c571b872abe6a48603fe1292a5725dbf2661f Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Thu, 4 Apr 2019 12:53:51 +0200 Subject: [PATCH] move mempool mock into top-level mock package --- blockchain/reactor_test.go | 4 ++-- consensus/replay.go | 4 ++-- consensus/replay_file.go | 4 ++-- consensus/replay_test.go | 4 ++-- consensus/wal_generator.go | 4 ++-- {mempool/mock => mock}/mempool.go | 10 +++++----- state/execution_test.go | 8 ++++---- 7 files changed, 19 insertions(+), 19 deletions(-) rename {mempool/mock => mock}/mempool.go (88%) diff --git a/blockchain/reactor_test.go b/blockchain/reactor_test.go index 0e338ecf6..efa45bca4 100644 --- a/blockchain/reactor_test.go +++ b/blockchain/reactor_test.go @@ -13,7 +13,7 @@ import ( cmn "github.com/tendermint/tendermint/libs/common" dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" - memplmock "github.com/tendermint/tendermint/mempool/mock" + "github.com/tendermint/tendermint/mock" "github.com/tendermint/tendermint/p2p" "github.com/tendermint/tendermint/proxy" sm "github.com/tendermint/tendermint/state" @@ -93,7 +93,7 @@ func newBlockchainReactor(logger log.Logger, genDoc *types.GenesisDoc, privVals // pool.height is determined from the store. fastSync := true blockExec := sm.NewBlockExecutor(dbm.NewMemDB(), log.TestingLogger(), proxyApp.Consensus(), - memplmock.Mempool{}, sm.MockEvidencePool{}) + mock.Mempool{}, sm.MockEvidencePool{}) // let's add some blocks in for blockHeight := int64(1); blockHeight <= maxBlockHeight; blockHeight++ { diff --git a/consensus/replay.go b/consensus/replay.go index 99325e023..1a7484e09 100644 --- a/consensus/replay.go +++ b/consensus/replay.go @@ -16,7 +16,7 @@ import ( cmn "github.com/tendermint/tendermint/libs/common" dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" - memplmock "github.com/tendermint/tendermint/mempool/mock" + "github.com/tendermint/tendermint/mock" "github.com/tendermint/tendermint/proxy" sm "github.com/tendermint/tendermint/state" "github.com/tendermint/tendermint/types" @@ -442,7 +442,7 @@ func (h *Handshaker) replayBlock(state sm.State, height int64, proxyApp proxy.Ap block := h.store.LoadBlock(height) meta := h.store.LoadBlockMeta(height) - blockExec := sm.NewBlockExecutor(h.stateDB, h.logger, proxyApp, memplmock.Mempool{}, sm.MockEvidencePool{}) + blockExec := sm.NewBlockExecutor(h.stateDB, h.logger, proxyApp, mock.Mempool{}, sm.MockEvidencePool{}) blockExec.SetEventBus(h.eventBus) var err error diff --git a/consensus/replay_file.go b/consensus/replay_file.go index 9feef6255..5bb73484e 100644 --- a/consensus/replay_file.go +++ b/consensus/replay_file.go @@ -16,7 +16,7 @@ import ( cmn "github.com/tendermint/tendermint/libs/common" dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" - memplmock "github.com/tendermint/tendermint/mempool/mock" + "github.com/tendermint/tendermint/mock" "github.com/tendermint/tendermint/proxy" sm "github.com/tendermint/tendermint/state" "github.com/tendermint/tendermint/types" @@ -313,7 +313,7 @@ func newConsensusStateForReplay(config cfg.BaseConfig, csConfig *cfg.ConsensusCo cmn.Exit(fmt.Sprintf("Error on handshake: %v", err)) } - mempool, evpool := memplmock.Mempool{}, sm.MockEvidencePool{} + mempool, evpool := mock.Mempool{}, sm.MockEvidencePool{} blockExec := sm.NewBlockExecutor(stateDB, log.TestingLogger(), proxyApp.Consensus(), mempool, evpool) consensusState := NewConsensusState(csConfig, state.Copy(), blockExec, diff --git a/consensus/replay_test.go b/consensus/replay_test.go index 368a4d56d..a65874656 100644 --- a/consensus/replay_test.go +++ b/consensus/replay_test.go @@ -21,7 +21,7 @@ import ( "github.com/tendermint/tendermint/crypto" dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" - memplmock "github.com/tendermint/tendermint/mempool/mock" + "github.com/tendermint/tendermint/mock" "github.com/tendermint/tendermint/privval" "github.com/tendermint/tendermint/proxy" sm "github.com/tendermint/tendermint/state" @@ -268,7 +268,7 @@ const ( ) var ( - mempool = memplmock.Mempool{} + mempool = mock.Mempool{} evpool = sm.MockEvidencePool{} ) diff --git a/consensus/wal_generator.go b/consensus/wal_generator.go index 6b2c6362c..93d96340e 100644 --- a/consensus/wal_generator.go +++ b/consensus/wal_generator.go @@ -17,7 +17,7 @@ import ( cmn "github.com/tendermint/tendermint/libs/common" "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" - memplmock "github.com/tendermint/tendermint/mempool/mock" + "github.com/tendermint/tendermint/mock" "github.com/tendermint/tendermint/privval" "github.com/tendermint/tendermint/proxy" sm "github.com/tendermint/tendermint/state" @@ -68,7 +68,7 @@ func WALGenerateNBlocks(t *testing.T, wr io.Writer, numBlocks int) (err error) { return errors.Wrap(err, "failed to start event bus") } defer eventBus.Stop() - mempool := memplmock.Mempool{} + mempool := mock.Mempool{} evpool := sm.MockEvidencePool{} blockExec := sm.NewBlockExecutor(stateDB, log.TestingLogger(), proxyApp.Consensus(), mempool, evpool) consensusState := NewConsensusState(config.Consensus, state.Copy(), blockExec, blockStore, mempool, evpool) diff --git a/mempool/mock/mempool.go b/mock/mempool.go similarity index 88% rename from mempool/mock/mempool.go rename to mock/mempool.go index 0a94dde06..f5fa7676f 100644 --- a/mempool/mock/mempool.go +++ b/mock/mempool.go @@ -3,14 +3,14 @@ package mock import ( abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/libs/clist" - mempl "github.com/tendermint/tendermint/mempool" + "github.com/tendermint/tendermint/mempool" "github.com/tendermint/tendermint/types" ) // Mempool is an empty implementation of a Mempool, useful for testing. type Mempool struct{} -var _ mempl.Mempool = Mempool{} +var _ mempool.Mempool = Mempool{} func (Mempool) Lock() {} func (Mempool) Unlock() {} @@ -19,7 +19,7 @@ func (Mempool) CheckTx(_ types.Tx, _ func(*abci.Response)) error { return nil } func (Mempool) CheckTxWithInfo(_ types.Tx, _ func(*abci.Response), - _ mempl.TxInfo) error { + _ mempool.TxInfo) error { return nil } func (Mempool) ReapMaxBytesMaxGas(_, _ int64) types.Txs { return types.Txs{} } @@ -27,8 +27,8 @@ func (Mempool) ReapMaxTxs(n int) types.Txs { return types.Txs{} } func (Mempool) Update( _ int64, _ types.Txs, - _ mempl.PreCheckFunc, - _ mempl.PostCheckFunc, + _ mempool.PreCheckFunc, + _ mempool.PostCheckFunc, ) error { return nil } diff --git a/state/execution_test.go b/state/execution_test.go index b15ea0cb0..161707aab 100644 --- a/state/execution_test.go +++ b/state/execution_test.go @@ -16,7 +16,7 @@ import ( cmn "github.com/tendermint/tendermint/libs/common" dbm "github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/log" - memplmock "github.com/tendermint/tendermint/mempool/mock" + "github.com/tendermint/tendermint/mock" "github.com/tendermint/tendermint/proxy" "github.com/tendermint/tendermint/types" tmtime "github.com/tendermint/tendermint/types/time" @@ -38,7 +38,7 @@ func TestApplyBlock(t *testing.T) { state, stateDB := state(1, 1) blockExec := NewBlockExecutor(stateDB, log.TestingLogger(), proxyApp.Consensus(), - memplmock.Mempool{}, MockEvidencePool{}) + mock.Mempool{}, MockEvidencePool{}) block := makeBlock(state, 1) blockID := types.BlockID{block.Hash(), block.MakePartSet(testPartSize).Header()} @@ -310,7 +310,7 @@ func TestEndBlockValidatorUpdates(t *testing.T) { state, stateDB := state(1, 1) - blockExec := NewBlockExecutor(stateDB, log.TestingLogger(), proxyApp.Consensus(), memplmock.Mempool{}, MockEvidencePool{}) + blockExec := NewBlockExecutor(stateDB, log.TestingLogger(), proxyApp.Consensus(), mock.Mempool{}, MockEvidencePool{}) eventBus := types.NewEventBus() err = eventBus.Start() @@ -367,7 +367,7 @@ func TestEndBlockValidatorUpdatesResultingInEmptySet(t *testing.T) { defer proxyApp.Stop() state, stateDB := state(1, 1) - blockExec := NewBlockExecutor(stateDB, log.TestingLogger(), proxyApp.Consensus(), memplmock.Mempool{}, MockEvidencePool{}) + blockExec := NewBlockExecutor(stateDB, log.TestingLogger(), proxyApp.Consensus(), mock.Mempool{}, MockEvidencePool{}) block := makeBlock(state, 1) blockID := types.BlockID{block.Hash(), block.MakePartSet(testPartSize).Header()}