Skip to content

Commit

Permalink
Merge branch 'master' into pkhry/backressure_chainhead_follow
Browse files Browse the repository at this point in the history
  • Loading branch information
pkhry authored Oct 18, 2024
2 parents 634e355 + 7240b47 commit f4dba4e
Show file tree
Hide file tree
Showing 29 changed files with 452 additions and 62 deletions.
10 changes: 3 additions & 7 deletions .github/scripts/common/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -405,14 +405,10 @@ function find_runtimes() {
# output: none
filter_version_from_input() {
version=$1
regex="(^v[0-9]+\.[0-9]+\.[0-9]+)$|(^v[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+)$"
regex="^(v)?[0-9]+\.[0-9]+\.[0-9]+(-rc[0-9]+)?$"

if [[ $version =~ $regex ]]; then
if [ -n "${BASH_REMATCH[1]}" ]; then
echo "${BASH_REMATCH[1]}"
elif [ -n "${BASH_REMATCH[2]}" ]; then
echo "${BASH_REMATCH[2]}"
fi
echo $version
else
echo "Invalid version: $version"
exit 1
Expand Down Expand Up @@ -462,7 +458,7 @@ function get_polkadot_node_version_from_code() {

validate_stable_tag() {
tag="$1"
pattern="^stable[0-9]{4}(-[0-9]+)?(-rc[0-9]+)?$"
pattern="^(polkadot-)?stable[0-9]{4}(-[0-9]+)?(-rc[0-9]+)?$"

if [[ $tag =~ $pattern ]]; then
echo $tag
Expand Down
4 changes: 3 additions & 1 deletion .github/scripts/generate-prdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,16 @@ def setup_parser(parser=None, pr_required=True):
return parser

def snake_to_title(s):
return ' '.join(word.capitalize() for word in s.split('_'))
return ' '.join(word.capitalize() for word in s.split('_'))

def main(args):
print(f"Args: {args}, force: {args.force}")
setup_yaml()
try:
# Convert snake_case audience arguments to title case
mapped_audiences = [snake_to_title(a) for a in args.audience]
if len(mapped_audiences) == 1:
mapped_audiences = mapped_audiences[0]
from_pr_number(args.pr, mapped_audiences, args.bump, args.force)
return 0
except Exception as e:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-10_rc-automation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
workflow_dispatch:
inputs:
version:
description: Current release/rc version in format vX.X.X
description: Current release/rc version in format polkadot-stableYYMM

jobs:
tag_rc:
Expand Down Expand Up @@ -41,7 +41,7 @@ jobs:
if [[ -z "${{ inputs.version }}" ]]; then
version=v$(get_polkadot_node_version_from_code)
else
version=$(filter_version_from_input ${{ inputs.version }})
version=$(validate_stable_tag ${{ inputs.version }})
fi
echo "$version"
echo "version=$version" >> $GITHUB_OUTPUT
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/release-30_publish_release_draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
tags:
# Catches v1.2.3 and v1.2.3-rc1
- v[0-9]+.[0-9]+.[0-9]+*
# - polkadot-stable[0-9]+* Activate when the release process from release org is setteled

workflow_dispatch:
inputs:
Expand All @@ -25,7 +26,7 @@ jobs:
build-runtimes:
uses: "./.github/workflows/release-srtool.yml"
with:
excluded_runtimes: "substrate-test bp cumulus-test kitchensink minimal-template parachain-template penpal polkadot-test seedling shell frame-try sp solochain-template"
excluded_runtimes: "asset-hub-rococo bridge-hub-rococo contracts-rococo coretime-rococo people-rococo rococo rococo-parachain substrate-test bp cumulus-test kitchensink minimal-template parachain-template penpal polkadot-test seedling shell frame-try sp solochain-template"
build_opts: "--features on-chain-release-build"

build-binaries:
Expand Down Expand Up @@ -79,30 +80,27 @@ jobs:
env:
RUSTC_STABLE: ${{ needs.get-rust-versions.outputs.rustc-stable }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ASSET_HUB_ROCOCO_DIGEST: ${{ github.workspace}}/asset-hub-rococo-runtime/asset-hub-rococo-srtool-digest.json
ASSET_HUB_WESTEND_DIGEST: ${{ github.workspace}}/asset-hub-westend-runtime/asset-hub-westend-srtool-digest.json
BRIDGE_HUB_ROCOCO_DIGEST: ${{ github.workspace}}/bridge-hub-rococo-runtime/bridge-hub-rococo-srtool-digest.json
BRIDGE_HUB_WESTEND_DIGEST: ${{ github.workspace}}/bridge-hub-westend-runtime/bridge-hub-westend-srtool-digest.json
COLLECTIVES_WESTEND_DIGEST: ${{ github.workspace}}/collectives-westend-runtime/collectives-westend-srtool-digest.json
CONTRACTS_ROCOCO_DIGEST: ${{ github.workspace}}/contracts-rococo-runtime/contracts-rococo-srtool-digest.json
CORETIME_ROCOCO_DIGEST: ${{ github.workspace}}/coretime-rococo-runtime/coretime-rococo-srtool-digest.json
CORETIME_WESTEND_DIGEST: ${{ github.workspace}}/coretime-westend-runtime/coretime-westend-srtool-digest.json
GLUTTON_WESTEND_DIGEST: ${{ github.workspace}}/glutton-westend-runtime/glutton-westend-srtool-digest.json
PEOPLE_ROCOCO_DIGEST: ${{ github.workspace}}/people-rococo-runtime/people-rococo-srtool-digest.json
PEOPLE_WESTEND_DIGEST: ${{ github.workspace}}/people-westend-runtime/people-westend-srtool-digest.json
ROCOCO_DIGEST: ${{ github.workspace}}/rococo-runtime/rococo-srtool-digest.json
WESTEND_DIGEST: ${{ github.workspace}}/westend-runtime/westend-srtool-digest.json
shell: bash
run: |
. ./.github/scripts/common/lib.sh
export REF1=$(get_latest_release_tag)
if [[ -z "${{ inputs.version }}" ]]; then
export REF2="${{ github.ref_name }}"
echo "REF2: ${REF2}"
else
export REF2="${{ inputs.version }}"
echo "REF2: ${REF2}"
fi
echo "REL_TAG=$REF2" >> $GITHUB_ENV
export VERSION=$(echo "$REF2" | sed -E 's/^v([0-9]+\.[0-9]+\.[0-9]+).*$/\1/')
export VERSION=$(echo "$REF2" | sed -E 's/.*(stable[0-9]+).*$/\1/')
./scripts/release/build-changelogs.sh
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/release-50_publish-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,12 @@ jobs:
run: |
. ./.github/scripts/common/lib.sh
release="${{ needs.validate-inputs.outputs.stable_tag }}" && \
echo "release=${release}" >> $GITHUB_OUTPUT
echo "release=${{ needs.validate-inputs.outputs.stable_tag }}" >> $GITHUB_OUTPUT
commit=$(git rev-parse --short HEAD) && \
echo "commit=${commit}" >> $GITHUB_OUTPUT
tag="${{ needs.validate-inputs.outputs.version }}" && \
echo "tag=${tag}" >> $GITHUB_OUTPUT
echo "tag=${{ needs.validate-inputs.outputs.version }}" >> $GITHUB_OUTPUT
- name: Fetch release tags
working-directory: release-artifacts
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/release-branchoff-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@ on:
type: string

node_version:
description: Version of the polkadot node in the format vX.XX.X (e.g. 1.15.0)
description: Version of the polkadot node in the format X.XX.X (e.g. 1.15.0)
required: true

jobs:
# TODO: Activate this job when the pipeline is moved to the fork in the `paritytech-release` org
# check-workflow-can-run:
# uses: paritytech-release/sync-workflows/.github/workflows/check-syncronization.yml@latest
check-workflow-can-run:
uses: paritytech-release/sync-workflows/.github/workflows/check-syncronization.yml@main


prepare-tooling:
needs: [check-workflow-can-run]
if: needs.check-workflow-can-run.outputs.checks_passed == 'true'
runs-on: ubuntu-latest
outputs:
node_version: ${{ steps.validate_inputs.outputs.node_version }}
Expand All @@ -40,9 +41,7 @@ jobs:
echo "stable_version=${stable_version}" >> $GITHUB_OUTPUT
create-stable-branch:
# needs: [check-workflow-can-run, prepare-tooling]
needs: [prepare-tooling]
# if: needs. check-workflow-can-run.outputs.checks_passed == 'true'
runs-on: ubuntu-latest

env:
Expand Down Expand Up @@ -100,6 +99,6 @@ jobs:
# Set new version for polkadot-parachain binary to match the polkadot node binary
# set_polkadot_parachain_binary_version $NODE_VERSION "cumulus/polkadot-parachain/Cargo.toml"
reorder_prdocs $NODE_VERSION
reorder_prdocs $STABLE_BRANCH_NAME
git push origin "$STABLE_BRANCH_NAME"
2 changes: 1 addition & 1 deletion .github/workflows/release-reusable-rc-buid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ jobs:
needs: [build-rc]
uses: ./.github/workflows/release-reusable-s3-upload.yml
with:
package: ${{ inputs.binary }}
package: polkadot-parachain
release_tag: ${{ inputs.release_tag }}
secrets:
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/release-srtool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ jobs:
sudo dpkg -i toml.deb
toml --version; jq --version
- name: Scan runtimes
- name: Scan and get runtimes list
id: get_runtimes_list
env:
EXCLUDED_RUNTIMES: ${{ inputs.excluded_runtimes }}:"substrate-test"
run: |
Expand All @@ -51,13 +52,6 @@ jobs:
MATRIX=$(find_runtimes | tee runtimes_list.json)
echo $MATRIX
- name: Get runtimes list
id: get_runtimes_list
run: |
ls -al
MATRIX=$(cat runtimes_list.json)
echo $MATRIX
echo "runtime=$MATRIX" >> $GITHUB_OUTPUT
srtool:
Expand Down
13 changes: 12 additions & 1 deletion cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ use xcm::latest::prelude::{
};
use xcm::{
latest::prelude::{AssetId, BodyId},
VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm,
VersionedAsset, VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm,
};
use xcm_runtime_apis::{
dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects},
Expand Down Expand Up @@ -1098,6 +1098,8 @@ pub type Executive = frame_executive::Executive<
Migrations,
>;

type XcmTrustedQueryResult = Result<bool, xcm_runtime_apis::trusted_query::Error>;

#[cfg(feature = "runtime-benchmarks")]
mod benches {
frame_benchmarking::define_benchmarks!(
Expand Down Expand Up @@ -1798,6 +1800,15 @@ impl_runtime_apis! {
genesis_config_presets::preset_names()
}
}

impl xcm_runtime_apis::trusted_query::TrustedQueryApi<Block> for Runtime {
fn is_trusted_reserve(asset: VersionedAsset, location: VersionedLocation) -> XcmTrustedQueryResult {
PolkadotXcm::is_trusted_reserve(asset, location)
}
fn is_trusted_teleporter(asset: VersionedAsset, location: VersionedLocation) -> XcmTrustedQueryResult {
PolkadotXcm::is_trusted_teleporter(asset, location)
}
}
}

cumulus_pallet_parachain_system::register_validate_block! {
Expand Down
11 changes: 10 additions & 1 deletion cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ use assets_common::{
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
use xcm::{
latest::prelude::AssetId,
prelude::{VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm},
prelude::{VersionedAsset, VersionedAssetId, VersionedAssets, VersionedLocation, VersionedXcm},
};

#[cfg(feature = "runtime-benchmarks")]
Expand Down Expand Up @@ -1894,6 +1894,15 @@ impl_runtime_apis! {
genesis_config_presets::preset_names()
}
}

impl xcm_runtime_apis::trusted_query::TrustedQueryApi<Block> for Runtime {
fn is_trusted_reserve(asset: VersionedAsset, location: VersionedLocation) -> Result<bool, xcm_runtime_apis::trusted_query::Error> {
PolkadotXcm::is_trusted_reserve(asset, location)
}
fn is_trusted_teleporter(asset: VersionedAsset, location: VersionedLocation) -> Result<bool, xcm_runtime_apis::trusted_query::Error> {
PolkadotXcm::is_trusted_teleporter(asset, location)
}
}
}

cumulus_pallet_parachain_system::register_validate_block! {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1521,6 +1521,15 @@ impl_runtime_apis! {
genesis_config_presets::preset_names()
}
}

impl xcm_runtime_apis::trusted_query::TrustedQueryApi<Block> for Runtime {
fn is_trusted_reserve(asset: VersionedAsset, location: VersionedLocation) -> Result<bool, xcm_runtime_apis::trusted_query::Error> {
PolkadotXcm::is_trusted_reserve(asset, location)
}
fn is_trusted_teleporter(asset: VersionedAsset, location: VersionedLocation) -> Result<bool, xcm_runtime_apis::trusted_query::Error> {
PolkadotXcm::is_trusted_teleporter(asset, location)
}
}
}

#[cfg(test)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1337,6 +1337,15 @@ impl_runtime_apis! {
genesis_config_presets::preset_names()
}
}

impl xcm_runtime_apis::trusted_query::TrustedQueryApi<Block> for Runtime {
fn is_trusted_reserve(asset: VersionedAsset, location: VersionedLocation) -> Result<bool, xcm_runtime_apis::trusted_query::Error> {
PolkadotXcm::is_trusted_reserve(asset, location)
}
fn is_trusted_teleporter(asset: VersionedAsset, location: VersionedLocation) -> Result<bool, xcm_runtime_apis::trusted_query::Error> {
PolkadotXcm::is_trusted_teleporter(asset, location)
}
}
}

cumulus_pallet_parachain_system::register_validate_block! {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1165,6 +1165,15 @@ impl_runtime_apis! {
genesis_config_presets::preset_names()
}
}

impl xcm_runtime_apis::trusted_query::TrustedQueryApi<Block> for Runtime {
fn is_trusted_reserve(asset: VersionedAsset, location: VersionedLocation) -> Result<bool, xcm_runtime_apis::trusted_query::Error> {
PolkadotXcm::is_trusted_reserve(asset, location)
}
fn is_trusted_teleporter(asset: VersionedAsset, location: VersionedLocation) -> Result<bool, xcm_runtime_apis::trusted_query::Error> {
PolkadotXcm::is_trusted_teleporter(asset, location)
}
}
}

