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 all commits
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
35 changes: 24 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,20 @@ $ 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]

--builder.bellatrix_fork_version value (default: "0x02000000")
Bellatrix fork version. [$BUILDER_BELLATRIX_FORK_VERSION]

--builder.blacklist value
Wazzymandias marked this conversation as resolved.
Show resolved Hide resolved
Path to file containing blacklisted addresses, json-encoded list of strings.
Builder will ignore transactions that touch mentioned addresses.

--builder.block_resubmit_interval value (default: "500ms")
Determines the interval at which builder will resubmit block submissions
[$FLASHBOTS_BUILDER_RATE_LIMIT_RESUBMIT_INTERVAL]
Expand Down Expand Up @@ -74,6 +81,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
builder.algotype=greedy-buckets [$FLASHBOTS_BUILDER_PRICE_CUTOFF_PERCENT]

--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 Expand Up @@ -111,21 +127,19 @@ $ geth --help
blocks. For example, if a slot is 12 seconds long, and the offset is 2 seconds,
the builder will submit blocks at 10 seconds into the slot.
[$FLASHBOTS_BUILDER_SUBMISSION_OFFSET]

--builder.validation_blacklist value
Wazzymandias marked this conversation as resolved.
Show resolved Hide resolved
Path to file containing blacklisted addresses, json-encoded list of strings


--builder.validator_checks (default: false)
Enable the validator checks

MINER

--miner.algotype value (default: "mev-geth")
Block building algorithm to use [=mev-geth] (mev-geth, greedy, greedy-buckets)
[NOTE: Deprecated, please use builder.algotype instead] Block building algorithm
to use [=mev-geth] (mev-geth, greedy, greedy-buckets)

--miner.blocklist value
flashbots - Path to JSON file with list of blocked addresses. Miner will ignore
txs that touch mentioned addresses.
--miner.blocklist value
[NOTE: Deprecated, please use builder.blacklist] flashbots - Path to JSON file with
list of blocked addresses. Miner will ignore txs that touch mentioned addresses.

