Skip to content

Commit 46459c7

Browse files
committed
Update 2025-01 - Add CC names in action summaries
- 00_common.sh now includes a likst of CC-ColdHashes and there council names. This is set for Mainnet and PreProd-Testnet - 24a_genVote.sh and 24c_queryVote.sh are now showing the names of CC members that have voted with there CC-Hot-Keys. The names appear in the YES, NO, ABSTAIN columns right below the counts. - The CC total voting power calculation has been optimized to actually count authorized and active CC members - cardano-cli version is currently limited to max. 10.3.99, because most likely 10.4.0.0 will introduce a breaking change in the stake-address-info query output
1 parent c20f2d0 commit 46459c7

File tree

4 files changed

+124
-16
lines changed

4 files changed

+124
-16
lines changed

cardano/mainnet/00_common.sh

+25-2
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,16 @@ case "${network,,}" in
192192
_lightModeParametersURL="https://uptime.live/data/cardano/parms/mainnet-parameters.json" #Parameters-JSON-File with current informations about cardano-cli version, tip, era, protocol-parameters
193193
_guardrailScriptUTXO="dc06746a898fd230f164f47a3d749348b65655b8fb388ff275f54d62891653e2#0"
194194
_guardrailScriptSize=2132
195-
;;
195+
_ccMemberColdHashNames='{
196+
"scriptHash-349e55f83e9af24813e6cb368df6a80d38951b2a334dfcdf26815558": "CAC",
197+
"scriptHash-84aebcfd3e00d0f87af918fc4b5e00135f407e379893df7e7d392c6a": "ECC",
198+
"scriptHash-b6012034ba0a7e4afbbf2c7a1432f8824aee5299a48e38e41a952686": "CF",
199+
"scriptHash-ce8b37a72b178a37bbd3236daa7b2c158c9d3604e7aa667e6c6004b7": "Emurgo",
200+
"scriptHash-df0e83bde65416dade5b1f97e7f115cc1ff999550ad968850783fe50": "IOG",
201+
"scriptHash-e8165b3328027ee0d74b1f07298cb092fd99aa7697a1436f5997f625": "CJC",
202+
"scriptHash-f0dc2c00d92a45521267be2d5de1c485f6f9d14466d7e16062897cf7": "ICC"
203+
}'
204+
;;
196205

197206

198207
"preprod"|"pre-prod" )
@@ -207,6 +216,15 @@ case "${network,,}" in
207216
_adahandleAPI="https://preprod.api.handle.me" #Adahandle-API URLs -> autoresolve into ${adahandleAPI}
208217
_catalystAPI="https://api.testnet.projectcatalyst.io/api/v1" #Catalyst-API URLs -> autoresolve into ${catalystAPI}
209218
_lightModeParametersURL="https://uptime.live/data/cardano/parms/preprod-parameters.json" #Parameters-JSON-File with current informations about cardano-cli version, tip, era, protocol-parameters
219+
_ccMemberColdHashNames='{
220+
"scriptHash-5098dfd0deba725fadd692198fc33ee959fbe7e6edf1b5a695e06e61": "CAC",
221+
"scriptHash-5a71f17f4ce4c1c0be053575d717ade6ad8a1d5453d02a65ce40d4b1": "ECC",
222+
"scriptHash-6095e643ea6f1cccb6e463ec34349026b3a48621aac5d512655ab1bf": "CF",
223+
"scriptHash-94c0de47e7ae32e3f7234ada5cf976506b68e3bb88c54dc53b4ba984": "ICC"
224+
"scriptHash-94f51c795a6c11adb9c1e30f0b6def4230cbd0b8bc800098e2d2307b": "Emurgo",
225+
"scriptHash-a6a5e006fd4e8f51062dc431362369b2a43140abced8aa2ff2256d7b": "IOG",
226+
"scriptHash-2f4a6c6f098e20ee4bfd5b39942c164575f8ceb348e754df5d0ec04f": "CJC"
227+
}'
210228
;;
211229

212230

@@ -224,6 +242,7 @@ case "${network,,}" in
224242
_lightModeParametersURL="https://uptime.live/data/cardano/parms/preview-parameters.json" #Parameters-JSON-File with current informations about cardano-cli version, tip, era, protocol-parameters
225243
_guardrailScriptUTXO="f3f61635034140e6cec495a1c69ce85b22690e65ab9553ef408d524f58183649#0"
226244
_guardrailScriptSize=2132
245+
_ccMemberColdHashNames='{}'
227246
;;
228247

229248

