From 7ff75ac2f2f8a62d52367271194aa7889a5b5c88 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Tue, 28 Feb 2017 23:18:13 +0100 Subject: [PATCH] cmd/utils, core, params: fork all teh things for dev mode (#3697) --- cmd/utils/flags.go | 2 ++ core/genesis.go | 3 +++ params/config.go | 10 ++++++++++ 3 files changed, 15 insertions(+) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 25c3a1ada7..a586ffeb34 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -861,6 +861,8 @@ func MakeChainConfigFromDb(ctx *cli.Context, db ethdb.Database) *params.ChainCon if defaults { if ctx.GlobalBool(TestNetFlag.Name) { config = params.TestnetChainConfig + } else if ctx.GlobalBool(DevModeFlag.Name) { + config = params.AllProtocolChanges } else { // Homestead fork config.HomesteadBlock = params.MainNetHomesteadBlock diff --git a/core/genesis.go b/core/genesis.go index d827ac1c11..9fa49f4d0e 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -64,6 +64,9 @@ func WriteGenesisBlock(chainDb ethdb.Database, reader io.Reader) (*types.Block, if err := json.Unmarshal(contents, &genesis); err != nil { return nil, err } + if genesis.ChainConfig == nil { + genesis.ChainConfig = params.AllProtocolChanges + } // creating with empty hash always works statedb, _ := state.New(common.Hash{}, chainDb) diff --git a/params/config.go b/params/config.go index 8c285781e9..ee993fe4a1 100644 --- a/params/config.go +++ b/params/config.go @@ -47,6 +47,16 @@ var TestnetChainConfig = &ChainConfig{ EIP158Block: big.NewInt(10), } +// AllProtocolChanges contains every protocol change (EIPs) +// introduced and accepted by the Ethereum core developers. +// +// This configuration is intentionally not using keyed fields. +// This configuration must *always* have all forks enabled, which +// means that all fields must be set at all times. This forces +// anyone adding flags to the config to also have to set these +// fields. +var AllProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0)} + // ChainConfig is the core config which determines the blockchain settings. // // ChainConfig is stored in the database on a per block basis. This means