Skip to content

Commit 5a7f535

Browse files
authored
feat(krakatoa): operate_exclusively toggles krakatoa features (#1060)
* add flag for operate exclusively and populate from config instead of hard coding * legacy pool tx lifecycle hooks are a no op if mempool is not operating exclusively * dont supply rechecker to legacypool if not operating exclusively * use BroadcastTxFn if mempool is not operating exclusively, broadcast within on tx promoted hook instead of directly within legacypool * abstract insert behavior behind Inserter interface to hide queue vs sync behavior * update tests * linting * update test to default off krakatoa * typo * refactor to new Krakatoa Mempool instance instead of both feature sets in one struct * thread mempool and new interfaces through backend and json rpc server * experimental mempool should broadcast evm txs on promote * updates * add back in pending method for legacypool * queue test updates * update VMKeeperI mocks * legacypool tests * iterator bench test * blockchain tests * unit tests passing * integration tests compiling * fix remove nil ptr * integration tests passing * integration test support for exlcusive mempool * linting * allow custom node arguments to be specified when running a system test * fix * debug * fix suite init * fix * update test * krakatoa system test * reset timeout commit if not set * remove print * set event bus correctly for krakatoa mempool * debig * add back in systemtests * add synchronous evm recheck function for test determinism * refactor duplicate code from evm tx store and legacypool * use AllowUnsafeSyncInsert for determinism * update comment * greptile * fix build * remove
1 parent 43a1f17 commit 5a7f535

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1509
-829
lines changed

evmd/app.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ type EVMD struct {
185185
FeeMarketKeeper feemarketkeeper.Keeper
186186
EVMKeeper *evmkeeper.Keeper
187187
Erc20Keeper erc20keeper.Keeper
188-
EVMMempool *evmmempool.ExperimentalEVMMempool
188+
EVMMempool sdkmempool.ExtMempool
189189

190190
// the module manager
191191
ModuleManager *module.Manager

evmd/mempool.go

Lines changed: 76 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ import (
1717
sdkmempool "github.com/cosmos/cosmos-sdk/types/mempool"
1818
)
1919

20-
// enables abci.InsertTx & abci.ReapTxs to be used exclusively by the mempool.
21-
// @see evmmempool.ExperimentalEVMMempool.OperateExclusively
22-
const mempoolOperateExclusively = true
23-
2420
// configureEVMMempool sets up the EVM mempool and related handlers using viper configuration.
2521
func (app *EVMD) configureEVMMempool(appOpts servertypes.AppOptions, logger log.Logger) error {
2622
if evmtypes.GetChainConfig() == nil {
@@ -34,65 +30,97 @@ func (app *EVMD) configureEVMMempool(appOpts servertypes.AppOptions, logger log.
3430
return nil
3531
}
3632

37-
mempoolConfig, err := app.createMempoolConfig(appOpts, logger)
38-
if err != nil {
39-
return fmt.Errorf("failed to get mempool config: %w", err)
33+
if server.GetShouldOperateExclusively(appOpts, logger) {
34+
logger.Info("app-side mempool is operating exclusively, setting up Krakatoa mempool")
35+
36+
krakatoaConfig := app.createKrakatoaMempoolConfig(appOpts, logger)
37+
txEncoder := evmmempool.NewTxEncoder(app.txConfig)
38+
evmRechecker := evmmempool.NewTxRechecker(krakatoaConfig.AnteHandler, txEncoder)
39+
cosmosRechecker := evmmempool.NewTxRechecker(krakatoaConfig.AnteHandler, txEncoder)
40+
41+
krakatoaMempool := evmmempool.NewKrakatoaMempool(
42+
app.CreateQueryContext,
43+
logger,
44+
app.EVMKeeper,
45+
app.FeeMarketKeeper,
46+
app.txConfig,
47+
evmRechecker,
48+
cosmosRechecker,
49+
krakatoaConfig,
50+
cosmosPoolMaxTx,
51+
)
52+
53+
app.SetInsertTxHandler(app.NewInsertTxHandler(krakatoaMempool))
54+
app.SetReapTxsHandler(app.NewReapTxsHandler(krakatoaMempool))
55+
56+
txVerifier := NewNoCheckProposalTxVerifier(app.BaseApp)
57+
abciProposalHandler := baseapp.NewDefaultProposalHandler(krakatoaMempool, txVerifier)
58+
abciProposalHandler.SetSignerExtractionAdapter(
59+
evmmempool.NewEthSignerExtractionAdapter(
60+
sdkmempool.NewDefaultSignerExtractionAdapter(),
61+
),
62+
)
63+
app.SetPrepareProposal(abciProposalHandler.PrepareProposalHandler())
64+
65+
app.EVMMempool = krakatoaMempool
66+
app.SetMempool(krakatoaMempool)
67+
} else {
68+
logger.Info("app-side mempool is not operating exclusively, setting up default EVM mempool")
69+
70+
evmMempool := evmmempool.NewExperimentalEVMMempool(
71+
app.CreateQueryContext,
72+
logger,
73+
app.EVMKeeper,
74+
app.FeeMarketKeeper,
75+
app.txConfig,
76+
app.createMempoolConfig(appOpts, logger),
77+
cosmosPoolMaxTx,
78+
)
79+
80+
app.SetCheckTxHandler(evmmempool.NewCheckTxHandler(evmMempool))
81+
82+
abciProposalHandler := baseapp.NewDefaultProposalHandler(evmMempool, app)
83+
abciProposalHandler.SetSignerExtractionAdapter(
84+
evmmempool.NewEthSignerExtractionAdapter(
85+
sdkmempool.NewDefaultSignerExtractionAdapter(),
86+
),
87+
)
88+
app.SetPrepareProposal(abciProposalHandler.PrepareProposalHandler())
89+
90+
app.EVMMempool = evmMempool
91+
app.SetMempool(evmMempool)
4092
}
4193

42-
txEncoder := evmmempool.NewTxEncoder(app.txConfig)
43-
evmRechecker := evmmempool.NewTxRechecker(mempoolConfig.AnteHandler, txEncoder)
44-
cosmosRechecker := evmmempool.NewTxRechecker(mempoolConfig.AnteHandler, txEncoder)
45-
46-
evmMempool := evmmempool.NewExperimentalEVMMempool(
47-
app.CreateQueryContext,
48-
logger,
49-
app.EVMKeeper,
50-
app.FeeMarketKeeper,
51-
app.txConfig,
52-
txEncoder,
53-
evmRechecker,
54-
cosmosRechecker,
55-
mempoolConfig,
56-
cosmosPoolMaxTx,
57-
)
58-
app.EVMMempool = evmMempool
59-
app.SetMempool(evmMempool)
60-
checkTxHandler := evmmempool.NewCheckTxHandler(evmMempool)
61-
app.SetCheckTxHandler(checkTxHandler)
62-
app.SetInsertTxHandler(app.NewInsertTxHandler(evmMempool))
63-
app.SetReapTxsHandler(app.NewReapTxsHandler(evmMempool))
64-
65-
txVerifier := NewNoCheckProposalTxVerifier(app.BaseApp)
66-
abciProposalHandler := baseapp.NewDefaultProposalHandler(evmMempool, txVerifier)
67-
abciProposalHandler.SetSignerExtractionAdapter(
68-
evmmempool.NewEthSignerExtractionAdapter(
69-
sdkmempool.NewDefaultSignerExtractionAdapter(),
70-
),
71-
)
72-
app.SetPrepareProposal(abciProposalHandler.PrepareProposalHandler())
73-
7494
return nil
7595
}
7696

7797
// createMempoolConfig creates a new EVMMempoolConfig with the default configuration
7898
// and overrides it with values from appOpts if they exist and are non-zero.
79-
func (app *EVMD) createMempoolConfig(appOpts servertypes.AppOptions, logger log.Logger) (*evmmempool.EVMMempoolConfig, error) {
99+
func (app *EVMD) createMempoolConfig(appOpts servertypes.AppOptions, logger log.Logger) *evmmempool.EVMMempoolConfig {
80100
return &evmmempool.EVMMempoolConfig{
81-
AnteHandler: app.GetAnteHandler(),
82-
LegacyPoolConfig: server.GetLegacyPoolConfig(appOpts, logger),
83-
BlockGasLimit: server.GetBlockGasLimit(appOpts, logger),
84-
MinTip: server.GetMinTip(appOpts, logger),
85-
OperateExclusively: mempoolOperateExclusively,
101+
AnteHandler: app.GetAnteHandler(),
102+
LegacyPoolConfig: server.GetLegacyPoolConfig(appOpts, logger),
103+
BlockGasLimit: server.GetBlockGasLimit(appOpts, logger),
104+
MinTip: server.GetMinTip(appOpts, logger),
105+
}
106+
}
107+
108+
// createKrakatoaMempoolConfig creates a new KrakatoaMempoolConfig with the default configuration
109+
// and overrides it with values from appOpts if they exist and are non-zero.
110+
func (app *EVMD) createKrakatoaMempoolConfig(appOpts servertypes.AppOptions, logger log.Logger) *evmmempool.KrakatoaMempoolConfig {
111+
mempoolConfig := app.createMempoolConfig(appOpts, logger)
112+
return &evmmempool.KrakatoaMempoolConfig{
113+
EVMMempoolConfig: *mempoolConfig,
86114
PendingTxProposalTimeout: server.GetPendingTxProposalTimeout(appOpts, logger),
87115
InsertQueueSize: server.GetMempoolInsertQueueSize(appOpts, logger),
88-
}, nil
116+
}
89117
}
90118

91119
const (
92120
CodeTypeNoRetry = 1
93121
)
94122

95-
func (app *EVMD) NewInsertTxHandler(evmMempool *evmmempool.ExperimentalEVMMempool) sdk.InsertTxHandler {
123+
func (app *EVMD) NewInsertTxHandler(evmMempool *evmmempool.KrakatoaMempool) sdk.InsertTxHandler {
96124
return func(req *abci.RequestInsertTx) (*abci.ResponseInsertTx, error) {
97125
txBytes := req.GetTx()
98126

@@ -121,7 +149,7 @@ func (app *EVMD) NewInsertTxHandler(evmMempool *evmmempool.ExperimentalEVMMempoo
121149
}
122150
}
123151

124-
func (app *EVMD) NewReapTxsHandler(evmMempool *evmmempool.ExperimentalEVMMempool) sdk.ReapTxsHandler {
152+
func (app *EVMD) NewReapTxsHandler(evmMempool *evmmempool.KrakatoaMempool) sdk.ReapTxsHandler {
125153
return func(req *abci.RequestReapTxs) (*abci.ResponseReapTxs, error) {
126154
maxBytes, maxGas := req.GetMaxBytes(), req.GetMaxGas()
127155
txs, err := evmMempool.ReapNewValidTxs(maxBytes, maxGas)

evmd/tests/integration/create_app.go

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
dbm "github.com/cosmos/cosmos-db"
88
"github.com/cosmos/evm"
99
"github.com/cosmos/evm/evmd"
10-
evmmempool "github.com/cosmos/evm/mempool"
1110
srvflags "github.com/cosmos/evm/server/flags"
1211
"github.com/cosmos/evm/testutil/constants"
1312
feemarkettypes "github.com/cosmos/evm/x/feemarket/types"
@@ -23,9 +22,8 @@ import (
2322
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
2423
)
2524

26-
// CreateEvmd creates an evm app for regular integration tests (non-mempool)
27-
// This version uses a noop mempool to avoid state issues during transaction processing
28-
func CreateEvmd(chainID string, evmChainID uint64, customBaseAppOptions ...func(*baseapp.BaseApp)) evm.EvmApp {
25+
// CreateEvmd creates an evm app for integration tests
26+
func CreateEvmd(chainID string, evmChainID uint64, exclusiveMempool bool, customBaseAppOptions ...func(*baseapp.BaseApp)) evm.EvmApp {
2927
// A temporary home directory is created and used to prevent race conditions
3028
// related to home directory locks in chains that use the WASM module.
3129
defaultNodeHome, err := os.MkdirTemp("", "evmd-temp-homedir")
@@ -36,7 +34,7 @@ func CreateEvmd(chainID string, evmChainID uint64, customBaseAppOptions ...func(
3634
db := dbm.NewMemDB()
3735
logger := log.NewNopLogger()
3836
loadLatest := true
39-
appOptions := NewAppOptionsWithFlagHomeAndChainID(defaultNodeHome, evmChainID)
37+
appOptions := NewAppOptionsWithFlagHomeAndChainID(defaultNodeHome, evmChainID, exclusiveMempool)
4038

4139
baseAppOptions := append(customBaseAppOptions, baseapp.SetChainID(chainID))
4240

@@ -55,8 +53,8 @@ func CreateEvmd(chainID string, evmChainID uint64, customBaseAppOptions ...func(
5553
WithHeight(1).
5654
WithTxConfig(app.GetTxConfig())
5755

58-
// Get the mempool and set the client context
59-
if m, ok := app.GetMempool().(*evmmempool.ExperimentalEVMMempool); ok && m != nil {
56+
// Get the mempool and set the client context if supported
57+
if m, ok := app.GetMempool().(interface{ SetClientCtx(client.Context) }); ok && m != nil {
6058
m.SetClientCtx(clientCtx)
6159
}
6260

@@ -76,7 +74,7 @@ func SetupEvmd() (ibctesting.TestingApp, map[string]json.RawMessage) {
7674
dbm.NewMemDB(),
7775
nil,
7876
true,
79-
NewAppOptionsWithFlagHomeAndChainID(defaultNodeHome, constants.EighteenDecimalsChainID),
77+
NewAppOptionsWithFlagHomeAndChainID(defaultNodeHome, constants.EighteenDecimalsChainID, false),
8078
)
8179
// disable base fee for testing
8280
genesisState := app.DefaultGenesis()
@@ -93,11 +91,12 @@ func SetupEvmd() (ibctesting.TestingApp, map[string]json.RawMessage) {
9391
return app, genesisState
9492
}
9593

96-
func NewAppOptionsWithFlagHomeAndChainID(home string, evmChainID uint64) simutils.AppOptionsMap {
94+
func NewAppOptionsWithFlagHomeAndChainID(home string, evmChainID uint64, exlcusiveMempool bool) simutils.AppOptionsMap {
9795
return simutils.AppOptionsMap{
98-
flags.FlagHome: home,
99-
srvflags.EVMChainID: evmChainID,
100-
srvflags.EVMMempoolInsertQueueSize: 5000,
96+
flags.FlagHome: home,
97+
srvflags.EVMChainID: evmChainID,
98+
srvflags.EVMMempoolOperateExclusively: exlcusiveMempool,
99+
srvflags.EVMMempoolInsertQueueSize: 5000,
101100
srvflags.EVMMempoolPendingTxProposalTimeout: "250ms",
102101
}
103102
}

evmd/tests/integration/mempool/mempool_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,15 @@ import (
99
"github.com/cosmos/evm/evmd/tests/integration"
1010
"github.com/cosmos/evm/tests/integration/mempool"
1111
testapp "github.com/cosmos/evm/testutil/app"
12+
"github.com/cosmos/evm/testutil/integration/evm/network"
1213
)
1314

1415
func TestMempoolIntegrationTestSuite(t *testing.T) {
1516
create := testapp.ToEvmAppCreator[evm.IntegrationNetworkApp](integration.CreateEvmd, "evm.IntegrationNetworkApp")
1617
suite.Run(t, mempool.NewMempoolIntegrationTestSuite(create))
1718
}
19+
20+
func TestKrakatoaMempoolIntegrationTestSuite(t *testing.T) {
21+
create := testapp.ToEvmAppCreator[evm.IntegrationNetworkApp](integration.CreateEvmd, "evm.IntegrationNetworkApp")
22+
suite.Run(t, mempool.NewMempoolIntegrationTestSuite(create, network.WithExclusiveMempool()))
23+
}

go.mod

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ require (
115115
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
116116
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
117117
github.com/cespare/xxhash/v2 v2.3.0 // indirect
118+
github.com/chigopher/pathlib v0.19.1 // indirect
118119
github.com/chzyer/readline v1.5.1 // indirect
119120
github.com/cloudwego/base64x v0.1.6 // indirect
120121
github.com/cncf/xds/go v0.0.0-20251210132809-ee656c7534f5 // indirect
@@ -195,12 +196,14 @@ require (
195196
github.com/hdevalence/ed25519consensus v0.2.0 // indirect
196197
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
197198
github.com/huandu/skiplist v1.2.1 // indirect
199+
github.com/huandu/xstrings v1.4.0 // indirect
198200
github.com/huin/goupnp v1.3.0 // indirect
199201
github.com/iancoleman/strcase v0.3.0 // indirect
200202
github.com/inconshreveable/mousetrap v1.1.0 // indirect
201203
github.com/ipfs/go-cid v0.5.0 // indirect
202204
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
203205
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
206+
github.com/jinzhu/copier v0.4.0 // indirect
204207
github.com/jmhodges/levigo v1.0.0 // indirect
205208
github.com/klauspost/compress v1.18.4 // indirect
206209
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
@@ -306,6 +309,7 @@ require (
306309
github.com/tklauser/numcpus v0.11.0 // indirect
307310
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
308311
github.com/ulikunitz/xz v0.5.15 // indirect
312+
github.com/vektra/mockery/v2 v2.53.6 // indirect
309313
github.com/wlynxg/anet v0.0.5 // indirect
310314
github.com/yusufpapurcu/wmi v1.2.4 // indirect
311315
github.com/zondax/golem v0.27.0 // indirect

go.sum

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF
201201
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
202202
github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY=
203203
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk=
204+
github.com/chigopher/pathlib v0.19.1 h1:RoLlUJc0CqBGwq239cilyhxPNLXTK+HXoASGyGznx5A=
205+
github.com/chigopher/pathlib v0.19.1/go.mod h1:tzC1dZLW8o33UQpWkNkhvPwL5n4yyFRFm/jL1YGWFvY=
204206
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
205207
github.com/chzyer/logex v1.2.1 h1:XHDu3E6q+gdHgsdTPH6ImJMIp436vR6MPtH8gP05QzM=
206208
github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ=
@@ -609,6 +611,8 @@ github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3
609611
github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U=
610612
github.com/huandu/skiplist v1.2.1 h1:dTi93MgjwErA/8idWTzIw4Y1kZsMWx35fmI2c8Rij7w=
611613
github.com/huandu/skiplist v1.2.1/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w=
614+
github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU=
615+
github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
612616
github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg=
613617
github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc=
614618
github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8=
@@ -638,6 +642,8 @@ github.com/jhump/protoreflect v1.18.0 h1:TOz0MSR/0JOZ5kECB/0ufGnC2jdsgZ123Rd/k4Z
638642
github.com/jhump/protoreflect v1.18.0/go.mod h1:ezWcltJIVF4zYdIFM+D/sHV4Oh5LNU08ORzCGfwvTz8=
639643
github.com/jhump/protoreflect/v2 v2.0.0-beta.1 h1:Dw1rslK/VotaUGYsv53XVWITr+5RCPXfvvlGrM/+B6w=
640644
github.com/jhump/protoreflect/v2 v2.0.0-beta.1/go.mod h1:D9LBEowZyv8/iSu97FU2zmXG3JxVTmNw21mu63niFzU=
645+
github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8=
646+
github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg=
641647
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
642648
github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U=
643649
github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ=
@@ -1117,6 +1123,8 @@ github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY=
11171123
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
11181124
github.com/urfave/cli/v2 v2.27.5 h1:WoHEJLdsXr6dDWoJgMq/CboDmyY/8HMMH1fTECbih+w=
11191125
github.com/urfave/cli/v2 v2.27.5/go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ=
1126+
github.com/vektra/mockery/v2 v2.53.6 h1:qfUB6saauu652ZlMF/mEdlj7B/A0fw2XR0XBACBrf7Y=
1127+
github.com/vektra/mockery/v2 v2.53.6/go.mod h1:fjxC+mskIZqf67+z34pHxRRyyZnPnWNA36Cirf01Pkg=
11201128
github.com/wlynxg/anet v0.0.3/go.mod h1:eay5PRQr7fIVAMbTbchTnO9gG65Hg/uYGdc7mguHxoA=
11211129
github.com/wlynxg/anet v0.0.5 h1:J3VJGi1gvo0JwZ/P1/Yc/8p63SoW98B5dHkYDmpgvvU=
11221130
github.com/wlynxg/anet v0.0.5/go.mod h1:eay5PRQr7fIVAMbTbchTnO9gG65Hg/uYGdc7mguHxoA=

mempool/blockchain_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func TestBlockchainRaceCondition(t *testing.T) {
4545
logger := log.NewNopLogger()
4646

4747
// Create mock keepers using generated mocks
48-
mockVMKeeper := mocks.NewVMKeeper(t)
48+
mockVMKeeper := mocks.NewVMKeeperI(t)
4949
mockFeeMarketKeeper := mocks.NewFeeMarketKeeper(t)
5050

5151
ethCfg := vmtypes.DefaultChainConfig(constants.EighteenDecimalsChainID)

mempool/interface.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ import (
1313
sdk "github.com/cosmos/cosmos-sdk/types"
1414
)
1515

16+
// NotifiedMempool is the set of methods that a mempool must implement in order
17+
// to be notified of new blocks by this Keeper via the EndBlocker.
18+
type NotifiedMempool interface {
19+
// HasEventBus returns true if the mempool has an event bus configured to
20+
// get cometbft events
21+
HasEventBus() bool
22+
23+
// GetBlockchain returns the mempools blockchain representation.
24+
GetBlockchain() *Blockchain
25+
}
26+
1627
type VMKeeperI interface {
1728
GetBaseFee(ctx sdk.Context) *big.Int
1829
GetParams(ctx sdk.Context) (params vmtypes.Params)
@@ -29,7 +40,7 @@ type VMKeeperI interface {
2940
SetCode(ctx sdk.Context, codeHash []byte, code []byte)
3041
DeleteAccount(ctx sdk.Context, addr common.Address) error
3142
KVStoreKeys() map[string]storetypes.StoreKey
32-
SetEvmMempool(evmMempool *ExperimentalEVMMempool)
43+
SetEvmMempool(evmMempool NotifiedMempool)
3344
}
3445

3546
type FeeMarketKeeperI interface {

mempool/internal/queue/queue.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import (
88

99
"github.com/gammazero/deque"
1010

11-
"cosmossdk.io/log/v2"
12-
1311
"github.com/cosmos/cosmos-sdk/telemetry"
1412
)
1513

@@ -40,18 +38,16 @@ type Queue[Tx any] struct {
4038
// rejecting new additions
4139
maxSize int
4240

43-
logger log.Logger
44-
done chan struct{}
41+
done chan struct{}
4542
}
4643

4744
var ErrQueueFull = errors.New("queue full")
4845

4946
// New creates a new queue.
50-
func New[Tx any](insert func(txs []*Tx) []error, maxSize int, logger log.Logger) *Queue[Tx] {
47+
func New[Tx any](insert func(txs []*Tx) []error, maxSize int) *Queue[Tx] {
5148
iq := &Queue[Tx]{
5249
insert: insert,
5350
maxSize: maxSize,
54-
logger: logger,
5551
signal: make(chan struct{}, 1),
5652
done: make(chan struct{}),
5753
}

0 commit comments

Comments
 (0)