Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

[trivial] [Breaking Change] Migrate some miner CLI flags to builder #88

Merged
merged 6 commits into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ $ geth --help
--builder (default: false)
Enable the builder

--builder.algotype value (default: "mev-geth")
Wazzymandias marked this conversation as resolved.
Show resolved Hide resolved
Block building algorithm to use [=mev-geth] (mev-geth, greedy, greedy-buckets)

--builder.beacon_endpoints value (default: "http://127.0.0.1:5052")
Comma separated list of beacon endpoints to connect to for beacon chain data
[$BUILDER_BEACON_ENDPOINTS]
Expand Down Expand Up @@ -74,6 +77,15 @@ $ geth --help
--builder.no_bundle_fetcher (default: false)
Disable the bundle fetcher

--builder.price_cutoff_percent value (default: 50)
flashbots - The minimum effective gas price threshold used for bucketing
transactions by price. For example if the top transaction in a list has an
effective gas price of 1000 wei and price_cutoff_percent is 10 (i.e. 10%), then
the minimum effective gas price included in the same bucket as the top
transaction is (1000 * 10%) = 100 wei.
NOTE: This flag is only used when
miner.algotype=greedy-buckets [$FLASHBOTS_BUILDER_PRICE_CUTOFF_PERCENT]
Wazzymandias marked this conversation as resolved.
Show resolved Hide resolved

