Switch to 30 seconds slot duration; UX improvements

* On the testnet site, the first N instead of the last N validators
  will be considered reserved for users

* The number of validators is consistently named `totalValidators`
  in all commands

* Proper keys are generated by default in validator_keygen
This commit is contained in:
Zahary Karadjov 2019-03-27 14:06:06 +02:00 committed by zah
parent a3ce9d17ec
commit b3d23c052c
10 changed files with 29 additions and 24 deletions

View File

@ -704,7 +704,7 @@ when isMainModule:
case config.cmd
of createTestnet:
var deposits: seq[Deposit]
for i in config.firstValidator.int ..< config.numValidators.int:
for i in config.firstValidator.int ..< config.totalValidators.int:
let depositFile = config.validatorsDir /
validatorFileBaseName(i) & ".deposit.json"
deposits.add Json.loadFile(depositFile, Deposit)
@ -728,8 +728,8 @@ when isMainModule:
numShards: SHARD_COUNT,
slotDuration: SECONDS_PER_SLOT,
slotsPerEpoch: SLOTS_PER_EPOCH,
totalValidators: config.numValidators,
firstUserValidator: config.firstUserValidator)
totalValidators: config.totalValidators,
lastUserValidator: config.lastUserValidator)
Json.saveFile(config.outputNetwork.string, testnetMetadata, pretty = true)
echo "Wrote ", config.outputNetwork.string

View File

@ -250,8 +250,8 @@ type
slotDuration*: uint64
slotsPerEpoch*: uint64
totalValidators*: uint64
firstUserValidator*: uint64
lastUserValidator*: uint64
proc userValidatorsRange*(d: NetworkMetadata): HSlice[int, int] =
d.firstUserValidator.int ..< d.totalValidators.int
0 .. d.lastUserValidator.int

View File

