mirror of
https://github.com/tendermint/tendermint.git
synced 2025-12-23 06:15:19 +00:00
* Updated mocks * add reactor tests * add v1 reactor tests * Fix fuzz test for priority mempool * e2e adapted to mempool v1; prio pool is default now * Reverted default mempool to be fifo * Changed buf version * Added priority mempool to ci testnet * Fixed linter * Updated makefile * Aligned makefile changes to v0.34.x * Added go install for proto * Add log message to warn about prioritized mempool bug Signed-off-by: Thane Thomson <connect@thanethomson.com> * Changelog message Co-authored-by: Jasmina Malicevic <jasmina.dustinac@gmail.com> Co-authored-by: Callum Waters <cmwaters19@gmail.com> Co-authored-by: Sam Kleinman <garen@tychoish.com> Co-authored-by: Thane Thomson <connect@thanethomson.com>
97 lines
2.8 KiB
Go
97 lines
2.8 KiB
Go
package consensus
|
|
|
|
import (
|
|
abci "github.com/tendermint/tendermint/abci/types"
|
|
"github.com/tendermint/tendermint/libs/clist"
|
|
mempl "github.com/tendermint/tendermint/mempool"
|
|
tmstate "github.com/tendermint/tendermint/proto/tendermint/state"
|
|
"github.com/tendermint/tendermint/proxy"
|
|
"github.com/tendermint/tendermint/types"
|
|
)
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
type emptyMempool struct{}
|
|
|
|
var _ mempl.Mempool = emptyMempool{}
|
|
|
|
func (emptyMempool) Lock() {}
|
|
func (emptyMempool) Unlock() {}
|
|
func (emptyMempool) Size() int { return 0 }
|
|
func (emptyMempool) SizeBytes() int64 { return 0 }
|
|
func (emptyMempool) CheckTx(_ types.Tx, _ func(*abci.Response), _ mempl.TxInfo) error {
|
|
return nil
|
|
}
|
|
|
|
func (txmp emptyMempool) RemoveTxByKey(txKey types.TxKey) error {
|
|
return nil
|
|
}
|
|
|
|
func (emptyMempool) ReapMaxBytesMaxGas(_, _ int64) types.Txs { return types.Txs{} }
|
|
func (emptyMempool) ReapMaxTxs(n int) types.Txs { return types.Txs{} }
|
|
func (emptyMempool) Update(
|
|
_ int64,
|
|
_ types.Txs,
|
|
_ []*abci.ResponseDeliverTx,
|
|
_ mempl.PreCheckFunc,
|
|
_ mempl.PostCheckFunc,
|
|
) error {
|
|
return nil
|
|
}
|
|
func (emptyMempool) Flush() {}
|
|
func (emptyMempool) FlushAppConn() error { return nil }
|
|
func (emptyMempool) TxsAvailable() <-chan struct{} { return make(chan struct{}) }
|
|
func (emptyMempool) EnableTxsAvailable() {}
|
|
func (emptyMempool) TxsBytes() int64 { return 0 }
|
|
|
|
func (emptyMempool) TxsFront() *clist.CElement { return nil }
|
|
func (emptyMempool) TxsWaitChan() <-chan struct{} { return nil }
|
|
|
|
func (emptyMempool) InitWAL() error { return nil }
|
|
func (emptyMempool) CloseWAL() {}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// mockProxyApp uses ABCIResponses to give the right results.
|
|
//
|
|
// Useful because we don't want to call Commit() twice for the same block on
|
|
// the real app.
|
|
|
|
func newMockProxyApp(appHash []byte, abciResponses *tmstate.ABCIResponses) proxy.AppConnConsensus {
|
|
clientCreator := proxy.NewLocalClientCreator(&mockProxyApp{
|
|
appHash: appHash,
|
|
abciResponses: abciResponses,
|
|
})
|
|
cli, _ := clientCreator.NewABCIClient()
|
|
err := cli.Start()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return proxy.NewAppConnConsensus(cli)
|
|
}
|
|
|
|
type mockProxyApp struct {
|
|
abci.BaseApplication
|
|
|
|
appHash []byte
|
|
txCount int
|
|
abciResponses *tmstate.ABCIResponses
|
|
}
|
|
|
|
func (mock *mockProxyApp) DeliverTx(req abci.RequestDeliverTx) abci.ResponseDeliverTx {
|
|
r := mock.abciResponses.DeliverTxs[mock.txCount]
|
|
mock.txCount++
|
|
if r == nil {
|
|
return abci.ResponseDeliverTx{}
|
|
}
|
|
return *r
|
|
}
|
|
|
|
func (mock *mockProxyApp) EndBlock(req abci.RequestEndBlock) abci.ResponseEndBlock {
|
|
mock.txCount = 0
|
|
return *mock.abciResponses.EndBlock
|
|
}
|
|
|
|
func (mock *mockProxyApp) Commit() abci.ResponseCommit {
|
|
return abci.ResponseCommit{Data: mock.appHash}
|
|
}
|