Skip to content

Commit

Permalink
cmd/geth,cmd/utils,eth,eth/ethconfig: ECBP100-deactivate: move overri…
Browse files Browse the repository at this point in the history
…de flags to --override.X,

and categorize these flags.

Date: 2023-12-06 08:02:58-07:00
Signed-off-by: meows <[email protected]>
  • Loading branch information
meowsbits committed Dec 6, 2023
1 parent 35f1955 commit 0f7b11c
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 29 deletions.
10 changes: 5 additions & 5 deletions cmd/geth/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,16 +174,16 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
cfg.Eth.ECBP1100 = new(big.Int).SetUint64(n)
}
}
if ctx.IsSet(utils.ECBP1100DeactivateFlag.Name) {
if n := ctx.Uint64(utils.ECBP1100DeactivateFlag.Name); n != math.MaxUint64 {
cfg.Eth.ECBP1100Deactivate = new(big.Int).SetUint64(n)
}
}
if ctx.IsSet(utils.ECBP1100NoDisableFlag.Name) {
if enable := ctx.Bool(utils.ECBP1100NoDisableFlag.Name); enable {
cfg.Eth.ECBP1100NoDisable = &enable
}
}
if ctx.IsSet(utils.OverrideECBP1100DeactivateFlag.Name) {
if n := ctx.Uint64(utils.OverrideECBP1100DeactivateFlag.Name); n != math.MaxUint64 {
cfg.Eth.OverrideECBP1100Deactivate = new(big.Int).SetUint64(n)
}
}
if ctx.IsSet(utils.OverrideShanghai.Name) {
v := ctx.Uint64(utils.OverrideShanghai.Name)
cfg.Eth.OverrideShanghai = &v
Expand Down
2 changes: 1 addition & 1 deletion cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ var (
utils.MinerNotifyFullFlag,
utils.ECBP1100Flag,
utils.ECBP1100NoDisableFlag,
utils.ECBP1100DeactivateFlag,
utils.OverrideECBP1100DeactivateFlag,
configFileFlag,
}, utils.NetworkFlags, utils.DatabasePathFlags)

Expand Down
19 changes: 10 additions & 9 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -1064,18 +1064,19 @@ Please note that --` + MetricsHTTPFlag.Name + ` must be set to start the server.
Value: "",
}
ECBP1100Flag = &cli.Uint64Flag{
Name: "ecbp1100",
Usage: "Configure ECBP-1100 (MESS) block activation number",
Value: math.MaxUint64,
Name: "ecbp1100", // should have been override.ecbp1100, but maintained now for backwards compatibility
Usage: "Manually specify the ECBP-1100 (MESS) block activation number, overriding the bundled setting",
Category: flags.EthCategory,
}
ECBP1100DeactivateFlag = &cli.Uint64Flag{
Name: "ecbp1100.disable",
Usage: "Disable ECBP-1100 (MESS) block activation number",
Value: math.MaxUint64,
OverrideECBP1100DeactivateFlag = &cli.Uint64Flag{
Name: "override.ecbp1100.deactivate",
Usage: "Manually specify the ECBP-1100 (MESS) deactivation block number, overriding the bundled setting",
Category: flags.EthCategory,
}
ECBP1100NoDisableFlag = &cli.BoolFlag{
Name: "ecbp1100.nodisable",
Usage: "Short-circuit ECBP-1100 (MESS) disable mechanisms; (yields a permanent-once-activated state, deactivating auto-shutoff mechanisms)",
Name: "ecbp1100.nodisable",
Usage: "Short-circuit ECBP-1100 (MESS) disable mechanisms; (yields a permanent-once-activated state, deactivating auto-shutoff mechanisms)",
Category: flags.DeprecatedCategory,
}

MetricsEnableInfluxDBV2Flag = &cli.BoolFlag{
Expand Down
19 changes: 8 additions & 11 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package eth
import (
"errors"
"fmt"
"math"
"math/big"
"runtime"
"sync"
Expand Down Expand Up @@ -231,18 +230,16 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
}
eth.bloomIndexer.Start(eth.blockchain)
// Handle artificial finality config override cases.
if config.ECBP1100 != nil {
if n := config.ECBP1100.Uint64(); n != math.MaxUint64 {
if err := eth.blockchain.Config().SetECBP1100Transition(&n); err != nil {
return nil, err
}
if n := config.ECBP1100; n != nil {
v := n.Uint64()
if err := eth.blockchain.Config().SetECBP1100Transition(&v); err != nil {
return nil, err
}
}
if config.ECBP1100Deactivate != nil {
if n := config.ECBP1100Deactivate.Uint64(); n != math.MaxUint64 {
if err := eth.blockchain.Config().SetECBP1100DeactivateTransition(&n); err != nil {
return nil, err
}
if n := config.OverrideECBP1100Deactivate; n != nil {
v := n.Uint64()
if err := eth.blockchain.Config().SetECBP1100DeactivateTransition(&v); err != nil {
return nil, err
}
}

Expand Down
2 changes: 1 addition & 1 deletion eth/ethconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ type Config struct {
// Manual configuration field for ECBP1100 activation number. Used for modifying genesis config via CLI flag.
ECBP1100 *big.Int
// Manual configuration field for ECBP1100's disablement block number. Used for modifying genesis config via CLI flag.
ECBP1100Deactivate *big.Int
OverrideECBP1100Deactivate *big.Int

// ECBP1100NoDisable overrides
// When this value is *true, ECBP100 will not (ever) be disabled; when *false, it will never be enabled.
Expand Down
4 changes: 2 additions & 2 deletions eth/ethconfig/gen_config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0f7b11c

Please sign in to comment.