From c2a52d7fc5d4db3ea97eff1442e877c4cd1f8b6d Mon Sep 17 00:00:00 2001 From: Mamy Ratsimbazafy Date: Thu, 14 Feb 2019 13:15:10 +0100 Subject: [PATCH] Allow faster slots (#112) * Allow compile time configurable slot time --- beacon_chain/spec/datatypes.nim | 2 +- tests/simulation/start.sh | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/beacon_chain/spec/datatypes.nim b/beacon_chain/spec/datatypes.nim index e082f0864..ee188041f 100644 --- a/beacon_chain/spec/datatypes.nim +++ b/beacon_chain/spec/datatypes.nim @@ -107,7 +107,7 @@ const # Time parameters # https://github.com/ethereum/eth2.0-specs/blob/v0.2.0/specs/core/0_beacon-chain.md#time-parameters - SLOT_DURATION* = 6'u64 ## \ + SLOT_DURATION*{.intdefine.} = 6'u64 # Compile with -d:SLOT_DURATION=1 for 6x faster slots ## TODO consistent time unit across projects, similar to C++ chrono? MIN_ATTESTATION_INCLUSION_DELAY* = 2'u64^2 ##\ diff --git a/tests/simulation/start.sh b/tests/simulation/start.sh index b73e7b231..25518650f 100755 --- a/tests/simulation/start.sh +++ b/tests/simulation/start.sh @@ -25,14 +25,15 @@ mkdir -p $BUILD_OUTPUTS_DIR BEACON_NODE_BIN=$BUILD_OUTPUTS_DIR/beacon_node VALIDATOR_KEYGEN_BIN=$BUILD_OUTPUTS_DIR/validator_keygen +SLOT_DURATION="-d:SLOT_DURATION=3" # Default is 6 if [[ -z "$SKIP_BUILDS" ]]; then - nim c -o:"$VALIDATOR_KEYGEN_BIN" -d:release beacon_chain/validator_keygen - nim c -o:"$BEACON_NODE_BIN" beacon_chain/beacon_node + nim c -o:"$VALIDATOR_KEYGEN_BIN" "$SLOT_DURATION" -d:release beacon_chain/validator_keygen + nim c -o:"$BEACON_NODE_BIN" "$SLOT_DURATION" beacon_chain/beacon_node fi if [ ! -f $STARTUP_FILE ]; then - $VALIDATOR_KEYGEN_BIN --validators=$NUMBER_OF_VALIDATORS --outputDir="$SIMULATION_DIR" --startupDelay=2 + $VALIDATOR_KEYGEN_BIN --validators=$NUMBER_OF_VALIDATORS --outputDir="$SIMULATION_DIR" # --startupDelay=2 fi if [ ! -f $SNAPSHOT_FILE ]; then