From 49e49c54a51fe77c2d91f39b70a7982f98c04288 Mon Sep 17 00:00:00 2001 From: Elena Bardho Date: Tue, 4 Nov 2025 16:36:50 +0000 Subject: [PATCH 1/6] fix references on metadata create --- scripts/metadata-create.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/metadata-create.sh b/scripts/metadata-create.sh index 62d93ee..e4225aa 100755 --- a/scripts/metadata-create.sh +++ b/scripts/metadata-create.sh @@ -157,7 +157,7 @@ get_section() { get_section_last() { local label="$1" - awk "/^${label}\$/,/^### References\$/" "$TEMP_MD" | sed "1d" \ + awk "/^${label}\$/,/^## References\$/" "$TEMP_MD" | sed "1d" \ | jq -Rs . } From bd273b38c1a5c2600b5294654a96417d463cf357 Mon Sep 17 00:00:00 2001 From: Elena Bardho Date: Tue, 4 Nov 2025 16:57:16 +0000 Subject: [PATCH 2/6] Prevent references appending to reationale --- scripts/metadata-create.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/metadata-create.sh b/scripts/metadata-create.sh index e4225aa..e6e6f95 100755 --- a/scripts/metadata-create.sh +++ b/scripts/metadata-create.sh @@ -157,8 +157,8 @@ get_section() { get_section_last() { local label="$1" - awk "/^${label}\$/,/^## References\$/" "$TEMP_MD" | sed "1d" \ - | jq -Rs . + awk "/^${label}\$/ {found=1; next} /^## References$/ {found=0} found" "$TEMP_MD" | jq -Rs . + } # Extract references from References section From c9a08f1d9f9e43b24afd8e0ef8f109ebaa00de3e Mon Sep 17 00:00:00 2001 From: Elena Bardho Date: Thu, 4 Dec 2025 15:56:54 +0000 Subject: [PATCH 3/6] Update create metadata to include committee update action --- scripts/metadata-create.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/scripts/metadata-create.sh b/scripts/metadata-create.sh index e6e6f95..e6e56c4 100755 --- a/scripts/metadata-create.sh +++ b/scripts/metadata-create.sh @@ -33,7 +33,7 @@ usage() { echo "Usage: $0 <.md-file> --governance-action-type --deposit-return-addr " echo "Options:" echo " <.md-file> Path to the .md file as input" - echo " --governance-action-type Type of governance action (info, treasury, protocol param update, etc.)" + echo " --governance-action-type Type of governance action (info, treasury, protocol param update, etc.)" echo " --deposit-return-addr Stake address for deposit return (bech32)" echo " -h, --help Show this help message and exit" exit 1 @@ -323,6 +323,16 @@ generate_treasury_onchain() { EOF } +generate_update_committee_onchain() { + + cat < Date: Fri, 5 Dec 2025 12:37:09 +0000 Subject: [PATCH 4/6] Add placeholder for update committee schema --- scripts/metadata-validate.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/metadata-validate.sh b/scripts/metadata-validate.sh index 46f225c..11b1029 100755 --- a/scripts/metadata-validate.sh +++ b/scripts/metadata-validate.sh @@ -19,6 +19,7 @@ CIP_136_SCHEMA="https://raw.githubusercontent.com/cardano-foundation/CIPs/refs/h INTERSECT_TREASURY_SCHEMA="https://raw.githubusercontent.com/IntersectMBO/governance-actions/refs/heads/main/schemas/treasury-withdrawals/common.schema.json" INTERSECT_INFO_SCHEMA="https://raw.githubusercontent.com/IntersectMBO/governance-actions/refs/heads/main/schemas/info/common.schema.json" INTERSECT_PPU_SCHEMA="https://raw.githubusercontent.com/IntersectMBO/governance-actions/refs/heads/main/schemas/parameter-changes/common.schema.json" +INTERSECT_COMMITTEE_UPDATE_SCHEMA="" # Placeholder for future schema # Default schema values DEFAULT_USE_CIP_100="false" @@ -258,6 +259,10 @@ if [ "$use_intersect_schema" = "true" ]; then elif [ "$governance_action_type" = "protocolParameterChanges" ]; then echo -e "${WHITE}Downloading Intersect ${YELLOW}parameterChanges${WHITE} schema...${NC}" INTERSECT_SCHEMA_URL="$INTERSECT_PPU_SCHEMA" + + elif [ "$governance_action_type" = "updateCommittee" ]; then + echo -e "${WHITE}Downloading Intersect ${YELLOW}parameterChanges${WHITE} schema...${NC}" + #INTERSECT_SCHEMA_URL="$INTERSECT_COMMITTEE_UPDATE_SCHEMA" PLACEHOLDER for future schema else echo -e "${RED}Error: Unknown governanceActionType '${YELLOW}$governance_action_type${RED}' in '${YELLOW}$JSON_FILE${RED}'.${NC}" exit 1 From 537a11e99f08b59722e28ca358472135aa795cac Mon Sep 17 00:00:00 2001 From: Elena Bardho Date: Mon, 8 Dec 2025 00:43:16 +0000 Subject: [PATCH 5/6] Add fields to remove/add committee cred --- scripts/action-create-info.sh | 4 + scripts/metadata-create.sh | 142 +++++++++++++++++++++++++++++++++- 2 files changed, 145 insertions(+), 1 deletion(-) diff --git a/scripts/action-create-info.sh b/scripts/action-create-info.sh index 5e8dc93..987a231 100755 --- a/scripts/action-create-info.sh +++ b/scripts/action-create-info.sh @@ -216,7 +216,11 @@ is_stake_address_script() { is_stake_address_registered(){ local address="$1" + echo -e "Checking if stake address $address is registered on-chain..." + which cardano-cli + cardano-cli conway query stake-address-info --address "$address" stake_address_deposit=$(cardano-cli conway query stake-address-info --address "$address" | jq -r '.[0].delegationDeposit') + if [ "$stake_address_deposit" != "null" ]; then return 0 else diff --git a/scripts/metadata-create.sh b/scripts/metadata-create.sh index e6e56c4..fa5e246 100755 --- a/scripts/metadata-create.sh +++ b/scripts/metadata-create.sh @@ -323,12 +323,152 @@ generate_treasury_onchain() { EOF } +collect_remove_committee_credentials() { + echo " " >&2 + echo -e "${YELLOW}Collecting credentials to REMOVE from committee...${NC}" >&2 + + echo -n "How many credentials do you want to remove? (0 if none): " >&2 + IFS= read -r remove_count &2 + exit 1 + fi + + local remove_credentials="[]" + + if [ "$remove_count" -gt 0 ]; then + local creds="[" + for ((i=1; i<=remove_count; i++)); do + echo " " >&2 + echo -e "${CYAN}Credential $i to remove:${NC}" >&2 + + # Ask for credential type + echo -n " Type (script/key): " >&2 + IFS= read -r cred_type &2 + exit 1 + fi + + # Ask for credential hash + echo -n " Hash: " >&2 + IFS= read -r cred_hash &2 + exit 1 + fi + + # Add to credentials array + if [ $i -gt 1 ]; then + creds+="," + fi + creds+="{\"type\":\"$cred_type\",\"hash\":\"$cred_hash\"}" + done + creds+="]" + remove_credentials="$creds" + fi + + echo "$remove_credentials" +} + +collect_add_committee_credentials() { + echo " " >&2 + echo -e "${YELLOW}Collecting credentials to ADD to committee...${NC}" >&2 + + echo -n "How many credentials do you want to add? (0 if none): " >&2 + IFS= read -r add_count &2 + exit 1 + fi + + local add_credentials="[]" + + if [ "$add_count" -gt 0 ]; then + local creds="[" + for ((i=1; i<=add_count; i++)); do + echo " " >&2 + echo -e "${CYAN}Credential $i to add:${NC}" >&2 + + # Ask for credential type + echo -n " Type (script/key): " >&2 + IFS= read -r cred_type &2 + exit 1 + fi + + # Ask for credential hash + echo -n " Hash: " >&2 + IFS= read -r cred_hash &2 + exit 1 + fi + + # Ask for epoch expiry + echo -n " Epoch expiry: " >&2 + IFS= read -r epoch_expiry &2 + exit 1 + fi + + # Add to credentials array + if [ $i -gt 1 ]; then + creds+="," + fi + creds+="{\"type\":\"$cred_type\",\"hash\":\"$cred_hash\",\"epochExpiry\":$epoch_expiry}" + done + creds+="]" + add_credentials="$creds" + fi + + echo "$add_credentials" +} + generate_update_committee_onchain() { + # Collect credentials to remove and add + local remove_creds=$(collect_remove_committee_credentials) + local add_creds=$(collect_add_committee_credentials) + + # Display summary + echo " " >&2 + echo -e "${GREEN}Committee changes summary:${NC}" >&2 + echo -e " Credentials to remove: $remove_creds" >&2 + echo -e " Credentials to add: $add_creds" >&2 + + # Confirm with user + echo -n "Is this correct? (y/n): " >&2 + IFS= read -r confirm &2 + exit 1 + fi + # Generate JSON output cat < Date: Mon, 8 Dec 2025 00:46:11 +0000 Subject: [PATCH 6/6] Improve script --- scripts/metadata-create.sh | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/scripts/metadata-create.sh b/scripts/metadata-create.sh index fa5e246..0495dc8 100755 --- a/scripts/metadata-create.sh +++ b/scripts/metadata-create.sh @@ -460,15 +460,31 @@ generate_update_committee_onchain() { exit 1 fi + # Build committeeChanges object dynamically, excluding empty arrays + local committee_changes="{" + + # Check if add_creds is not empty + if [ "$add_creds" != "[]" ]; then + committee_changes+="\"addCommitteeCredentials\": $add_creds" + fi + + # Check if remove_creds is not empty + if [ "$remove_creds" != "[]" ]; then + # Add comma if add_creds was added + if [ "$add_creds" != "[]" ]; then + committee_changes+="," + fi + committee_changes+="\"removeCommitteeCredentials\": $remove_creds" + fi + + committee_changes+="}" + # Generate JSON output cat <