@@ -239,6 +258,7 @@ case "${network,,}" in
239258
_adahandleAPI=
240259
_catalystAPI= #Catalyst-API URLs -> autoresolve into ${catalystAPI}
241260
_lightModeParametersURL= #Parameters-JSON-File with current informations about cardano-cli version, tip, era, protocol-parameters
261+
_ccMemberColdHashNames='{}'
242262
;;
243263

244264

@@ -256,6 +276,7 @@ case "${network,,}" in
256276
_lightModeParametersURL="https://uptime.live/data/cardano/parms/sanchonet-parameters.json" #Parameters-JSON-File with current informations about cardano-cli version, tip, era, protocol-parameters
257277
# _guardrailScriptUTXO="8b9163fa38914b45470a5426c27939cfb77628f0c54d08b0b61b9905c2cbfc2b#0"
258278
_guardrailScriptSize=2132
279+
_ccMemberColdHashNames='{}'
259280
;;
260281

261282

@@ -271,6 +292,7 @@ case "${network,,}" in
271292
_adahandleAPI=
272293
_catalystAPI= #Catalyst-API URLs -> autoresolve into ${catalystAPI}
273294
_lightModeParametersURL= #Parameters-JSON-File with current informations about cardano-cli version, tip, era, protocol-parameters
295+
_ccMemberColdHashNames='{}'
274296
;;
275297

276298
esac
@@ -289,6 +311,7 @@ catalystAPI=${catalystAPI:-"${_catalystAPI}"}
289311
lightModeParametersURL=${lightModeParametersURL:-"${_lightModeParametersURL}"}
290312
guardrailScriptUTXO=${guardrailScriptUTXO:-"${_guardrailScriptUTXO}"}
291313
guardrailScriptSize=${guardrailScriptSize:-"${_guardrailScriptSize}"}
314+
ccMemberColdHashNames=${ccMemberColdHashNames:-"${_ccMemberColdHashNames}"}
292315

293316

294317
#Check about the / at the end of the URLs
@@ -303,7 +326,7 @@ if [[ "${magicparam}" == "" || ${addrformat} == "" || ${byronToShelleyEpochs} =
303326

304327
#Don't allow to overwrite the needed Versions, so we set it after the overwrite part
305328
minCliVersion="10.2.0" #minimum allowed cli version for this script-collection version
306-
maxCliVersion="99.99.9" #maximum allowed cli version, 99.99.9 = no limit so far
329+
maxCliVersion="10.3.99" #maximum allowed cli version, 99.99.9 = no limit so far
307330
minNodeVersion="10.1.4" #minimum allowed node version for this script-collection version
308331
maxNodeVersion="99.99.9" #maximum allowed node version, 99.99.9 = no limit so far
309332
minLedgerCardanoAppVersion=${ENV_MINLEDGERCARDANOAPPVERSION:-"7.1.1"} #minimum version for the cardano-app on the Ledger HW-Wallet

cardano/mainnet/24a_genVote.sh

+47-6
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,12 @@ case ${workMode} in
302302
poolPowerTotal=$(jq -r '[ .[][1] ] | add // 0' <<< "${poolStakeDistributionJSON}" 2> /dev/null)
303303

304304
#Get the committee power distribution -> Generate an Array of CommitteeHotHashes and there Votingpower (MembersAuthorized count as 1, all others like MemberNotAuthorized or MemberResigned count as 0)
305-
committeePowerDistributionJSON=$(${cardanocli} ${cliEra} query committee-state | jq -r "[ .committee | ( to_entries[] | select(.value.hotCredsAuthStatus.tag == \"MemberAuthorized\" and .value.status == \"Active\") | [ \"\(.value.hotCredsAuthStatus.contents |keys[0])-\(.value.hotCredsAuthStatus.contents.keyHash // .value.hotCredsAuthStatus.contents.scriptHash)\", 1 ] ) ]" 2> /dev/null)
305+
committeeStateJSON=$(${cardanocli} ${cliEra} query committee-state | jq -r "[ .committee | to_entries[] | select(.value.hotCredsAuthStatus.tag == \"MemberAuthorized\" and .value.status == \"Active\") ]" 2> /dev/null)
306+
committeePowerDistributionJSON=$(jq -r "[ ( .[] | [ \"\(.value.hotCredsAuthStatus.contents |keys[0])-\(.value.hotCredsAuthStatus.contents.keyHash // .value.hotCredsAuthStatus.contents.scriptHash)\", 1 ] ) ]" <<< "${committeeStateJSON}" 2> /dev/null)
306307
if [[ ${committeePowerDistributionJSON} == "" ]]; then committeePowerDistributionJSON="[]"; fi #in case there is no committee yet
307308

308309
#Get the total committee power -> only authorized and active keys in the list, so the totalPower is just the length of the array
309-
committeePowerTotal=$(jq -r "length // 0" <<< ${committeePowerDistributionJSON} 2> /dev/null)
310+
committeePowerTotal=$(jq -r "length // 0" <<< ${committeeStateJSON} 2> /dev/null)
310311

311312
#Get the current committee member voting threshold
312313
{ read committeePowerThreshold; } <<< $(jq -r '"\(.committee.threshold)" // 0' <<< ${govStateJSON} 2> /dev/null)
@@ -320,14 +321,21 @@ case ${workMode} in
320321
"number")
321322
committeePowerThreshold=$(bc <<< "scale=2; 100.00 * ${committeePowerThreshold}") #scale it to 0.00-100.00%
322323
;;
324+
325+
*) #if any other type, throw an error
326+
echo -e "\e[35mERROR - Could not handle committeeThresholdType = ${committeeThresholdType}\e[0m\n"; exit 1
327+
;;
323328
esac
324329

