-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Description
The init script is below:
if [ $i -eq 0 ] ; then
${workspace}/bin/geth --datadir ${workspace}/.local/node${i} init --state.scheme ${stateScheme} --db.engine ${dbEngine} ${workspace}/genesis/genesis.json > "${initLog}" 2>&1
elif [ $i -eq 1 ] ; then
${workspace}/bin/geth --datadir ${workspace}/.local/node${i} init --state.scheme path --db.engine pebble --multidatabase ${workspace}/genesis/genesis.json > "${initLog}" 2>&1
else
${workspace}/bin/geth --datadir ${workspace}/.local/node${i} init --state.scheme path --db.engine pebble ${workspace}/genesis/genesis.json > "${initLog}" 2>&1
fi
The run script is below:
nohup ${workspace}/.local/node${i}/geth${i} --config ${workspace}/.local/node${i}/config.toml \
--mine --vote --password ${workspace}/.local/node${i}/password.txt --unlock ${cons_addr} --miner.etherbase ${cons_addr} --blspassword ${workspace}/.local/node${i}/password.txt \
--datadir ${workspace}/.local/node${i} \
...
--rialtohash ${rialtoHash} **--override.passedforktime ${PassedForkTime} --override.lorentz ${PassedForkTime} --override.maxwell** ${LastHardforkTime} \
--override.immutabilitythreshold ${FullImmutabilityThreshold} --override.breatheblockinterval ${BreatheBlockInterval} \
--override.minforblobrequest ${MinBlocksForBlobRequests} --override.defaultextrareserve ${DefaultExtraReserveForBlobRequests} \
>> ${workspace}/.local/node${i}/bsc-node.log 2>&1 &
The initGenesis code is below:
// initGenesis will initialise the given JSON format genesis file and writes it as
// the zero'd block (i.e. genesis) or will fail hard if it can't succeed.
func initGenesis(ctx *cli.Context) error {
if ctx.Args().Len() != 1 {
utils.Fatalf("need genesis.json file as the only argument")
}
...
var overrides core.ChainOverrides
if ctx.IsSet(utils.OverridePassedForkTime.Name) {
v := ctx.Uint64(utils.OverridePassedForkTime.Name)
overrides.OverridePassedForkTime = &v
}
if ctx.IsSet(utils.OverrideLorentz.Name) {
v := ctx.Uint64(utils.OverrideLorentz.Name)
overrides.OverrideLorentz = &v
}
if ctx.IsSet(utils.OverrideMaxwell.Name) {
v := ctx.Uint64(utils.OverrideMaxwell.Name)
overrides.OverrideMaxwell = &v
}
if ctx.IsSet(utils.OverrideFermi.Name) {
v := ctx.Uint64(utils.OverrideFermi.Name)
overrides.OverrideFermi = &v
}
if ctx.IsSet(utils.OverrideVerkle.Name) {
v := ctx.Uint64(utils.OverrideVerkle.Name)
overrides.OverrideVerkle = &v
}
...
_, hash, _, err := core.SetupGenesisBlockWithOverride(chaindb, triedb, genesis, &overrides)
if err != nil {
utils.Fatalf("Failed to write genesis block: %v", err)
}
log.Info("Successfully wrote genesis state", "database", name, "hash", hash.String())
return nil
}
This method handles the override parameter, but it is not passed in the script.The init script will write the configuration to the genesis block. When the node is running, if some modules read the genesis block configuration in the db, and some modes use the configuration in the running parameters, it may cause inconsistent data reading and writing.
Metadata
Metadata
Assignees
Labels
No labels