--miner.extradata value
Block extra data set by the miner (default = client version)
Expand Down Expand Up @@ -169,8 +183,7 @@ See the [metrics docs](https://geth.ethereum.org/docs/monitoring/metrics) for ge

If you want to reject transactions interacting with certain addresses, save the addresses in json file with an array of strings. Deciding whether to use such a list, as well as maintaining it, is your own responsibility.

- for block building, use `--miner.blocklist`
- for validation, use `--builder.validation_blacklist`
- for block building and validation, use `--builder.blacklist`

--

Expand Down Expand Up @@ -220,7 +233,7 @@ Miner is responsible for block creation. Request from the `builder` is routed to
* `algo_greedy.go` implements logic of the block building. Bundles and transactions are sorted in the order of effective gas price then
we try to insert everything into to block until gas limit is reached. Failing bundles are reverted during the insertion but txs are not.
* Builder can filter transactions touching a particular set of addresses.
If a bundle or transaction touches one of the addresses it is skipped. (see `--miner.blocklist` flag)
If a bundle or transaction touches one of the addresses it is skipped. (see `--builder.blacklist` flag)

## Bundle Movement

Expand Down
3 changes: 2 additions & 1 deletion cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ var (
utils.MinerMaxMergedBundlesFlag,
utils.MinerBlocklistFileFlag,
utils.MinerNewPayloadTimeout,
utils.MinerPriceCutoffPercentFlag,
utils.NATFlag,
utils.NoDiscoverFlag,
utils.DiscoveryV5Flag,
Expand All @@ -159,6 +158,8 @@ var (

builderApiFlags = []cli.Flag{
utils.BuilderEnabled,
utils.BuilderAlgoTypeFlag,
utils.BuilderPriceCutoffPercentFlag,
utils.BuilderEnableValidatorChecks,
utils.BuilderBlockValidationBlacklistSourceFilePath,
utils.BuilderEnableLocalRelay,
Expand Down
86 changes: 67 additions & 19 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ var (
}
MinerAlgoTypeFlag = &cli.StringFlag{
Name: "miner.algotype",
Usage: "Block building algorithm to use [=mev-geth] (mev-geth, greedy, greedy-buckets)",
Usage: "[NOTE: Deprecated, please use builder.algotype instead] Block building algorithm to use [=mev-geth] (mev-geth, greedy, greedy-buckets)",
Value: "mev-geth",
Category: flags.MinerCategory,
}
Expand Down Expand Up @@ -581,7 +581,7 @@ var (
}
MinerBlocklistFileFlag = &cli.StringFlag{
Name: "miner.blocklist",
Usage: "flashbots - Path to JSON file with list of blocked addresses. Miner will ignore txs that touch mentioned addresses.",
Usage: "[NOTE: Deprecated, please use builder.blacklist] flashbots - Path to JSON file with list of blocked addresses. Miner will ignore txs that touch mentioned addresses.",
Value: "",
Category: flags.MinerCategory,
}
Expand All @@ -591,17 +591,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,15 +698,44 @@ 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 builder.algotype=greedy-buckets",
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",
Category: flags.BuilderCategory,
}
BuilderBlockValidationBlacklistSourceFilePath = &cli.StringFlag{
Name: "builder.validation_blacklist",
Usage: "Path to file containing blacklisted addresses, json-encoded list of strings",
Name: "builder.blacklist",
Usage: "Path to file containing blacklisted addresses, json-encoded list of strings. " +
"Builder will ignore transactions that touch mentioned addresses. This flag is also used for block validation API.\n" +
"NOTE: builder.validation_blacklist is deprecated and will be removed in the future in favor of builder.blacklist",
Value: "",
Aliases: []string{"builder.validation_blacklist"},
Category: flags.BuilderCategory,
}
BuilderEnableLocalRelay = &cli.BoolFlag{
Expand Down Expand Up @@ -1675,7 +1693,15 @@ func SetBuilderConfig(ctx *cli.Context, cfg *builder.Config) {
cfg.BeaconEndpoints = strings.Split(ctx.String(BuilderBeaconEndpoints.Name), ",")
cfg.RemoteRelayEndpoint = ctx.String(BuilderRemoteRelayEndpoint.Name)
cfg.SecondaryRemoteRelayEndpoints = strings.Split(ctx.String(BuilderSecondaryRemoteRelayEndpoints.Name), ",")
cfg.ValidationBlocklist = ctx.String(BuilderBlockValidationBlacklistSourceFilePath.Name)
// NOTE: This flag is deprecated and will be removed in the future in favor of BuilderBlockValidationBlacklistSourceFilePath
if ctx.IsSet(MinerBlocklistFileFlag.Name) {
cfg.ValidationBlocklist = ctx.String(MinerBlocklistFileFlag.Name)
}

// NOTE: This flag takes precedence and will overwrite value set by MinerBlocklistFileFlag
if ctx.IsSet(BuilderBlockValidationBlacklistSourceFilePath.Name) {
cfg.ValidationBlocklist = ctx.String(BuilderBlockValidationBlacklistSourceFilePath.Name)
}
cfg.BuilderRateLimitDuration = ctx.String(BuilderRateLimitDuration.Name)
cfg.BuilderRateLimitMaxBurst = ctx.Int(BuilderRateLimitMaxBurst.Name)
cfg.BuilderSubmissionOffset = ctx.Duration(BuilderSubmissionOffset.Name)
Expand Down Expand Up @@ -1876,10 +1902,19 @@ func setMiner(ctx *cli.Context, cfg *miner.Config) {
if ctx.IsSet(MinerGasPriceFlag.Name) {
cfg.GasPrice = flags.GlobalBig(ctx, MinerGasPriceFlag.Name)
}
// NOTE: This flag is deprecated and will be removed in the future.
if ctx.IsSet(MinerAlgoTypeFlag.Name) {
algoType, err := miner.AlgoTypeFlagToEnum(ctx.String(MinerAlgoTypeFlag.Name))
algoType, err := miner.AlgoTypeFlagToEnum(ctx.String(BuilderAlgoTypeFlag.Name))
if err != nil {
Fatalf("Invalid algo in --miner.algotype: %s", ctx.String(BuilderAlgoTypeFlag.Name))
}
cfg.AlgoType = algoType
}
// NOTE: BuilderAlgoTypeFlag takes precedence and will overwrite value set by MinerAlgoTypeFlag.
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 @@ -1895,6 +1930,7 @@ func setMiner(ctx *cli.Context, cfg *miner.Config) {

cfg.MaxMergedBundles = ctx.Int(MinerMaxMergedBundlesFlag.Name)

// NOTE: This flag is deprecated and will be removed in the future in favor of BuilderBlockValidationBlacklistSourceFilePath
if ctx.IsSet(MinerBlocklistFileFlag.Name) {
bytes, err := os.ReadFile(ctx.String(MinerBlocklistFileFlag.Name))
if err != nil {
Expand All @@ -1906,7 +1942,19 @@ func setMiner(ctx *cli.Context, cfg *miner.Config) {
}
}

cfg.PriceCutoffPercent = ctx.Int(MinerPriceCutoffPercentFlag.Name)
// NOTE: This flag takes precedence and will overwrite value set by MinerBlocklistFileFlag
if ctx.IsSet(BuilderBlockValidationBlacklistSourceFilePath.Name) {
bytes, err := os.ReadFile(ctx.String(MinerBlocklistFileFlag.Name))
if err != nil {
Fatalf("Failed to read blocklist file: %s", err)
}

if err := json.Unmarshal(bytes, &cfg.Blocklist); err != nil {
Fatalf("Failed to parse blocklist: %s", err)
}
}

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

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