330+
#Generate the JSON of all committeeHotHashes and there names, depending on the committeeColdHashes
331+
ccMemberHotHashNamesJSON=$(jq -r "[ .[] | { \"\(.value.hotCredsAuthStatus.contents | keys[0])-\(.value.hotCredsAuthStatus.contents | flatten[0])\": (${ccMemberColdHashNames}[.key]) } ] | reduce .[] as \$o ({}; . * \$o)" <<< ${committeeStateJSON} 2> /dev/null)
332+
325333
#Get the current protocolParameters for the dRep and pool voting thresholds
326334
protocolParametersJSON=$(${cardanocli} ${cliEra} query protocol-parameters)
327335
;;
328336

329337

330-
"light")
338+
"light")
331339
voterID="" #disable filtering
332340
showProcessAnimation "Query Governance-Action Info-LightMode: " &
333341
actionStateJSON=$(queryLight_actionState "${govActionUTXO}" "${govActionIdx}" "${voterID}")
@@ -336,21 +344,37 @@ case ${workMode} in
336344
#strip the outter array for now
337345
actionStateJSON=$(jq -r ".[]" 2> /dev/null <<< "${actionStateJSON}")
338346

347+
#Get the committeeState -> only use active and authorized members -> use it to generate the CC names for hotHashes
348+
showProcessAnimation "Query Committee-State LightMode: " &
349+
committeeStateLightJSON=$(queryLight_committeeState "")
350+
if [ $? -ne 0 ]; then stopProcessAnimation; echo -e "\e[35mERROR - ${committeeStateLightJSON}\e[0m\n"; exit $?; else stopProcessAnimation; fi;
351+
committeeStateJSON=$(jq -r "[ .committee | to_entries[] | select(.value.hotCredsAuthStatus.tag == \"MemberAuthorized\" and .value.status == \"Active\") ]" <<< "${committeeStateLightJSON}" 2> /dev/null)
352+
if [ $? -ne 0 ]; then stopProcessAnimation; echo -e "\e[35mERROR - Could not generate committeeStateJSON\e[0m\n"; exit $?; else stopProcessAnimation; fi;
353+
#Generate the JSON of all committeeHotHashes and there names, depending on the committeeColdHashes
354+
ccMemberHotHashNamesJSON=$(jq -r "[ .[] | { \"\(.value.hotCredsAuthStatus.contents | keys[0])-\(.value.hotCredsAuthStatus.contents | flatten[0])\": (${ccMemberColdHashNames}[.key]) } ] | reduce .[] as \$o ({}; . * \$o)" <<< ${committeeStateJSON} 2> /dev/null)
355+
339356
#Get the current protocolParameters for the dRep, pool and committee voting thresholds
340357
protocolParametersJSON=${lightModeParametersJSON} #lightmode
341358

359+
#Get the total committee power -> only authorized and active keys in the list, so the totalPower is just the length of the array
360+
committeePowerTotal=$(jq -r "length // 0" <<< ${committeeStateJSON} 2> /dev/null)
361+
342362
#Get the current committee member count and voting threshold
343-
{ read committeePowerTotal; read committeeThreshold; } <<< $(jq -r '(.committee.members | length) // 0, "\(.committee.threshold)" // 0' 2> /dev/null <<< "${protocolParametersJSON}")
363+
committeeThreshold=$(jq -r '"\(.threshold)" // 0' 2> /dev/null <<< "${committeeStateLightJSON}")
344364
committeeThresholdType=$(jq -r "type" <<< "${committeeThreshold}" 2> /dev/null)
345365
case ${committeeThresholdType} in
346366
"object")
347367
{ read numerator; read denominator; } <<< $(jq -r '.numerator // "-", .denominator // "-"' <<< "${committeeThreshold}")
348368
committeePowerThreshold=$(bc <<< "scale=2; 100 * ${numerator} / ${denominator}")
349-
;;
369+
;;
350370