@ -85,15 +85,15 @@ type
desc: "Directory containing validator descriptors named vXXXXXXX.deposit.json"
shortform: "d".}: InputDir
numValidators* {.
totalValidators* {.
desc: "The number of validators in the newly created chain".}: uint64
firstValidator* {.
desc: "Index of first validator to add to validator list"
defaultValue: 0 .}: uint64
firstUserValidator* {.
desc: "The first validator index that will free for taking from a testnet participant"
lastUserValidator* {.
desc: "The last validator index that will free for taking from a testnet participant"
defaultValue: 0 .}: uint64
bootstrapAddress* {.

View File

@ -12,11 +12,11 @@ proc writeFile(filename: string, value: auto) =
Json.saveFile(filename, value, pretty = true)
echo "Wrote ", filename
cli do (validators: int = 125000,
cli do (totalValidators: int = 125000,
outputDir: string = "validators",
generateFakeKeys = true):
generateFakeKeys = false):
for i in 0 ..< validators:
for i in 0 ..< totalValidators:
let
v = validatorFileBaseName(i)
depositFn = outputDir / v & ".deposit.json"

View File

@ -19,8 +19,8 @@ The `beacon_node` binary has a `createTestnet` command.
createTestnet \
--networkId=$NETWORK_ID \
--validatorsDir=$NETWORK_DIR \
--numValidators=$VALIDATOR_COUNT \
--firstUserValidator=$FIRST_USER_VALIDATOR \
--totalValidators=$VALIDATOR_COUNT \
--lastUserValidator=$LAST_USER_VALIDATOR \
--outputGenesis=$NETWORK_DIR/genesis.json \
--outputNetwork=$NETWORK_DIR/$NETWORK_FLAVOUR-network.json \
--bootstrapAddress=$PUBLIC_IP \

View File

@ -8,7 +8,7 @@ source "$NETWORK_NAME.env"
cd ..
NIM_FLAGS="-d:release --lineTrace:on -d:SHARD_COUNT=$SHARD_COUNT -d:SLOTS_PER_EPOCH=$SLOTS_PER_EPOCH"
NIM_FLAGS="-d:release --lineTrace:on -d:SECONDS_PER_SLOT=$SECONDS_PER_SLOT -d:SHARD_COUNT=$SHARD_COUNT -d:SLOTS_PER_EPOCH=$SLOTS_PER_EPOCH"
nim c $NIM_FLAGS beacon_chain/beacon_node
if [ ! -d ~/.cache/nimbus/BeaconNode/$NETWORK_NAME/validators ]; then

View File

@ -18,14 +18,13 @@ PUBLIC_IP=$(curl -s ifconfig.me)
NETWORK_DIR=$WWW_DIR/$NETWORK_NAME
regenTestnetFiles() {
NIM_FLAGS="-d:release -d:SHARD_COUNT=$SHARD_COUNT -d:SLOTS_PER_EPOCH=$SLOTS_PER_EPOCH ${2:-}"
NIM_FLAGS="-d:release -d:SECONDS_PER_SLOT=$SECONDS_PER_SLOT -d:SHARD_COUNT=$SHARD_COUNT -d:SLOTS_PER_EPOCH=$SLOTS_PER_EPOCH ${2:-}"
NETWORK_FLAVOUR=$1
if [ ! -f $NETWORK_DIR/genesis.json ]; then
rm -f $NETWORK_DIR/*
nim c -r $NIM_FLAGS beacon_chain/validator_keygen \
--generateFakeKeys=no \
--validators=$VALIDATOR_COUNT \
--totalValidators=$VALIDATOR_COUNT \
--outputDir="$NETWORK_DIR"
fi
@ -35,8 +34,8 @@ regenTestnetFiles() {
createTestnet \
--networkId=$NETWORK_ID \
--validatorsDir=$NETWORK_DIR \
--numValidators=$VALIDATOR_COUNT \
--firstUserValidator=$FIRST_USER_VALIDATOR \
--totalValidators=$VALIDATOR_COUNT \
--lastUserValidator=$LAST_USER_VALIDATOR \
--outputGenesis=$NETWORK_DIR/genesis.json \
--outputNetwork=$NETWORK_DIR/$NETWORK_FLAVOUR-network.json \
--bootstrapAddress=$PUBLIC_IP \

View File

@ -1,7 +1,8 @@
NETWORK_ID=1000000
SHARD_COUNT=8
SLOTS_PER_EPOCH=8
SECONDS_PER_SLOT=30
VALIDATOR_COUNT=400
FIRST_USER_VALIDATOR=340
LAST_USER_VALIDATOR=49
BOOTSTRAP_PORT=9000

View File

@ -1,7 +1,8 @@
NETWORK_ID=2000000
SHARD_COUNT=128
SLOTS_PER_EPOCH=64
SECONDS_PER_SLOT=30
VALIDATOR_COUNT=20000
FIRST_USER_VALIDATOR=19000
LAST_USER_VALIDATOR=1999
BOOTSTRAP_PORT=9100

View File

@ -33,7 +33,10 @@ if [ ! -f $LAST_VALIDATOR ]; then
nim c -o:"$VALIDATOR_KEYGEN_BIN" $DEFS -d:release beacon_chain/validator_keygen
fi
$VALIDATOR_KEYGEN_BIN --validators=$NUM_VALIDATORS --outputDir="$VALIDATORS_DIR"
$VALIDATOR_KEYGEN_BIN \
--totalValidators=$NUM_VALIDATORS \
--outputDir="$VALIDATORS_DIR" \
--generateFakeKeys=yes
fi
if [[ -z "$SKIP_BUILDS" ]]; then
@ -41,10 +44,11 @@ if [[ -z "$SKIP_BUILDS" ]]; then
fi
if [ ! -f $SNAPSHOT_FILE ]; then
$BEACON_NODE_BIN --dataDir=$SIMULATION_DIR/node-0 createTestnet \
$BEACON_NODE_BIN createTestnet \
--dataDir=$SIMULATION_DIR/node-0 \
--networkId=1000 \
--validatorsDir=$VALIDATORS_DIR \
--numValidators=$NUM_VALIDATORS \
--totalValidators=$NUM_VALIDATORS \
--outputGenesis=$SNAPSHOT_FILE \
--outputNetwork=$NETWORK_METADATA_FILE \
--bootstrapAddress=127.0.0.1 \