From 8fe12aa8c1d7ab5dbf7c540d51e5a5fd383052f0 Mon Sep 17 00:00:00 2001 From: Adrian Chifor Date: Sat, 3 Dec 2022 01:26:29 +0000 Subject: [PATCH 1/4] Add option to submit blocks only with bundles --- builder/builder.go | 41 ++++++++++++++++++++++--------------- builder/builder_test.go | 2 +- builder/config.go | 2 ++ builder/local_relay_test.go | 2 +- builder/service.go | 2 +- cmd/geth/main.go | 1 + cmd/utils/flags.go | 6 ++++++ 7 files changed, 36 insertions(+), 20 deletions(-) diff --git a/builder/builder.go b/builder/builder.go index 12ef6ca117..eb26e44186 100644 --- a/builder/builder.go +++ b/builder/builder.go @@ -50,14 +50,15 @@ type IBuilder interface { } type Builder struct { - ds flashbotsextra.IDatabaseService - relay IRelay - eth IEthereumService - dryRun bool - validator *blockvalidation.BlockValidationAPI - builderSecretKey *bls.SecretKey - builderPublicKey boostTypes.PublicKey - builderSigningDomain boostTypes.Domain + ds flashbotsextra.IDatabaseService + relay IRelay + eth IEthereumService + dryRun bool + onlyBlocksWithBundles bool + validator *blockvalidation.BlockValidationAPI + builderSecretKey *bls.SecretKey + builderPublicKey boostTypes.PublicKey + builderSigningDomain boostTypes.Domain limiter *rate.Limiter @@ -68,21 +69,22 @@ type Builder struct { slotCtxCancel context.CancelFunc } -func NewBuilder(sk *bls.SecretKey, ds flashbotsextra.IDatabaseService, relay IRelay, builderSigningDomain boostTypes.Domain, eth IEthereumService, dryRun bool, validator *blockvalidation.BlockValidationAPI) *Builder { +func NewBuilder(sk *bls.SecretKey, ds flashbotsextra.IDatabaseService, relay IRelay, builderSigningDomain boostTypes.Domain, eth IEthereumService, dryRun bool, validator *blockvalidation.BlockValidationAPI, onlyBlocksWithBundles bool) *Builder { pkBytes := bls.PublicKeyFromSecretKey(sk).Compress() pk := boostTypes.PublicKey{} pk.FromSlice(pkBytes) slotCtx, slotCtxCancel := context.WithCancel(context.Background()) return &Builder{ - ds: ds, - relay: relay, - eth: eth, - dryRun: dryRun, - validator: validator, - builderSecretKey: sk, - builderPublicKey: pk, - builderSigningDomain: builderSigningDomain, + ds: ds, + relay: relay, + eth: eth, + dryRun: dryRun, + onlyBlocksWithBundles: onlyBlocksWithBundles, + validator: validator, + builderSecretKey: sk, + builderPublicKey: pk, + builderSigningDomain: builderSigningDomain, limiter: rate.NewLimiter(rate.Every(time.Millisecond), 510), slot: 0, @@ -126,6 +128,11 @@ func (b *Builder) onSealedBlock(block *types.Block, ordersClosedAt time.Time, se Value: *value, } + if b.onlyBlocksWithBundles && len(commitedBundles) == 0 { + log.Info("No bundles included, skipping block submission", "slot", blockBidMsg.Slot, "value", blockBidMsg.Value.String(), "parent", blockBidMsg.ParentHash, "hash", block.Hash()) + return nil + } + signature, err := boostTypes.SignMessage(&blockBidMsg, b.builderSigningDomain, b.builderSecretKey) if err != nil { log.Error("could not sign builder bid", "err", err) diff --git a/builder/builder_test.go b/builder/builder_test.go index c1a413d3b4..3dc5741d25 100644 --- a/builder/builder_test.go +++ b/builder/builder_test.go @@ -74,7 +74,7 @@ func TestOnPayloadAttributes(t *testing.T) { testEthService := &testEthereumService{synced: true, testExecutableData: testExecutableData, testBlock: testBlock} - builder := NewBuilder(sk, flashbotsextra.NilDbService{}, &testRelay, bDomain, testEthService, false, nil) + builder := NewBuilder(sk, flashbotsextra.NilDbService{}, &testRelay, bDomain, testEthService, false, nil, false) builder.Start() defer builder.Stop() diff --git a/builder/config.go b/builder/config.go index cc445d5efc..789602d8fe 100644 --- a/builder/config.go +++ b/builder/config.go @@ -7,6 +7,7 @@ type Config struct { SlotsInEpoch uint64 `toml:",omitempty"` SecondsInSlot uint64 `toml:",omitempty"` DisableBundleFetcher bool `toml:",omitempty"` + OnlyBlocksWithBundles bool `toml:",omitempty"` DryRun bool `toml:",omitempty"` BuilderSecretKey string `toml:",omitempty"` RelaySecretKey string `toml:",omitempty"` @@ -28,6 +29,7 @@ var DefaultConfig = Config{ SlotsInEpoch: 32, SecondsInSlot: 12, DisableBundleFetcher: false, + OnlyBlocksWithBundles: false, DryRun: false, BuilderSecretKey: "0x2fc12ae741f29701f8e30f5de6350766c020cb80768a0ff01e6838ffd2431e11", RelaySecretKey: "0x2fc12ae741f29701f8e30f5de6350766c020cb80768a0ff01e6838ffd2431e11", diff --git a/builder/local_relay_test.go b/builder/local_relay_test.go index d992db064a..137a6cd7b9 100644 --- a/builder/local_relay_test.go +++ b/builder/local_relay_test.go @@ -32,7 +32,7 @@ func newTestBackend(t *testing.T, forkchoiceData *beacon.ExecutableDataV1, block beaconClient := &testBeaconClient{validator: validator} localRelay := NewLocalRelay(sk, beaconClient, bDomain, cDomain, ForkData{}, true) ethService := &testEthereumService{synced: true, testExecutableData: forkchoiceData, testBlock: block} - backend := NewBuilder(sk, flashbotsextra.NilDbService{}, localRelay, bDomain, ethService, false, nil) + backend := NewBuilder(sk, flashbotsextra.NilDbService{}, localRelay, bDomain, ethService, false, nil, false) // service := NewService("127.0.0.1:31545", backend) backend.limiter = rate.NewLimiter(rate.Inf, 0) diff --git a/builder/service.go b/builder/service.go index 2481bf5400..f14acba16f 100644 --- a/builder/service.go +++ b/builder/service.go @@ -195,7 +195,7 @@ func Register(stack *node.Node, backend *eth.Ethereum, cfg *Config) error { return errors.New("incorrect builder API secret key provided") } - builderBackend := NewBuilder(builderSk, ds, relay, builderSigningDomain, ethereumService, cfg.DryRun, validator) + builderBackend := NewBuilder(builderSk, ds, relay, builderSigningDomain, ethereumService, cfg.DryRun, validator, cfg.OnlyBlocksWithBundles) builderService := NewService(cfg.ListenAddr, localRelay, builderBackend) stack.RegisterAPIs([]rpc.API{ diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 2c517fd4b9..224840dedd 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -169,6 +169,7 @@ var ( utils.BuilderSecondsInSlot, utils.BuilderSlotsInEpoch, utils.BuilderDisableBundleFetcher, + utils.BuilderOnlyBlocksWithBundles, utils.BuilderDryRun, utils.BuilderSecretKey, utils.BuilderRelaySecretKey, diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 423a9ac1c6..e9e060523f 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -725,6 +725,11 @@ var ( Usage: "Disable the bundle fetcher", Category: flags.BuilderCategory, } + BuilderOnlyBlocksWithBundles = &cli.BoolFlag{ + Name: "builder.only_bundle_blocks", + Usage: "Submit only blocks with bundles", + Category: flags.BuilderCategory, + } BuilderDryRun = &cli.BoolFlag{ Name: "builder.dry-run", Usage: "Builder only validates blocks without submission to the relay", @@ -1598,6 +1603,7 @@ func SetBuilderConfig(ctx *cli.Context, cfg *builder.Config) { cfg.SlotsInEpoch = ctx.Uint64(BuilderSlotsInEpoch.Name) cfg.SecondsInSlot = ctx.Uint64(BuilderSecondsInSlot.Name) cfg.DisableBundleFetcher = ctx.IsSet(BuilderDisableBundleFetcher.Name) + cfg.OnlyBlocksWithBundles = ctx.IsSet(BuilderOnlyBlocksWithBundles.Name) cfg.DryRun = ctx.IsSet(BuilderDryRun.Name) cfg.BuilderSecretKey = ctx.String(BuilderSecretKey.Name) cfg.RelaySecretKey = ctx.String(BuilderRelaySecretKey.Name) From 04cab25786e310c0488dbd935a6600c6dc490140 Mon Sep 17 00:00:00 2001 From: Adrian Chifor Date: Sat, 3 Dec 2022 01:28:59 +0000 Subject: [PATCH 2/4] Update readme --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 392dcc5b93..a7baa721ba 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,9 @@ $ geth --help --builder.no_bundle_fetcher (default: false) Disable the bundle fetcher + + --builder.only_bundle_blocks (default: false) + Submit only blocks with bundles --builder.relay_secret_key value (default: "0x2fc12ae741f29701f8e30f5de6350766c020cb80768a0ff01e6838ffd2431e11") Builder local relay API key used for signing headers [$BUILDER_RELAY_SECRET_KEY] From 4789e42f6f9ce77b01750609fec5900d6502ffc9 Mon Sep 17 00:00:00 2001 From: Adrian Chifor Date: Sat, 3 Dec 2022 10:58:04 +0000 Subject: [PATCH 3/4] Move flag to miner --- README.md | 6 +++--- builder/builder.go | 41 +++++++++++++++---------------------- builder/builder_test.go | 2 +- builder/config.go | 2 -- builder/local_relay_test.go | 2 +- builder/service.go | 2 +- cmd/geth/main.go | 2 +- cmd/utils/flags.go | 12 +++++------ miner/miner.go | 27 ++++++++++++------------ miner/worker.go | 3 +++ 10 files changed, 47 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index a7baa721ba..a1fb29cccc 100644 --- a/README.md +++ b/README.md @@ -58,9 +58,6 @@ $ geth --help --builder.no_bundle_fetcher (default: false) Disable the bundle fetcher - - --builder.only_bundle_blocks (default: false) - Submit only blocks with bundles --builder.relay_secret_key value (default: "0x2fc12ae741f29701f8e30f5de6350766c020cb80768a0ff01e6838ffd2431e11") Builder local relay API key used for signing headers [$BUILDER_RELAY_SECRET_KEY] @@ -88,6 +85,9 @@ $ geth --help --miner.algotype value (default: "mev-geth") Block building algorithm to use [=mev-geth] (mev-geth, greedy) + + --miner.only_bundle_blocks (default: false) + Build only blocks with bundles --miner.blocklist value flashbots - Path to JSON file with list of blocked addresses. Miner will ignore diff --git a/builder/builder.go b/builder/builder.go index eb26e44186..12ef6ca117 100644 --- a/builder/builder.go +++ b/builder/builder.go @@ -50,15 +50,14 @@ type IBuilder interface { } type Builder struct { - ds flashbotsextra.IDatabaseService - relay IRelay - eth IEthereumService - dryRun bool - onlyBlocksWithBundles bool - validator *blockvalidation.BlockValidationAPI - builderSecretKey *bls.SecretKey - builderPublicKey boostTypes.PublicKey - builderSigningDomain boostTypes.Domain + ds flashbotsextra.IDatabaseService + relay IRelay + eth IEthereumService + dryRun bool + validator *blockvalidation.BlockValidationAPI + builderSecretKey *bls.SecretKey + builderPublicKey boostTypes.PublicKey + builderSigningDomain boostTypes.Domain limiter *rate.Limiter @@ -69,22 +68,21 @@ type Builder struct { slotCtxCancel context.CancelFunc } -func NewBuilder(sk *bls.SecretKey, ds flashbotsextra.IDatabaseService, relay IRelay, builderSigningDomain boostTypes.Domain, eth IEthereumService, dryRun bool, validator *blockvalidation.BlockValidationAPI, onlyBlocksWithBundles bool) *Builder { +func NewBuilder(sk *bls.SecretKey, ds flashbotsextra.IDatabaseService, relay IRelay, builderSigningDomain boostTypes.Domain, eth IEthereumService, dryRun bool, validator *blockvalidation.BlockValidationAPI) *Builder { pkBytes := bls.PublicKeyFromSecretKey(sk).Compress() pk := boostTypes.PublicKey{} pk.FromSlice(pkBytes) slotCtx, slotCtxCancel := context.WithCancel(context.Background()) return &Builder{ - ds: ds, - relay: relay, - eth: eth, - dryRun: dryRun, - onlyBlocksWithBundles: onlyBlocksWithBundles, - validator: validator, - builderSecretKey: sk, - builderPublicKey: pk, - builderSigningDomain: builderSigningDomain, + ds: ds, + relay: relay, + eth: eth, + dryRun: dryRun, + validator: validator, + builderSecretKey: sk, + builderPublicKey: pk, + builderSigningDomain: builderSigningDomain, limiter: rate.NewLimiter(rate.Every(time.Millisecond), 510), slot: 0, @@ -128,11 +126,6 @@ func (b *Builder) onSealedBlock(block *types.Block, ordersClosedAt time.Time, se Value: *value, } - if b.onlyBlocksWithBundles && len(commitedBundles) == 0 { - log.Info("No bundles included, skipping block submission", "slot", blockBidMsg.Slot, "value", blockBidMsg.Value.String(), "parent", blockBidMsg.ParentHash, "hash", block.Hash()) - return nil - } - signature, err := boostTypes.SignMessage(&blockBidMsg, b.builderSigningDomain, b.builderSecretKey) if err != nil { log.Error("could not sign builder bid", "err", err) diff --git a/builder/builder_test.go b/builder/builder_test.go index 3dc5741d25..c1a413d3b4 100644 --- a/builder/builder_test.go +++ b/builder/builder_test.go @@ -74,7 +74,7 @@ func TestOnPayloadAttributes(t *testing.T) { testEthService := &testEthereumService{synced: true, testExecutableData: testExecutableData, testBlock: testBlock} - builder := NewBuilder(sk, flashbotsextra.NilDbService{}, &testRelay, bDomain, testEthService, false, nil, false) + builder := NewBuilder(sk, flashbotsextra.NilDbService{}, &testRelay, bDomain, testEthService, false, nil) builder.Start() defer builder.Stop() diff --git a/builder/config.go b/builder/config.go index 789602d8fe..cc445d5efc 100644 --- a/builder/config.go +++ b/builder/config.go @@ -7,7 +7,6 @@ type Config struct { SlotsInEpoch uint64 `toml:",omitempty"` SecondsInSlot uint64 `toml:",omitempty"` DisableBundleFetcher bool `toml:",omitempty"` - OnlyBlocksWithBundles bool `toml:",omitempty"` DryRun bool `toml:",omitempty"` BuilderSecretKey string `toml:",omitempty"` RelaySecretKey string `toml:",omitempty"` @@ -29,7 +28,6 @@ var DefaultConfig = Config{ SlotsInEpoch: 32, SecondsInSlot: 12, DisableBundleFetcher: false, - OnlyBlocksWithBundles: false, DryRun: false, BuilderSecretKey: "0x2fc12ae741f29701f8e30f5de6350766c020cb80768a0ff01e6838ffd2431e11", RelaySecretKey: "0x2fc12ae741f29701f8e30f5de6350766c020cb80768a0ff01e6838ffd2431e11", diff --git a/builder/local_relay_test.go b/builder/local_relay_test.go index 137a6cd7b9..d992db064a 100644 --- a/builder/local_relay_test.go +++ b/builder/local_relay_test.go @@ -32,7 +32,7 @@ func newTestBackend(t *testing.T, forkchoiceData *beacon.ExecutableDataV1, block beaconClient := &testBeaconClient{validator: validator} localRelay := NewLocalRelay(sk, beaconClient, bDomain, cDomain, ForkData{}, true) ethService := &testEthereumService{synced: true, testExecutableData: forkchoiceData, testBlock: block} - backend := NewBuilder(sk, flashbotsextra.NilDbService{}, localRelay, bDomain, ethService, false, nil, false) + backend := NewBuilder(sk, flashbotsextra.NilDbService{}, localRelay, bDomain, ethService, false, nil) // service := NewService("127.0.0.1:31545", backend) backend.limiter = rate.NewLimiter(rate.Inf, 0) diff --git a/builder/service.go b/builder/service.go index f14acba16f..2481bf5400 100644 --- a/builder/service.go +++ b/builder/service.go @@ -195,7 +195,7 @@ func Register(stack *node.Node, backend *eth.Ethereum, cfg *Config) error { return errors.New("incorrect builder API secret key provided") } - builderBackend := NewBuilder(builderSk, ds, relay, builderSigningDomain, ethereumService, cfg.DryRun, validator, cfg.OnlyBlocksWithBundles) + builderBackend := NewBuilder(builderSk, ds, relay, builderSigningDomain, ethereumService, cfg.DryRun, validator) builderService := NewService(cfg.ListenAddr, localRelay, builderBackend) stack.RegisterAPIs([]rpc.API{ diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 224840dedd..2dcba5f2ab 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -131,6 +131,7 @@ var ( utils.MinerGasLimitFlag, utils.MinerGasPriceFlag, utils.MinerAlgoTypeFlag, + utils.MinerOnlyBlocksWithBundlesFlag, utils.MinerEtherbaseFlag, utils.MinerExtraDataFlag, utils.MinerRecommitIntervalFlag, @@ -169,7 +170,6 @@ var ( utils.BuilderSecondsInSlot, utils.BuilderSlotsInEpoch, utils.BuilderDisableBundleFetcher, - utils.BuilderOnlyBlocksWithBundles, utils.BuilderDryRun, utils.BuilderSecretKey, utils.BuilderRelaySecretKey, diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index e9e060523f..112a6bf61c 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -553,6 +553,11 @@ var ( Value: "mev-geth", Category: flags.MinerCategory, } + MinerOnlyBlocksWithBundlesFlag = &cli.BoolFlag{ + Name: "miner.only_bundle_blocks", + Usage: "Build only blocks with bundles", + Category: flags.MinerCategory, + } MinerEtherbaseFlag = &cli.StringFlag{ Name: "miner.etherbase", Usage: "Public address for block mining rewards (default = first account)", @@ -725,11 +730,6 @@ var ( Usage: "Disable the bundle fetcher", Category: flags.BuilderCategory, } - BuilderOnlyBlocksWithBundles = &cli.BoolFlag{ - Name: "builder.only_bundle_blocks", - Usage: "Submit only blocks with bundles", - Category: flags.BuilderCategory, - } BuilderDryRun = &cli.BoolFlag{ Name: "builder.dry-run", Usage: "Builder only validates blocks without submission to the relay", @@ -1603,7 +1603,6 @@ func SetBuilderConfig(ctx *cli.Context, cfg *builder.Config) { cfg.SlotsInEpoch = ctx.Uint64(BuilderSlotsInEpoch.Name) cfg.SecondsInSlot = ctx.Uint64(BuilderSecondsInSlot.Name) cfg.DisableBundleFetcher = ctx.IsSet(BuilderDisableBundleFetcher.Name) - cfg.OnlyBlocksWithBundles = ctx.IsSet(BuilderOnlyBlocksWithBundles.Name) cfg.DryRun = ctx.IsSet(BuilderDryRun.Name) cfg.BuilderSecretKey = ctx.String(BuilderSecretKey.Name) cfg.RelaySecretKey = ctx.String(BuilderRelaySecretKey.Name) @@ -1819,6 +1818,7 @@ func setMiner(ctx *cli.Context, cfg *miner.Config) { } cfg.AlgoType = algoType } + cfg.OnlyBlocksWithBundles = ctx.IsSet(MinerOnlyBlocksWithBundlesFlag.Name) if ctx.IsSet(MinerRecommitIntervalFlag.Name) { cfg.Recommit = ctx.Duration(MinerRecommitIntervalFlag.Name) } diff --git a/miner/miner.go b/miner/miner.go index 4eb06a213d..2ac80703fe 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -67,19 +67,20 @@ func AlgoTypeFlagToEnum(algoString string) (AlgoType, error) { // Config is the configuration parameters of mining. type Config struct { - Etherbase common.Address `toml:",omitempty"` // Public address for block mining rewards (default = first account) - Notify []string `toml:",omitempty"` // HTTP URL list to be notified of new work packages (only useful in ethash). - NotifyFull bool `toml:",omitempty"` // Notify with pending block headers instead of work packages - ExtraData hexutil.Bytes `toml:",omitempty"` // Block extra data set by the miner - GasFloor uint64 // Target gas floor for mined blocks. - GasCeil uint64 // Target gas ceiling for mined blocks. - GasPrice *big.Int // Minimum gas price for mining a transaction - AlgoType AlgoType // Algorithm to use for block building - Recommit time.Duration // The time interval for miner to re-create mining work. - Noverify bool // Disable remote mining solution verification(only useful in ethash). - BuilderTxSigningKey *ecdsa.PrivateKey // Signing key of builder coinbase to make transaction to validator - MaxMergedBundles int - Blocklist []common.Address `toml:",omitempty"` + Etherbase common.Address `toml:",omitempty"` // Public address for block mining rewards (default = first account) + Notify []string `toml:",omitempty"` // HTTP URL list to be notified of new work packages (only useful in ethash). + NotifyFull bool `toml:",omitempty"` // Notify with pending block headers instead of work packages + ExtraData hexutil.Bytes `toml:",omitempty"` // Block extra data set by the miner + GasFloor uint64 // Target gas floor for mined blocks. + GasCeil uint64 // Target gas ceiling for mined blocks. + GasPrice *big.Int // Minimum gas price for mining a transaction + AlgoType AlgoType // Algorithm to use for block building + OnlyBlocksWithBundles bool // Build only blocks with bundles + Recommit time.Duration // The time interval for miner to re-create mining work. + Noverify bool // Disable remote mining solution verification(only useful in ethash). + BuilderTxSigningKey *ecdsa.PrivateKey // Signing key of builder coinbase to make transaction to validator + MaxMergedBundles int + Blocklist []common.Address `toml:",omitempty"` } // Miner creates blocks and searches for proof-of-work values. diff --git a/miner/worker.go b/miner/worker.go index fd22e5fc1c..e687d67497 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -1338,6 +1338,9 @@ func (w *worker) fillTransactions(interrupt *int32, env *environment) (error, [] var allBundles []types.SimulatedBundle if w.flashbots.isFlashbots { bundles := w.eth.TxPool().MevBundles(env.header.Number, env.header.Time) + if w.config.OnlyBlocksWithBundles && len(bundles) == 0 { + return errors.New("no bundles included, skipping block building"), nil, nil + } var bundleTxs types.Transactions var resultingBundle simulatedBundle From b4cf65d953278baf1a7a0866b1fcb01a50899177 Mon Sep 17 00:00:00 2001 From: Adrian Chifor Date: Mon, 2 Jan 2023 17:33:38 +0000 Subject: [PATCH 4/4] Fix flag. Cover all MevBundles calls --- cmd/utils/flags.go | 4 +++- miner/worker.go | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 112a6bf61c..13e1afdd7f 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -1818,7 +1818,9 @@ func setMiner(ctx *cli.Context, cfg *miner.Config) { } cfg.AlgoType = algoType } - cfg.OnlyBlocksWithBundles = ctx.IsSet(MinerOnlyBlocksWithBundlesFlag.Name) + if ctx.IsSet(MinerOnlyBlocksWithBundlesFlag.Name) { + cfg.OnlyBlocksWithBundles = ctx.Bool(MinerOnlyBlocksWithBundlesFlag.Name) + } if ctx.IsSet(MinerRecommitIntervalFlag.Name) { cfg.Recommit = ctx.Duration(MinerRecommitIntervalFlag.Name) } diff --git a/miner/worker.go b/miner/worker.go index e687d67497..c3c489cef0 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -1408,6 +1408,9 @@ func (w *worker) getSimulatedBundles(env *environment) ([]types.SimulatedBundle, } bundles := w.eth.TxPool().MevBundles(env.header.Number, env.header.Time) + if w.config.OnlyBlocksWithBundles && len(bundles) == 0 { + return nil, errors.New("no bundles included, skipping block building") + } // TODO: consider interrupt simBundles, err := w.simulateBundles(env, bundles, nil) /* do not consider gas impact of mempool txs as bundles are treated as transactions wrt ordering */