From cbe7b13df39b8cc7af117f89b55d9b0200c32287 Mon Sep 17 00:00:00 2001 From: Kosyrev Serge Date: Fri, 31 Jul 2020 17:40:34 +0300 Subject: [PATCH] CAD-1393 shelley3pools: support --cardano mode (--byron regressed) --- benchmarks/shelley3pools/.gitignore | 3 +- benchmarks/shelley3pools/benchmark.sh | 22 +- .../configuration/byron-protocol-params.json | 23 ++ .../configuration-generator.yaml | 20 +- .../configuration/configuration-node-1.yaml | 12 +- .../configuration/configuration-node-2.yaml | 12 +- .../configuration/configuration-node-3.yaml | 12 +- .../shelley3pools/configuration/parameters | 12 +- .../shelley3pools/prepare_genesis_byron.sh | 62 ++++ .../prepare_genesis_expenditure.sh | 269 ++++++++++++++++++ ...d.sh => prepare_genesis_shelley_staked.sh} | 11 +- benchmarks/shelley3pools/run-3pools.sh | 14 +- benchmarks/shelley3pools/run-tx-generator.sh | 36 ++- .../shelley3pools/submit_delegation_tx.sh | 6 +- scripts/common.sh | 6 +- 15 files changed, 468 insertions(+), 52 deletions(-) create mode 100644 benchmarks/shelley3pools/configuration/byron-protocol-params.json create mode 100755 benchmarks/shelley3pools/prepare_genesis_byron.sh create mode 100755 benchmarks/shelley3pools/prepare_genesis_expenditure.sh rename benchmarks/shelley3pools/{prepare_genesis_staked.sh => prepare_genesis_shelley_staked.sh} (96%) diff --git a/benchmarks/shelley3pools/.gitignore b/benchmarks/shelley3pools/.gitignore index 0f524549..7126c1ed 100644 --- a/benchmarks/shelley3pools/.gitignore +++ b/benchmarks/shelley3pools/.gitignore @@ -1,5 +1,6 @@ -configuration/genesis +configuration/genesis* +configuration/start-time db/ logs/ diff --git a/benchmarks/shelley3pools/benchmark.sh b/benchmarks/shelley3pools/benchmark.sh index f979ef1a..451cef9c 100755 --- a/benchmarks/shelley3pools/benchmark.sh +++ b/benchmarks/shelley3pools/benchmark.sh @@ -5,7 +5,7 @@ BASEDIR=$(realpath $(dirname "$0")) . "${BASEDIR}"/../../scripts/common.sh prebuild 'cardano-tx-generator' || exit 1 -prebuild 'cardano-rt-view-service' || exit 1 +# prebuild 'cardano-rt-view-service' || exit 1 prebuild 'cardano-node' || exit 1 prebuild 'cardano-cli' || exit 1 @@ -27,8 +27,22 @@ set -e rm -rf ./db/* ./logs/* mkdir -p db logs/sockets -# 1 prepare genesis -./prepare_genesis_staked.sh +# 1 prepare geneses for all eras & update configs +rm -f 'configuration/start-time' +. "$BASEDIR"/configuration/parameters +./prepare_genesis_byron.sh +./prepare_genesis_shelley_staked.sh + +case $era in + byron ) protocol='RealPBFT';; + shelley ) protocol='TPraos';; + cardano-* ) protocol='Cardano';; esac + +for cf in ${BASEDIR}/configuration/*.yaml +do sed -i 's/^ShelleyGenesisHash:.*$/ShelleyGenesisHash: '"$(cat "$GENESISDIR_shelley"/GENHASH)"'/' "$cf" + sed -i 's/^ByronGenesisHash:.*$/ByronGenesisHash: '"$(cat "$GENESISDIR_byron"/GENHASH)"'/' "$cf" + sed -i 's/^Protocol:.*$/Protocol: '"$protocol"'/' "$cf" +done # 2 run rt-view tmux select-window -t :0 @@ -50,7 +64,7 @@ do echo -n "."; sleep 1; done; echo # 4 run tx-gen tmux select-window -t :0 tmux new-window -n TxGen \ - "${TMUX_ENV_PASSTHROUGH[*]} ./run-tx-generator.sh; $SHELL" + "${TMUX_ENV_PASSTHROUGH[*]} ./run-tx-generator.sh $era; $SHELL" sleep 1 tmux select-window -t Nodes diff --git a/benchmarks/shelley3pools/configuration/byron-protocol-params.json b/benchmarks/shelley3pools/configuration/byron-protocol-params.json new file mode 100644 index 00000000..49239388 --- /dev/null +++ b/benchmarks/shelley3pools/configuration/byron-protocol-params.json @@ -0,0 +1,23 @@ +{ + "heavyDelThd": "300000000000", + "maxBlockSize": "2000000", + "maxHeaderSize": "2000000", + "maxProposalSize": "700", + "maxTxSize": "4096", + "mpcThd": "20000000000000", + "scriptVersion": 0, + "slotDuration": "1000", + "softforkRule": { + "initThd": "900000000000000", + "minThd": "600000000000000", + "thdDecrement": "50000000000000" + }, + "txFeePolicy": { + "multiplier": "43946000000", + "summand": "155381000000000" + }, + "unlockStakeEpoch": "18446744073709551615", + "updateImplicit": "10000", + "updateProposalThd": "100000000000000", + "updateVoteThd": "1000000000000" +} diff --git a/benchmarks/shelley3pools/configuration/configuration-generator.yaml b/benchmarks/shelley3pools/configuration/configuration-generator.yaml index 94f04eb6..d406effb 100644 --- a/benchmarks/shelley3pools/configuration/configuration-generator.yaml +++ b/benchmarks/shelley3pools/configuration/configuration-generator.yaml @@ -1,3 +1,13 @@ +Protocol: + +ByronGenesisFile: genesis-byron/genesis.json +ByronGenesisHash: +ShelleyGenesisFile: genesis-shelley/genesis.json +ShelleyGenesisHash: + +RequiresNetworkMagic: RequiresMagic +NumCoreNodes: 1 + # global filter; messages must have at least this severity to pass: minSeverity: Debug @@ -78,19 +88,9 @@ options: ############### Cardano Node Configuration ############### ########################################################## - -NodeId: -Protocol: TPraos -GenesisFile: genesis/genesis.json -NumCoreNodes: 1 -RequiresNetworkMagic: RequiresMagic -PBftSignatureThreshold: TurnOnLogging: True ViewMode: SimpleView TurnOnLogMetrics: False -SocketPath: - - ##### Update Parameters ##### diff --git a/benchmarks/shelley3pools/configuration/configuration-node-1.yaml b/benchmarks/shelley3pools/configuration/configuration-node-1.yaml index 33d87ad7..e47435e4 100644 --- a/benchmarks/shelley3pools/configuration/configuration-node-1.yaml +++ b/benchmarks/shelley3pools/configuration/configuration-node-1.yaml @@ -3,10 +3,16 @@ ############### Cardano Byron Node Configuration ######### ########################################################## +ByronGenesisFile: genesis-byron/genesis.json +ByronGenesisHash: +ShelleyGenesisFile: genesis-shelley/genesis.json +ShelleyGenesisHash: -##### Locations ##### -GenesisFile: genesis/genesis.json + + +PBftSignatureThreshold: 0.5 +TestShelleyHardForkAtEpoch: 1 ##### Core protocol parameters ##### @@ -14,7 +20,7 @@ GenesisFile: genesis/genesis.json # The node also supports various test and mock instances. # "RealPBFT" is the real (ie not mock) (permissive) OBFT protocol, which # is what we use on mainnet in Byron era. -Protocol: TPraos +Protocol: # The mainnet does not include the network magic into addresses. Testnets do. RequiresNetworkMagic: RequiresMagic diff --git a/benchmarks/shelley3pools/configuration/configuration-node-2.yaml b/benchmarks/shelley3pools/configuration/configuration-node-2.yaml index d7d812f5..1c468a4e 100644 --- a/benchmarks/shelley3pools/configuration/configuration-node-2.yaml +++ b/benchmarks/shelley3pools/configuration/configuration-node-2.yaml @@ -3,10 +3,16 @@ ############### Cardano Byron Node Configuration ######### ########################################################## +ByronGenesisFile: genesis-byron/genesis.json +ByronGenesisHash: +ShelleyGenesisFile: genesis-shelley/genesis.json +ShelleyGenesisHash: -##### Locations ##### -GenesisFile: genesis/genesis.json + + +PBftSignatureThreshold: 0.5 +TestShelleyHardForkAtEpoch: 1 ##### Core protocol parameters ##### @@ -14,7 +20,7 @@ GenesisFile: genesis/genesis.json # The node also supports various test and mock instances. # "RealPBFT" is the real (ie not mock) (permissive) OBFT protocol, which # is what we use on mainnet in Byron era. -Protocol: TPraos +Protocol: # The mainnet does not include the network magic into addresses. Testnets do. RequiresNetworkMagic: RequiresMagic diff --git a/benchmarks/shelley3pools/configuration/configuration-node-3.yaml b/benchmarks/shelley3pools/configuration/configuration-node-3.yaml index a04ffd74..711eafc1 100644 --- a/benchmarks/shelley3pools/configuration/configuration-node-3.yaml +++ b/benchmarks/shelley3pools/configuration/configuration-node-3.yaml @@ -3,10 +3,16 @@ ############### Cardano Byron Node Configuration ######### ########################################################## +ByronGenesisFile: genesis-byron/genesis.json +ByronGenesisHash: +ShelleyGenesisFile: genesis-shelley/genesis.json +ShelleyGenesisHash: -##### Locations ##### -GenesisFile: genesis/genesis.json + + +PBftSignatureThreshold: 0.5 +TestShelleyHardForkAtEpoch: 1 ##### Core protocol parameters ##### @@ -14,7 +20,7 @@ GenesisFile: genesis/genesis.json # The node also supports various test and mock instances. # "RealPBFT" is the real (ie not mock) (permissive) OBFT protocol, which # is what we use on mainnet in Byron era. -Protocol: TPraos +Protocol: # The mainnet does not include the network magic into addresses. Testnets do. RequiresNetworkMagic: RequiresMagic diff --git a/benchmarks/shelley3pools/configuration/parameters b/benchmarks/shelley3pools/configuration/parameters index 33e9477a..f6a48760 100644 --- a/benchmarks/shelley3pools/configuration/parameters +++ b/benchmarks/shelley3pools/configuration/parameters @@ -1,6 +1,7 @@ # the directory of the fresh genesis and keys -GENESISDIR=configuration/genesis +GENESISDIR_byron=configuration/genesis-byron +GENESISDIR_shelley=configuration/genesis-shelley # genesis parameters GEN_SLOTLENGTH="0.2" @@ -13,7 +14,7 @@ GEN_DECENTRALISATIONPARAM="0.5" MAGIC=42 # total supply of Lovelaces in genesis -TOTAL_SUPPLY=1000000000000 +TOTAL_SUPPLY=100000000000000 # supply of pool-delegated Lovelaces in genesis POOL_SUPPLY=$((TOTAL_SUPPLY / 2)) @@ -56,3 +57,10 @@ txfee=1000000 # number of transactions for cli benchmarking NUM_OF_ADDRESSES=1000 + +start_time_file=configuration/start-time +if test -f $start_time_file +then start_time=$(cat $start_time_file) +else start_time=$(date --date='5 seconds' +%s) + echo -n $start_time > $start_time_file +fi \ No newline at end of file diff --git a/benchmarks/shelley3pools/prepare_genesis_byron.sh b/benchmarks/shelley3pools/prepare_genesis_byron.sh new file mode 100755 index 00000000..327f7345 --- /dev/null +++ b/benchmarks/shelley3pools/prepare_genesis_byron.sh @@ -0,0 +1,62 @@ +#!/usr/bin/env bash +# shellcheck disable=SC1090 + +set -e + +basedir=$(realpath "$(dirname "$0")") +. "$basedir"/../../scripts/common.sh +. "$basedir"/configuration/parameters + +cd "$basedir" + +gendir=$GENESISDIR_byron +cli=${CLICMD:-'run cardano-cli'} + +umask 077 +protocol_params="$basedir/configuration/byron-protocol-params.json" + +protocol_magic=$MAGIC +total_balance=8000000000000002 + +parameter_k=10 +n_poors=1 +n_delegates=3 +delegate_share=0.5 +avvm_entries=0 +avvm_entry_balance=10000000000000 +not_so_secret=2718281828 + +tmpdir="`mktemp`.d" +args=( + --genesis-output-dir "${tmpdir}" + --start-time "${start_time}" + --protocol-parameters-file "${protocol_params}" + --k ${parameter_k} + --protocol-magic ${protocol_magic} + --n-poor-addresses ${n_poors} + --n-delegate-addresses ${n_delegates} + --total-balance ${total_balance} + --delegate-share ${delegate_share} + --avvm-entry-count ${avvm_entries} + --avvm-entry-balance ${avvm_entry_balance} + --real-pbft + --secret-seed ${not_so_secret} +) + +$cli genesis "${args[@]}" "$@" + +rm -rf "$gendir" +mkdir -p "$gendir" +cp -ia ${tmpdir}/genesis.json $gendir/ +cp -ia ${tmpdir}/delegate-keys.*.key $gendir/ +cp -ia ${tmpdir}/delegation-cert.*.json $gendir/ +cp -ia ${tmpdir}/genesis-keys.*.key $gendir/ +cp -ia ${tmpdir}/poor-keys.*.key $gendir/ + +$cli shelley key convert-byron-key \ + --byron-payment-key-type \ + --byron-signing-key-file $gendir/poor-keys.000.key \ + --out-file $gendir/poor-keys.000.skey + +$cli print-genesis-hash --genesis-json "$gendir"/genesis.json | + tail -1 > $gendir/GENHASH diff --git a/benchmarks/shelley3pools/prepare_genesis_expenditure.sh b/benchmarks/shelley3pools/prepare_genesis_expenditure.sh new file mode 100755 index 00000000..acc42115 --- /dev/null +++ b/benchmarks/shelley3pools/prepare_genesis_expenditure.sh @@ -0,0 +1,269 @@ +#!/usr/bin/env bash +# shellcheck disable=SC1090 + +set -e + +basedir=$(realpath "$(dirname "$0")") +. "$basedir"/../../scripts/common.sh +. "$basedir"/configuration/parameters + +cd "$basedir" + +gendir=$GENESISDIR_shelley +cli=${CLICMD:-'run cardano-cli'} + +coin=4000000000000000 + +byron_delegate_key=$GENESISDIR_byron/delegate-keys.000.key +byron_poor_key=$GENESISDIR_byron/poor-keys.000.key +utxo_ext_vkey=$GENESISDIR_shelley/utxo-keys/utxo1.ext.vkey +utxo_skey=$GENESISDIR_shelley/utxo-keys/utxo1.skey +utxo_vkey=$GENESISDIR_shelley/utxo-keys/utxo1.vkey + +rm -f $utxo_ext_vkey $utxo_vkey $utxo_skey + +get_funds_via_byron_payment_key_byron() { + local src_skey=$1 target_skey=$2 target_vkey=$3 coin=$4 + local src_key_addr target_key_addr + local byron_inter_skey=byron-inter.skey + local txfile=genesis-expenditure.tx + + rm -f $byron_inter_skey + ## create intermediate key + $cli keygen \ + --byron-formats \ + --no-password \ + --secret $byron_inter_skey + target_key_addr=$($cli signing-key-address \ + --byron-formats \ + --testnet-magic $MAGIC \ + --secret $byron_inter_skey | head -n1) + ## move funds from genesis to intermediate + src_key_addr=$($cli signing-key-address \ + --byron-formats \ + --testnet-magic $MAGIC \ + --secret $src_skey | head -n1) + rm -f $txfile + $cli issue-genesis-utxo-expenditure \ + --byron-formats \ + --genesis-json $GENESISDIR_byron/genesis.json \ + --testnet-magic $MAGIC \ + --wallet-key $src_skey \ + --txout "(\"$target_key_addr\",$coin)" \ + --rich-addr-from $src_key_addr \ + --tx $txfile + CARDANO_NODE_SOCKET_PATH=logs/sockets/1 \ + $cli submit-tx \ + --testnet-magic $MAGIC \ + --tx $txfile + ## convert intermediate key to Shelley format + $cli shelley key convert-byron-key \ + --byron-payment-key-type \ + --byron-signing-key-file $byron_inter_skey \ + --out-file $target_skey + rm -f $txfile $byron_inter_skey + $cli shelley key verification-key \ + --signing-key-file $target_skey \ + --verification-key-file $target_vkey + sed -i 's/PaymentVerificationKeyByron_ed25519_bip32/GenesisUTxOVerificationKey_ed25519/' $target_vkey +} + +wait_seconds() { + n=$1 expl="$2" + echo -n "--( waiting $expl: $n" + while printf "\b\b\b%3d" $n + test $n -gt 0 + do n=$((n-1)); sleep 1s; done +} >&2 + +query_addr_txin() { + local addr=$1 coin=$2; shift 2 + echo "$(CARDANO_NODE_SOCKET_PATH=logs/sockets/1 \ + cardano-cli shelley query utxo \ + --address "$addr" \ + --testnet-magic "$MAGIC" "$@" | \ + grep "$coin" | \ + cut -d' ' -f1)#0" +} + +get_byron_key_addr() { + $cli signing-key-address \ + --byron-formats \ + --testnet-magic "$MAGIC" \ + --secret "$1" | head -n1 +} + +get_shelley_key_addr() { + $cli shelley address build \ + --testnet-magic "$MAGIC" \ + --payment-verification-key-file "$1" +} + +move_genesis_byron() { + local key=$1 srcaddr=$2 toaddr=$3 coin=$4 + + local txin + txin="$(query_addr_txin "$srcaddr" "$coin" --cardano-mode)" + if test -z "$txin" + then echo "ERROR: couldn't determine initial TxIn for addr $srcaddr">&2; exit 1; fi + echo "-- intermediate TxIn: $txin" >&2 + + local tx=move.tx + $cli issue-utxo-expenditure \ + --byron-formats \ + --testnet-magic "$MAGIC" \ + --wallet-key "$key" \ + --txin "(\"$txin\",0)" \ + --txout "$toaddr:$coin" \ + --tx "$tx" + + $cli submit-tx \ + --testnet-magic "$MAGIC" \ + --tx "$tx" +} + +move_utxo_shelley() { + local key=$1 srcaddr=$2 toaddr=$3 coin=$4 + + local txin + txin="$(query_addr_txin "$srcaddr" "$coin" --cardano-mode)" + if test -z "$txin" + then echo "ERROR: couldn't determine initial TxIn for addr $srcaddr">&2; exit 1; fi + echo "-- shelley TxIn: $txin" >&2 + + local txbody=move.txbody + $cli shelley transaction build-raw \ + --tx-in "$txin" \ + --tx-out "$toaddr+$coin" \ + --ttl 10000000 \ + --fee 0 \ + --out-file "$txbody" + local tx=move.tx + $cli shelley transaction sign \ + --tx-body-file "$txbody" \ + --signing-key-file "$key" \ + --testnet-magic "$MAGIC" \ + --out-file "$tx" + CARDANO_NODE_SOCKET_PATH=logs/sockets/1 \ + $cli shelley transaction submit \ + --tx-file "$tx" \ + --testnet-magic "$MAGIC" +} + +get_funds_directly_delegate() { + local src_skey=$1 target_skey=$2 target_vkey=$3 coin=$4 + local utxo_ext_vkey=utxo.ext.vkey + + $cli shelley key convert-byron-key \ + --byron-genesis-delegate-key-type \ + --byron-signing-key-file $src_skey \ + --out-file $target_skey + $cli shelley key verification-key \ + --signing-key-file $target_skey \ + --verification-key-file $utxo_ext_vkey + $cli shelley key non-extended-key \ + --extended-verification-key-file $utxo_ext_vkey \ + --verification-key-file $target_vkey + sed -i 's/GenesisDelegateVerificationKey_ed25519/GenesisUTxOVerificationKey_ed25519/' $target_vkey + rm -f $utxo_ext_vkey +} + +get_funds_directly_poor() { + local src_skey=$1 target_skey=$2 target_vkey=$3 coin=$4 + local utxo_ext_vkey=utxo.ext.vkey + + rm -f "$target_skey" "$target_vkey" + $cli shelley key convert-byron-key \ + --byron-payment-key-type \ + --byron-signing-key-file $src_skey \ + --out-file $target_skey + $cli shelley key verification-key \ + --signing-key-file $target_skey \ + --verification-key-file $target_vkey +} + +get_funds_poor_via_shelley() { + local src_skey=$1 target_skey=$2 target_vkey=$3 coin=$4 + local inter_skey=inter.skey inter_vkey=inter.vkey + + rm -f "$target_skey" "$target_vkey" + $cli shelley key convert-byron-key \ + --byron-payment-key-type \ + --byron-signing-key-file $src_skey \ + --out-file $inter_skey + $cli shelley key verification-key \ + --signing-key-file $inter_skey \ + --verification-key-file $inter_vkey + + local src_addr + src_addr=$(get_byron_key_addr "$src_skey") + + $cli shelley address key-gen \ + --verification-key-file $target_vkey \ + --signing-key-file $target_skey + + local to_addr + to_addr=$(get_shelley_key_addr "$target_vkey") + # to_addr_byron=$(cardano-cli shelley address info \ + # --address "$to_addr" | + # jq .base16 --raw-output) + + move_utxo_shelley "$inter_skey" "$src_addr" "$to_addr" "$coin" +} + +wait_seconds 105 "until the first epoch passes" + +set -x +# src_key=$byron_delegate_key +src_key=$byron_poor_key +echo "-- Byron funds source key: $src_key" >&2 + +src_addr=$(get_byron_key_addr "$src_key") + +if test -z "$src_addr" +then echo "ERROR: couldn't determine address for $src_key">&2; exit 1; fi +echo "-- Byron source key address: $src_addr" >&2 + +# get_funds_directly_poor "$src_key" "$utxo_skey" "$utxo_vkey" "$coin" +# get_funds_directly_delegate "$src_key" "$utxo_skey" "$utxo_vkey" "$coin" +# get_funds_via_byron_payment_key_byron "$src_key" "$utxo_skey" "$utxo_vkey" "$coin" +get_funds_poor_via_shelley "$src_key" "$utxo_skey" "$utxo_vkey" "$coin" +echo "-- derived Shelley keys: $utxo_skey $utxo_vkey" >&2 + +addr=$(get_shelley_key_addr $utxo_vkey) +if test -z "$addr" +then echo "ERROR: couldn't determine address for $utxo_vkey">&2; exit 1; fi +echo "-- derived Shelley key addr: $addr" >&2 + +txout="$addr+$coin" + +wait_seconds 10 "until the funds UTxO settles" + +txin="$(query_addr_txin "$addr" "$coin")" +if test -z "$txin" +then echo "ERROR: couldn't determine initial TxIn for $utxo_vkey">&2; exit 1; fi +echo "-- funds TxIn: $txin" >&2 + + +jq '{ txout: "\($txout)" + , txin: $txin + } +' --arg txin "$txin" \ + --arg txout "$txout" \ + <<<0 + +{ + echo -e "\nUTxO of src_addr ($src_addr):" + CARDANO_NODE_SOCKET_PATH=logs/sockets/1 \ + $cli \ + shelley query utxo \ + --testnet-magic $MAGIC \ + --address "$src_addr" + + echo -e "\nUTxO of addr ($addr):" + CARDANO_NODE_SOCKET_PATH=logs/sockets/1 \ + $cli \ + shelley query utxo \ + --testnet-magic $MAGIC \ + --address "$addr" +} >&2 diff --git a/benchmarks/shelley3pools/prepare_genesis_staked.sh b/benchmarks/shelley3pools/prepare_genesis_shelley_staked.sh similarity index 96% rename from benchmarks/shelley3pools/prepare_genesis_staked.sh rename to benchmarks/shelley3pools/prepare_genesis_shelley_staked.sh index ddc1dd48..56d9bd90 100755 --- a/benchmarks/shelley3pools/prepare_genesis_staked.sh +++ b/benchmarks/shelley3pools/prepare_genesis_shelley_staked.sh @@ -9,7 +9,7 @@ basedir=$(realpath "$(dirname "$0")") cd "$basedir" -gendir=$GENESISDIR +gendir=$GENESISDIR_shelley cli=${CLICMD:-'run cardano-cli'} ### @@ -106,7 +106,7 @@ mv "$gendir"/genesis.spec.json. "$gendir"/genesis.spec.json params=(--genesis-dir "$gendir" --testnet-magic "$MAGIC" --supply "$TOTAL_SUPPLY" - --start-time "$(date --iso-8601=s --date='5 seconds' --utc | cut -c-19)Z" + --start-time "$(date --iso-8601=s --date=@$start_time --utc | cut -c-19)Z" ) ## update genesis from template $cli shelley genesis create "${params[@]}" @@ -254,5 +254,8 @@ jq '. + } + $initialFundsOfPools) } ' "${params[@]}" \ - < "$gendir"/genesis.json > "$gendir"/genesis.json. -mv "$gendir"/genesis.json. "$gendir"/genesis.json + < "$gendir"/genesis.json > "$gendir"/genesis.json. +mv "$gendir"/genesis.json. "$gendir"/genesis.json + +$cli shelley genesis hash --genesis "$gendir"/genesis.json | + tr -d '"' > "$gendir"/GENHASH diff --git a/benchmarks/shelley3pools/run-3pools.sh b/benchmarks/shelley3pools/run-3pools.sh index b47e5d7a..9ca44876 100755 --- a/benchmarks/shelley3pools/run-3pools.sh +++ b/benchmarks/shelley3pools/run-3pools.sh @@ -13,8 +13,6 @@ HOSTADDR=127.0.0.1 # the nodes will listen on ports starting with: PORTBASE=3000 -GENESISDIR=configuration/genesis - # redirect stderr if LiveView active REDIRSTDERR="2>/dev/null" REDIRSTDERR= @@ -33,7 +31,9 @@ tmux split-window -h mkdir -p logs for N in 1 2 3 -do tmux select-pane -t $((N - 1)) +do N1=$((N - 1)) + N13=$(printf "%03d" $N1) + tmux select-pane -t $N1 tmux send-keys \ "${TMUX_ENV_PASSTHROUGH[*]} @@ -49,9 +49,11 @@ do tmux select-pane -t $((N - 1)) --socket-path logs/sockets/${N} \ --host-addr ${HOSTADDR} --port $((PORTBASE + N - 1)) \ --config configuration/configuration-node-${N}.yaml \ - --shelley-kes-key ${GENESISDIR}/node${N}/kes.skey \ - --shelley-vrf-key ${GENESISDIR}/node${N}/vrf.skey \ - --shelley-operational-certificate ${GENESISDIR}/node${N}/node.cert \ + --signing-key ${GENESISDIR_byron}/delegate-keys.$N13.key \ + --delegation-certificate ${GENESISDIR_byron}/delegation-cert.$N13.json \ + --shelley-kes-key ${GENESISDIR_shelley}/node${N}/kes.skey \ + --shelley-vrf-key ${GENESISDIR_shelley}/node${N}/vrf.skey \ + --shelley-operational-certificate ${GENESISDIR_shelley}/node${N}/node.cert \ " ${REDIRSTDERR} \ C-m done diff --git a/benchmarks/shelley3pools/run-tx-generator.sh b/benchmarks/shelley3pools/run-tx-generator.sh index c4cb3584..6972543c 100755 --- a/benchmarks/shelley3pools/run-tx-generator.sh +++ b/benchmarks/shelley3pools/run-tx-generator.sh @@ -12,9 +12,12 @@ TARGETNODES=`for N in $targetnodes; do echo -n "--target-node (\"127.0.0.1\",$(( localsock=$BASEDIR/logs/sockets/1 -args_common=( +era=${1:-shelley} +echo "--( args: $*" +echo "--( era: $era" + +args=( --config ${CONFIGDIR}/configuration-generator.yaml - --genesis-file ${CONFIGDIR}/genesis/genesis.json --socket-path $localsock --num-of-txs $numtx --add-tx-size $addsizetx @@ -25,22 +28,33 @@ args_common=( --init-cooldown $init_cooldown ${TARGETNODES} ) -args_byron=( - --sig-key ${CONFIGDIR}/genesis/delegate-keys.000.key -) -args_shelley=( - --sig-key ${CONFIGDIR}/genesis/utxo-keys/utxo1.skey -) echo "starting submission to: $TARGETNODES" case $era in byron ) - run 'cardano-tx-generator' "${args_common[@]}" "${args_byron[@]}";; + args+=( + --genesis-funds-key ${GENESISDIR_byron}/poor-keys.000.skey + ) + run 'cardano-tx-generator' "${args[@]}";; shelley ) + args+=( + --genesis-funds-key ${GENESISDIR_shelley}/utxo-keys/utxo1.skey + ) + run 'cardano-tx-generator' "${args[@]}";; +cardano-shelley ) + txio="$($BASEDIR/prepare_genesis_expenditure.sh)" + if test -z "$txio" + then echo "ERROR: couldn't obtain funds for generator">&2; exit 1; fi + args+=( + --shelley + --utxo-funds-key ${GENESISDIR_shelley}/utxo-keys/utxo1.skey + --tx-out "$(jq .txout <<<$txio --raw-output)" + --tx-in "$(jq .txin <<<$txio --raw-output)" + ) set +e - run 'cardano-tx-generator' "${args_common[@]}" "${args_shelley[@]}" - echo run 'cardano-tx-generator' "${args_common[@]}" "${args_shelley[@]}";; + echo run 'cardano-tx-generator' "${args[@]}" + run 'cardano-tx-generator' "${args[@]}";; *) echo "ERROR: unknown era '$era'" >&2;; esac diff --git a/benchmarks/shelley3pools/submit_delegation_tx.sh b/benchmarks/shelley3pools/submit_delegation_tx.sh index 22e815ba..61a4fef1 100755 --- a/benchmarks/shelley3pools/submit_delegation_tx.sh +++ b/benchmarks/shelley3pools/submit_delegation_tx.sh @@ -9,12 +9,12 @@ CLICMD=${CLICMD:-"run cardano-cli"} # === submit delegation transactions === for N in ${STAKEPOOLS}; do - if [ -e ${GENESISDIR}/node${N}/tx-delegate${N}.tx ]; then + if [ -e ${GENESISDIR_shelley}/node${N}/tx-delegate${N}.tx ]; then CARDANO_NODE_SOCKET_PATH=logs/sockets/${N} \ ${CLICMD} shelley transaction submit \ - --tx-file ${GENESISDIR}/node${N}/tx-delegate${N}.tx \ + --tx-file ${GENESISDIR_shelley}/node${N}/tx-delegate${N}.tx \ --testnet-magic ${MAGIC} else - echo "no delegation transaction ${GENESISDIR}/node${N}/tx-delegate${N}.tx found!" + echo "no delegation transaction ${GENESISDIR_shelley}/node${N}/tx-delegate${N}.tx found!" fi done diff --git a/scripts/common.sh b/scripts/common.sh index a37124fc..8756866d 100644 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -36,8 +36,9 @@ Usage: --mnemonic-suffix SUFFIX Profiling output will get an additional suffix - --shelley Set era to Shelley. Default - --byron Set era to Byron + --shelley Non-HFC mode, Shelley era. Default + --byron Non-HFC mode, Byron era + --cardano Cardano/HFC mode, Shelley era --quiet Don't print much. The default --verbose Be verbose about what's going on @@ -164,6 +165,7 @@ do case "$1" in --shelley ) era='shelley';; --byron ) era='byron';; + --cardano ) era='cardano-shelley';; --quiet ) verbose=;; --verbose ) verbose=t;;