--builder.rate_limit_duration value (default: "500ms")
Determines rate limit of events processed by builder. For example, a value of
"500ms" denotes that the builder processes events every 500ms. A duration string
Expand Down
4 changes: 2 additions & 2 deletions cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,13 @@ var (
utils.MinerNotifyFlag,
utils.MinerGasLimitFlag,
utils.MinerGasPriceFlag,
utils.MinerAlgoTypeFlag,
utils.MinerEtherbaseFlag,
utils.MinerExtraDataFlag,
utils.MinerRecommitIntervalFlag,
utils.MinerNoVerifyFlag,
utils.MinerMaxMergedBundlesFlag,
utils.MinerBlocklistFileFlag,
utils.MinerNewPayloadTimeout,
utils.MinerPriceCutoffPercentFlag,
utils.NATFlag,
utils.NoDiscoverFlag,
utils.DiscoveryV5Flag,
Expand All @@ -159,6 +157,8 @@ var (

builderApiFlags = []cli.Flag{
utils.BuilderEnabled,
utils.BuilderAlgoTypeFlag,
utils.BuilderPriceCutoffPercentFlag,
utils.BuilderEnableValidatorChecks,
utils.BuilderBlockValidationBlacklistSourceFilePath,
utils.BuilderEnableLocalRelay,
Expand Down
51 changes: 30 additions & 21 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -546,12 +546,6 @@ var (
Value: ethconfig.Defaults.Miner.GasPrice,
Category: flags.MinerCategory,
}
MinerAlgoTypeFlag = &cli.StringFlag{
Name: "miner.algotype",
Usage: "Block building algorithm to use [=mev-geth] (mev-geth, greedy, greedy-buckets)",
Value: "mev-geth",
Category: flags.MinerCategory,
}
MinerEtherbaseFlag = &cli.StringFlag{
Name: "miner.etherbase",
Usage: "0x prefixed public address for block mining rewards",
Expand Down Expand Up @@ -591,17 +585,6 @@ var (
Value: ethconfig.Defaults.Miner.NewPayloadTimeout,
Category: flags.MinerCategory,
}
MinerPriceCutoffPercentFlag = &cli.IntFlag{
Name: "miner.price_cutoff_percent",
Usage: "flashbots - The minimum effective gas price threshold used for bucketing transactions by price. " +
"For example if the top transaction in a list has an effective gas price of 1000 wei and price_cutoff_percent " +
"is 10 (i.e. 10%), then the minimum effective gas price included in the same bucket as the top transaction " +
"is (1000 * 10%) = 100 wei.\n" +
"NOTE: This flag is only used when miner.algotype=greedy-buckets",
Value: ethconfig.Defaults.Miner.PriceCutoffPercent,
Category: flags.MinerCategory,
EnvVars: []string{"FLASHBOTS_MINER_PRICE_CUTOFF_PERCENT"},
}

// Account settings
UnlockedAccountFlag = &cli.StringFlag{
Expand Down Expand Up @@ -709,6 +692,32 @@ var (
Usage: "Enable the builder",
Category: flags.BuilderCategory,
}

// BuilderAlgoTypeFlag replaces MinerAlgoTypeFlag to move away from deprecated miner package
// Note: builder.algotype was previously miner.algotype - this flag is still propagated to the miner configuration,
// see setMiner in cmd/utils/flags.go
BuilderAlgoTypeFlag = &cli.StringFlag{
Name: "builder.algotype",
Usage: "Block building algorithm to use [=mev-geth] (mev-geth, greedy, greedy-buckets)",
Value: "mev-geth",
Category: flags.BuilderCategory,
}

// BuilderPriceCutoffPercentFlag replaces MinerPriceCutoffPercentFlag to move away from deprecated miner package
// Note: builder.price_cutoff_percent was previously miner.price_cutoff_percent -
// this flag is still propagated to the miner configuration, see setMiner in cmd/utils/flags.go
BuilderPriceCutoffPercentFlag = &cli.IntFlag{
Name: "builder.price_cutoff_percent",
Usage: "flashbots - The minimum effective gas price threshold used for bucketing transactions by price. " +
"For example if the top transaction in a list has an effective gas price of 1000 wei and price_cutoff_percent " +
"is 10 (i.e. 10%), then the minimum effective gas price included in the same bucket as the top transaction " +
"is (1000 * 10%) = 100 wei.\n" +
"NOTE: This flag is only used when miner.algotype=greedy-buckets",
Wazzymandias marked this conversation as resolved.
Show resolved Hide resolved
Value: ethconfig.Defaults.Miner.PriceCutoffPercent,
Category: flags.BuilderCategory,
EnvVars: []string{"FLASHBOTS_BUILDER_PRICE_CUTOFF_PERCENT"},
}

BuilderEnableValidatorChecks = &cli.BoolFlag{
Name: "builder.validator_checks",
Usage: "Enable the validator checks",
Expand Down Expand Up @@ -1876,10 +1885,10 @@ func setMiner(ctx *cli.Context, cfg *miner.Config) {
if ctx.IsSet(MinerGasPriceFlag.Name) {
cfg.GasPrice = flags.GlobalBig(ctx, MinerGasPriceFlag.Name)
}
if ctx.IsSet(MinerAlgoTypeFlag.Name) {
algoType, err := miner.AlgoTypeFlagToEnum(ctx.String(MinerAlgoTypeFlag.Name))
if ctx.IsSet(BuilderAlgoTypeFlag.Name) {
algoType, err := miner.AlgoTypeFlagToEnum(ctx.String(BuilderAlgoTypeFlag.Name))
if err != nil {
Fatalf("Invalid algo in --miner.algotype: %s", ctx.String(MinerAlgoTypeFlag.Name))
Fatalf("Invalid algo in --builder.algotype: %s", ctx.String(BuilderAlgoTypeFlag.Name))
}
cfg.AlgoType = algoType
}
Expand All @@ -1906,7 +1915,7 @@ func setMiner(ctx *cli.Context, cfg *miner.Config) {
}
}

cfg.PriceCutoffPercent = ctx.Int(MinerPriceCutoffPercentFlag.Name)
cfg.PriceCutoffPercent = ctx.Int(BuilderPriceCutoffPercentFlag.Name)
}

func setRequiredBlocks(ctx *cli.Context, cfg *ethconfig.Config) {
Expand Down
Loading