Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add disable tx gossip option #70

Merged
merged 11 commits into from
Jun 27, 2023
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ The historical RPC endpoint. op-erigon queries historical execution data that op

For more information about legacy geth, refer the [Optimism's node operator guide](https://community.optimism.io/docs/developers/bedrock/node-operator-guide/#legacy-geth).

### `--rollup.disabletxpoolgossip`
**[New flag / Optional]**
Disables transaction pool gossiping. Though this is not required, it's useful to set this to true since transaction pool gossip is currently unsupported in the Optimism protocol. If not provided, default value is set to `false`.

### `--maxpeers=0`, `--nodiscover`
**[Optional]**
Disable P2P. Execution-layer peering is currently not supported in the Optimism protocol. Though this is not required, it saves resources since TX pool gossip is currently not available.
Expand Down Expand Up @@ -120,6 +124,7 @@ $ ./build/bin/erigon \
--authrpc.jwtsecret=$JWT_SECRET_FILE \
--rollup.sequencerhttp="https://mainnet-sequencer.optimism.io" \
--rollup.historicalrpc="https://mainnet.optimism.io" \
--rollup.disabletxpoolgossip=true \
--chain=optimism-mainnet \
--nodiscover
```
Expand Down
1 change: 1 addition & 0 deletions cmd/erigon-el/backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ func NewBackend(stack *node.Node, config *ethconfig.Config, logger log.Logger) (
}
backend.historicalRPCService = client
}
config.TxPool.NoTxGossip = config.RollupDisableTxPoolGossip

var miningRPC txpool_proto.MiningServer
stateDiffClient := direct.NewStateDiffClientDirect(kvRPC)
Expand Down
1 change: 1 addition & 0 deletions cmd/rpcdaemon/cli/httpcfg/http_cfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,5 @@ type HttpCfg struct {
RollupSequencerHTTP string
RollupHistoricalRPC string
RollupHistoricalRPCTimeout time.Duration
RollupDisableTxPoolGossip bool
}
6 changes: 5 additions & 1 deletion cmd/txpool/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ var (
accountSlots uint64
priceBump uint64

optimism bool
optimism bool
noTxGossip bool

commitEvery time.Duration
)
Expand All @@ -79,6 +80,7 @@ func init() {
rootCmd.PersistentFlags().Uint64Var(&priceBump, "txpool.pricebump", txpoolcfg.DefaultConfig.PriceBump, "Price bump percentage to replace an already existing transaction")
rootCmd.PersistentFlags().DurationVar(&commitEvery, utils.TxPoolCommitEveryFlag.Name, utils.TxPoolCommitEveryFlag.Value, utils.TxPoolCommitEveryFlag.Usage)
rootCmd.PersistentFlags().BoolVar(&optimism, "txpool.optimism", txpoolcfg.DefaultConfig.Optimism, "Enable Optimism Bedrock to make txpool account for L1 cost of transactions")
rootCmd.PersistentFlags().BoolVar(&noTxGossip, "txpool.disabletxpoolgossip", txpoolcfg.DefaultConfig.NoTxGossip, "Disable transaction pool gossip")
rootCmd.Flags().StringSliceVar(&traceSenders, utils.TxPoolTraceSendersFlag.Name, []string{}, utils.TxPoolTraceSendersFlag.Usage)
}

Expand Down Expand Up @@ -147,6 +149,8 @@ func doTxpool(ctx context.Context) error {
cfg.MinFeeCap = priceLimit
cfg.AccountSlots = accountSlots
cfg.PriceBump = priceBump
cfg.Optimism = optimism
cfg.NoTxGossip = noTxGossip

cacheConfig := kvcache.DefaultCoherentConfig
cacheConfig.MetricsLabel = "txpool"
Expand Down
9 changes: 7 additions & 2 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -602,17 +602,19 @@ var (
Name: "rollup.sequencerhttp",
Usage: "HTTP endpoint for the sequencer mempool",
}

RollupHistoricalRPCFlag = cli.StringFlag{
Name: "rollup.historicalrpc",
Usage: "RPC endpoint for historical data.",
}

RollupHistoricalRPCTimeoutFlag = cli.StringFlag{
Name: "rollup.historicalrpctimeout",
Usage: "Timeout for historical RPC requests.",
Value: "5s",
}
RollupDisableTxPoolGossipFlag = cli.StringFlag{
Name: "rollup.disabletxpoolgossip",
Usage: "Disables transaction pool gossip.",
}

// Metrics flags
MetricsEnabledFlag = cli.BoolFlag{
Expand Down Expand Up @@ -1602,6 +1604,9 @@ func SetEthConfig(ctx *cli.Context, nodeConfig *nodecfg.Config, cfg *ethconfig.C
if ctx.IsSet(RollupHistoricalRPCTimeoutFlag.Name) {
cfg.RollupHistoricalRPCTimeout = ctx.Duration(RollupHistoricalRPCTimeoutFlag.Name)
}
if ctx.IsSet(RollupDisableTxPoolGossipFlag.Name) {
cfg.RollupDisableTxPoolGossip = ctx.Bool(RollupDisableTxPoolGossipFlag.Name)
}
// Override any default configs for hard coded networks.
chain := ctx.String(ChainFlag.Name)

Expand Down
1 change: 1 addition & 0 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
}
backend.historicalRPCService = client
}
config.TxPool.NoTxGossip = config.RollupDisableTxPoolGossip

var miningRPC txpool_proto.MiningServer
stateDiffClient := direct.NewStateDiffClientDirect(kvRPC)
Expand Down
1 change: 1 addition & 0 deletions eth/ethconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ type Config struct {
RollupSequencerHTTP string
RollupHistoricalRPC string
RollupHistoricalRPCTimeout time.Duration
RollupDisableTxPoolGossip bool
}

type Sync struct {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/ledgerwatch/erigon
go 1.19

//fork with minor protobuf file changes and txpool support
replace github.com/ledgerwatch/erigon-lib v0.0.0-20230423044930-fc9dd74e6407 => github.com/testinprod-io/erigon-lib v0.0.0-20230616053951-ae06f5d5c536
replace github.com/ledgerwatch/erigon-lib v0.0.0-20230423044930-fc9dd74e6407 => github.com/testinprod-io/erigon-lib v0.0.0-20230616062622-16981b32f2f9

//for local dev:
//replace github.com/ledgerwatch/erigon-lib v0.0.0-20230423044930-fc9dd74e6407 => ../erigon-lib
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -777,8 +777,8 @@ github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o
github.com/supranational/blst v0.3.10 h1:CMciDZ/h4pXDDXQASe8ZGTNKUiVNxVVA5hpci2Uuhuk=
github.com/supranational/blst v0.3.10/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw=
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
github.com/testinprod-io/erigon-lib v0.0.0-20230616053951-ae06f5d5c536 h1:xootH/fjZSJ0VNE3v0cGU1PleXRsqaseAyvjUWUDh8U=
github.com/testinprod-io/erigon-lib v0.0.0-20230616053951-ae06f5d5c536/go.mod h1:6SIBkeREz7fob8A0EBsTCVzTqJIc+BBiuPAsb5sUYk0=
github.com/testinprod-io/erigon-lib v0.0.0-20230616062622-16981b32f2f9 h1:OCamWzi5kgUZrlha0oQGRVeRTqLTRLUpyI0MgFUnEf4=
github.com/testinprod-io/erigon-lib v0.0.0-20230616062622-16981b32f2f9/go.mod h1:6SIBkeREz7fob8A0EBsTCVzTqJIc+BBiuPAsb5sUYk0=
github.com/thomaso-mirodin/intmath v0.0.0-20160323211736-5dc6d854e46e h1:cR8/SYRgyQCt5cNCMniB/ZScMkhI9nk8U5C7SbISXjo=
github.com/thomaso-mirodin/intmath v0.0.0-20160323211736-5dc6d854e46e/go.mod h1:Tu4lItkATkonrYuvtVjG0/rhy15qrNGNTjPdaphtZ/8=
github.com/tidwall/btree v1.6.0 h1:LDZfKfQIBHGHWSwckhXI0RPSXzlo+KYdjK7FWSqOzzg=
Expand Down
1 change: 1 addition & 0 deletions turbo/cli/default_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ var DefaultFlags = []cli.Flag{
&utils.RollupSequencerHTTPFlag,
&utils.RollupHistoricalRPCFlag,
&utils.RollupHistoricalRPCTimeoutFlag,
&utils.RollupDisableTxPoolGossipFlag,

&utils.ConfigFlag,
&logging.LogConsoleVerbosityFlag,
Expand Down
Loading