351371
"number")
352372
committeePowerThreshold=$(bc <<< "scale=2; 100 * ${committeeThreshold}")
353-
;;
373+
;;
374+
375+
*) #if any other type, throw an error
376+
echo -e "\e[35mERROR - Could not handle committeeThresholdType = ${committeeThresholdType}\e[0m\n"; exit 1
377+
;;
354378
esac
355379
;;
356380

@@ -497,6 +521,11 @@ do
497521
.[0].pool_yes_vote_power // 0,
498522
.[0].pool_active_no_vote_power // 0,
499523
.[0].pool_active_abstain_vote_power // 0 ' <<< ${actionVotesSummaryJSON})
524+
525+
#Generate lists with the committee hashes that have voted yes, no or abstain.
526+
{ read committeeHashYes; read committeeHashNo; read committeeHashAbstain; } <<< $(jq -r '"\(.committeeVotes | with_entries(select(.value | contains("Yes"))) | keys )",
527+
"\(.committeeVotes | with_entries(select(.value | contains("No"))) | keys)",
528+
"\(.committeeVotes | with_entries(select(.value | contains("Abstain"))) | keys)"' <<< ${actionEntry} 2> /dev/null)
500529
;;
501530
esac
502531

@@ -926,6 +955,18 @@ do
926955
else
927956
printf "\e[90m%13s\e[90m │ \e[90m%10s\e[90m │ \e[90m%10s\e[90m │ \e[90m%10s\e[90m │ \e[90m%10s\e[90m │ \e[90m%7s %%\e[90m │ \e[90m%6s %%\e[90m │ %b \e[0m\n" "Committee" "-" "-" "-" "" "-" "-"
928957
fi
958+
959+
#show CC names that have voted -> replace the hotHash with the name from the ccMemberHotHashNames-JSON, convert linebreaks into spaces (make it a line), wordwrap the line, trimstrim each line, make it an array
960+
readarray -t committeeNamesYes <<< $(jq -r ".[] | ${ccMemberHotHashNamesJSON}[.] // \"Unknown?\"" <<< "${committeeHashYes}" 2> /dev/null | tr '\n' ' ' | fold -w 11 -s | awk '{$1=$1};1')
961+
readarray -t committeeNamesNo <<< $(jq -r ".[] | ${ccMemberHotHashNamesJSON}[.] // \"Unknown?\"" <<< "${committeeHashNo}" 2> /dev/null | tr '\n' ' ' | fold -w 11 -s | awk '{$1=$1};1')
962+
readarray -t committeeNamesAbstain <<< $(jq -r ".[] | ${ccMemberHotHashNamesJSON}[.] // \"Unknown?\"" <<< "${committeeHashAbstain}" 2> /dev/null | tr '\n' ' ' | fold -w 11 -s | awk '{$1=$1};1')
963+
tmpCnt2=0
964+
while [[ "${committeeNamesYes[${tmpCnt2}]}${committeeNamesNo[${tmpCnt2}]}${committeeNamesAbstain[${tmpCnt2}]}" != "" ]]; do
965+
printf "\e[94m%13s\e[90m │ \e[32m%10s\e[90m │ \e[91m%10s\e[90m │ \e[33m%10s\e[90m │ \e[90m%10s\e[90m │ \e[0m%7s \e[90m │ \e[97m%6s \e[90m │ \e[0m\n" "" "${committeeNamesYes[${tmpCnt2}]}" "${committeeNamesNo[${tmpCnt2}]}" "${committeeNamesAbstain[${tmpCnt2}]}" "" "" ""
966+
tmpCnt2=$(( ${tmpCnt2} + 1 ))
967+
done
968+
unset committeeNamesYes committeeNamesNo committeeNamesAbstain tmpCnt2
969+
929970
printf "\e[90m──────────────┴────────────┴────────────┴────────────┴────────────┴───────────┴──────────┼────────\e[0m\n"
930971
case "${totalAccept}" in
931972
*"N/A"*) totalAcceptIcon="N/A";;

0 commit comments

Comments
 (0)