Skip to content

Commit d79bc3d

Browse files
committed
Rename 'ROOT' to 'ARTIFACTS_DIR' in devnet
1 parent efbaa32 commit d79bc3d

File tree

8 files changed

+71
-72
lines changed

8 files changed

+71
-72
lines changed

mithril-test-lab/mithril-devnet/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,39 +90,39 @@ NODES=mithril ./devnet-query.sh
9090

9191
```bash
9292
# Run devnet with 2 BFT nodes and 5 SPO nodes
93-
ROOT=artifacts NUM_BFT_NODES=2 NUM_POOL_NODES=5 ./devnet-run.sh
93+
ARTIFACTS_DIR=artifacts NUM_BFT_NODES=2 NUM_POOL_NODES=5 ./devnet-run.sh
9494

9595
# Run devnet custom slot length (0.5s) and custom epoch length (120s)
9696
# Slot length: the duration of a Cardano Eslot (can help modulate the immutables creation rate)
9797
# Epoch Length: the duration of a Cardano Epoch
98-
ROOT=artifacts SLOT_LENGTH=0.5 EPOCH_LENGTH=120 ./devnet-run.sh
98+
ARTIFACTS_DIR=artifacts SLOT_LENGTH=0.5 EPOCH_LENGTH=120 ./devnet-run.sh
9999

100100
# Logs devnet
101-
ROOT=artifacts LINES=10 ./devnet-log.sh
101+
ARTIFACTS_DIR=artifacts LINES=10 ./devnet-log.sh
102102

103103
# Query devnet
104-
ROOT=artifacts ./devnet-query.sh
104+
ARTIFACTS_DIR=artifacts ./devnet-query.sh
105105

106106
# Stop devnet
107-
ROOT=artifacts ./devnet-stop.sh
107+
ARTIFACTS_DIR=artifacts ./devnet-stop.sh
108108

109109
# Visualize devnet
110-
ROOT=artifacts ./devnet-visualize.sh
110+
ARTIFACTS_DIR=artifacts ./devnet-visualize.sh
111111
```
112112

113113
## Step by step run with custom configuration
114114

