From b2378303d6468e7e156237d24f853ecaa3122d06 Mon Sep 17 00:00:00 2001 From: Paul Lange Date: Tue, 22 Aug 2023 02:18:51 +0200 Subject: [PATCH] "mycelo genesis" gingerbread activation fix (#2169) --- cmd/mycelo/genesis_commands.go | 15 ++++++++------- cmd/mycelo/templates.go | 1 - monorepo_commit | 2 +- mycelo/internal/utils/jsonfile.go | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cmd/mycelo/genesis_commands.go b/cmd/mycelo/genesis_commands.go index d5d34f9098..a54ed8a6e7 100644 --- a/cmd/mycelo/genesis_commands.go +++ b/cmd/mycelo/genesis_commands.go @@ -6,6 +6,7 @@ import ( "os" "path" + "github.com/celo-org/celo-blockchain/common" "github.com/celo-org/celo-blockchain/internal/fileutils" "github.com/celo-org/celo-blockchain/log" "github.com/celo-org/celo-blockchain/mycelo/env" @@ -44,23 +45,23 @@ var templateFlags = []cli.Flag{ }, cli.Int64Flag{ Name: "forks.churrito", - Usage: "Optional flag to allow churrito fork overwritting (default: 0, disable: -1)", + Usage: "Optional flag to allow churrito fork overwriting (default: 0, disable: -1)", }, cli.Int64Flag{ Name: "forks.donut", - Usage: "Optional flag to allow donut fork overwritting (default: 0, disable: -1)", + Usage: "Optional flag to allow donut fork overwriting (default: 0, disable: -1)", }, cli.Int64Flag{ Name: "forks.espresso", - Usage: "Optional flag to allow espresso fork overwritting (default: 0, disable: -1)", + Usage: "Optional flag to allow espresso fork overwriting (default: 0, disable: -1)", }, cli.Int64Flag{ Name: "forks.gingerbread", - Usage: "Optional flag to allow gingerbread fork overwritting (default: 0, disable: -1)", + Usage: "Optional flag to allow gingerbread fork overwriting (default: 0, disable: -1)", }, cli.Int64Flag{ Name: "forks.gingerbreadp2", - Usage: "Optional flag to allow gingerbread p2 fork overwritting (default: 0, disable: -1)", + Usage: "Optional flag to allow gingerbread p2 fork overwriting (default: 0, disable: -1)", }, } @@ -139,6 +140,8 @@ func envFromTemplate(ctx *cli.Context, workdir string) (*env.Environment, *genes } else { gingerbreadBlock = big.NewInt(gingerbreadBlockNumber) } + } else { + gingerbreadBlock = common.Big1 } // Genesis config @@ -185,8 +188,6 @@ func envFromTemplate(ctx *cli.Context, workdir string) (*env.Environment, *genes } } - genesisConfig.Hardforks.GingerbreadBlock = gingerbreadBlock - if ctx.IsSet("forks.gingerbreadp2") { gingerbreadP2BlockNumber := ctx.Int64("forks.gingerbreadp2") if gingerbreadP2BlockNumber < 0 { diff --git a/cmd/mycelo/templates.go b/cmd/mycelo/templates.go index 9d2e70bdca..fa9b60fb4d 100644 --- a/cmd/mycelo/templates.go +++ b/cmd/mycelo/templates.go @@ -49,7 +49,6 @@ func (e localEnv) createEnv(workdir string) (*env.Environment, error) { } func (e localEnv) createGenesisConfig(env *env.Environment, gingerbreadBlock *big.Int) (*genesis.Config, error) { - genesisConfig, err := genesis.CreateCommonGenesisConfig(env.Config.ChainID, env.Accounts().AdminAccount().Address, params.IstanbulConfig{ Epoch: 10, ProposerPolicy: 2, diff --git a/monorepo_commit b/monorepo_commit index e8a1780229..093c0e94ba 100644 --- a/monorepo_commit +++ b/monorepo_commit @@ -1 +1 @@ -549ff08afc86f2123abd8bb19000e248e5a86477 +f08e269d88c6680641427952ce4743a7d26336a6 diff --git a/mycelo/internal/utils/jsonfile.go b/mycelo/internal/utils/jsonfile.go index 02e7b0d0ac..210f8dd17e 100644 --- a/mycelo/internal/utils/jsonfile.go +++ b/mycelo/internal/utils/jsonfile.go @@ -2,11 +2,11 @@ package utils import ( "encoding/json" - "io/ioutil" + "os" ) func ReadJson(out interface{}, filepath string) error { - byteValue, err := ioutil.ReadFile(filepath) + byteValue, err := os.ReadFile(filepath) if err != nil { return err } @@ -20,5 +20,5 @@ func WriteJson(in interface{}, filepath string) error { return err } - return ioutil.WriteFile(filepath, byteValue, 0644) + return os.WriteFile(filepath, byteValue, 0644) }