From c13f612c54a8cfd5a4a77d27d588fe1235958e52 Mon Sep 17 00:00:00 2001 From: mmsqe Date: Thu, 30 May 2024 13:59:58 +0800 Subject: [PATCH] use sdk mempool --- app/app.go | 18 ++++++++++++++++++ go.mod | 3 +-- go.sum | 8 ++++---- gomod2nix.toml | 9 ++++----- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/app/app.go b/app/app.go index d8c31380f3..b895ba6216 100644 --- a/app/app.go +++ b/app/app.go @@ -330,6 +330,8 @@ type App struct { invCheckPeriod uint + chPendingTx chan []byte + // keys to access the substores keys map[string]*storetypes.KVStoreKey tkeys map[string]*storetypes.TransientStoreKey @@ -466,6 +468,7 @@ func New( tkeys: tkeys, memKeys: memKeys, blockProposalHandler: blockProposalHandler, + chPendingTx: make(chan []byte), } // init params keeper and subspaces @@ -1212,6 +1215,21 @@ func (app *App) RegisterTendermintService(clientCtx client.Context) { ) } +func (app *App) PendingTxStream() <-chan []byte { + return app.chPendingTx +} + +func (app *App) CheckTx(req abci.RequestCheckTx) abci.ResponseCheckTx { + res := app.BaseApp.CheckTx(req) + if res.Code == 0 && req.Type == abci.CheckTxType_New { + select { + case app.chPendingTx <- req.Tx: + default: + } + } + return res +} + func (app *App) RegisterNodeService(clientCtx client.Context) { node.RegisterNodeService(clientCtx, app.GRPCQueryRouter()) } diff --git a/go.mod b/go.mod index 9c11139d77..d3837e0bd6 100644 --- a/go.mod +++ b/go.mod @@ -240,7 +240,6 @@ require ( replace ( // Use cosmos keyring github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 - github.com/cometbft/cometbft => github.com/mmsqe/cometbft v0.37.0-rc3.0.20240522022348-4d00e28bcfec github.com/cometbft/cometbft-db => github.com/crypto-org-chain/cometbft-db v0.0.0-20231011055109-57922ac52a63 // release/v0.47.x github.com/cosmos/cosmos-sdk => github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20240517084251-5ba20d99ec23 @@ -251,7 +250,7 @@ replace ( // TODO: remove it: https://github.com/cosmos/cosmos-sdk/issues/13134 github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2 github.com/ethereum/go-ethereum => github.com/crypto-org-chain/go-ethereum v1.10.20-0.20231207063621-43cf32d91c3e - github.com/evmos/ethermint => github.com/mmsqe/ethermint v0.6.5-0.20240522022734-81d7d1c6f7dc + github.com/evmos/ethermint => github.com/mmsqe/ethermint v0.6.5-0.20240530055349-d980b89eab00 // Fix upstream GHSA-h395-qcrw-5vmq and GHSA-3vp4-m3rf-835h vulnerabilities. // TODO Remove it: https://github.com/cosmos/cosmos-sdk/issues/10409 github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.9.0 diff --git a/go.sum b/go.sum index 0c8d66bd3f..cb2e94fda5 100644 --- a/go.sum +++ b/go.sum @@ -426,6 +426,8 @@ github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZ github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/coinbase/rosetta-sdk-go/types v1.0.0 h1:jpVIwLcPoOeCR6o1tU+Xv7r5bMONNbHU7MuEHboiFuA= github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c= +github.com/cometbft/cometbft v0.37.7-0.20240515092623-8a0f4814d1dc h1:uXdNbzatJAZ+hznHwYU22BePtqqf2VCRssnm7/0DD3M= +github.com/cometbft/cometbft v0.37.7-0.20240515092623-8a0f4814d1dc/go.mod h1:gFGCFXNGDci6tMLemANPGTfU+j4+oH63PjeLe0iIjJk= github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4= github.com/confio/ics23/go v0.9.0/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e/mYVRak= github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= @@ -1166,10 +1168,8 @@ github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjU github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.1/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/mmsqe/cometbft v0.37.0-rc3.0.20240522022348-4d00e28bcfec h1:o84e+ylSFjwhmtxpqiL9YNtMPXp2c84jwLLSAOXgRwM= -github.com/mmsqe/cometbft v0.37.0-rc3.0.20240522022348-4d00e28bcfec/go.mod h1:gFGCFXNGDci6tMLemANPGTfU+j4+oH63PjeLe0iIjJk= -github.com/mmsqe/ethermint v0.6.5-0.20240522022734-81d7d1c6f7dc h1:2l2edGRledFzcV9/U+7WaWEQobJ1AvJFWZ+9bv/YiQg= -github.com/mmsqe/ethermint v0.6.5-0.20240522022734-81d7d1c6f7dc/go.mod h1:/AJSi8cTL8Pnlr/lKXmcQqy9z9JBsUUC568gedozArE= +github.com/mmsqe/ethermint v0.6.5-0.20240530055349-d980b89eab00 h1:tCIpIXk5dtpUONlVfQ2+TMTc8yxYjE5KK7pqNJ2Ywgw= +github.com/mmsqe/ethermint v0.6.5-0.20240530055349-d980b89eab00/go.mod h1:R/gopCwdgJ6/7T8T3hsX/YaLjpfHdWZoBglTQS1OyMk= github.com/moby/sys/mountinfo v0.5.0/go.mod h1:3bMD3Rg+zkqx8MRYPi7Pyb0Ie97QEBmdxbhnCLlSvSU= github.com/moby/term v0.0.0-20201216013528-df9cb8a40635/go.mod h1:FBS0z0QWA44HXygs7VXDUOGoN/1TV3RuWkLO04am3wc= github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6/go.mod h1:E2VnQOmVuvZB6UYnnDB0qG5Nq/1tD9acaOpo6xmt0Kw= diff --git a/gomod2nix.toml b/gomod2nix.toml index 37221c44aa..7a1e2defb8 100644 --- a/gomod2nix.toml +++ b/gomod2nix.toml @@ -126,9 +126,8 @@ schema = 3 version = "v1.0.0" hash = "sha256-z/0E0NiEGo7zxM7d94ImgUf8P0/KG6hbP9T4Vuym4p0=" [mod."github.com/cometbft/cometbft"] - version = "v0.37.0-rc3.0.20240522022348-4d00e28bcfec" - hash = "sha256-4PHL+1goJV+F8cT/a41l7U6PYp6y2dGuXg2vD0qqAh0=" - replaced = "github.com/mmsqe/cometbft" + version = "v0.37.7-0.20240515092623-8a0f4814d1dc" + hash = "sha256-e5IRb9X+IfkcNlG/95JTuv31R7uafdWpP1wWRvg7uSM=" [mod."github.com/cometbft/cometbft-db"] version = "v0.0.0-20231011055109-57922ac52a63" hash = "sha256-iLs/FN1be3AcoyhKj2+b5Msqeat9j2ja4acyOs+w+Uk=" @@ -220,8 +219,8 @@ schema = 3 hash = "sha256-lDIqRLUrXYCb9mmFBY/+WW+ee69+IkxOgqjHVyo4ij0=" replaced = "github.com/crypto-org-chain/go-ethereum" [mod."github.com/evmos/ethermint"] - version = "v0.6.5-0.20240522022734-81d7d1c6f7dc" - hash = "sha256-OomNb+DfR0MrTQ7zoyoyeG/E3kFvVjlCfu7BM3SwUx8=" + version = "v0.6.5-0.20240530055349-d980b89eab00" + hash = "sha256-L6J3nY9ZcCcFLHtQAwkqH/oVgyz2FQvrxafUgi2HUIM=" replaced = "github.com/mmsqe/ethermint" [mod."github.com/felixge/httpsnoop"] version = "v1.0.4"