Detect and use Lighthouse's boot_enr.yaml files

This commit is contained in:
Zahary Karadjov 2020-01-13 02:03:52 +02:00 committed by zah
parent 07d329acb8
commit 4848b12050
4 changed files with 23 additions and 10 deletions

View File

@ -5,7 +5,7 @@ type
rlpx
const
NETWORK_TYPE {.strdefine.} = "libp2p"
NETWORK_TYPE {.strdefine.} = "libp2p_daemon"
networkBackend* = when NETWORK_TYPE == "rlpx": rlpx
elif NETWORK_TYPE == "libp2p": libp2p

View File

@ -3,8 +3,9 @@ import
const
rootDir = thisDir() / ".."
bootstrapFile = "bootstrap_nodes.txt"
depositContractFile = "deposit_contract.txt"
bootstrapTxtFileName = "bootstrap_nodes.txt"
bootstrapYamlFileName = "boot_enr.yaml"
depositContractFileName = "deposit_contract.txt"
genesisFile = "genesis.ssz"
configFile = "config.yaml"
testnetsRepo = "eth2-testnets"
@ -37,7 +38,11 @@ cli do (testnetName {.argument.}: string):
# TODO
# The branch below is temporarily changed until the following issue is addressed:
# https://github.com/eth2-clients/eth2-testnets/pull/3
exec &"git clone --quiet --depth=1 --branch=lighthouse-add-missing-constants {testnetsGitUrl}"
exec &"git clone --quiet --depth=1 {testnetsGitUrl}"
var
depositContractOpt = ""
bootstrapFileOpt = ""
let testnetDir = allTestnetsDir / team / testnet
if not system.dirExists(testnetDir):
@ -50,9 +55,18 @@ cli do (testnetName {.argument.}: string):
echo &"The required file {fileName} is not present in '{testnetDir}'."
quit 1
checkRequiredFile bootstrapFile
checkRequiredFile genesisFile
let bootstrapTxtFile = testnetDir / bootstrapTxtFileName
if system.fileExists(bootstrapTxtFile):
bootstrapFileOpt = &"--bootstrap-file=\"{bootstrapTxtFile}\""
else:
let bootstrapYamlFile = testnetDir / bootstrapYamlFileName
if system.fileExists(bootstrapYamlFile):
bootstrapFileOpt = &"--enr-bootstrap-file=\"{bootstrapYamlFile}\""
else:
echo "Warning: the network metadata doesn't include a bootstrap file"
var preset = testnetDir / configFile
if not system.fileExists(preset): preset = "minimal"
@ -64,8 +78,7 @@ cli do (testnetName {.argument.}: string):
beaconNodeBinary = buildDir / "beacon_node_" & dataDirName
nimFlags = "-d:chronicles_log_level=DEBUG " & getEnv("NIM_PARAMS")
var depositContractOpt = ""
let depositContractFile = testnetDir / depositContractFile
let depositContractFile = testnetDir / depositContractFileName
if system.fileExists(depositContractFile):
depositContractOpt = "--deposit-contract=" & readFile(depositContractFile).strip
@ -117,6 +130,6 @@ cli do (testnetName {.argument.}: string):
execIgnoringExitCode replace(&"""{beaconNodeBinary}
--data-dir="{dataDir}"
--dump=true
--bootstrap-file="{testnetDir/bootstrapFile}"
{bootstrapFileOpt}
--state-snapshot="{testnetDir/genesisFile}" """ & depositContractOpt, "\n", " ")

2
vendor/nim-chronos vendored

@ -1 +1 @@
Subproject commit c39c0696806a0ef09bc90e477ea6b177d2824699
Subproject commit f02e748f18e0bc43ae6c68f92aa2c78323265bce

2
vendor/nim-stew vendored

@ -1 +1 @@
Subproject commit 1c1195dba38bf5a14fd0f5d9b7641fdbe6972258
Subproject commit 1edeabb453724aa452a940ab03ddc82f5aeeff6e