115115
```bash
116116
# Parameters
117-
ROOT=artifacts # Directory where artifacts are produced
117+
ARTIFACTS_DIR=artifacts # Directory where artifacts are produced
118118
NUM_BFT_NODES=1 # Number of Cardano BFT nodes
119119
NUM_POOL_NODES=3 # Number of Cardano SPO nodes
120120

121121
# Bootstrap devnet with 1 BFT nodes and 3 SPO nodes
122-
rm -rf ${ROOT} && ./devnet-mkfiles.sh ${ROOT} ${NUM_BFT_NODES} ${NUM_POOL_NODES}
122+
rm -rf ${ARTIFACTS_DIR} && ./devnet-mkfiles.sh ${ARTIFACTS_DIR} ${NUM_BFT_NODES} ${NUM_POOL_NODES}
123123

124124
# Change directory
125-
cd ${ROOT}
125+
cd ${ARTIFACTS_DIR}
126126

127127
# Start devnet Cardano nodes
128128
./start-cardano.sh

mithril-test-lab/mithril-devnet/devnet-log.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env bash
22

33
# Default values
4-
if [ -z "${ROOT}" ]; then
5-
ROOT="artifacts"
4+
if [ -z "${ARTIFACTS_DIR}" ]; then
5+
ARTIFACTS_DIR="artifacts"
66
fi
77
if [ -z "${LINES}" ]; then
88
LINES="10"
@@ -12,7 +12,7 @@ if [ -z "${NODES}" ]; then
1212
fi
1313

1414
# Change directory
15-
cd ${ROOT}
15+
cd ${ARTIFACTS_DIR}
1616

1717
# Logs devnet
1818
echo "====================================================================="

mithril-test-lab/mithril-devnet/devnet-query.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#!/usr/bin/env bash
22

33
# Default values
4-
if [ -z "${ROOT}" ]; then
5-
ROOT="artifacts"
4+
if [ -z "${ARTIFACTS_DIR}" ]; then
5+
ARTIFACTS_DIR="artifacts"
66
fi
77
if [ -z "${NODES}" ]; then
88
NODES="*"
99
fi
1010

1111
# Change directory
12-
cd ${ROOT}
12+
cd ${ARTIFACTS_DIR}
1313

1414
# Query devnet
1515
echo "====================================================================="

mithril-test-lab/mithril-devnet/devnet-run.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ set -e
55
if [ -z "${NODES}" ]; then
66
NODES="*"
77
fi
8-
if [ -z "${ROOT}" ]; then
9-
ROOT="artifacts"
8+
if [ -z "${ARTIFACTS_DIR}" ]; then
9+
ARTIFACTS_DIR="artifacts"
1010
fi
11-
if [ -z "${FORCE_DELETE_ROOT_DIRECTORY}" ]; then
12-
FORCE_DELETE_ROOT_DIRECTORY="true"
11+
if [ -z "${FORCE_DELETE_ARTIFACTS_DIR}" ]; then
12+
FORCE_DELETE_ARTIFACTS_DIR="true"
1313
fi
1414
if [ -z "${DELEGATE_PERIOD}" ]; then
1515
DELEGATE_PERIOD="180"
@@ -21,15 +21,15 @@ echo "====================================================================="
2121
echo " Bootstrap Mithril/Cardano devnet"
2222
echo "====================================================================="
2323
echo
24-
if [[ "$FORCE_DELETE_ROOT_DIRECTORY" == "true" ]]; then
25-
echo ">> The ${ROOT} directory was force deleted"
26-
rm -rf ${ROOT} > /dev/null
24+
if [[ "$FORCE_DELETE_ARTIFACTS_DIR" == "true" ]]; then
25+
echo ">> The ${ARTIFACTS_DIR} directory was force deleted"
26+
rm -rf ${ARTIFACTS_DIR} > /dev/null
2727
fi
28-
ROOT=${ROOT} $(pwd)/devnet-mkfiles.sh
28+
ARTIFACTS_DIR=${ARTIFACTS_DIR} $(pwd)/devnet-mkfiles.sh
2929
echo
3030

3131
# Change directory
32-
pushd ${ROOT} > /dev/null
32+
pushd ${ARTIFACTS_DIR} > /dev/null
3333

3434
# Start devnet Cardano nodes
3535
if [ "${NODES}" = "cardano" ] || [ "${NODES}" = "*" ]; then

mithril-test-lab/mithril-devnet/devnet-stop.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/usr/bin/env bash
22

33
# Default values
4-
if [ -z "${ROOT}" ]; then
5-
ROOT="artifacts"
4+
if [ -z "${ARTIFACTS_DIR}" ]; then
5+
ARTIFACTS_DIR="artifacts"
66
fi
77

88
# Change directory
9-
cd ${ROOT}
9+
cd ${ARTIFACTS_DIR}
1010

1111
# Stop devnet
1212
echo "====================================================================="

mithril-test-lab/mithril-devnet/devnet-visualize.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/usr/bin/env bash
22

33
# Default values
4-
if [ -z "${ROOT}" ]; then
5-
ROOT="artifacts"
4+
if [ -z "${ARTIFACTS_DIR}" ]; then
5+
ARTIFACTS_DIR="artifacts"
66
fi
77

88
# Change directory
9-
cd ${ROOT}
9+
cd ${ARTIFACTS_DIR}
1010

1111
# Stop devnet
1212
echo "====================================================================="

mithril-test-lab/mithril-devnet/mkfiles/mkfiles-cardano.sh

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
ROOT_TEMP=./temp
2-
mkdir -p ${ROOT_TEMP}
1+
ARTIFACTS_DIR_TEMP=./temp
2+
mkdir -p ${ARTIFACTS_DIR_TEMP}
33

44
# Step 1: Bootstrap the devnet artifacts
55
# Adapted from https://github.com/IntersectMBO/cardano-node/blob/master/scripts/babbage/mkfiles.sh
@@ -29,7 +29,7 @@ START_GENESIS_DELAY=1
2929

3030
START_TIME="$(${DATE} -d "now + ${START_GENESIS_DELAY} seconds" +%s)"
3131

32-
cat > "${ROOT_TEMP}/byron.genesis.spec.json" <<EOF
32+
cat > "${ARTIFACTS_DIR_TEMP}/byron.genesis.spec.json" <<EOF
3333
{
3434
"heavyDelThd": "300000000000",
3535
"maxBlockSize": "2000000",
@@ -65,17 +65,17 @@ $CARDANO_CLI byron genesis genesis \
6565
--delegate-share 1 \
6666
--avvm-entry-count 0 \
6767
--avvm-entry-balance 0 \
68-
--protocol-parameters-file "${ROOT_TEMP}/byron.genesis.spec.json" \
69-
--genesis-output-dir "${ROOT_TEMP}/byron-gen-command"
68+
--protocol-parameters-file "${ARTIFACTS_DIR_TEMP}/byron.genesis.spec.json" \
69+
--genesis-output-dir "${ARTIFACTS_DIR_TEMP}/byron-gen-command"
7070

71-
cp $SCRIPT_DIRECTORY/configuration/babbage/alonzo-babbage-test-genesis.json "${ROOT_TEMP}/genesis.alonzo.spec.json"
72-
cp $SCRIPT_DIRECTORY/configuration/babbage/conway-babbage-test-genesis.json "${ROOT_TEMP}/genesis.conway.spec.json"
71+
cp $SCRIPT_DIRECTORY/configuration/babbage/alonzo-babbage-test-genesis.json "${ARTIFACTS_DIR_TEMP}/genesis.alonzo.spec.json"
72+
cp $SCRIPT_DIRECTORY/configuration/babbage/conway-babbage-test-genesis.json "${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json"
7373

7474
# Fix 8.1.2, to avoid the following error: 'Command failed: genesis create-staked Error: Error while decoding Shelley genesis at: example/genesis.conway.spec.json Error: Error in $: key "genDelegs" not found'
75-
mv ${ROOT_TEMP}/genesis.conway.spec.json ${ROOT_TEMP}/genesis.conway.spec.json.tmp && cat ${ROOT_TEMP}/genesis.conway.spec.json.tmp | jq '. += {"genDelegs":{}}' > ${ROOT_TEMP}/genesis.conway.spec.json && rm ${ROOT_TEMP}/genesis.conway.spec.json.tmp
75+
mv ${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json ${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json.tmp && cat ${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json.tmp | jq '. += {"genDelegs":{}}' > ${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json && rm ${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json.tmp
7676

77-
cp $SCRIPT_DIRECTORY/configuration/byron/configuration.yaml "${ROOT_TEMP}/"
78-
$SED -i "${ROOT_TEMP}/configuration.yaml" \
77+
cp $SCRIPT_DIRECTORY/configuration/byron/configuration.yaml "${ARTIFACTS_DIR_TEMP}/"
78+
$SED -i "${ARTIFACTS_DIR_TEMP}/configuration.yaml" \
7979
-e 's/Protocol: RealPBFT/Protocol: Cardano/' \
8080
-e '/Protocol/ aPBftSignatureThreshold: 0.6' \
8181
-e 's/minSeverity: Info/minSeverity: Info/' \
@@ -94,15 +94,15 @@ $SED -i "${ROOT_TEMP}/configuration.yaml" \
9494
-e 's/LastKnownBlockVersion-Major: 0/LastKnownBlockVersion-Major: 6/' \
9595
-e 's/LastKnownBlockVersion-Minor: 2/LastKnownBlockVersion-Minor: 0/'
9696

97-
echo "TestShelleyHardForkAtEpoch: 0" >> "${ROOT_TEMP}/configuration.yaml"
98-
echo "TestAllegraHardForkAtEpoch: 0" >> "${ROOT_TEMP}/configuration.yaml"
99-
echo "TestMaryHardForkAtEpoch: 0" >> "${ROOT_TEMP}/configuration.yaml"
100-
echo "TestAlonzoHardForkAtEpoch: 0" >> "${ROOT_TEMP}/configuration.yaml"
101-
echo "TestBabbageHardForkAtEpoch: 0" >> "${ROOT_TEMP}/configuration.yaml"
102-
echo "TestConwayHardForkAtEpoch: 0" >> "${ROOT_TEMP}/configuration.yaml"
103-
echo "ExperimentalProtocolsEnabled: True" >> "${ROOT_TEMP}/configuration.yaml"
97+
echo "TestShelleyHardForkAtEpoch: 0" >> "${ARTIFACTS_DIR_TEMP}/configuration.yaml"
98+
echo "TestAllegraHardForkAtEpoch: 0" >> "${ARTIFACTS_DIR_TEMP}/configuration.yaml"
99+
echo "TestMaryHardForkAtEpoch: 0" >> "${ARTIFACTS_DIR_TEMP}/configuration.yaml"
100+
echo "TestAlonzoHardForkAtEpoch: 0" >> "${ARTIFACTS_DIR_TEMP}/configuration.yaml"
101+
echo "TestBabbageHardForkAtEpoch: 0" >> "${ARTIFACTS_DIR_TEMP}/configuration.yaml"
102+
echo "TestConwayHardForkAtEpoch: 0" >> "${ARTIFACTS_DIR_TEMP}/configuration.yaml"
103+
echo "ExperimentalProtocolsEnabled: True" >> "${ARTIFACTS_DIR_TEMP}/configuration.yaml"
104104

105-
$CARDANO_CLI genesis create-staked --genesis-dir "${ROOT_TEMP}" \
105+
$CARDANO_CLI genesis create-staked --genesis-dir "${ARTIFACTS_DIR_TEMP}" \
106106
--testnet-magic "${NETWORK_MAGIC}" \
107107
--gen-pools ${NUM_SPO_NODES} \
108108
--supply ${TOTAL_SUPPLY} \
@@ -111,42 +111,42 @@ $CARDANO_CLI genesis create-staked --genesis-dir "${ROOT_TEMP}" \
111111
--gen-utxo-keys ${NUM_SPO_NODES}
112112

113113
## Customize the Shelley genesis file
114-
cat ${ROOT_TEMP}/genesis.json | jq --argjson slot_length ${SLOT_LENGTH} --argjson epoch_length ${EPOCH_LENGTH} --argjson security_param ${SECURITY_PARAM} '. + {slotLength: $slot_length, activeSlotsCoeff: 0.50, securityParam: $security_param, epochLength: $epoch_length, maxLovelaceSupply: 10000000000000, updateQuorum: 2}' > ${ROOT_TEMP}/genesis.json.tmp
115-
cat ${ROOT_TEMP}/genesis.json.tmp | jq --raw-output '.protocolParams.protocolVersion.major = 7 | .protocolParams.minFeeA = 44 | .protocolParams.minFeeB = 155381 | .protocolParams.minUTxOValue = 1000000 | .protocolParams.decentralisationParam = 0.7 | .protocolParams.rho = 0.1 | .protocolParams.tau = 0.1' > ${ROOT_TEMP}/genesis.json
116-
rm ${ROOT_TEMP}/genesis.json.tmp
114+
cat ${ARTIFACTS_DIR_TEMP}/genesis.json | jq --argjson slot_length ${SLOT_LENGTH} --argjson epoch_length ${EPOCH_LENGTH} --argjson security_param ${SECURITY_PARAM} '. + {slotLength: $slot_length, activeSlotsCoeff: 0.50, securityParam: $security_param, epochLength: $epoch_length, maxLovelaceSupply: 10000000000000, updateQuorum: 2}' > ${ARTIFACTS_DIR_TEMP}/genesis.json.tmp
115+
cat ${ARTIFACTS_DIR_TEMP}/genesis.json.tmp | jq --raw-output '.protocolParams.protocolVersion.major = 7 | .protocolParams.minFeeA = 44 | .protocolParams.minFeeB = 155381 | .protocolParams.minUTxOValue = 1000000 | .protocolParams.decentralisationParam = 0.7 | .protocolParams.rho = 0.1 | .protocolParams.tau = 0.1' > ${ARTIFACTS_DIR_TEMP}/genesis.json
116+
rm ${ARTIFACTS_DIR_TEMP}/genesis.json.tmp
117117

118118
# Step 2: Dispatch artifacts in the correct directories
119119

120120
## Copy the configuration files
121121
for NODE in ${ALL_NODES}; do
122-
cp ${ROOT_TEMP}/configuration.yaml ${NODE}/
122+
cp ${ARTIFACTS_DIR_TEMP}/configuration.yaml ${NODE}/
123123
done
124124

125125
## Copy the Byron genesis files
126126
for NODE in ${ALL_NODES}; do
127-
cp ${ROOT_TEMP}/byron-gen-command/genesis.json ${NODE}/byron/
128-
cp ${ROOT_TEMP}/genesis.spec.json ${NODE}/byron/
127+
cp ${ARTIFACTS_DIR_TEMP}/byron-gen-command/genesis.json ${NODE}/byron/
128+
cp ${ARTIFACTS_DIR_TEMP}/genesis.spec.json ${NODE}/byron/
129129
done
130130

131131
## Copy the Byron delegation artifacts
132132
for N in ${POOL_NODES_N}; do
133-
cp ${ROOT_TEMP}/byron-gen-command/delegate-keys.00$((${N} - 1)).key node-pool${N}/byron/delegate.key
134-
cp ${ROOT_TEMP}/byron-gen-command/delegation-cert.00$((${N} - 1)).json node-pool${N}/byron/delegate.cert
133+
cp ${ARTIFACTS_DIR_TEMP}/byron-gen-command/delegate-keys.00$((${N} - 1)).key node-pool${N}/byron/delegate.key
134+
cp ${ARTIFACTS_DIR_TEMP}/byron-gen-command/delegation-cert.00$((${N} - 1)).json node-pool${N}/byron/delegate.cert
135135
done
136136

137137
## Copy the Shelley genesis files
138138
for NODE in ${ALL_NODES}; do
139-
cp ${ROOT_TEMP}/genesis*.json ${NODE}/shelley/
139+
cp ${ARTIFACTS_DIR_TEMP}/genesis*.json ${NODE}/shelley/
140140
done
141141

142142
## Copy the SPO artifacts
143143
for N in ${POOL_NODES_N}; do
144-
cp ${ROOT_TEMP}/pools/vrf${N}.skey node-pool${N}/shelley/vrf.skey
145-
cp ${ROOT_TEMP}/pools/vrf${N}.vkey node-pool${N}/shelley/vrf.vkey
146-
cp ${ROOT_TEMP}/pools/cold${N}.skey node-pool${N}/shelley/cold.skey
147-
cp ${ROOT_TEMP}/pools/cold${N}.vkey node-pool${N}/shelley/cold.vkey
148-
cp ${ROOT_TEMP}/pools/kes${N}.skey node-pool${N}/shelley/kes.skey
149-
cp ${ROOT_TEMP}/pools/kes${N}.vkey node-pool${N}/shelley/kes.vkey
150-
cp ${ROOT_TEMP}/pools/opcert${N}.counter node-pool${N}/shelley/opcert.counter
151-
cp ${ROOT_TEMP}/pools/opcert${N}.cert node-pool${N}/shelley/opcert.cert
144+
cp ${ARTIFACTS_DIR_TEMP}/pools/vrf${N}.skey node-pool${N}/shelley/vrf.skey
145+
cp ${ARTIFACTS_DIR_TEMP}/pools/vrf${N}.vkey node-pool${N}/shelley/vrf.vkey
146+
cp ${ARTIFACTS_DIR_TEMP}/pools/cold${N}.skey node-pool${N}/shelley/cold.skey
147+
cp ${ARTIFACTS_DIR_TEMP}/pools/cold${N}.vkey node-pool${N}/shelley/cold.vkey
148+
cp ${ARTIFACTS_DIR_TEMP}/pools/kes${N}.skey node-pool${N}/shelley/kes.skey
149+
cp ${ARTIFACTS_DIR_TEMP}/pools/kes${N}.vkey node-pool${N}/shelley/kes.vkey
150+
cp ${ARTIFACTS_DIR_TEMP}/pools/opcert${N}.counter node-pool${N}/shelley/opcert.counter
151+
cp ${ARTIFACTS_DIR_TEMP}/pools/opcert${N}.cert node-pool${N}/shelley/opcert.cert
152152
done

mithril-test-lab/mithril-devnet/mkfiles/mkfiles-init.sh

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ if [ -z "${LISTENING_ADDR}" ]; then
2525
fi
2626

2727
# Display configuration summary
28-
echo ">> Directory: ${ROOT}"
29-
echo ">> Nodes: ${NODES}"
28+
echo ">> Artifacts Directory: ${ARTIFACTS_DIR}"
3029
echo ">> Cardano Node Version: ${CARDANO_NODE_VERSION}"
3130
echo ">> Cardano Network Magic: ${NETWORK_MAGIC}"
3231
echo ">> Cardano BFT nodes: ${NUM_BFT_NODES}"
@@ -37,8 +36,8 @@ echo ">> Cardano Delegation Period: ${DELEGATE_PERIOD}s"
3736
echo ">> Cardano Listening Address: ${LISTENING_ADDR}"
3837

3938
# Check if root directory already exists
40-
if ! mkdir -p "${ROOT}"; then
41-
echo ">> The ${ROOT} directory already exists, please move or remove it"
39+
if ! mkdir -p "${ARTIFACTS_DIR}"; then
40+
echo "The ${ARTIFACTS_DIR} directory already exists, please move or remove it"
4241
exit
4342
fi
4443

@@ -51,7 +50,7 @@ if [[ "$SKIP_CARDANO_BIN_DOWNLOAD" != "true" ]]; then
5150
fi
5251

5352
# And copy cardano-cli & cardano-node
54-
cp cardano-cli ${ROOT}/cardano-cli
55-
cp cardano-node ${ROOT}/cardano-node
53+
cp cardano-cli ${ARTIFACTS_DIR}/cardano-cli
54+
cp cardano-node ${ARTIFACTS_DIR}/cardano-node
5655

57-
pushd ${ROOT} > /dev/null
56+
pushd ${ARTIFACTS_DIR} > /dev/null

0 commit comments

Comments
 (0)