Skip to content

Commit 2832f32

Browse files
committed
fix: support new stake address creation of registration certificate in infra
1 parent 76eb5d8 commit 2832f32

File tree

3 files changed

+43
-9
lines changed

3 files changed

+43
-9
lines changed

mithril-infra/assets/tools/pool/create-keys.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,20 @@ CARDANO_CLI_CMD node issue-op-cert \
6262
--out-file ${POOL_ARTIFACTS_DIR}/opcert.cert
6363

6464
### Create a registration certificate
65-
CARDANO_CLI_CMD stake-address registration-certificate \
66-
--stake-verification-key-file ${POOL_ARTIFACTS_DIR}/stake.vkey \
67-
--out-file ${POOL_ARTIFACTS_DIR}/stake.cert
65+
if [ "${CARDANO_ERA}" == "conway"]; then
66+
KEY_REGISTRATION_DEPOSIT_ANOUNT=$(CARDANO_CLI_CMD ${CARDANO_ERA} query gov-state --testnet-magic ${NETWORK_MAGIC} | jq -r .enactState.curPParams.keyDeposit)
67+
# Conway specific creation of registration certificate
68+
CARDANO_CLI_CMD stake-address registration-certificate \
69+
--stake-verification-key-file ${POOL_ARTIFACTS_DIR}/stake.vkey \
70+
--out-file ${POOL_ARTIFACTS_DIR}/stake.cert \
71+
--key-reg-deposit-amt $KEY_REGISTRATION_DEPOSIT_ANOUNT
72+
else
73+
# Legacy creation of registration certificate
74+
CARDANO_CLI_CMD stake-address registration-certificate \
75+
--stake-verification-key-file ${POOL_ARTIFACTS_DIR}/stake.vkey \
76+
--out-file ${POOL_ARTIFACTS_DIR}/stake.cert
77+
fi
78+
6879

6980
### Compute Pool Id
7081
POOL_ID=$(CARDANO_CLI_CMD stake-pool id --cold-verification-key-file ${POOL_ARTIFACTS_DIR}/cold.vkey)

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ mkdir -p ${ARTIFACTS_DIR_TEMP}
44
# Step 1: Bootstrap the devnet artifacts
55
# Adapted from https://github.com/IntersectMBO/cardano-node/blob/master/scripts/babbage/mkfiles.sh
66

7+
# Is semver on the first argument strictly lower than equal to the second argument?
8+
version_lt() {
9+
VERSION_LHS=$1
10+
VERSION_RHS=$2
11+
if [ "${VERSION_LHS}" != "${VERSION_RHS}" ] && [ "${VERSION_LHS}" = "`echo -e "${VERSION_LHS}\n${VERSION_RHS}" | sort -V | head -n1`" ]; then
12+
echo "true"
13+
else
14+
echo "false"
15+
fi
16+
}
17+
718
UNAME=$(uname -s) SED=
819
case $UNAME in
920
Darwin ) SED="gsed";;
@@ -77,8 +88,8 @@ if [ "${CARDANO_NODE_VERSION_RELEASE}" = "8.1.2" ]; then
7788
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
7889
fi
7990

80-
if [ "${CARDANO_NODE_VERSION_RELEASE}" = "8.8.0" ]; then
81-
# 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
91+
if [ $(version_lt "${CARDANO_NODE_VERSION_RELEASE}" "8.8.0") = "false" ]; then
92+
# 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
8293
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
8394
cat ${ARTIFACTS_DIR_TEMP}/genesis.conway.spec.json
8495
fi

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

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,23 @@ CURRENT_EPOCH=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-
2121
--testnet-magic ${NETWORK_MAGIC} | jq .epoch)
2222
echo ">>>> Current Epoch: \${CURRENT_EPOCH}"
2323
24+
# Is semver on the first argument strictly lower than equal to the second argument?
25+
version_lt() {
26+
VERSION_LHS=\$1
27+
VERSION_RHS=\$2
28+
if [ "\${VERSION_LHS}" != "\${VERSION_RHS}" ] && [ "\${VERSION_LHS}" = "`echo -e "\${VERSION_LHS}\n\${VERSION_RHS}" | sort -V | head -n1`" ]; then
29+
echo "true"
30+
else
31+
echo "false"
32+
fi
33+
}
34+
2435
# Stake addresses registration certs
2536
for ADDR in ${USER_ADDRS}; do
26-
if [ "\${CURRENT_CARDANO_ERA}" == "conway" ]; then
27-
KEY_REGISTRATION_DEPOSIT_ANOUNT=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli \${CURRENT_CARDANO_ERA} query gov-state --testnet-magic ${NETWORK_MAGIC} | jq -r .enactState.curPParams.keyDeposit)
28-
if [ "\${KEY_REGISTRATION_DEPOSIT_ANOUNT}" != "null" ]; then
37+
if [ \$(version_lt "${CARDANO_NODE_VERSION_RELEASE}" "8.8.0") = "false" ]; then
38+
#KEY_REGISTRATION_DEPOSIT_ANOUNT=\$(CARDANO_NODE_SOCKET_PATH=node-pool${N}/ipc/node.sock ./cardano-cli \${CURRENT_CARDANO_ERA} query gov-state --testnet-magic ${NETWORK_MAGIC} | jq -r .enactState.curPParams.keyDeposit)
39+
KEY_REGISTRATION_DEPOSIT_ANOUNT=0
40+
if [ "\${CURRENT_CARDANO_ERA}" == "conway" ]; then
2941
# Conway specific creation of registration certificate
3042
./cardano-cli \${CURRENT_CARDANO_ERA} stake-address registration-certificate \
3143
--stake-verification-key-file addresses/\${ADDR}-stake.vkey \
@@ -50,7 +62,7 @@ EOF
5062
# User N will delegate to pool N
5163
for N in ${POOL_NODES_N}; do
5264
cat >> delegate.sh <<EOF
53-
if [ "\${CURRENT_CARDANO_ERA}" == "conway" ]; then
65+
if [ \$(version_lt "${CARDANO_NODE_VERSION_RELEASE}" "8.8.0") = "false" ]; then
5466
# Stake address delegation certs
5567
./cardano-cli \${CURRENT_CARDANO_ERA} stake-address stake-delegation-certificate \
5668
--stake-verification-key-file addresses/user${N}-stake.vkey \

0 commit comments

Comments
 (0)