Use SSZ genesis files
Multi-client testing requires more portable formats, and SSZ is much better specified than our flavour of Json. Tools like ncli and zcli can be now used to inspect the contents of the SSZ files.
This commit is contained in:
parent
efa6d2d08e
commit
6664f1689f
|
@ -17,7 +17,7 @@ import
|
|||
|
||||
const
|
||||
dataDirValidators = "validators"
|
||||
genesisFile = "genesis.json"
|
||||
genesisFile = "genesis.ssz"
|
||||
hasPrompt = not defined(withoutPrompt)
|
||||
|
||||
# https://github.com/ethereum/eth2.0-metrics/blob/master/metrics.md#interop-metrics
|
||||
|
@ -943,13 +943,12 @@ when isMainModule:
|
|||
stderr.write "Please regenerate the deposit files by running makeDeposits again\n"
|
||||
quit 1
|
||||
|
||||
let eth1Hash = if config.depositWeb3Url.len == 0:
|
||||
eth1BlockHash
|
||||
else:
|
||||
waitFor getLatestEth1BlockHash(config.depositWeb3Url)
|
||||
|
||||
var
|
||||
let
|
||||
startTime = uint64(times.toUnix(times.getTime()) + config.genesisOffset)
|
||||
outGenesis = config.outputGenesis.string
|
||||
eth1Hash = if config.depositWeb3Url.len == 0: eth1BlockHash
|
||||
else: waitFor getLatestEth1BlockHash(config.depositWeb3Url)
|
||||
var
|
||||
initialState = initialize_beacon_state_from_eth1(
|
||||
eth1Hash, startTime, deposits, {skipValidation})
|
||||
|
||||
|
@ -958,12 +957,14 @@ when isMainModule:
|
|||
|
||||
doAssert initialState.validators.len > 0
|
||||
|
||||
Json.saveFile(config.outputGenesis.string, initialState, pretty = true)
|
||||
echo "Wrote ", config.outputGenesis.string
|
||||
let outGenesisExt = splitFile(outGenesis).ext
|
||||
if cmpIgnoreCase(outGenesisExt, ".json") == 0:
|
||||
Json.saveFile(outGenesis, initialState, pretty = true)
|
||||
echo "Wrote ", outGenesis
|
||||
|
||||
let sszGenesis = config.outputGenesis.string.changeFileExt "ssz"
|
||||
SSZ.saveFile(sszGenesis, initialState)
|
||||
echo "Wrote ", sszGenesis
|
||||
let outSszGenesis = outGenesis.changeFileExt "ssz"
|
||||
SSZ.saveFile(outSszGenesis, initialState)
|
||||
echo "Wrote ", outSszGenesis
|
||||
|
||||
var
|
||||
bootstrapAddress = getPersistenBootstrapAddr(
|
||||
|
|
|
@ -19,7 +19,7 @@ NUM_MISSING_NODES=${MISSING_NODES:-2}
|
|||
|
||||
SIMULATION_DIR="${SIM_ROOT}/data"
|
||||
VALIDATORS_DIR="${SIM_ROOT}/validators"
|
||||
SNAPSHOT_FILE="${SIMULATION_DIR}/state_snapshot.json"
|
||||
SNAPSHOT_FILE="${SIMULATION_DIR}/state_snapshot.ssz"
|
||||
NETWORK_BOOTSTRAP_FILE="${SIMULATION_DIR}/bootstrap_nodes.txt"
|
||||
BEACON_NODE_BIN="${SIMULATION_DIR}/beacon_node"
|
||||
MASTER_NODE_ADDRESS_FILE="${SIMULATION_DIR}/node-0/beacon_node.address"
|
||||
|
|
|
@ -19,7 +19,7 @@ The `beacon_node` binary has a `createTestnet` command.
|
|||
--validators-dir=$NETWORK_DIR \
|
||||
--total-validators=$VALIDATOR_COUNT \
|
||||
--last-user-validator=$LAST_USER_VALIDATOR \
|
||||
--output-genesis=$NETWORK_DIR/genesis.json \
|
||||
--output-genesis=$NETWORK_DIR/genesis.ssz \
|
||||
--output-bootstrap-file=$NETWORK_DIR/bootstrap_nodes.txt \
|
||||
--bootstrap-address=$PUBLIC_IP \
|
||||
--genesis-offset=600 # Delay in seconds
|
||||
|
|
|
@ -22,7 +22,7 @@ NUM_MISSING_NODES=${MISSING_NODES:-1}
|
|||
SIMULATION_DIR="${SIM_ROOT}/data"
|
||||
METRICS_DIR="${SIM_ROOT}/prometheus"
|
||||
VALIDATORS_DIR="${SIM_ROOT}/validators"
|
||||
SNAPSHOT_FILE="${SIMULATION_DIR}/state_snapshot.json"
|
||||
SNAPSHOT_FILE="${SIMULATION_DIR}/state_snapshot.ssz"
|
||||
NETWORK_BOOTSTRAP_FILE="${SIMULATION_DIR}/bootstrap_nodes.txt"
|
||||
BEACON_NODE_BIN="${SIMULATION_DIR}/beacon_node"
|
||||
DEPLOY_DEPOSIT_CONTRACT_BIN="${SIMULATION_DIR}/deploy_deposit_contract"
|
||||
|
|
Loading…
Reference in New Issue