feat: initialize Kurdistan SDK - independent fork of Polkadot SDK

This commit is contained in:
2025-12-13 15:44:15 +03:00
commit 286de54384
6841 changed files with 1848356 additions and 0 deletions
+105
View File
@@ -0,0 +1,105 @@
#!/usr/bin/env bash
export PRODUCT=pezkuwi
export VERSION=${VERSION:-stable2409}
export ENGINE=${ENGINE:-podman}
export REF1=${REF1:-'HEAD'}
export REF2=${REF2}
export RUSTC_STABLE=${RUSTC_STABLE:-'1.0'}
export NO_RUNTIMES=${NO_RUNTIMES:-'false'}
export CRATES_ONLY=${CRATES_ONLY:-'false'}
PROJECT_ROOT=`git rev-parse --show-toplevel`
echo $PROJECT_ROOT
TMP=${TMP:-$(mktemp -d)}
TEMPLATE_AUDIENCE="${PROJECT_ROOT}/scripts/release/templates/audience.md.tera"
TEMPLATE_CHANGELOG="${PROJECT_ROOT}/scripts/release/templates/changelog.md.tera"
DATA_JSON="${TMP}/data.json"
CONTEXT_JSON="${TMP}/context.json"
echo -e "TEMPLATE_AUDIENCE: \t$TEMPLATE_AUDIENCE"
echo -e "DATA_JSON: \t\t$DATA_JSON"
echo -e "CONTEXT_JSON: \t\t$CONTEXT_JSON"
# Create output folder
OUTPUT="${TMP}/changelogs/$PRODUCT/$VERSION"
echo -e "OUTPUT: \t\t$OUTPUT"
mkdir -p $OUTPUT
$ENGINE run --rm -v ${PROJECT_ROOT}:/repo paritytech/prdoc load -d "prdoc/$VERSION" --json > $DATA_JSON
cat $DATA_JSON | jq ' { "prdoc" : .}' > $CONTEXT_JSON
# Fetch the list of valid audiences and their descriptions
SCHEMA_URL=https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json
SCHEMA=$(curl -s $SCHEMA_URL | sed 's|^//.*||')
aud_desc_array=()
while IFS= read -r line; do
audience=$(jq -r '.const' <<< "$line" )
description=$(jq -r '.description' <<< "$line")
if [ -n "$audience" ] && [ -n "$description" ]; then
aud_desc_array+=("($audience; $description)")
fi
done < <(jq -c '."$defs".audience_id.oneOf[]' <<< "$SCHEMA")
# Generate a release notes doc per audience
for tuple in "${aud_desc_array[@]}"; do
audience=$(echo "$tuple" | cut -d ';' -f 1 | sed 's/(//')
audience_id="$(tr [A-Z] [a-z] <<< "$audience")"
audience_id="$(tr ' ' '_' <<< "$audience_id")"
description=$(echo "$tuple" | cut -d ';' -f 2 | sed 's/)//')
echo "Processing audience: $audience ($audience_id)"
export TARGET_AUDIENCE="$audience"
export AUDIENCE_DESC="**️ These changes are relevant to:** $description"
tera -t "${TEMPLATE_AUDIENCE}" --env --env-key env "${CONTEXT_JSON}" > "$OUTPUT/relnote_${audience_id}.md"
cat "$OUTPUT/relnote_${audience_id}.md" >> "$PROJECT_ROOT/scripts/release/templates/changelog.md"
done
# Generate a changelog containing list of the commits
echo "Generating changelog..."
tera -t "${TEMPLATE_CHANGELOG}" --env --env-key env "${CONTEXT_JSON}" > "$OUTPUT/relnote_commits.md"
echo "Changelog ready in $OUTPUT/relnote_commits.md"
# Show the files
tree -s -h -c $OUTPUT/
if [[ "$NO_RUNTIMES" == "false" && "$CRATES_ONLY" == "false" ]]; then
ASSET_HUB_ZAGROS_DIGEST=${ASSET_HUB_ZAGROS_DIGEST:-"$PROJECT_ROOT/scripts/release/digests/asset-hub-zagros-srtool-digest.json"}
BRIDGE_HUB_ZAGROS_DIGEST=${BRIDGE_HUB_ZAGROS_DIGEST:-"$PROJECT_ROOT/scripts/release/digests/bridge-hub-zagros-srtool-digest.json"}
COLLECTIVES_ZAGROS_DIGEST=${COLLECTIVES_ZAGROS_DIGEST:-"$PROJECT_ROOT/scripts/release/digests/collectives-zagros-srtool-digest.json"}
CORETIME_ZAGROS_DIGEST=${CORETIME_ZAGROS_DIGEST:-"$PROJECT_ROOT/scripts/release/digests/coretime-zagros-srtool-digest.json"}
GLUTTON_ZAGROS_DIGEST=${GLUTTON_ZAGROS_DIGEST:-"$PROJECT_ROOT/scripts/release/digests/glutton-zagros-srtool-digest.json"}
PEOPLE_ZAGROS_DIGEST=${PEOPLE_ZAGROS_DIGEST:-"$PROJECT_ROOT/scripts/release/digests/people-zagros-srtool-digest.json"}
ZAGROS_DIGEST=${ZAGROS_DIGEST:-"$PROJECT_ROOT/scripts/release/digests/zagros-srtool-digest.json"}
jq \
--slurpfile srtool_asset_hub_zagros $ASSET_HUB_ZAGROS_DIGEST \
--slurpfile srtool_bridge_hub_zagros $BRIDGE_HUB_ZAGROS_DIGEST \
--slurpfile srtool_collectives_zagros $COLLECTIVES_ZAGROS_DIGEST \
--slurpfile srtool_coretime_zagros $CORETIME_ZAGROS_DIGEST \
--slurpfile srtool_glutton_zagros $GLUTTON_ZAGROS_DIGEST \
--slurpfile srtool_people_zagros $PEOPLE_ZAGROS_DIGEST \
--slurpfile srtool_zagros $ZAGROS_DIGEST \
-n '{
srtool: [
{ order: 10, name: "Zagros", data: $srtool_zagros[0] },
{ order: 11, name: "Zagros AssetHub", data: $srtool_asset_hub_zagros[0] },
{ order: 12, name: "Zagros BridgeHub", data: $srtool_bridge_hub_zagros[0] },
{ order: 13, name: "Zagros Collectives", data: $srtool_collectives_zagros[0] },
{ order: 14, name: "Zagros Coretime", data: $srtool_coretime_zagros[0] },
{ order: 15, name: "Zagros Glutton", data: $srtool_glutton_zagros[0] },
{ order: 16, name: "Zagros People", data: $srtool_people_zagros[0] }
] }' > "$PROJECT_ROOT/scripts/release/context.json"
else
echo '{}' > "$PROJECT_ROOT/scripts/release/context.json"
fi
RELEASE_DIR="$PROJECT_ROOT/scripts/release/"
pushd $RELEASE_DIR >/dev/null
tera --env --env-key env --include-path templates --template templates/template.md.tera context.json > RELEASE_DRAFT.md
popd >/dev/null
+34
View File
@@ -0,0 +1,34 @@
#!/bin/bash
TARGET_FILE="umbrella/Cargo.toml"
TMP_FILE="${TARGET_FILE}.tmp"
echo "Processing $TARGET_FILE..."
# Find and remove version lines in [dependencies.*] sections only
awk '
# Match [dependencies.<crate>] section
/^\[dependencies\.[^]]+\]/ {
in_dependencies_section = 1
print
next
}
# Any new section turns off the flag
/^\[.*\]/ {
in_dependencies_section = 0
print
next
}
# Skip version = "..." if in a [dependencies.*] section
{
if (in_dependencies_section && $0 ~ /^[ \t]*version[ \t]*=[ \t]*".*"/) {
next
} else {
print
}
}
' "$TARGET_FILE" > "$TMP_FILE" && mv "$TMP_FILE" "$TARGET_FILE"
echo "✅ Done: Removed version lines inside [dependencies.*] sections."
@@ -0,0 +1,14 @@
#!/bin/bash
ROOT_TOML="./Cargo.toml"
echo "Processing $ROOT_TOML..."
# Find lines that have path = "..." and version = "..."
# and remove only the version = "..." part, regardless of other fields
sed -i.bak -E 's/(path\s*=\s*"[^"]*"\s*(,\s*[^,]*?)*)\s*,\s*version\s*=\s*"[^"]*"/\1/g' "$ROOT_TOML"
# Clean up backup
rm -f "${ROOT_TOML}.bak"
echo "Done. Removed version fields from local path dependencies."
+1
View File
@@ -0,0 +1 @@
*.json
View File
+33
View File
@@ -0,0 +1,33 @@
#!/bin/bash
# Find all Cargo.toml files excluding the root,umbrella/Cargo.toml,
# substrate/frame/contracts/fixtures/build/Cargo.toml,
# substrate/frame/contracts/fixtures/contracts/common/Cargo.toml
find . -name "Cargo.toml" \
! -path "./Cargo.toml" \
! -path "./umbrella/Cargo.toml" \
! -path "./substrate/frame/contracts/fixtures/build/Cargo.toml" \
! -path "./substrate/frame/contracts/fixtures/contracts/common/Cargo.toml"| while read -r file; do
echo "Processing $file..."
# Find and replace path dependencies with "workspace = true"
awk '
BEGIN { in_section = 0 }
/^\[dependencies\]/ { in_section = 1; print; next }
/^\[dev-dependencies\]/ { in_section = 2; print; next }
/^\[.*\]/ { in_section = 0; print; next }
{
if (in_section == 1 || in_section == 2) {
if ($0 ~ /path *= *".*"/) {
gsub(/path *= *".*"/, "workspace = true")
}
}
print
}
' "$file" > "${file}.tmp" && mv "${file}.tmp" "$file"
done
echo "All applicable Cargo.toml files updated."
@@ -0,0 +1,10 @@
{# This file uses the Markdown format with additional templating such as this comment. -#}
{# Such a comment will not show up in the rendered release notes. -#}
{# The content of this file (if any) will be inserted at the top of the release notes -#}
{# and generated for each new release candidate. -#}
{# Ensure you leave an empty line at both top and bottom of this file. -#}
<!-- Such a comment will be rendered but remain invisible in the rendered markdown -->
<!-- Edit below this line -->
<!-- Edit above this line -->
@@ -0,0 +1,13 @@
### Changelog for `{{ env.TARGET_AUDIENCE }}`
{{ env.AUDIENCE_DESC }}
{% for file in prdoc -%}
{% for doc_item in file.content.doc %}
{%- if doc_item.audience is containing(env.TARGET_AUDIENCE) %}
#### [#{{file.doc_filename.number}}]: {{ file.content.title }}
{{ doc_item.description }}
{% endif -%}
{%- endfor %}
{%- endfor %}
@@ -0,0 +1,7 @@
## Changelog for `{{ env.PRODUCT | capitalize }} {{ env.VERSION }}`
{% for file in prdoc | sort(attribute="doc_filename.number") -%}
{%- set author= file.content.author | default(value="n/a") -%}
{%- set topic= file.content.topic | default(value="n/a") -%}
- #{{file.doc_filename.number}}: {{ file.content.title }} (@{{ author }}) [{{ topic | capitalize }}]
{% endfor -%}
@@ -0,0 +1,4 @@
{# This include generates the section showing the changes #}
## Changelog
{% include "changelog.md" -%}
@@ -0,0 +1,6 @@
## Rust compiler versions
This release was built and tested against the following versions of `rustc`.
Other versions may work.
- Rust Stable: `{{ env.RUSTC_STABLE }}`
@@ -0,0 +1,19 @@
## Docker images
The docker images for the `polkadot` node binary and the `polkadot-parachain` binary can be found at Docker hub (will be available a few minutes after the release has been published):
- [Polkadot image](https://hub.docker.com/r/parity/polkadot/tags?page=1&ordering=last_updated)
- [Polkadot-Parachain image](https://hub.docker.com/r/parity/polkadot-parachain/tags?page=1&ordering=last_updated)
You may also pull it with:
```
docker pull parity/polkadot:{{ env.VERSION }}
```
or
```
docker pull parity/polkadot-parachain:{{ env.VERSION }}
```
+26
View File
@@ -0,0 +1,26 @@
{# This macro shows one runtime #}
{%- macro runtime(runtime) -%}
### {{ runtime.name | title }}
{%- if runtime.data.runtimes.compressed.subwasm.compression.compressed %}
{%- set compressed = "Yes" %}
{%- else %}
{%- set compressed = "No" %}
{%- endif %}
{%- set comp_ratio = 100 - (runtime.data.runtimes.compressed.subwasm.compression.size_compressed /
runtime.data.runtimes.compressed.subwasm.compression.size_decompressed *100) %}
```
🏋️ Runtime Size: {{ runtime.data.runtimes.compressed.subwasm.size | filesizeformat }} ({{
runtime.data.runtimes.compressed.subwasm.size }} bytes)
🔥 Core Version: {{ runtime.data.runtimes.compressed.subwasm.core_version.specName }}-{{runtime.data.runtimes.compressed.subwasm.core_version.specVersion }} ({{runtime.data.runtimes.compressed.subwasm.core_version.implName }}-{{runtime.data.runtimes.compressed.subwasm.core_version.implVersion }}.tx{{runtime.data.runtimes.compressed.subwasm.core_version.transactionVersion }}.au{{runtime.data.runtimes.compressed.subwasm.core_version.authoringVersion }})
🗜 Compressed: {{ compressed }}: {{ comp_ratio | round(method="ceil", precision=2) }}%
🎁 Metadata version: V{{ runtime.data.runtimes.compressed.subwasm.metadata_version }}
🗳️ system.setCode hash: {{ runtime.data.runtimes.compressed.subwasm.proposal_hash }}
🗳️ authorizeUpgrade hash: {{ runtime.data.runtimes.compressed.subwasm.parachain_authorize_upgrade_hash }}
🗳️ Blake2-256 hash: {{ runtime.data.runtimes.compressed.subwasm.blake2_256 }}
📦 IPFS: {{ runtime.data.runtimes.compressed.subwasm.ipfs_hash }}
```
{%- endmacro runtime %}
@@ -0,0 +1,19 @@
{# This include shows the list and details of the runtimes #}
{%- import "runtime.md.tera" as m_r -%}
{# --- #}
## Runtimes
{% set rtm = srtool[0] -%}
The information about the runtimes included in this release can be found below.
The runtimes have been built using [{{ rtm.data.gen }}](https://github.com/paritytech/srtool) and `{{ rtm.data.rustc }}`.
{%- for runtime in srtool | sort(attribute="name") %}
{%- set HIDE_VAR = "HIDE_SRTOOL_" ~ runtime.name | upper %}
{%- if not env is containing(HIDE_VAR) %}
{{ m_r::runtime(runtime=runtime) }}
{%- endif %}
{%- endfor %}
@@ -0,0 +1,19 @@
{# This is the entry point of the template -#}
This release contains the changes from `{{ env.REF1 | replace(from="refs/tags/", to="") }}` to `{{ env.REF2 | replace(from="refs/tags/", to="") }}`.
{# -- Manual free notes section -- #}
{% include "_free_notes.md.tera" -%}
{# -- Automatic section -- #}
{% include "changes.md.tera" -%}
{% include "compiler.md.tera" -%}
{% if env.NO_RUNTIMES == "false" and env.CRATES_ONLY == "false" -%}
{% include "runtimes.md.tera" -%}
{% endif -%}
{% if env.CRATES_ONLY == "false" -%}
{% include "docker_image.md.tera" -%}
{% endif -%}