Skip to content

Commit

Permalink
mycelo hardforks config
Browse files Browse the repository at this point in the history
  • Loading branch information
gastonponti committed Aug 26, 2022
1 parent c391784 commit b46a0a6
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
40 changes: 40 additions & 0 deletions cmd/mycelo/genesis_commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"math/big"
"os"
"path"

Expand Down Expand Up @@ -41,6 +42,18 @@ var templateFlags = []cli.Flag{
Name: "mnemonic",
Usage: "Mnemonic to generate accounts",
},
cli.Int64Flag{
Name: "forks.churrito",
Usage: "Optional flag to allow churrito fork overwritting (default: 0, disable: -1)",
},
cli.Int64Flag{
Name: "forks.donut",
Usage: "Optional flag to allow donut fork overwritting (default: 0, disable: -1)",
},
cli.Int64Flag{
Name: "forks.espresso",
Usage: "Optional flag to allow espresso fork overwritting (default: 0, disable: -1)",
},
}

var buildpathFlag = cli.StringFlag{
Expand Down Expand Up @@ -127,6 +140,33 @@ func envFromTemplate(ctx *cli.Context, workdir string) (*env.Environment, *genes
genesisConfig.Blockchain.BlockGasLimit = ctx.Uint64("blockgaslimit")
}

if ctx.IsSet("forks.churrito") {
churritoBlockNumber := ctx.Int64("forks.churrito")
if churritoBlockNumber < 0 {
genesisConfig.Hardforks.EspressoBlock = nil
} else {
genesisConfig.Hardforks.ChurritoBlock = big.NewInt(churritoBlockNumber)
}
}

if ctx.IsSet("forks.donut") {
donutBlockNumber := ctx.Int64("forks.donut")
if donutBlockNumber < 0 {
genesisConfig.Hardforks.DonutBlock = nil
} else {
genesisConfig.Hardforks.DonutBlock = big.NewInt(donutBlockNumber)
}
}

if ctx.IsSet("forks.espresso") {
espressoBlockNumber := ctx.Int64("forks.espresso")
if espressoBlockNumber < 0 {
genesisConfig.Hardforks.EspressoBlock = nil
} else {
genesisConfig.Hardforks.EspressoBlock = big.NewInt(espressoBlockNumber)
}
}

return env, genesisConfig, nil
}

Expand Down
1 change: 1 addition & 0 deletions mycelo/genesis/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func CreateCommonGenesisConfig(chainID *big.Int, adminAccountAddress common.Addr
genesisConfig.Hardforks = HardforkConfig{
ChurritoBlock: common.Big0,
DonutBlock: common.Big0,
EspressoBlock: common.Big0,
}

// Make admin account manager of Governance & Reserve
Expand Down

0 comments on commit b46a0a6

Please sign in to comment.