From b8b2bdf594165a76635933e3247945d1bb2ea353 Mon Sep 17 00:00:00 2001 From: "Wonyong Kim(Ryan Kim)" Date: Tue, 14 Feb 2023 14:29:04 +0900 Subject: [PATCH] feat: enable tx pool sync by force This commit removes 2 flags. - `RollupSequencerHttpFlag`: This transfers transaction to geth that is specified with this flag. - `RollupDisableTxPoolGossipFlag`: This diables tx pool sync if this flag is on. --- cmd/geth/main.go | 2 -- cmd/utils/flags.go | 18 ------------------ eth/api_backend.go | 10 ---------- eth/backend.go | 18 ------------------ eth/ethconfig/config.go | 4 ---- eth/handler.go | 4 ---- eth/handler_eth.go | 13 ------------- les/client.go | 13 ------------- 8 files changed, 82 deletions(-) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 1c41a508e4..a94c0c17db 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -150,8 +150,6 @@ var ( utils.GpoIgnoreGasPriceFlag, utils.MinerNotifyFullFlag, utils.IgnoreLegacyReceiptsFlag, - utils.RollupSequencerHTTPFlag, - utils.RollupDisableTxPoolGossipFlag, configFileFlag, }, utils.NetworkFlags, utils.DatabasePathFlags) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 6ca715af0b..03bfbee9ce 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -910,19 +910,6 @@ var ( Category: flags.GasPriceCategory, } - // Rollup Flags - RollupSequencerHTTPFlag = &cli.StringFlag{ - Name: "rollup.sequencerhttp", - Usage: "HTTP endpoint for the sequencer mempool", - Category: flags.RollupCategory, - } - - RollupDisableTxPoolGossipFlag = &cli.BoolFlag{ - Name: "rollup.disabletxpoolgossip", - Usage: "Disable transaction pool gossip.", - Category: flags.RollupCategory, - } - // Metrics flags MetricsEnabledFlag = &cli.BoolFlag{ Name: "metrics", @@ -1918,11 +1905,6 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) { } cfg.SyncTarget = &block } - // Only configure sequencer http flag if we're running in verifier mode i.e. --mine is disabled. - if ctx.IsSet(RollupSequencerHTTPFlag.Name) && !ctx.IsSet(MiningEnabledFlag.Name) { - cfg.RollupSequencerHTTP = ctx.String(RollupSequencerHTTPFlag.Name) - } - cfg.RollupDisableTxPoolGossip = ctx.Bool(RollupDisableTxPoolGossipFlag.Name) // Override any default configs for hard coded networks. switch { case ctx.Bool(MainnetFlag.Name): diff --git a/eth/api_backend.go b/eth/api_backend.go index 11a086d213..8df6a5aca0 100644 --- a/eth/api_backend.go +++ b/eth/api_backend.go @@ -26,7 +26,6 @@ import ( "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/consensus" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/bloombits" @@ -258,15 +257,6 @@ func (b *EthAPIBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscri } func (b *EthAPIBackend) SendTx(ctx context.Context, tx *types.Transaction) error { - if b.eth.seqRPCService != nil { - data, err := tx.MarshalBinary() - if err != nil { - return err - } - if err := b.eth.seqRPCService.CallContext(ctx, nil, "eth_sendRawTransaction", hexutil.Encode(data)); err != nil { - return err - } - } return b.eth.txPool.AddLocal(tx) } diff --git a/eth/backend.go b/eth/backend.go index 74027d6d59..db5c88d37e 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -18,14 +18,12 @@ package eth import ( - "context" "errors" "fmt" "math/big" "runtime" "sync" "sync/atomic" - "time" "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/common" @@ -76,8 +74,6 @@ type Ethereum struct { snapDialCandidates enode.Iterator merger *consensus.Merger - seqRPCService *rpc.Client - // DB interfaces chainDb ethdb.Database // Block chain database @@ -236,7 +232,6 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) { EventMux: eth.eventMux, Checkpoint: checkpoint, RequiredBlocks: config.RequiredBlocks, - NoTxGossip: config.RollupDisableTxPoolGossip, }); err != nil { return nil, err } @@ -265,16 +260,6 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) { return nil, err } - if config.RollupSequencerHTTP != "" { - ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) - client, err := rpc.DialContext(ctx, config.RollupSequencerHTTP) - cancel() - if err != nil { - return nil, err - } - eth.seqRPCService = client - } - // Start the RPC service eth.netRPCService = ethapi.NewNetAPI(eth.p2pServer, config.NetworkId) @@ -566,9 +551,6 @@ func (s *Ethereum) Stop() error { s.miner.Close() s.blockchain.Stop() s.engine.Close() - if s.seqRPCService != nil { - s.seqRPCService.Close() - } // Clean shutdown marker as the last thing before closing db s.shutdownTracker.Stop() diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index f2152990f3..a392cf2917 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -217,10 +217,6 @@ type Config struct { // development purposes. SyncTarget *types.Block - RollupSequencerHTTP string - - RollupDisableTxPoolGossip bool - // [Scroll: START] // Trace option MPTWitness int diff --git a/eth/handler.go b/eth/handler.go index 30721ee7a6..143147b0c8 100644 --- a/eth/handler.go +++ b/eth/handler.go @@ -87,7 +87,6 @@ type handlerConfig struct { EventMux *event.TypeMux // Legacy event mux, deprecate for `feed` Checkpoint *params.TrustedCheckpoint // Hard coded checkpoint for sync challenges RequiredBlocks map[uint64]common.Hash // Hard coded map of required block hashes for sync challenges - NoTxGossip bool // Disable P2P transaction gossip } type handler struct { @@ -105,8 +104,6 @@ type handler struct { chain *core.BlockChain maxPeers int - noTxGossip bool - downloader *downloader.Downloader blockFetcher *fetcher.BlockFetcher txFetcher *fetcher.TxFetcher @@ -140,7 +137,6 @@ func newHandler(config *handlerConfig) (*handler, error) { eventMux: config.EventMux, database: config.Database, txpool: config.TxPool, - noTxGossip: config.NoTxGossip, chain: config.Chain, peers: newPeerSet(), merger: config.Merger, diff --git a/eth/handler_eth.go b/eth/handler_eth.go index 6f573cc3e9..a94bf474d7 100644 --- a/eth/handler_eth.go +++ b/eth/handler_eth.go @@ -35,17 +35,7 @@ type ethHandler handler func (h *ethHandler) Chain() *core.BlockChain { return h.chain } -// NilPool satisfies the TxPool interface but does not return any tx in the -// pool. It is used to disable transaction gossip. -type NilPool struct{} - -// NilPool Get always returns nil -func (n NilPool) Get(hash common.Hash) *types.Transaction { return nil } - func (h *ethHandler) TxPool() eth.TxPool { - if h.noTxGossip { - return &NilPool{} - } return h.txpool } @@ -65,9 +55,6 @@ func (h *ethHandler) PeerInfo(id enode.ID) interface{} { // AcceptTxs retrieves whether transaction processing is enabled on the node // or if inbound transactions should simply be dropped. func (h *ethHandler) AcceptTxs() bool { - if h.noTxGossip { - return false - } return atomic.LoadUint32(&h.acceptTxs) == 1 } diff --git a/les/client.go b/les/client.go index 90c5c76eb6..c304bf86f8 100644 --- a/les/client.go +++ b/les/client.go @@ -18,7 +18,6 @@ package les import ( - "context" "fmt" "strings" "time" @@ -67,8 +66,6 @@ type LightEthereum struct { pruner *pruner merger *consensus.Merger - seqRPCService *rpc.Client - bloomRequests chan chan *bloombits.Retrieval // Channel receiving bloom data retrieval requests bloomIndexer *core.ChainIndexer // Bloom indexer operating during block imports @@ -198,16 +195,6 @@ func New(stack *node.Node, config *ethconfig.Config) (*LightEthereum, error) { leth.blockchain.DisableCheckFreq() } - if config.RollupSequencerHTTP != "" { - ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) - client, err := rpc.DialContext(ctx, config.RollupSequencerHTTP) - cancel() - if err != nil { - return nil, err - } - leth.seqRPCService = client - } - leth.netRPCService = ethapi.NewNetAPI(leth.p2pServer, leth.config.NetworkId) // Register the backend on the node