Skip to content

Commit

Permalink
CAD-1393 shelley3pools: support --cardano mode (--byron regressed)
Browse files Browse the repository at this point in the history
  • Loading branch information
deepfire committed Aug 3, 2020
1 parent a6292b0 commit cbe7b13
Show file tree
Hide file tree
Showing 15 changed files with 468 additions and 52 deletions.
3 changes: 2 additions & 1 deletion benchmarks/shelley3pools/.gitignore
@@ -1,5 +1,6 @@

configuration/genesis
configuration/genesis*
configuration/start-time

db/
logs/
Expand Down
22 changes: 18 additions & 4 deletions benchmarks/shelley3pools/benchmark.sh
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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
Expand Down
23 changes: 23 additions & 0 deletions 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"
}
20 changes: 10 additions & 10 deletions 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

Expand Down Expand Up @@ -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 #####

Expand Down
12 changes: 9 additions & 3 deletions benchmarks/shelley3pools/configuration/configuration-node-1.yaml
Expand Up @@ -3,18 +3,24 @@
############### 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 #####

# This is the instance of the Ouroboros family that we are running.
# 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
Expand Down
12 changes: 9 additions & 3 deletions benchmarks/shelley3pools/configuration/configuration-node-2.yaml
Expand Up @@ -3,18 +3,24 @@
############### 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 #####

# This is the instance of the Ouroboros family that we are running.
# 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
Expand Down
12 changes: 9 additions & 3 deletions benchmarks/shelley3pools/configuration/configuration-node-3.yaml
Expand Up @@ -3,18 +3,24 @@
############### 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 #####

# This is the instance of the Ouroboros family that we are running.
# 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
Expand Down
12 changes: 10 additions & 2 deletions 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"
Expand All @@ -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))
Expand Down Expand Up @@ -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
62 changes: 62 additions & 0 deletions 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

0 comments on commit cbe7b13

Please sign in to comment.