Skip to content

Commit

Permalink
CAD-1859 shelley3pools: support --reuse-genesis
Browse files Browse the repository at this point in the history
  • Loading branch information
deepfire committed Oct 19, 2020
1 parent d990f54 commit 23baf98
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 7 deletions.
5 changes: 4 additions & 1 deletion Makefile
Expand Up @@ -29,8 +29,9 @@ EXES=cardano-node cardano-cli cardano-tx-generator
###
nix: MODE=nix
cabal: MODE=cabal
cabal: EXTRA_OPTS=--no-path-exes
cabal: EXTRA_OPTS+=--no-path-exes
nix cabal: cluster
recabal: cabal

sync:
@echo "Syncing 'cabal.project' to ../cardano-node"
Expand All @@ -53,6 +54,8 @@ setup:
build: setup
cabal v2-build ${CABAL_OPTIONS} $(foreach exe,${EXES},${exe}:exe:${exe})

recluster: EXTRA_OPTS+=--reuse-genesis
recluster: cluster
cluster: build
cd ./benchmarks/shelley3pools; ./start.sh --${MODE} ${EXTRA_OPTS}

Expand Down
9 changes: 8 additions & 1 deletion benchmarks/shelley3pools/benchmark.sh
Expand Up @@ -31,7 +31,14 @@ mkdir -p db logs/sockets
rm -f 'configuration/start-time'
. "$BASEDIR"/configuration/parameters
./prepare_genesis_byron.sh
./prepare_genesis_shelley_staked.sh
if test -z "$reuse_genesis"
then ./prepare_genesis_shelley_staked.sh
else sed -i 's/"systemStart": ".*"/"systemStart": "'"$(date \
--iso-8601=seconds \
--date=@$(cat "$BASEDIR"/configuration/start-time))"'"/
' "$GENESISDIR_shelley"/genesis.json
./hash_genesis.sh
fi

case $era in
byron ) protocol='RealPBFT';;
Expand Down
15 changes: 15 additions & 0 deletions benchmarks/shelley3pools/hash_genesis.sh
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

set -e

basedir=$(realpath "$(dirname "$0")")
. "$basedir"/../../scripts/common.sh
. "$basedir"/configuration/parameters

cd "$basedir"

gendir=$GENESISDIR_shelley
cli=${CLICMD:-'run cardano-cli'}

$cli shelley genesis hash --genesis "$gendir"/genesis.json |
tr -d '"' > "$gendir"/GENHASH
3 changes: 1 addition & 2 deletions benchmarks/shelley3pools/prepare_genesis_shelley_staked.sh
Expand Up @@ -118,5 +118,4 @@ params=(--genesis-dir "$gendir"
## extend template with final parameters
$cli shelley genesis create-staked "${params[@]}"

$cli shelley genesis hash --genesis "$gendir"/genesis.json |
tr -d '"' > "$gendir"/GENHASH
"$basedir"/hash_genesis.sh
5 changes: 2 additions & 3 deletions scripts/common.sh
Expand Up @@ -148,7 +148,7 @@ default_mode='nix'
SCRIPTS_LIB_SH_MODE=${SCRIPTS_LIB_SH_MODE:-default}
cmdline_mode=
mnemonic_suffix=${mnemonic_suffix:-}
force_genesis=
reuse_genesis=

while test -n "$1"
do case "$1" in
Expand All @@ -163,8 +163,7 @@ do case "$1" in
--profile ) profile=$2; shift;;
--mnemonic-suffix ) mnemonic_suffix=$2; shift;;

## Should be moved to lib-node.sh?
--force-genesis ) force_genesis=t;;
--reuse-genesis ) reuse_genesis=t;;

--shelley ) era='shelley';;
--byron ) era='byron';;
Expand Down

0 comments on commit 23baf98

Please sign in to comment.