Browse Source

move mempool mock into top-level mock package

pull/3524/head
Anton Kaliaev 6 years ago
parent
commit
ac3c571b87
No known key found for this signature in database GPG Key ID: 7B6881D965918214
7 changed files with 19 additions and 19 deletions
  1. +2
    -2
      blockchain/reactor_test.go
  2. +2
    -2
      consensus/replay.go
  3. +2
    -2
      consensus/replay_file.go
  4. +2
    -2
      consensus/replay_test.go
  5. +2
    -2
      consensus/wal_generator.go
  6. +5
    -5
      mock/mempool.go
  7. +4
    -4
      state/execution_test.go

+ 2
- 2
blockchain/reactor_test.go View File

@ -13,7 +13,7 @@ import (
cmn "github.com/tendermint/tendermint/libs/common" cmn "github.com/tendermint/tendermint/libs/common"
dbm "github.com/tendermint/tendermint/libs/db" dbm "github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log" "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/p2p"
"github.com/tendermint/tendermint/proxy" "github.com/tendermint/tendermint/proxy"
sm "github.com/tendermint/tendermint/state" 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. // pool.height is determined from the store.
fastSync := true fastSync := true
blockExec := sm.NewBlockExecutor(dbm.NewMemDB(), log.TestingLogger(), proxyApp.Consensus(), blockExec := sm.NewBlockExecutor(dbm.NewMemDB(), log.TestingLogger(), proxyApp.Consensus(),
memplmock.Mempool{}, sm.MockEvidencePool{})
mock.Mempool{}, sm.MockEvidencePool{})
// let's add some blocks in // let's add some blocks in
for blockHeight := int64(1); blockHeight <= maxBlockHeight; blockHeight++ { for blockHeight := int64(1); blockHeight <= maxBlockHeight; blockHeight++ {


+ 2
- 2
consensus/replay.go View File

@ -16,7 +16,7 @@ import (
cmn "github.com/tendermint/tendermint/libs/common" cmn "github.com/tendermint/tendermint/libs/common"
dbm "github.com/tendermint/tendermint/libs/db" dbm "github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log" "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/proxy"
sm "github.com/tendermint/tendermint/state" sm "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/types" "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) block := h.store.LoadBlock(height)
meta := h.store.LoadBlockMeta(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) blockExec.SetEventBus(h.eventBus)
var err error var err error


+ 2
- 2
consensus/replay_file.go View File

@ -16,7 +16,7 @@ import (
cmn "github.com/tendermint/tendermint/libs/common" cmn "github.com/tendermint/tendermint/libs/common"
dbm "github.com/tendermint/tendermint/libs/db" dbm "github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log" "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/proxy"
sm "github.com/tendermint/tendermint/state" sm "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/types" "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)) 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) blockExec := sm.NewBlockExecutor(stateDB, log.TestingLogger(), proxyApp.Consensus(), mempool, evpool)
consensusState := NewConsensusState(csConfig, state.Copy(), blockExec, consensusState := NewConsensusState(csConfig, state.Copy(), blockExec,


+ 2
- 2
consensus/replay_test.go View File

@ -21,7 +21,7 @@ import (
"github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto"
dbm "github.com/tendermint/tendermint/libs/db" dbm "github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log" "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/privval"
"github.com/tendermint/tendermint/proxy" "github.com/tendermint/tendermint/proxy"
sm "github.com/tendermint/tendermint/state" sm "github.com/tendermint/tendermint/state"
@ -268,7 +268,7 @@ const (
) )
var ( var (
mempool = memplmock.Mempool{}
mempool = mock.Mempool{}
evpool = sm.MockEvidencePool{} evpool = sm.MockEvidencePool{}
) )


+ 2
- 2
consensus/wal_generator.go View File

@ -17,7 +17,7 @@ import (
cmn "github.com/tendermint/tendermint/libs/common" cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/libs/db" "github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log" "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/privval"
"github.com/tendermint/tendermint/proxy" "github.com/tendermint/tendermint/proxy"
sm "github.com/tendermint/tendermint/state" 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") return errors.Wrap(err, "failed to start event bus")
} }
defer eventBus.Stop() defer eventBus.Stop()
mempool := memplmock.Mempool{}
mempool := mock.Mempool{}
evpool := sm.MockEvidencePool{} evpool := sm.MockEvidencePool{}
blockExec := sm.NewBlockExecutor(stateDB, log.TestingLogger(), proxyApp.Consensus(), mempool, evpool) blockExec := sm.NewBlockExecutor(stateDB, log.TestingLogger(), proxyApp.Consensus(), mempool, evpool)
consensusState := NewConsensusState(config.Consensus, state.Copy(), blockExec, blockStore, mempool, evpool) consensusState := NewConsensusState(config.Consensus, state.Copy(), blockExec, blockStore, mempool, evpool)


mempool/mock/mempool.go → mock/mempool.go View File


+ 4
- 4
state/execution_test.go View File

@ -16,7 +16,7 @@ import (
cmn "github.com/tendermint/tendermint/libs/common" cmn "github.com/tendermint/tendermint/libs/common"
dbm "github.com/tendermint/tendermint/libs/db" dbm "github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log" "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/proxy"
"github.com/tendermint/tendermint/types" "github.com/tendermint/tendermint/types"
tmtime "github.com/tendermint/tendermint/types/time" tmtime "github.com/tendermint/tendermint/types/time"
@ -38,7 +38,7 @@ func TestApplyBlock(t *testing.T) {
state, stateDB := state(1, 1) state, stateDB := state(1, 1)
blockExec := NewBlockExecutor(stateDB, log.TestingLogger(), proxyApp.Consensus(), blockExec := NewBlockExecutor(stateDB, log.TestingLogger(), proxyApp.Consensus(),
memplmock.Mempool{}, MockEvidencePool{})
mock.Mempool{}, MockEvidencePool{})
block := makeBlock(state, 1) block := makeBlock(state, 1)
blockID := types.BlockID{block.Hash(), block.MakePartSet(testPartSize).Header()} blockID := types.BlockID{block.Hash(), block.MakePartSet(testPartSize).Header()}
@ -310,7 +310,7 @@ func TestEndBlockValidatorUpdates(t *testing.T) {
state, stateDB := state(1, 1) 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() eventBus := types.NewEventBus()
err = eventBus.Start() err = eventBus.Start()
@ -367,7 +367,7 @@ func TestEndBlockValidatorUpdatesResultingInEmptySet(t *testing.T) {
defer proxyApp.Stop() defer proxyApp.Stop()
state, stateDB := state(1, 1) 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) block := makeBlock(state, 1)
blockID := types.BlockID{block.Hash(), block.MakePartSet(testPartSize).Header()} blockID := types.BlockID{block.Hash(), block.MakePartSet(testPartSize).Header()}


Loading…
Cancel
Save