Make all testnet env file values optional [skip CI]
Also removes some usages of SHARD_COUNT
This commit is contained in:
parent
5a93e50b5e
commit
f40675509a
|
@ -814,7 +814,6 @@ proc start(node: BeaconNode, headState: BeaconState) =
|
|||
int64(node.blockPool.finalizedHead.slot.toBeaconTime()) -
|
||||
int64(node.beaconClock.now()),
|
||||
stateSlot = shortLog(headState.slot),
|
||||
SHARD_COUNT,
|
||||
SLOTS_PER_EPOCH,
|
||||
SECONDS_PER_SLOT,
|
||||
SPEC_VERSION,
|
||||
|
|
|
@ -5,12 +5,12 @@ type
|
|||
rlpxBackend
|
||||
|
||||
const
|
||||
network_type {.strdefine.} = "libp2p_daemon"
|
||||
NETWORK_TYPE {.strdefine.} = "libp2p_daemon"
|
||||
|
||||
networkBackend* = when network_type == "rlpx": rlpxBackend
|
||||
elif network_type == "libp2p": libp2pBackend
|
||||
elif network_type == "libp2p_daemon": libp2pDaemonBackend
|
||||
else: {.fatal: "The 'network_type' should be either 'libp2p', 'libp2p_daemon' or 'rlpx'" .}
|
||||
networkBackend* = when NETWORK_TYPE == "rlpx": rlpxBackend
|
||||
elif NETWORK_TYPE == "libp2p": libp2pBackend
|
||||
elif NETWORK_TYPE == "libp2p_daemon": libp2pDaemonBackend
|
||||
else: {.fatal: "The 'NETWORK_TYPE' should be either 'libp2p', 'libp2p_daemon' or 'rlpx'" .}
|
||||
|
||||
const
|
||||
copyrights* = "Copyright (c) 2019 Status Research & Development GmbH"
|
||||
|
@ -35,5 +35,5 @@ const
|
|||
$versionMajor & "." & $versionMinor & "." & $versionBuild
|
||||
|
||||
fullVersionStr* =
|
||||
versionAsStr & " (" & gitRevision & ", " & network_type & ")"
|
||||
versionAsStr & " (" & gitRevision & ", " & NETWORK_TYPE & ")"
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ ARG NETWORK_TYPE
|
|||
|
||||
RUN cd nim-beacon-chain \
|
||||
&& set -a \
|
||||
&& . scripts/${NETWORK}.env \
|
||||
&& . scripts/load-testnet-nim-flags.sh scripts/${NETWORK}.env \
|
||||
&& ./env.sh nim \
|
||||
-o:/usr/bin/beacon_node \
|
||||
-d:release \
|
||||
|
@ -38,10 +38,7 @@ RUN cd nim-beacon-chain \
|
|||
--verbosity:0 \
|
||||
--hints:off \
|
||||
--warnings:off \
|
||||
-d:"network_type=${NETWORK_TYPE}" \
|
||||
-d:"SHARD_COUNT=${SHARD_COUNT}" \
|
||||
-d:"SLOTS_PER_EPOCH=${SLOTS_PER_EPOCH}" \
|
||||
-d:"SECONDS_PER_SLOT=${SECONDS_PER_SLOT}" \
|
||||
${TESTNET_NIM_FLAGS} \
|
||||
-d:"chronicles_log_level=DEBUG" \
|
||||
-d:"testnet_servers_image" \
|
||||
c beacon_chain/beacon_node.nim
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
set -a
|
||||
source $1
|
||||
set +a
|
||||
|
||||
TESTNET_NIM_FLAGS=""
|
||||
|
||||
testnet_env () {
|
||||
eval "TESTNET_FLAG_VALUE=\$$1"
|
||||
if [[ ! -z "$TESTNET_FLAG_VALUE" ]]; then
|
||||
TESTNET_NIM_FLAGS+=" -d:$1=$TESTNET_FLAG_VALUE"
|
||||
fi
|
||||
}
|
||||
|
||||
testnet_env CONST_PRESET
|
||||
testnet_env NETWORK_TYPE
|
||||
testnet_env SLOTS_PER_EPOCH
|
||||
testnet_env SLOTS_PER_EPOCH
|
||||
testnet_env MAX_COMMITTEES_PER_SLOT
|
||||
|
||||
export TESTNET_NIM_FLAGS
|
||||
|
|
@ -5,7 +5,7 @@ set -eu
|
|||
cd $(dirname "$0")
|
||||
|
||||
NETWORK_NAME=$1
|
||||
source "$NETWORK_NAME.env"
|
||||
source load-testnet-nim-flags.sh $NETWORK_NAME.env
|
||||
|
||||
cd ..
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
CONST_PRESET=minimal
|
||||
NETWORK_TYPE=libp2p_daemon
|
||||
SHARD_COUNT=8
|
||||
SLOTS_PER_EPOCH=8
|
||||
SECONDS_PER_SLOT=6
|
||||
QUICKSTART_VALIDATORS=8
|
||||
RANDOM_VALIDATORS=120
|
||||
BOOTSTRAP_PORT=9000
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
CONST_PRESET=minimal
|
||||
NETWORK_TYPE=libp2p_daemon
|
||||
SHARD_COUNT=16
|
||||
SLOTS_PER_EPOCH=16
|
||||
SECONDS_PER_SLOT=16
|
||||
MAX_COMMITTEES_PER_SLOT=8
|
||||
QUICKSTART_VALIDATORS=40
|
||||
RANDOM_VALIDATORS=960
|
||||
BOOTSTRAP_PORT=9100
|
||||
|
|
|
@ -16,7 +16,7 @@ cd "$GIT_ROOT"
|
|||
|
||||
NIMFLAGS="-d:chronicles_log_level=DEBUG --hints:off --warnings:off --verbosity:0 --opt:speed --debuginfo"
|
||||
|
||||
# Run with "SHARD_COUNT=4 ./start.sh" to change these
|
||||
# Run with "SLOTS_PER_EPOCH=8 ./start.sh" to change these
|
||||
DEFS=""
|
||||
|
||||
DEFS+="-d:MAX_COMMITTEES_PER_SLOT=${MAX_COMMITTEES_PER_SLOT:-1} " # Spec default: 64
|
||||
|
|
Loading…
Reference in New Issue