cumulus_pallet_parachain_system::register_validate_block! {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,15 @@ impl_runtime_apis! {
vec![]
}
}

impl xcm_runtime_apis::trusted_query::TrustedQueryApi<Block> for Runtime {
fn is_trusted_reserve(asset: VersionedAsset, location: VersionedLocation) -> Result<bool, xcm_runtime_apis::trusted_query::Error> {
PolkadotXcm::is_trusted_reserve(asset, location)
}
fn is_trusted_teleporter(asset: VersionedAsset, location: VersionedLocation) -> Result<bool, xcm_runtime_apis::trusted_query::Error> {
PolkadotXcm::is_trusted_teleporter(asset, location)
}
}
}

cumulus_pallet_parachain_system::register_validate_block! {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,15 @@ impl_runtime_apis! {
vec![]
}
}

impl xcm_runtime_apis::trusted_query::TrustedQueryApi<Block> for Runtime {
fn is_trusted_reserve(asset: VersionedAsset, location: VersionedLocation) -> Result<bool, xcm_runtime_apis::trusted_query::Error> {
PolkadotXcm::is_trusted_reserve(asset, location)
}
fn is_trusted_teleporter(asset: VersionedAsset, location: VersionedLocation) -> Result<bool, xcm_runtime_apis::trusted_query::Error> {
PolkadotXcm::is_trusted_teleporter(asset, location)
}
}
}

