From 262842b25afaa7ac4b6df5a8e50bdbe48f103bd0 Mon Sep 17 00:00:00 2001 From: axelKingsley Date: Mon, 4 Nov 2024 21:48:59 -0600 Subject: [PATCH] Add Flag for Interop Mempool Filtering --- cmd/geth/main.go | 1 + cmd/utils/flags.go | 9 +++++++++ eth/backend.go | 2 +- eth/ethconfig/config.go | 3 ++- eth/ethconfig/gen_config.go | 6 ++++++ 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 45c44e77ae..30c7df3b84 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -160,6 +160,7 @@ var ( utils.RollupHistoricalRPCFlag, utils.RollupHistoricalRPCTimeoutFlag, utils.RollupInteropRPCFlag, + utils.RollupInteropMempoolFilteringFlag, utils.RollupDisableTxPoolGossipFlag, utils.RollupComputePendingBlock, utils.RollupHaltOnIncompatibleProtocolVersionFlag, diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index c68ba3d3ab..8eda534783 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -945,6 +945,12 @@ var ( Category: flags.RollupCategory, } + RollupInteropMempoolFilteringFlag = &cli.BoolFlag{ + Name: "rollup.interopmempoolfiltering", + Usage: "If using interop, transactions are checked for interop validity before being added to the mempool (experimental).", + Category: flags.RollupCategory, + } + RollupDisableTxPoolGossipFlag = &cli.BoolFlag{ Name: "rollup.disabletxpoolgossip", Usage: "Disable transaction pool gossip.", @@ -1950,6 +1956,9 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) { if ctx.IsSet(RollupInteropRPCFlag.Name) { cfg.InteropMessageRPC = ctx.String(RollupInteropRPCFlag.Name) } + if ctx.IsSet(RollupInteropMempoolFilteringFlag.Name) { + cfg.InteropMempoolFiltering = ctx.Bool(RollupInteropMempoolFilteringFlag.Name) + } cfg.RollupDisableTxPoolGossip = ctx.Bool(RollupDisableTxPoolGossipFlag.Name) cfg.RollupDisableTxPoolAdmission = cfg.RollupSequencerHTTP != "" && !ctx.Bool(RollupEnableTxPoolAdmissionFlag.Name) cfg.RollupHaltOnIncompatibleProtocolVersion = ctx.String(RollupHaltOnIncompatibleProtocolVersionFlag.Name) diff --git a/eth/backend.go b/eth/backend.go index b6b55b002e..79453719c6 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -276,7 +276,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) { // if interop is enabled, establish an Interop Filter connected to this Ethereum instance's // simulated logs and message safety check functions poolFilters := []txpool.IngressFilter{} - if config.InteropMessageRPC != "" { + if config.InteropMessageRPC != "" && config.InteropMempoolFiltering { poolFilters = append(poolFilters, txpool.NewInteropFilter(eth.SimLogs, eth.CheckMessages)) } eth.txPool, err = txpool.New(config.TxPool.PriceLimit, eth.blockchain, txPools, poolFilters) diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index dc5cb07528..29eca7bb28 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -182,7 +182,8 @@ type Config struct { RollupDisableTxPoolAdmission bool RollupHaltOnIncompatibleProtocolVersion string - InteropMessageRPC string `toml:",omitempty"` + InteropMessageRPC string `toml:",omitempty"` + InteropMempoolFiltering bool `toml:",omitempty"` } // CreateConsensusEngine creates a consensus engine for the given chain config. diff --git a/eth/ethconfig/gen_config.go b/eth/ethconfig/gen_config.go index 16391019df..72f0e1dc73 100644 --- a/eth/ethconfig/gen_config.go +++ b/eth/ethconfig/gen_config.go @@ -68,6 +68,7 @@ func (c Config) MarshalTOML() (interface{}, error) { RollupDisableTxPoolAdmission bool RollupHaltOnIncompatibleProtocolVersion string InteropMessageRPC string `toml:",omitempty"` + InteropMempoolFiltering bool `toml:",omitempty"` } var enc Config enc.Genesis = c.Genesis @@ -121,6 +122,7 @@ func (c Config) MarshalTOML() (interface{}, error) { enc.RollupDisableTxPoolAdmission = c.RollupDisableTxPoolAdmission enc.RollupHaltOnIncompatibleProtocolVersion = c.RollupHaltOnIncompatibleProtocolVersion enc.InteropMessageRPC = c.InteropMessageRPC + enc.InteropMempoolFiltering = c.InteropMempoolFiltering return &enc, nil } @@ -178,6 +180,7 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error { RollupDisableTxPoolAdmission *bool RollupHaltOnIncompatibleProtocolVersion *string InteropMessageRPC *string `toml:",omitempty"` + InteropMempoolFiltering *bool `toml:",omitempty"` } var dec Config if err := unmarshal(&dec); err != nil { @@ -336,5 +339,8 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error { if dec.InteropMessageRPC != nil { c.InteropMessageRPC = *dec.InteropMessageRPC } + if dec.InteropMempoolFiltering != nil { + c.InteropMempoolFiltering = *dec.InteropMempoolFiltering + } return nil }