Skip to content

Commit

Permalink
"mycelo genesis" gingerbread activation fix (#2169)
Browse files Browse the repository at this point in the history
  • Loading branch information
palango authored and gastonponti committed Aug 22, 2023
1 parent a0655eb commit b237830
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
15 changes: 8 additions & 7 deletions cmd/mycelo/genesis_commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)",
},
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion cmd/mycelo/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion monorepo_commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
549ff08afc86f2123abd8bb19000e248e5a86477
f08e269d88c6680641427952ce4743a7d26336a6
6 changes: 3 additions & 3 deletions mycelo/internal/utils/jsonfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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)
}

0 comments on commit b237830

Please sign in to comment.