Skip to content

Commit

Permalink
txnprovider: move txpool away from erigon-lib (#12718)
Browse files Browse the repository at this point in the history
  • Loading branch information
taratorio authored Nov 14, 2024
1 parent d6ad01f commit 0d22267
Show file tree
Hide file tree
Showing 249 changed files with 32 additions and 36 deletions.
3 changes: 2 additions & 1 deletion cmd/rpcdaemon/rpcservices/eth_txpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ import (
"google.golang.org/grpc"
"google.golang.org/protobuf/types/known/emptypb"

txpool2 "github.com/erigontech/erigon/txnprovider/txpool"

"github.com/erigontech/erigon-lib/gointerfaces"
"github.com/erigontech/erigon-lib/gointerfaces/grpcutil"
txpooproto "github.com/erigontech/erigon-lib/gointerfaces/txpoolproto"
"github.com/erigontech/erigon-lib/log/v3"
txpool2 "github.com/erigontech/erigon-lib/txpool"
)

type TxPoolService struct {
Expand Down
6 changes: 3 additions & 3 deletions cmd/txpool/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ import (
"github.com/erigontech/erigon-lib/kv/remotedb"
"github.com/erigontech/erigon-lib/kv/remotedbserver"
"github.com/erigontech/erigon-lib/log/v3"
"github.com/erigontech/erigon-lib/txpool"
"github.com/erigontech/erigon-lib/txpool/txpoolcfg"
"github.com/erigontech/erigon-lib/txpool/txpoolutil"
"github.com/erigontech/erigon-lib/types"
"github.com/erigontech/erigon/cmd/rpcdaemon/rpcdaemontest"
common2 "github.com/erigontech/erigon/common"
"github.com/erigontech/erigon/consensus/misc"
"github.com/erigontech/erigon/ethdb/privateapi"
"github.com/erigontech/erigon/txnprovider/txpool"
"github.com/erigontech/erigon/txnprovider/txpool/txpoolcfg"
"github.com/erigontech/erigon/txnprovider/txpool/txpoolutil"

"github.com/erigontech/erigon/cmd/utils"
"github.com/erigontech/erigon/common/paths"
Expand Down
2 changes: 1 addition & 1 deletion cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import (
"github.com/erigontech/erigon-lib/direct"
downloadercfg2 "github.com/erigontech/erigon-lib/downloader/downloadercfg"
"github.com/erigontech/erigon-lib/log/v3"
"github.com/erigontech/erigon-lib/txpool/txpoolcfg"
"github.com/erigontech/erigon/cl/clparams"
"github.com/erigontech/erigon/cmd/downloader/downloadernat"
"github.com/erigontech/erigon/cmd/utils/flags"
Expand All @@ -65,6 +64,7 @@ import (
"github.com/erigontech/erigon/polygon/heimdall"
"github.com/erigontech/erigon/rpc/rpccfg"
"github.com/erigontech/erigon/turbo/logging"
"github.com/erigontech/erigon/txnprovider/txpool/txpoolcfg"
)

// These are all the command line flags we support.
Expand Down
2 changes: 1 addition & 1 deletion core/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ import (
"github.com/erigontech/erigon-lib/common/math"
"github.com/erigontech/erigon-lib/crypto"
"github.com/erigontech/erigon-lib/log/v3"
"github.com/erigontech/erigon-lib/txpool/txpoolcfg"
types2 "github.com/erigontech/erigon-lib/types"
"github.com/erigontech/erigon/common/u256"
"github.com/erigontech/erigon/core/tracing"
"github.com/erigontech/erigon/core/types"
"github.com/erigontech/erigon/core/vm"
"github.com/erigontech/erigon/core/vm/evmtypes"
"github.com/erigontech/erigon/params"
"github.com/erigontech/erigon/txnprovider/txpool/txpoolcfg"
)

var emptyCodeHash = crypto.Keccak256Hash(nil)
Expand Down
2 changes: 1 addition & 1 deletion core/types/transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ import (
"github.com/erigontech/erigon-lib/common/hexutility"
"github.com/erigontech/erigon-lib/crypto"
"github.com/erigontech/erigon-lib/crypto/kzg"
"github.com/erigontech/erigon-lib/txpool"
libtypes "github.com/erigontech/erigon-lib/types"
"github.com/erigontech/erigon/common"
"github.com/erigontech/erigon/common/u256"
"github.com/erigontech/erigon/rlp"
"github.com/erigontech/erigon/txnprovider/txpool"
)

// The values in those tests are from the Transaction Tests
Expand Down
2 changes: 0 additions & 2 deletions erigon-lib/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ require (
github.com/c2h5oh/datasize v0.0.0-20231215233829-aa82cc1e6500
github.com/containerd/cgroups/v3 v3.0.3
github.com/crate-crypto/go-kzg-4844 v0.7.0
github.com/deckarep/golang-set/v2 v2.3.1
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0
github.com/edsrzf/mmap-go v1.1.0
github.com/elastic/go-freelru v0.13.0
Expand All @@ -29,7 +28,6 @@ require (
github.com/google/btree v1.1.3
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
github.com/hashicorp/go-retryablehttp v0.7.7
github.com/hashicorp/golang-lru/v2 v2.0.7
github.com/holiman/bloomfilter/v2 v2.0.3
github.com/holiman/uint256 v1.3.1
github.com/nyaosorg/go-windows-shortcut v0.0.0-20220529122037-8b0c89bca4c4
Expand Down
4 changes: 0 additions & 4 deletions erigon-lib/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/deckarep/golang-set/v2 v2.3.1 h1:vjmkvJt/IV27WXPyYQpAh4bRyWJc5Y435D17XQ9QU5A=
github.com/deckarep/golang-set/v2 v2.3.1/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4=
github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y=
github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg=
Expand Down Expand Up @@ -257,8 +255,6 @@ github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVH
github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU=
github.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
github.com/holiman/uint256 v1.3.1 h1:JfTzmih28bittyHM8z360dCjIA9dbPIBlcTI6lmctQs=
Expand Down
6 changes: 3 additions & 3 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ import (
"github.com/erigontech/erigon-lib/log/v3"
libsentry "github.com/erigontech/erigon-lib/p2p/sentry"
libstate "github.com/erigontech/erigon-lib/state"
"github.com/erigontech/erigon-lib/txpool"
"github.com/erigontech/erigon-lib/txpool/txpoolcfg"
"github.com/erigontech/erigon-lib/txpool/txpoolutil"
libtypes "github.com/erigontech/erigon-lib/types"
"github.com/erigontech/erigon-lib/wrap"
"github.com/erigontech/erigon/cl/clparams"
Expand Down Expand Up @@ -134,6 +131,9 @@ import (
"github.com/erigontech/erigon/turbo/snapshotsync/freezeblocks"
stages2 "github.com/erigontech/erigon/turbo/stages"
"github.com/erigontech/erigon/turbo/stages/headerdownload"
"github.com/erigontech/erigon/txnprovider/txpool"
"github.com/erigontech/erigon/txnprovider/txpool/txpoolcfg"
"github.com/erigontech/erigon/txnprovider/txpool/txpoolutil"
)

// Config contains the configuration options of the ETH protocol.
Expand Down
2 changes: 1 addition & 1 deletion eth/ethconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import (
"github.com/erigontech/erigon-lib/common"
"github.com/erigontech/erigon-lib/common/datadir"
"github.com/erigontech/erigon-lib/downloader/downloadercfg"
"github.com/erigontech/erigon-lib/txpool/txpoolcfg"
"github.com/erigontech/erigon/cl/clparams"
"github.com/erigontech/erigon/consensus/ethash/ethashcfg"
"github.com/erigontech/erigon/core/types"
Expand All @@ -44,6 +43,7 @@ import (
"github.com/erigontech/erigon/ethdb/prune"
"github.com/erigontech/erigon/params"
"github.com/erigontech/erigon/rpc"
"github.com/erigontech/erigon/txnprovider/txpool/txpoolcfg"
)

// BorDefaultMinerGasPrice defines the minimum gas price for bor validators to mine a transaction.
Expand Down
2 changes: 1 addition & 1 deletion eth/ethconfig/gen_config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion eth/ethconfig/tx_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"time"

"github.com/erigontech/erigon-lib/common"
"github.com/erigontech/erigon-lib/txpool/txpoolcfg"
"github.com/erigontech/erigon/txnprovider/txpool/txpoolcfg"
)

// DeprecatedTxPoolConfig are the configuration parameters of the transaction pool.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ require (
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/go-stack/stack v1.8.1
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
Expand Down
2 changes: 1 addition & 1 deletion tests/bor/helper/miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/erigontech/erigon-lib/direct"
"github.com/erigontech/erigon-lib/downloader/downloadercfg"
"github.com/erigontech/erigon-lib/log/v3"
"github.com/erigontech/erigon-lib/txpool/txpoolcfg"
"github.com/erigontech/erigon/cmd/utils"
"github.com/erigontech/erigon/core/types"
"github.com/erigontech/erigon/eth"
Expand All @@ -27,6 +26,7 @@ import (
"github.com/erigontech/erigon/p2p/nat"
"github.com/erigontech/erigon/params"
"github.com/erigontech/erigon/polygon/bor/borcfg"
"github.com/erigontech/erigon/txnprovider/txpool/txpoolcfg"
)

// InitGenesis initializes genesis file from json with sprint size and chain name as configurable inputs
Expand Down
2 changes: 1 addition & 1 deletion turbo/cli/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/erigontech/erigon-lib/common/hexutil"
"github.com/erigontech/erigon-lib/config3"

"github.com/erigontech/erigon-lib/txpool/txpoolcfg"
"github.com/erigontech/erigon/txnprovider/txpool/txpoolcfg"

libcommon "github.com/erigontech/erigon-lib/common"

Expand Down
2 changes: 1 addition & 1 deletion turbo/jsonrpc/send_transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ import (
sentry "github.com/erigontech/erigon-lib/gointerfaces/sentryproto"
txpool "github.com/erigontech/erigon-lib/gointerfaces/txpoolproto"
"github.com/erigontech/erigon-lib/kv/kvcache"
"github.com/erigontech/erigon-lib/txpool/txpoolcfg"
"github.com/erigontech/erigon-lib/wrap"
"github.com/erigontech/erigon/rpc/rpccfg"
"github.com/erigontech/erigon/txnprovider/txpool/txpoolcfg"

"github.com/erigontech/erigon/cmd/rpcdaemon/rpcdaemontest"
"github.com/erigontech/erigon/common/u256"
Expand Down
2 changes: 1 addition & 1 deletion turbo/rpchelper/filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import (
remote "github.com/erigontech/erigon-lib/gointerfaces/remoteproto"
txpool "github.com/erigontech/erigon-lib/gointerfaces/txpoolproto"
"github.com/erigontech/erigon-lib/log/v3"
txpool2 "github.com/erigontech/erigon-lib/txpool"
txpool2 "github.com/erigontech/erigon/txnprovider/txpool"

"github.com/erigontech/erigon/core/types"
"github.com/erigontech/erigon/eth/filters"
Expand Down
4 changes: 2 additions & 2 deletions turbo/stages/mock/mock_sentry.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ import (
"github.com/erigontech/erigon-lib/kv/temporal/temporaltest"
"github.com/erigontech/erigon-lib/log/v3"
libstate "github.com/erigontech/erigon-lib/state"
"github.com/erigontech/erigon-lib/txpool"
"github.com/erigontech/erigon-lib/txpool/txpoolcfg"
types2 "github.com/erigontech/erigon-lib/types"
"github.com/erigontech/erigon-lib/wrap"
"github.com/erigontech/erigon/consensus"
Expand Down Expand Up @@ -92,6 +90,8 @@ import (
stages2 "github.com/erigontech/erigon/turbo/stages"
"github.com/erigontech/erigon/turbo/stages/bodydownload"
"github.com/erigontech/erigon/turbo/stages/headerdownload"
"github.com/erigontech/erigon/txnprovider/txpool"
"github.com/erigontech/erigon/txnprovider/txpool/txpoolcfg"
)

const MockInsertAsInitialCycle = false
Expand Down
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions erigon-lib/txpool/pool.go → txnprovider/txpool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ import (

gokzg4844 "github.com/crate-crypto/go-kzg-4844"
mapset "github.com/deckarep/golang-set/v2"
"github.com/erigontech/erigon-lib/kv/order"
"github.com/go-stack/stack"
"github.com/google/btree"
"github.com/hashicorp/golang-lru/v2/simplelru"
"github.com/holiman/uint256"

"github.com/erigontech/erigon-lib/kv/order"

"github.com/erigontech/erigon-lib/chain"
"github.com/erigontech/erigon-lib/common"
"github.com/erigontech/erigon-lib/common/assert"
Expand All @@ -58,8 +59,8 @@ import (
"github.com/erigontech/erigon-lib/kv/mdbx"
"github.com/erigontech/erigon-lib/log/v3"
"github.com/erigontech/erigon-lib/metrics"
"github.com/erigontech/erigon-lib/txpool/txpoolcfg"
"github.com/erigontech/erigon-lib/types"
"github.com/erigontech/erigon/txnprovider/txpool/txpoolcfg"
)

const DefaultBlockGasLimit = uint64(30000000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ import (
"github.com/erigontech/erigon-lib/kv/kvcache"
"github.com/erigontech/erigon-lib/kv/memdb"
"github.com/erigontech/erigon-lib/rlp"
"github.com/erigontech/erigon-lib/txpool/txpoolcfg"
"github.com/erigontech/erigon-lib/types"
"github.com/erigontech/erigon/txnprovider/txpool/txpoolcfg"
)

// https://go.dev/doc/fuzz/
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ import (
"github.com/erigontech/erigon-lib/kv"
"github.com/erigontech/erigon-lib/kv/kvcache"
"github.com/erigontech/erigon-lib/kv/memdb"
"github.com/erigontech/erigon-lib/txpool/txpoolcfg"
"github.com/erigontech/erigon-lib/types"
"github.com/erigontech/erigon/txnprovider/txpool/txpoolcfg"
)

func TestNonceFromAddress(t *testing.T) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import (
"google.golang.org/protobuf/types/known/emptypb"

"github.com/erigontech/erigon-lib/log/v3"
"github.com/erigontech/erigon-lib/txpool/txpoolcfg"
"github.com/erigontech/erigon/txnprovider/txpool/txpoolcfg"

"github.com/erigontech/erigon-lib/common"
"github.com/erigontech/erigon-lib/gointerfaces"
Expand Down Expand Up @@ -172,7 +172,7 @@ func (s *GrpcServer) Pending(ctx context.Context, _ *emptypb.Empty) (*txpool_pro
}

func (s *GrpcServer) FindUnknown(ctx context.Context, in *txpool_proto.TxHashes) (*txpool_proto.TxHashes, error) {
return nil, fmt.Errorf("unimplemented")
return nil, errors.New("unimplemented")
}

func (s *GrpcServer) Add(ctx context.Context, in *txpool_proto.AddRequest) (*txpool_proto.AddReply, error) {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ import (
"github.com/erigontech/erigon-lib/kv/kvcache"
"github.com/erigontech/erigon-lib/kv/mdbx"
"github.com/erigontech/erigon-lib/log/v3"
"github.com/erigontech/erigon-lib/txpool"
"github.com/erigontech/erigon-lib/txpool/txpoolcfg"
"github.com/erigontech/erigon-lib/types"
"github.com/erigontech/erigon/txnprovider/txpool"
"github.com/erigontech/erigon/txnprovider/txpool/txpoolcfg"
)

func SaveChainConfigIfNeed(ctx context.Context, coreDB kv.RoDB, txPoolDB kv.RwDB, force bool, logger log.Logger) (cc *chain.Config, blockNum uint64, err error) {
Expand Down

0 comments on commit 0d22267

Please sign in to comment.