Skip to content

Commit

Permalink
Merge pull request #13 from light-scale/feat/enable-tx-pool-sync-by-f…
Browse files Browse the repository at this point in the history
…orce

feat: enable tx pool sync by force
  • Loading branch information
chokobole authored Feb 16, 2023
2 parents a722987 + b8b2bdf commit 76d960f
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 82 deletions.
2 changes: 0 additions & 2 deletions cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,6 @@ var (
utils.GpoIgnoreGasPriceFlag,
utils.MinerNotifyFullFlag,
utils.IgnoreLegacyReceiptsFlag,
utils.RollupSequencerHTTPFlag,
utils.RollupDisableTxPoolGossipFlag,
configFileFlag,
}, utils.NetworkFlags, utils.DatabasePathFlags)

Expand Down
18 changes: 0 additions & 18 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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):
Expand Down
10 changes: 0 additions & 10 deletions eth/api_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
}

Expand Down
18 changes: 0 additions & 18 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -76,8 +74,6 @@ type Ethereum struct {
snapDialCandidates enode.Iterator
merger *consensus.Merger

seqRPCService *rpc.Client

// DB interfaces
chainDb ethdb.Database // Block chain database

Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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()
Expand Down
4 changes: 0 additions & 4 deletions eth/ethconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,6 @@ type Config struct {
// development purposes.
SyncTarget *types.Block

RollupSequencerHTTP string

RollupDisableTxPoolGossip bool

// [Scroll: START]
// Trace option
MPTWitness int
Expand Down
4 changes: 0 additions & 4 deletions eth/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -105,8 +104,6 @@ type handler struct {
chain *core.BlockChain
maxPeers int

noTxGossip bool

downloader *downloader.Downloader
blockFetcher *fetcher.BlockFetcher
txFetcher *fetcher.TxFetcher
Expand Down Expand Up @@ -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,
Expand Down
13 changes: 0 additions & 13 deletions eth/handler_eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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
}

Expand Down
13 changes: 0 additions & 13 deletions les/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package les

import (
"context"
"fmt"
"strings"
"time"
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 76d960f

Please sign in to comment.