cumulus_pallet_parachain_system::register_validate_block! {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,15 @@ impl_runtime_apis! {
vec![]
}
}

impl xcm_runtime_apis::trusted_query::TrustedQueryApi<Block> for Runtime {
fn is_trusted_reserve(asset: VersionedAsset, location: VersionedLocation) -> Result<bool, xcm_runtime_apis::trusted_query::Error> {
PolkadotXcm::is_trusted_reserve(asset, location)
}
fn is_trusted_teleporter(asset: VersionedAsset, location: VersionedLocation) -> Result<bool, xcm_runtime_apis::trusted_query::Error> {
PolkadotXcm::is_trusted_teleporter(asset, location)
}
}
}

cumulus_pallet_parachain_system::register_validate_block! {
Expand Down
9 changes: 9 additions & 0 deletions cumulus/parachains/runtimes/people/people-rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,15 @@ impl_runtime_apis! {
vec![]
}
}

impl xcm_runtime_apis::trusted_query::TrustedQueryApi<Block> for Runtime {
fn is_trusted_reserve(asset: VersionedAsset, location: VersionedLocation) -> Result<bool, xcm_runtime_apis::trusted_query::Error> {
PolkadotXcm::is_trusted_reserve(asset, location)
}
fn is_trusted_teleporter(asset: VersionedAsset, location: VersionedLocation) -> Result<bool, xcm_runtime_apis::trusted_query::Error> {
PolkadotXcm::is_trusted_teleporter(asset, location)
}
}
}

cumulus_pallet_parachain_system::register_validate_block! {
Expand Down
9 changes: 9 additions & 0 deletions cumulus/parachains/runtimes/people/people-westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,15 @@ impl_runtime_apis! {
vec![]
}
}

impl xcm_runtime_apis::trusted_query::TrustedQueryApi<Block> for Runtime {
fn is_trusted_reserve(asset: VersionedAsset, location: VersionedLocation) -> Result<bool, xcm_runtime_apis::trusted_query::Error> {
PolkadotXcm::is_trusted_reserve(asset, location)
}
fn is_trusted_teleporter(asset: VersionedAsset, location: VersionedLocation) -> Result<bool, xcm_runtime_apis::trusted_query::Error> {
PolkadotXcm::is_trusted_teleporter(asset, location)
}
}
}

cumulus_pallet_parachain_system::register_validate_block! {
Expand Down
Loading

0 comments on commit f4dba4e

Please sign in to comment.