Skip to content

Commit

Permalink
chore: remove hacks for Cardano '8.1.2' in devnet
Browse files Browse the repository at this point in the history
  • Loading branch information
jpraynaud committed Sep 3, 2024
1 parent e644856 commit 7e268b7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 33 deletions.
5 changes: 0 additions & 5 deletions mithril-test-lab/mithril-devnet/mkfiles/mkfiles-cardano.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,6 @@ $CARDANO_CLI byron genesis genesis \
cp $SCRIPT_DIRECTORY/configuration/babbage/alonzo-babbage-test-genesis.json "${ARTIFACTS_DIR_TEMP}/genesis.alonzo.spec.json"
cp $SCRIPT_DIRECTORY/configuration/babbage/conway-babbage-test-genesis.json "${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json"

if [ "${CARDANO_NODE_VERSION_RELEASE}" = "8.1.2" ]; then
# 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'
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
fi

if [ $(version_lt "${CARDANO_NODE_VERSION_RELEASE}" "8.8.0") = "false" ]; then
# Fix >=8.8.0, to avoid the following errors: 'Command failed: genesis create-staked Error: Error: Error while decoding Shelley genesis at: ./temp/genesis.conway.spec.json Error: Error in $.poolVotingThresholds: key "motionNoConfidence" not found'
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 '. += {"poolVotingThresholds": {"motionNoConfidence": 0.51, "committeeNormal": 0.51, "committeeNoConfidence": 0.51, "hardForkInitiation": 0.51, "ppSecurityGroup": 0.51}, "dRepVotingThresholds": {"motionNoConfidence": 0.51, "committeeNormal": 0.51, "committeeNoConfidence": 0.51, "updateToConstitution": 0.51, "hardForkInitiation": 0.51, "ppNetworkGroup": 0.51, "ppEconomicGroup": 0.51, "ppTechnicalGroup": 0.51, "ppGovGroup": 0.51, "treasuryWithdrawal": 0.51}}' > ${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json && rm ${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json.tmp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ CURRENT_CARDANO_ERA=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock $CAR
| jq -r '.era |= ascii_downcase | .era')
echo ">>>> Current Cardano Era: \${CURRENT_CARDANO_ERA}"
# Fix: era related command is not (well) supported in Cardano node version '8.1.2'
if [ "${CARDANO_NODE_VERSION}" = "8.1.2" ]; then
CURRENT_CARDANO_ERA=""
fi
# Get the current epoch
CURRENT_EPOCH=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock $CARDANO_CLI query tip \\
--cardano-mode \\
Expand Down Expand Up @@ -65,19 +60,11 @@ EOF
# User N will delegate to pool N
for N in ${POOL_NODES_N}; do
cat >> delegate.sh <<EOF
if [ \$(version_lte "${CARDANO_NODE_VERSION_RELEASE}" "8.1.2") == "false" ]; then
# Stake address delegation certs
$CARDANO_CLI \${CURRENT_CARDANO_ERA} stake-address stake-delegation-certificate \
--stake-verification-key-file addresses/user${N}-stake.vkey \
--cold-verification-key-file node-pool${N}/shelley/cold.vkey \
--out-file addresses/user${N}-stake.deleg.cert
else
# Legacy stake address delegation certs
$CARDANO_CLI \${CURRENT_CARDANO_ERA} stake-address delegation-certificate \
--stake-verification-key-file addresses/user${N}-stake.vkey \
--cold-verification-key-file node-pool${N}/shelley/cold.vkey \
--out-file addresses/user${N}-stake.deleg.cert
fi
# Stake address delegation certs
$CARDANO_CLI \${CURRENT_CARDANO_ERA} stake-address stake-delegation-certificate \
--stake-verification-key-file addresses/user${N}-stake.vkey \
--cold-verification-key-file node-pool${N}/shelley/cold.vkey \
--out-file addresses/user${N}-stake.deleg.cert
EOF
done
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ function send_funds_to_era_address {
| jq -r '.era |= ascii_downcase | .era')
echo ">>>> Current Cardano Era: \${CURRENT_CARDANO_ERA}"
# Fix: era related command is not (well) supported in Cardano node version '8.1.2'
if [ "${CARDANO_NODE_VERSION}" = "8.1.2" ]; then
CURRENT_CARDANO_ERA=""
fi
# Get current Cardano block
CURRENT_CARDANO_BLOCK=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock $CARDANO_CLI query tip \\
--testnet-magic ${NETWORK_MAGIC} \\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ cat >> payment-mithril.sh <<EOF
| jq -r '.era |= ascii_downcase | .era')
echo ">>>>>> Current Cardano Era: \${CURRENT_CARDANO_ERA}"
# Fix: era related command is not (well) supported in Cardano node version '8.1.2'
if [ "${CARDANO_NODE_VERSION}" = "8.1.2" ]; then
CURRENT_CARDANO_ERA=""
fi
# Set the amount to be transferred
AMOUNT_TRANSFERRED=\$(( 2000000 + 10 * ${i} + j))
echo ">>>>>> Send funds: \${AMOUNT_TRANSFERRED} Lovelace from 'utxo${i}.addr' to '${ADDR_RX}.addr'"
Expand Down

0 comments on commit 7e268b7

Please sign in to comment.