Skip to content

Commit

Permalink
cmd, eth, les: replace Shanghai override flag with Cancun (ethereum#2…
Browse files Browse the repository at this point in the history
  • Loading branch information
karalabe authored and shekhirin committed Jun 6, 2023
1 parent cd6f00b commit ad3aeff
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions cmd/geth/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, gethConfig) {
// makeFullNode loads geth configuration and creates the Ethereum backend.
func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
stack, cfg := makeConfigNode(ctx)
if ctx.IsSet(utils.OverrideShanghai.Name) {
v := ctx.Uint64(utils.OverrideShanghai.Name)
cfg.Eth.OverrideShanghai = &v
if ctx.IsSet(utils.OverrideCancun.Name) {
v := ctx.Uint64(utils.OverrideCancun.Name)
cfg.Eth.OverrideCancun = &v
}
backend, eth := utils.RegisterEthService(stack, &cfg.Eth)

Expand Down
2 changes: 1 addition & 1 deletion cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ var (
utils.NoUSBFlag,
utils.USBFlag,
utils.SmartCardDaemonPathFlag,
utils.OverrideShanghai,
utils.OverrideCancun,
utils.EnablePersonal,
utils.EthashCacheDirFlag,
utils.EthashCachesInMemoryFlag,
Expand Down
6 changes: 3 additions & 3 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,9 @@ var (
Value: 2048,
Category: flags.EthCategory,
}
OverrideShanghai = &cli.Uint64Flag{
Name: "override.shanghai",
Usage: "Manually specify the Shanghai fork timestamp, overriding the bundled setting",
OverrideCancun = &cli.Uint64Flag{
Name: "override.cancun",
Usage: "Manually specify the Cancun fork timestamp, overriding the bundled setting",
Category: flags.EthCategory,
}
// Light server and client settings
Expand Down
6 changes: 3 additions & 3 deletions core/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ func (e *GenesisMismatchError) Error() string {

// ChainOverrides contains the changes to chain config.
type ChainOverrides struct {
OverrideShanghai *uint64
OverrideCancun *uint64
}

// SetupGenesisBlock writes or updates the genesis block in db.
Expand All @@ -293,8 +293,8 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, triedb *trie.Database, gen
}
applyOverrides := func(config *params.ChainConfig) {
if config != nil {
if overrides != nil && overrides.OverrideShanghai != nil {
config.ShanghaiTime = overrides.OverrideShanghai
if overrides != nil && overrides.OverrideCancun != nil {
config.CancunTime = overrides.OverrideCancun
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
)
// Override the chain config with provided settings.
var overrides core.ChainOverrides
if config.OverrideShanghai != nil {
overrides.OverrideShanghai = config.OverrideShanghai
if config.OverrideCancun != nil {
overrides.OverrideCancun = config.OverrideCancun
}
eth.blockchain, err = core.NewBlockChain(chainDb, cacheConfig, config.Genesis, &overrides, eth.engine, vmConfig, eth.shouldPreserve, &config.TxLookupLimit)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions eth/ethconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ type Config struct {
// send-transaction variants. The unit is ether.
RPCTxFeeCap float64

// OverrideShanghai (TODO: remove after the fork)
OverrideShanghai *uint64 `toml:",omitempty"`
// OverrideCancun (TODO: remove after the fork)
OverrideCancun *uint64 `toml:",omitempty"`
}

// CreateConsensusEngine creates a consensus engine for the given chain configuration.
Expand Down
10 changes: 5 additions & 5 deletions eth/ethconfig/gen_config.go

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

4 changes: 2 additions & 2 deletions les/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ func New(stack *node.Node, config *ethconfig.Config) (*LightEthereum, error) {
return nil, err
}
var overrides core.ChainOverrides
if config.OverrideShanghai != nil {
overrides.OverrideShanghai = config.OverrideShanghai
if config.OverrideCancun != nil {
overrides.OverrideCancun = config.OverrideCancun
}
chainConfig, genesisHash, genesisErr := core.SetupGenesisBlockWithOverride(chainDb, trie.NewDatabase(chainDb), config.Genesis, &overrides)
if _, isCompat := genesisErr.(*params.ConfigCompatError); genesisErr != nil && !isCompat {
Expand Down

0 comments on commit ad3aeff

Please sign in to comment.