diff --git a/.github/scripts/check-workspace.py b/.github/scripts/check-workspace.py
index d200122fee9f..1f8f103e4e15 100644
--- a/.github/scripts/check-workspace.py
+++ b/.github/scripts/check-workspace.py
@@ -18,7 +18,7 @@ def parse_args():
parser.add_argument('workspace_dir', help='The directory to check', metavar='workspace_dir', type=str, nargs=1)
parser.add_argument('--exclude', help='Exclude crate paths from the check', metavar='exclude', type=str, nargs='*', default=[])
-
+
args = parser.parse_args()
return (args.workspace_dir[0], args.exclude)
@@ -26,7 +26,7 @@ def main(root, exclude):
workspace_crates = get_members(root, exclude)
all_crates = get_crates(root, exclude)
print(f'📦 Found {len(all_crates)} crates in total')
-
+
check_duplicates(workspace_crates)
check_missing(workspace_crates, all_crates)
check_links(all_crates)
@@ -48,14 +48,14 @@ def get_members(workspace_dir, exclude):
if not 'members' in root_manifest['workspace']:
return []
-
+
members = []
for member in root_manifest['workspace']['members']:
if member in exclude:
print(f'❌ Excluded member should not appear in the workspace {member}')
sys.exit(1)
members.append(member)
-
+
return members
# List all members of the workspace.
@@ -74,12 +74,12 @@ def get_crates(workspace_dir, exclude_crates) -> dict:
with open(path, "r") as f:
content = f.read()
manifest = toml.loads(content)
-
+
if 'workspace' in manifest:
if root != workspace_dir:
print("⏩ Excluded recursive workspace at %s" % path)
continue
-
+
# Cut off the root path and the trailing /Cargo.toml.
path = path[len(workspace_dir)+1:-11]
name = manifest['package']['name']
@@ -87,7 +87,7 @@ def get_crates(workspace_dir, exclude_crates) -> dict:
print("⏩ Excluded crate %s at %s" % (name, path))
continue
crates[name] = (path, manifest)
-
+
return crates
# Check that there are no duplicate entries in the workspace.
@@ -138,23 +138,23 @@ def check_deps(deps):
if not 'path' in deps[dep]:
broken.append((name, dep_name, "crate must be linked via `path`"))
return
-
+
def check_crate(deps):
to_checks = ['dependencies', 'dev-dependencies', 'build-dependencies']
for to_check in to_checks:
if to_check in deps:
check_deps(deps[to_check])
-
+
# There could possibly target dependant deps:
if 'target' in manifest:
# Target dependant deps can only have one level of nesting:
for _, target in manifest['target'].items():
check_crate(target)
-
+
check_crate(manifest)
-
+
links.sort()
broken.sort()
diff --git a/.github/scripts/common/lib.sh b/.github/scripts/common/lib.sh
index bd12d9c6e6ff..29dc269ffd23 100755
--- a/.github/scripts/common/lib.sh
+++ b/.github/scripts/common/lib.sh
@@ -237,6 +237,61 @@ fetch_release_artifacts() {
popd > /dev/null
}
+# Fetch the release artifacts like binary and sigantures from S3. Assumes the ENV are set:
+# - RELEASE_ID
+# - GITHUB_TOKEN
+# - REPO in the form paritytech/polkadot
+fetch_release_artifacts_from_s3() {
+ echo "Version : $VERSION"
+ echo "Repo : $REPO"
+ echo "Binary : $BINARY"
+ OUTPUT_DIR=${OUTPUT_DIR:-"./release-artifacts/${BINARY}"}
+ echo "OUTPUT_DIR : $OUTPUT_DIR"
+
+ URL_BASE=$(get_s3_url_base $BINARY)
+ echo "URL_BASE=$URL_BASE"
+
+ URL_BINARY=$URL_BASE/$VERSION/$BINARY
+ URL_SHA=$URL_BASE/$VERSION/$BINARY.sha256
+ URL_ASC=$URL_BASE/$VERSION/$BINARY.asc
+
+ # Fetch artifacts
+ mkdir -p "$OUTPUT_DIR"
+ pushd "$OUTPUT_DIR" > /dev/null
+
+ echo "Fetching artifacts..."
+ for URL in $URL_BINARY $URL_SHA $URL_ASC; do
+ echo "Fetching %s" "$URL"
+ curl --progress-bar -LO "$URL" || echo "Missing $URL"
+ done
+
+ pwd
+ ls -al --color
+ popd > /dev/null
+
+}
+
+# Pass the name of the binary as input, it will
+# return the s3 base url
+function get_s3_url_base() {
+ name=$1
+ case $name in
+ polkadot | polkadot-execute-worker | polkadot-prepare-worker | staking-miner)
+ printf "https://releases.parity.io/polkadot"
+ ;;
+
+ polkadot-parachain)
+ printf "https://releases.parity.io/cumulus"
+ ;;
+
+ *)
+ printf "UNSUPPORTED BINARY $name"
+ exit 1
+ ;;
+ esac
+}
+
+
# Check the checksum for a given binary
function check_sha256() {
echo "Checking SHA256 for $1"
@@ -248,13 +303,11 @@ function check_sha256() {
function import_gpg_keys() {
GPG_KEYSERVER=${GPG_KEYSERVER:-"keyserver.ubuntu.com"}
SEC="9D4B2B6EB8F97156D19669A9FF0812D491B96798"
- WILL="2835EAF92072BC01D188AF2C4A092B93E97CE1E2"
EGOR="E6FC4D4782EB0FA64A4903CCDB7D3555DD3932D3"
- MARA="533C920F40E73A21EEB7E9EBF27AEA7E7594C9CF"
MORGAN="2E92A9D8B15D7891363D1AE8AF9E6C43F7F8C4CF"
echo "Importing GPG keys from $GPG_KEYSERVER in parallel"
- for key in $SEC $WILL $EGOR $MARA $MORGAN; do
+ for key in $SEC $EGOR $MORGAN; do
(
echo "Importing GPG key $key"
gpg --no-tty --quiet --keyserver $GPG_KEYSERVER --recv-keys $key
@@ -344,3 +397,40 @@ function find_runtimes() {
done
echo $JSON
}
+
+# Filter the version matches the particular pattern and return it.
+# input: version (v1.8.0 or v1.8.0-rc1)
+# 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]+)$"
+
+ 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
+ else
+ echo "Invalid version: $version"
+ exit 1
+ fi
+
+}
+
+# Check if the release_id is valid number
+# input: release_id
+# output: release_id or exit 1
+check_release_id() {
+ input=$1
+
+ release_id=$(echo "$input" | sed 's/[^0-9]//g')
+
+ if [[ $release_id =~ ^[0-9]+$ ]]; then
+ echo "$release_id"
+ else
+ echo "Invalid release_id from input: $input"
+ exit 1
+ fi
+
+}
diff --git a/.github/workflows/check-licenses.yml b/.github/workflows/check-licenses.yml
index e1e92d288cea..c32b6fcf89e0 100644
--- a/.github/workflows/check-licenses.yml
+++ b/.github/workflows/check-licenses.yml
@@ -42,5 +42,4 @@ jobs:
shopt -s globstar
npx @paritytech/license-scanner scan \
--ensure-licenses ${{ env.LICENSES }} \
- --exclude ./substrate/bin/node-template \
-- ./substrate/**/*.rs
diff --git a/.github/workflows/release-50_publish-docker.yml b/.github/workflows/release-50_publish-docker.yml
index ecbac01cd3a5..67e93ee96574 100644
--- a/.github/workflows/release-50_publish-docker.yml
+++ b/.github/workflows/release-50_publish-docker.yml
@@ -36,7 +36,7 @@ on:
-H "Authorization: Bearer ${GITHUB_TOKEN}" https://api.github.com/repos/$OWNER/$REPO/releases | \
jq '.[] | { name: .name, id: .id }'
required: true
- type: string
+ type: number
registry:
description: Container registry
@@ -61,7 +61,6 @@ permissions:
contents: write
env:
- RELEASE_ID: ${{ inputs.release_id }}
ENGINE: docker
REGISTRY: ${{ inputs.registry }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -71,6 +70,7 @@ env:
# EVENT_ACTION: ${{ github.event.action }}
EVENT_NAME: ${{ github.event_name }}
IMAGE_TYPE: ${{ inputs.image_type }}
+ VERSION: ${{ inputs.version }}
jobs:
fetch-artifacts: # this job will be triggered for the polkadot-parachain rc and release or polkadot rc image build
@@ -95,13 +95,16 @@ jobs:
# chmod a+x $BINARY
# ls -al
- - name: Fetch rc artifacts or release artifacts based on release id
+ - name: Fetch rc artifacts or release artifacts from s3 based on version
#this step runs only if the workflow is triggered manually
if: ${{ env.EVENT_NAME == 'workflow_dispatch' }}
run: |
. ./.github/scripts/common/lib.sh
- fetch_release_artifacts
+ VERSION=$(filter_version_from_input "${{ inputs.version }}")
+ echo "VERSION=${VERSION}" >> $GITHUB_ENV
+
+ fetch_release_artifacts_from_s3
- name: Cache the artifacts
uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.3
@@ -147,7 +150,10 @@ jobs:
if: ${{ env.IMAGE_TYPE == 'rc' }}
id: fetch_rc_refs
run: |
- release=release-${{ inputs.release_id }} && \
+ . ./.github/scripts/common/lib.sh
+
+ RELEASE_ID=$(check_release_id "${{ inputs.release_id }}")
+ release=release-$RELEASE_ID && \
echo "release=${release}" >> $GITHUB_OUTPUT
commit=$(git rev-parse --short HEAD) && \
diff --git a/.github/workflows/release-99_notif-published.yml b/.github/workflows/release-99_notif-published.yml
index 732db15d9c0c..05c9d6a47f55 100644
--- a/.github/workflows/release-99_notif-published.yml
+++ b/.github/workflows/release-99_notif-published.yml
@@ -16,12 +16,6 @@ jobs:
- name: "RelEng: Polkadot Release Coordination"
room: '!cqAmzdIcbOFwrdrubV:parity.io'
pre-release: true
- - name: 'General: Rust, Polkadot, Substrate'
- room: '!aJymqQYtCjjqImFLSb:parity.io'
- pre-release: false
- - name: 'Team: DevOps'
- room: '!lUslSijLMgNcEKcAiE:parity.io'
- pre-release: true
# External
- name: 'Ledger <> Polkadot Coordination'
@@ -48,7 +42,9 @@ jobs:
access_token: ${{ secrets.RELEASENOTES_MATRIX_V2_ACCESS_TOKEN }}
server: m.parity.io
message: |
- A (pre)release has been ${{github.event.action}} in **${{github.event.repository.full_name}}:**
+ @room
+
+ A new node release has been ${{github.event.action}} in **${{github.event.repository.full_name}}:**
Release version: [${{github.event.release.tag_name}}](${{github.event.release.html_url}})
-----
diff --git a/.gitlab/pipeline/build.yml b/.gitlab/pipeline/build.yml
index 423587c1fb57..f8de61355725 100644
--- a/.gitlab/pipeline/build.yml
+++ b/.gitlab/pipeline/build.yml
@@ -337,7 +337,7 @@ build-runtimes-polkavm:
- .common-refs
- .run-immediately
script:
- - SUBSTRATE_RUNTIME_TARGET=riscv cargo check -p minimal-runtime
+ - SUBSTRATE_RUNTIME_TARGET=riscv cargo check -p minimal-template-runtime
- SUBSTRATE_RUNTIME_TARGET=riscv cargo check -p westend-runtime
- SUBSTRATE_RUNTIME_TARGET=riscv cargo check -p rococo-runtime
- SUBSTRATE_RUNTIME_TARGET=riscv cargo check -p polkadot-test-runtime
diff --git a/.gitlab/pipeline/check.yml b/.gitlab/pipeline/check.yml
index 4d71a473372d..52da33550508 100644
--- a/.gitlab/pipeline/check.yml
+++ b/.gitlab/pipeline/check.yml
@@ -259,3 +259,19 @@ find-fail-ci-phrase:
echo "No $ASSERT_REGEX was found, exiting with 0";
exit 0;
fi
+
+check-core-crypto-features:
+ stage: check
+ extends:
+ - .docker-env
+ - .common-refs
+ script:
+ - pushd substrate/primitives/core
+ - ./check-features-variants.sh
+ - popd
+ - pushd substrate/primitives/application-crypto
+ - ./check-features-variants.sh
+ - popd
+ - pushd substrate/primitives/keyring
+ - ./check-features-variants.sh
+ - popd
diff --git a/.gitlab/pipeline/test.yml b/.gitlab/pipeline/test.yml
index 5c41a3e6e08f..26e55e9385f3 100644
--- a/.gitlab/pipeline/test.yml
+++ b/.gitlab/pipeline/test.yml
@@ -494,3 +494,15 @@ test-syscalls:
printf "The x86_64 syscalls used by the worker binaries have changed. Please review if this is expected and update polkadot/scripts/list-syscalls/*-worker-syscalls as needed.\n";
fi
allow_failure: false # this rarely triggers in practice
+
+subsystem-regression-tests:
+ stage: test
+ extends:
+ - .docker-env
+ - .common-refs
+ - .run-immediately
+ script:
+ - cargo test --profile=testnet -p polkadot-availability-recovery --test availability-recovery-regression-bench --features subsystem-benchmarks
+ tags:
+ - benchmark
+ allow_failure: true
diff --git a/Cargo.lock b/Cargo.lock
index ad218001b40f..699fd35a8246 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -744,12 +744,6 @@ dependencies = [
"nodrop",
]
-[[package]]
-name = "arrayvec"
-version = "0.5.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
-
[[package]]
name = "arrayvec"
version = "0.7.4"
@@ -847,6 +841,7 @@ dependencies = [
"pallet-xcm",
"parachains-common",
"parity-scale-codec",
+ "penpal-runtime",
"rococo-runtime",
"rococo-system-emulated-network",
"sp-runtime",
@@ -968,6 +963,7 @@ dependencies = [
"pallet-xcm",
"parachains-common",
"parity-scale-codec",
+ "penpal-runtime",
"polkadot-runtime-common",
"sp-runtime",
"staging-xcm",
@@ -1334,7 +1330,7 @@ dependencies = [
"ark-std 0.4.0",
"dleq_vrf",
"fflonk",
- "merlin 3.0.0",
+ "merlin",
"rand_chacha 0.3.1",
"rand_core 0.6.4",
"ring 0.1.0",
@@ -1440,9 +1436,7 @@ version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93f2635620bf0b9d4576eb7bb9a38a55df78bd1205d26fa994b25911a69f212f"
dependencies = [
- "bitcoin_hashes",
- "rand",
- "rand_core 0.6.4",
+ "bitcoin_hashes 0.11.0",
"serde",
"unicode-normalization",
]
@@ -1462,12 +1456,28 @@ version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"
+[[package]]
+name = "bitcoin-internals"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9425c3bf7089c983facbae04de54513cce73b41c7f9ff8c845b54e7bc64ebbfb"
+
[[package]]
name = "bitcoin_hashes"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90064b8dee6815a6470d60bad07bbbaee885c0e12d04177138fa3291a01b7bc4"
+[[package]]
+name = "bitcoin_hashes"
+version = "0.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1930a4dabfebb8d7d9992db18ebe3ae2876f0a305fab206fd168df931ede293b"
+dependencies = [
+ "bitcoin-internals",
+ "hex-conservative",
+]
+
[[package]]
name = "bitflags"
version = "1.3.2"
@@ -1559,18 +1569,6 @@ dependencies = [
"constant_time_eq 0.3.0",
]
-[[package]]
-name = "block-buffer"
-version = "0.7.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b"
-dependencies = [
- "block-padding",
- "byte-tools",
- "byteorder",
- "generic-array 0.12.4",
-]
-
[[package]]
name = "block-buffer"
version = "0.9.0"
@@ -1589,15 +1587,6 @@ dependencies = [
"generic-array 0.14.7",
]
-[[package]]
-name = "block-padding"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5"
-dependencies = [
- "byte-tools",
-]
-
[[package]]
name = "blocking"
version = "1.3.1"
@@ -2634,9 +2623,9 @@ dependencies = [
[[package]]
name = "clap-num"
-version = "1.0.2"
+version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "488557e97528174edaa2ee268b23a809e0c598213a4bbcb4f34575a46fda147e"
+checksum = "0e063d263364859dc54fb064cedb7c122740cd4733644b14b176c097f51e8ab7"
dependencies = [
"num-traits",
]
@@ -2854,11 +2843,10 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
[[package]]
name = "colored"
-version = "2.0.4"
+version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6"
+checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8"
dependencies = [
- "is-terminal",
"lazy_static",
"windows-sys 0.48.0",
]
@@ -2886,7 +2874,7 @@ dependencies = [
"ark-std 0.4.0",
"fflonk",
"getrandom_or_panic",
- "merlin 3.0.0",
+ "merlin",
"rand_chacha 0.3.1",
]
@@ -3526,16 +3514,6 @@ dependencies = [
"subtle 2.5.0",
]
-[[package]]
-name = "crypto-mac"
-version = "0.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "25fab6889090c8133f3deb8f73ba3c65a7f456f66436fc012a1b1e272b1e103e"
-dependencies = [
- "generic-array 0.14.7",
- "subtle 2.5.0",
-]
-
[[package]]
name = "ctr"
version = "0.7.0"
@@ -4394,19 +4372,6 @@ dependencies = [
"url",
]
-[[package]]
-name = "curve25519-dalek"
-version = "2.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4a9b85542f99a2dfa2a1b8e192662741c9859a846b296bef1c92ef9b58b5a216"
-dependencies = [
- "byteorder",
- "digest 0.8.1",
- "rand_core 0.5.1",
- "subtle 2.5.0",
- "zeroize",
-]
-
[[package]]
name = "curve25519-dalek"
version = "3.2.0"
@@ -4864,6 +4829,7 @@ dependencies = [
"digest 0.10.7",
"elliptic-curve",
"rfc6979",
+ "serdect",
"signature",
"spki",
]
@@ -4930,9 +4896,9 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
[[package]]
name = "elliptic-curve"
-version = "0.13.5"
+version = "0.13.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "968405c8fdc9b3bf4df0a6638858cc0b52462836ab6b1c87377785dd09cf1c0b"
+checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47"
dependencies = [
"base16ct",
"crypto-bigint",
@@ -4943,6 +4909,7 @@ dependencies = [
"pkcs8",
"rand_core 0.6.4",
"sec1",
+ "serdect",
"subtle 2.5.0",
"zeroize",
]
@@ -4966,6 +4933,7 @@ dependencies = [
"parachains-common",
"parity-scale-codec",
"paste",
+ "polkadot-parachain-primitives",
"polkadot-primitives",
"polkadot-runtime-parachains",
"sc-consensus-grandpa",
@@ -5236,12 +5204,6 @@ dependencies = [
"once_cell",
]
-[[package]]
-name = "fake-simd"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
-
[[package]]
name = "fallible-iterator"
version = "0.2.0"
@@ -5351,7 +5313,7 @@ dependencies = [
"ark-poly",
"ark-serialize 0.4.2",
"ark-std 0.4.0",
- "merlin 3.0.0",
+ "merlin",
]
[[package]]
@@ -6309,9 +6271,9 @@ checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7"
[[package]]
name = "handlebars"
-version = "4.3.7"
+version = "5.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "83c3372087601b532857d332f5957cbae686da52bb7810bf038c3e3c3cc2fa0d"
+checksum = "ab283476b99e66691dee3f1640fea91487a8d81f50fb5ecc75538f8f8879a1e4"
dependencies = [
"log",
"pest",
@@ -6401,6 +6363,12 @@ version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
+[[package]]
+name = "hex-conservative"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "30ed443af458ccb6d81c1e7e661545f94d3176752fb1df2f543b902a1e0f51e2"
+
[[package]]
name = "hex-literal"
version = "0.4.1"
@@ -6426,16 +6394,6 @@ dependencies = [
"digest 0.9.0",
]
-[[package]]
-name = "hmac"
-version = "0.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b"
-dependencies = [
- "crypto-mac 0.11.0",
- "digest 0.9.0",
-]
-
[[package]]
name = "hmac"
version = "0.12.1"
@@ -7036,14 +6994,15 @@ dependencies = [
[[package]]
name = "k256"
-version = "0.13.1"
+version = "0.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc"
+checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b"
dependencies = [
"cfg-if",
"ecdsa",
"elliptic-curve",
"once_cell",
+ "serdect",
"sha2 0.10.7",
]
@@ -8122,18 +8081,6 @@ dependencies = [
"hash-db",
]
-[[package]]
-name = "merlin"
-version = "2.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4e261cf0f8b3c42ded9f7d2bb59dea03aa52bc8a1cbc7482f9fc3fd1229d3b42"
-dependencies = [
- "byteorder",
- "keccak",
- "rand_core 0.5.1",
- "zeroize",
-]
-
[[package]]
name = "merlin"
version = "3.0.0"
@@ -8170,15 +8117,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
-name = "minimal-node"
-version = "4.0.0-dev"
+name = "minimal-template-node"
+version = "0.0.0"
dependencies = [
"clap 4.5.1",
"frame",
"futures",
"futures-timer",
"jsonrpsee",
- "minimal-runtime",
+ "minimal-template-runtime",
"sc-basic-authorship",
"sc-cli",
"sc-client-api",
@@ -8205,12 +8152,12 @@ dependencies = [
]
[[package]]
-name = "minimal-runtime"
-version = "0.1.0"
+name = "minimal-template-runtime"
+version = "0.0.0"
dependencies = [
"frame",
- "frame-support",
"pallet-balances",
+ "pallet-minimal-template",
"pallet-sudo",
"pallet-timestamp",
"pallet-transaction-payment",
@@ -8232,9 +8179,9 @@ dependencies = [
[[package]]
name = "mio"
-version = "0.8.8"
+version = "0.8.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2"
+checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c"
dependencies = [
"libc",
"wasi 0.11.0+wasi-snapshot-preview1",
@@ -8724,50 +8671,6 @@ dependencies = [
"kitchensink-runtime",
]
-[[package]]
-name = "node-template"
-version = "4.0.0-dev"
-dependencies = [
- "clap 4.5.1",
- "frame-benchmarking",
- "frame-benchmarking-cli",
- "frame-system",
- "futures",
- "jsonrpsee",
- "node-template-runtime",
- "pallet-transaction-payment",
- "pallet-transaction-payment-rpc",
- "sc-basic-authorship",
- "sc-cli",
- "sc-client-api",
- "sc-consensus",
- "sc-consensus-aura",
- "sc-consensus-grandpa",
- "sc-executor",
- "sc-network",
- "sc-offchain",
- "sc-rpc-api",
- "sc-service",
- "sc-telemetry",
- "sc-transaction-pool",
- "sc-transaction-pool-api",
- "serde_json",
- "sp-api",
- "sp-block-builder",
- "sp-blockchain",
- "sp-consensus-aura",
- "sp-consensus-grandpa",
- "sp-core",
- "sp-inherents",
- "sp-io",
- "sp-keyring",
- "sp-runtime",
- "sp-timestamp",
- "substrate-build-script-utils",
- "substrate-frame-rpc-system",
- "try-runtime-cli",
-]
-
[[package]]
name = "node-template-release"
version = "3.0.0"
@@ -8782,45 +8685,6 @@ dependencies = [
"toml_edit 0.19.15",
]
-[[package]]
-name = "node-template-runtime"
-version = "4.0.0-dev"
-dependencies = [
- "frame-benchmarking",
- "frame-executive",
- "frame-support",
- "frame-system",
- "frame-system-benchmarking",
- "frame-system-rpc-runtime-api",
- "frame-try-runtime",
- "pallet-aura",
- "pallet-balances",
- "pallet-grandpa",
- "pallet-sudo",
- "pallet-template",
- "pallet-timestamp",
- "pallet-transaction-payment",
- "pallet-transaction-payment-rpc-runtime-api",
- "parity-scale-codec",
- "scale-info",
- "serde_json",
- "sp-api",
- "sp-block-builder",
- "sp-consensus-aura",
- "sp-consensus-grandpa",
- "sp-core",
- "sp-genesis-builder",
- "sp-inherents",
- "sp-offchain",
- "sp-runtime",
- "sp-session",
- "sp-std 14.0.0",
- "sp-storage 19.0.0",
- "sp-transaction-pool",
- "sp-version",
- "substrate-wasm-builder",
-]
-
[[package]]
name = "node-testing"
version = "3.0.0-dev"
@@ -9709,12 +9573,11 @@ dependencies = [
"anyhow",
"frame-system",
"parity-wasm",
- "polkavm-linker 0.5.0",
+ "polkavm-linker",
"sp-runtime",
"tempfile",
"toml 0.8.8",
"twox-hash",
- "wat",
]
[[package]]
@@ -9771,7 +9634,7 @@ dependencies = [
"bitflags 1.3.2",
"parity-scale-codec",
"paste",
- "polkavm-derive 0.5.0",
+ "polkavm-derive",
"scale-info",
]
@@ -10299,6 +10162,15 @@ dependencies = [
"sp-version",
]
+[[package]]
+name = "pallet-minimal-template"
+version = "0.0.0"
+dependencies = [
+ "frame",
+ "parity-scale-codec",
+ "scale-info",
+]
+
[[package]]
name = "pallet-mixnet"
version = "0.4.0"
@@ -10600,14 +10472,13 @@ dependencies = [
[[package]]
name = "pallet-parachain-template"
-version = "0.7.0"
+version = "0.0.0"
dependencies = [
"frame-benchmarking",
"frame-support",
"frame-system",
"parity-scale-codec",
"scale-info",
- "serde",
"sp-core",
"sp-io",
"sp-runtime",
@@ -11062,7 +10933,7 @@ dependencies = [
[[package]]
name = "pallet-template"
-version = "4.0.0-dev"
+version = "0.0.0"
dependencies = [
"frame-benchmarking",
"frame-support",
@@ -11072,7 +10943,6 @@ dependencies = [
"sp-core",
"sp-io",
"sp-runtime",
- "sp-std 14.0.0",
]
[[package]]
@@ -11385,7 +11255,7 @@ dependencies = [
[[package]]
name = "parachain-template-node"
-version = "0.1.0"
+version = "0.0.0"
dependencies = [
"clap 4.5.1",
"color-print",
@@ -11443,7 +11313,7 @@ dependencies = [
[[package]]
name = "parachain-template-runtime"
-version = "0.7.0"
+version = "0.0.0"
dependencies = [
"cumulus-pallet-aura-ext",
"cumulus-pallet-parachain-system",
@@ -11560,6 +11430,19 @@ dependencies = [
"substrate-wasm-builder",
]
+[[package]]
+name = "parity-bip39"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4e69bf016dc406eff7d53a7d3f7cf1c2e72c82b9088aac1118591e36dd2cd3e9"
+dependencies = [
+ "bitcoin_hashes 0.13.0",
+ "rand",
+ "rand_core 0.6.4",
+ "serde",
+ "unicode-normalization",
+]
+
[[package]]
name = "parity-bytes"
version = "0.1.2"
@@ -11715,19 +11598,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7924d1d0ad836f665c9065e26d016c673ece3993f30d340068b16f282afc1156"
[[package]]
-name = "paste"
-version = "1.0.14"
+name = "password-hash"
+version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
+checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166"
+dependencies = [
+ "base64ct",
+ "rand_core 0.6.4",
+ "subtle 2.5.0",
+]
[[package]]
-name = "pbkdf2"
-version = "0.8.0"
+name = "paste"
+version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d95f5254224e617595d2cc3cc73ff0a5eaf2637519e25f03388154e9378b6ffa"
-dependencies = [
- "crypto-mac 0.11.0",
-]
+checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
[[package]]
name = "pbkdf2"
@@ -11736,6 +11621,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2"
dependencies = [
"digest 0.10.7",
+ "password-hash",
]
[[package]]
@@ -11762,9 +11648,8 @@ dependencies = [
"frame-support",
"parachains-common",
"penpal-runtime",
- "rococo-emulated-chain",
"sp-core",
- "westend-emulated-chain",
+ "staging-xcm",
]
[[package]]
@@ -11826,7 +11711,6 @@ dependencies = [
"staging-xcm-builder",
"staging-xcm-executor",
"substrate-wasm-builder",
- "testnet-parachains-constants",
]
[[package]]
@@ -12528,7 +12412,7 @@ dependencies = [
"kvdb",
"kvdb-memorydb",
"log",
- "merlin 3.0.0",
+ "merlin",
"parity-scale-codec",
"parking_lot 0.12.1",
"polkadot-node-jaeger",
@@ -13482,6 +13366,7 @@ dependencies = [
"frame-support",
"frame-system",
"kitchensink-runtime",
+ "pallet-assets",
"pallet-aura",
"pallet-authorship",
"pallet-balances",
@@ -13746,7 +13631,7 @@ dependencies = [
"sc-keystore",
"sc-network",
"sc-service",
- "schnorrkel 0.9.1",
+ "schnorrkel 0.11.4",
"serde",
"serde_yaml",
"sha1",
@@ -13952,55 +13837,52 @@ dependencies = [
]
[[package]]
-name = "polkavm-common"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "88b4e215c80fe876147f3d58158d5dfeae7dabdd6047e175af77095b78d0035c"
-
-[[package]]
-name = "polkavm-common"
-version = "0.8.0"
+name = "polkavm"
+version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "92c99f7eee94e7be43ba37eef65ad0ee8cbaf89b7c00001c3f6d2be985cb1817"
+checksum = "8a3693e5efdb2bf74e449cd25fd777a28bd7ed87e41f5d5da75eb31b4de48b94"
+dependencies = [
+ "libc",
+ "log",
+ "polkavm-assembler",
+ "polkavm-common",
+ "polkavm-linux-raw",
+]
[[package]]
-name = "polkavm-derive"
-version = "0.5.0"
+name = "polkavm-assembler"
+version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6380dbe1fb03ecc74ad55d841cfc75480222d153ba69ddcb00977866cbdabdb8"
+checksum = "1fa96d6d868243acc12de813dd48e756cbadcc8e13964c70d272753266deadc1"
dependencies = [
- "polkavm-derive-impl 0.5.0",
- "syn 2.0.50",
+ "log",
]
[[package]]
-name = "polkavm-derive"
-version = "0.8.0"
+name = "polkavm-common"
+version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "79fa916f7962348bd1bb1a65a83401675e6fc86c51a0fdbcf92a3108e58e6125"
+checksum = "1d9428a5cfcc85c5d7b9fc4b6a18c4b802d0173d768182a51cc7751640f08b92"
dependencies = [
- "polkavm-derive-impl-macro",
+ "log",
]
[[package]]
-name = "polkavm-derive-impl"
-version = "0.5.0"
+name = "polkavm-derive"
+version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dc8211b3365bbafb2fb32057d68b0e1ca55d079f5cf6f9da9b98079b94b3987d"
+checksum = "ae8c4bea6f3e11cd89bb18bcdddac10bd9a24015399bd1c485ad68a985a19606"
dependencies = [
- "polkavm-common 0.5.0",
- "proc-macro2",
- "quote",
- "syn 2.0.50",
+ "polkavm-derive-impl-macro",
]
[[package]]
name = "polkavm-derive-impl"
-version = "0.8.0"
+version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c10b2654a8a10a83c260bfb93e97b262cf0017494ab94a65d389e0eda6de6c9c"
+checksum = "5c4fdfc49717fb9a196e74a5d28e0bc764eb394a2c803eb11133a31ac996c60c"
dependencies = [
- "polkavm-common 0.8.0",
+ "polkavm-common",
"proc-macro2",
"quote",
"syn 2.0.50",
@@ -14008,43 +13890,34 @@ dependencies = [
[[package]]
name = "polkavm-derive-impl-macro"
-version = "0.8.0"
+version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "15e85319a0d5129dc9f021c62607e0804f5fb777a05cdda44d750ac0732def66"
+checksum = "8ba81f7b5faac81e528eb6158a6f3c9e0bb1008e0ffa19653bc8dea925ecb429"
dependencies = [
- "polkavm-derive-impl 0.8.0",
+ "polkavm-derive-impl",
"syn 2.0.50",
]
[[package]]
name = "polkavm-linker"
-version = "0.5.0"
+version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a5a668bb33c7f0b5f4ca91adb1e1e71cf4930fef5e6909f46c2180d65cce37d0"
+checksum = "9c7be503e60cf56c0eb785f90aaba4b583b36bff00e93997d93fef97f9553c39"
dependencies = [
"gimli 0.28.0",
"hashbrown 0.14.3",
"log",
"object 0.32.2",
- "polkavm-common 0.5.0",
+ "polkavm-common",
"regalloc2 0.9.3",
"rustc-demangle",
]
[[package]]
-name = "polkavm-linker"
-version = "0.8.2"
+name = "polkavm-linux-raw"
+version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fdec1451cb18261d5d01de82acc15305e417fb59588cdcb3127d3dcc9672b925"
-dependencies = [
- "gimli 0.28.0",
- "hashbrown 0.14.3",
- "log",
- "object 0.32.2",
- "polkavm-common 0.8.0",
- "regalloc2 0.9.3",
- "rustc-demangle",
-]
+checksum = "26e85d3456948e650dff0cfc85603915847faf893ed1e66b020bb82ef4557120"
[[package]]
name = "polling"
@@ -14995,7 +14868,7 @@ dependencies = [
"blake2 0.10.6",
"common",
"fflonk",
- "merlin 3.0.0",
+ "merlin",
]
[[package]]
@@ -15777,7 +15650,6 @@ name = "sc-cli"
version = "0.36.0"
dependencies = [
"array-bytes 6.1.0",
- "bip39",
"chrono",
"clap 4.5.1",
"fdlimit",
@@ -15787,6 +15659,7 @@ dependencies = [
"libp2p-identity",
"log",
"names",
+ "parity-bip39",
"parity-scale-codec",
"rand",
"regex",
@@ -16258,6 +16131,7 @@ dependencies = [
"paste",
"regex",
"sc-executor-common",
+ "sc-executor-polkavm",
"sc-executor-wasmtime",
"sc-runtime-test",
"sc-tracing",
@@ -16287,6 +16161,7 @@ dependencies = [
name = "sc-executor-common"
version = "0.29.0"
dependencies = [
+ "polkavm",
"sc-allocator",
"sp-maybe-compressed-blob",
"sp-wasm-interface 20.0.0",
@@ -16294,6 +16169,16 @@ dependencies = [
"wasm-instrument",
]
+[[package]]
+name = "sc-executor-polkavm"
+version = "0.29.0"
+dependencies = [
+ "log",
+ "polkavm",
+ "sc-executor-common",
+ "sp-wasm-interface 20.0.0",
+]
+
[[package]]
name = "sc-executor-wasmtime"
version = "0.29.0"
@@ -16741,7 +16626,6 @@ dependencies = [
"hyper",
"jsonrpsee",
"log",
- "pin-project",
"serde_json",
"substrate-prometheus-endpoint",
"tokio",
@@ -17178,22 +17062,6 @@ dependencies = [
"hashbrown 0.13.2",
]
-[[package]]
-name = "schnorrkel"
-version = "0.9.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "021b403afe70d81eea68f6ea12f6b3c9588e5d536a94c3bf80f15e7faa267862"
-dependencies = [
- "arrayref",
- "arrayvec 0.5.2",
- "curve25519-dalek 2.1.3",
- "merlin 2.0.1",
- "rand_core 0.5.1",
- "sha2 0.8.2",
- "subtle 2.5.0",
- "zeroize",
-]
-
[[package]]
name = "schnorrkel"
version = "0.10.2"
@@ -17203,7 +17071,7 @@ dependencies = [
"arrayref",
"arrayvec 0.7.4",
"curve25519-dalek-ng",
- "merlin 3.0.0",
+ "merlin",
"rand_core 0.6.4",
"sha2 0.9.9",
"subtle-ng",
@@ -17221,7 +17089,7 @@ dependencies = [
"arrayvec 0.7.4",
"curve25519-dalek 4.1.2",
"getrandom_or_panic",
- "merlin 3.0.0",
+ "merlin",
"rand_core 0.6.4",
"serde_bytes",
"sha2 0.10.7",
@@ -17267,6 +17135,7 @@ dependencies = [
"der",
"generic-array 0.14.7",
"pkcs8",
+ "serdect",
"subtle 2.5.0",
"zeroize",
]
@@ -17525,6 +17394,16 @@ dependencies = [
"unsafe-libyaml",
]
+[[package]]
+name = "serdect"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a84f14a19e9a014bb9f4512488d9829a68e04ecabffb0f9904cd1ace94598177"
+dependencies = [
+ "base16ct",
+ "serde",
+]
+
[[package]]
name = "serial_test"
version = "2.0.0"
@@ -17585,18 +17464,6 @@ dependencies = [
"digest 0.10.7",
]
-[[package]]
-name = "sha2"
-version = "0.8.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69"
-dependencies = [
- "block-buffer 0.7.3",
- "digest 0.8.1",
- "fake-simd",
- "opaque-debug 0.2.3",
-]
-
[[package]]
name = "sha2"
version = "0.9.9"
@@ -17831,13 +17698,13 @@ dependencies = [
"hmac 0.12.1",
"itertools 0.11.0",
"libsecp256k1",
- "merlin 3.0.0",
+ "merlin",
"no-std-net",
"nom",
"num-bigint",
"num-rational",
"num-traits",
- "pbkdf2 0.12.2",
+ "pbkdf2",
"pin-project",
"poly1305 0.8.0",
"rand",
@@ -18353,6 +18220,87 @@ dependencies = [
"sha-1 0.9.8",
]
+[[package]]
+name = "solochain-template-node"
+version = "0.0.0"
+dependencies = [
+ "clap 4.5.1",
+ "frame-benchmarking-cli",
+ "frame-system",
+ "futures",
+ "jsonrpsee",
+ "pallet-transaction-payment",
+ "pallet-transaction-payment-rpc",
+ "sc-basic-authorship",
+ "sc-cli",
+ "sc-client-api",
+ "sc-consensus",
+ "sc-consensus-aura",
+ "sc-consensus-grandpa",
+ "sc-executor",
+ "sc-network",
+ "sc-offchain",
+ "sc-rpc-api",
+ "sc-service",
+ "sc-telemetry",
+ "sc-transaction-pool",
+ "sc-transaction-pool-api",
+ "serde_json",
+ "solochain-template-runtime",
+ "sp-api",
+ "sp-block-builder",
+ "sp-blockchain",
+ "sp-consensus-aura",
+ "sp-consensus-grandpa",
+ "sp-core",
+ "sp-inherents",
+ "sp-io",
+ "sp-keyring",
+ "sp-runtime",
+ "sp-timestamp",
+ "substrate-build-script-utils",
+ "substrate-frame-rpc-system",
+ "try-runtime-cli",
+]
+
+[[package]]
+name = "solochain-template-runtime"
+version = "0.0.0"
+dependencies = [
+ "frame-benchmarking",
+ "frame-executive",
+ "frame-support",
+ "frame-system",
+ "frame-system-benchmarking",
+ "frame-system-rpc-runtime-api",
+ "frame-try-runtime",
+ "pallet-aura",
+ "pallet-balances",
+ "pallet-grandpa",
+ "pallet-sudo",
+ "pallet-template",
+ "pallet-timestamp",
+ "pallet-transaction-payment",
+ "pallet-transaction-payment-rpc-runtime-api",
+ "parity-scale-codec",
+ "scale-info",
+ "sp-api",
+ "sp-block-builder",
+ "sp-consensus-aura",
+ "sp-consensus-grandpa",
+ "sp-core",
+ "sp-genesis-builder",
+ "sp-inherents",
+ "sp-offchain",
+ "sp-runtime",
+ "sp-session",
+ "sp-std 14.0.0",
+ "sp-storage 19.0.0",
+ "sp-transaction-pool",
+ "sp-version",
+ "substrate-wasm-builder",
+]
+
[[package]]
name = "sp-api"
version = "26.0.0"
@@ -18651,7 +18599,6 @@ version = "28.0.0"
dependencies = [
"array-bytes 6.1.0",
"bandersnatch_vrfs",
- "bip39",
"bitflags 1.3.2",
"blake2 0.10.6",
"bounded-collections",
@@ -18664,10 +18611,12 @@ dependencies = [
"hash256-std-hasher",
"impl-serde",
"itertools 0.10.5",
+ "k256",
"lazy_static",
"libsecp256k1",
"log",
- "merlin 3.0.0",
+ "merlin",
+ "parity-bip39",
"parity-scale-codec",
"parking_lot 0.12.1",
"paste",
@@ -18863,6 +18812,7 @@ dependencies = [
"libsecp256k1",
"log",
"parity-scale-codec",
+ "polkavm-derive",
"rustversion",
"secp256k1",
"sp-core",
@@ -19054,7 +19004,7 @@ dependencies = [
"bytes",
"impl-trait-for-tuples",
"parity-scale-codec",
- "polkavm-derive 0.8.0",
+ "polkavm-derive",
"primitive-types",
"rustversion",
"sp-core",
@@ -19822,14 +19772,14 @@ dependencies = [
[[package]]
name = "substrate-bip39"
-version = "0.4.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e620c7098893ba667438b47169c00aacdd9e7c10e042250ce2b60b087ec97328"
+version = "0.4.7"
dependencies = [
- "hmac 0.11.0",
- "pbkdf2 0.8.0",
- "schnorrkel 0.9.1",
- "sha2 0.9.9",
+ "bip39",
+ "hmac 0.12.1",
+ "pbkdf2",
+ "rustc-hex",
+ "schnorrkel 0.11.4",
+ "sha2 0.10.7",
"zeroize",
]
@@ -20076,7 +20026,7 @@ dependencies = [
"console",
"filetime",
"parity-wasm",
- "polkavm-linker 0.8.2",
+ "polkavm-linker",
"sp-maybe-compressed-blob",
"strum 0.24.1",
"tempfile",
@@ -22643,9 +22593,9 @@ dependencies = [
[[package]]
name = "zeroize"
-version = "1.6.0"
+version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9"
+checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d"
dependencies = [
"zeroize_derive",
]
diff --git a/Cargo.toml b/Cargo.toml
index 48aa25f5c5a9..f256d02808a8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,6 +3,7 @@ authors = ["Parity Technologies "]
edition = "2021"
repository = "https://github.com/paritytech/polkadot-sdk.git"
license = "GPL-3.0-only"
+homepage = "https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/index.html"
[workspace]
resolver = "2"
@@ -74,9 +75,6 @@ members = [
"cumulus/pallets/solo-to-para",
"cumulus/pallets/xcm",
"cumulus/pallets/xcmp-queue",
- "cumulus/parachain-template/node",
- "cumulus/parachain-template/pallets/template",
- "cumulus/parachain-template/runtime",
"cumulus/parachains/common",
"cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-rococo",
"cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-westend",
@@ -219,11 +217,6 @@ members = [
"polkadot/xcm/xcm-simulator",
"polkadot/xcm/xcm-simulator/example",
"polkadot/xcm/xcm-simulator/fuzzer",
- "substrate/bin/minimal/node",
- "substrate/bin/minimal/runtime",
- "substrate/bin/node-template/node",
- "substrate/bin/node-template/pallets/template",
- "substrate/bin/node-template/runtime",
"substrate/bin/node/bench",
"substrate/bin/node/cli",
"substrate/bin/node/inspect",
@@ -256,6 +249,7 @@ members = [
"substrate/client/db",
"substrate/client/executor",
"substrate/client/executor/common",
+ "substrate/client/executor/polkavm",
"substrate/client/executor/runtime-test",
"substrate/client/executor/wasmtime",
"substrate/client/informant",
@@ -503,7 +497,20 @@ members = [
"substrate/utils/frame/rpc/system",
"substrate/utils/frame/try-runtime/cli",
"substrate/utils/prometheus",
+ "substrate/utils/substrate-bip39",
"substrate/utils/wasm-builder",
+
+ "templates/minimal/node",
+ "templates/minimal/pallets/template",
+ "templates/minimal/runtime",
+
+ "templates/solochain/node",
+ "templates/solochain/pallets/template",
+ "templates/solochain/runtime",
+
+ "templates/parachain/node",
+ "templates/parachain/pallets/template",
+ "templates/parachain/runtime",
]
default-members = ["polkadot", "substrate/bin/node/cli"]
@@ -537,8 +544,9 @@ extra-unused-type-parameters = { level = "allow", priority = 2 } # stylistic
default_constructed_unit_structs = { level = "allow", priority = 2 } # stylistic
[workspace.dependencies]
-polkavm-linker = "0.8.2"
-polkavm-derive = "0.8.0"
+polkavm = "0.9.3"
+polkavm-linker = "0.9.2"
+polkavm-derive = "0.9.1"
log = { version = "0.4.20", default-features = false }
quote = { version = "1.0.33" }
serde = { version = "1.0.197", default-features = false }
diff --git a/bridges/bin/runtime-common/src/mock.rs b/bridges/bin/runtime-common/src/mock.rs
index 8877a4fd95ce..deee4524e858 100644
--- a/bridges/bin/runtime-common/src/mock.rs
+++ b/bridges/bin/runtime-common/src/mock.rs
@@ -141,7 +141,7 @@ parameter_types! {
pub const ReserveId: [u8; 8] = *b"brdgrlrs";
}
-#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
+#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for TestRuntime {
type Hash = ThisChainHash;
type Hashing = ThisChainHasher;
@@ -158,12 +158,13 @@ impl pallet_utility::Config for TestRuntime {
type WeightInfo = ();
}
-#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig as pallet_balances::DefaultConfig)]
+#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for TestRuntime {
type ReserveIdentifier = [u8; 8];
type AccountStore = System;
}
+#[derive_impl(pallet_transaction_payment::config_preludes::TestDefaultConfig)]
impl pallet_transaction_payment::Config for TestRuntime {
type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter;
type OperationalFeeMultiplier = ConstU8<5>;
diff --git a/bridges/modules/grandpa/src/mock.rs b/bridges/modules/grandpa/src/mock.rs
index e41e89341b31..4318d663a2e1 100644
--- a/bridges/modules/grandpa/src/mock.rs
+++ b/bridges/modules/grandpa/src/mock.rs
@@ -42,7 +42,7 @@ construct_runtime! {
}
}
-#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
+#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for TestRuntime {
type Block = Block;
}
diff --git a/bridges/modules/messages/src/mock.rs b/bridges/modules/messages/src/mock.rs
index af9212053985..ec63f15b94b5 100644
--- a/bridges/modules/messages/src/mock.rs
+++ b/bridges/modules/messages/src/mock.rs
@@ -77,14 +77,14 @@ frame_support::construct_runtime! {
pub type DbWeight = RocksDbWeight;
-#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
+#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for TestRuntime {
type Block = Block;
type AccountData = pallet_balances::AccountData;
type DbWeight = DbWeight;
}
-#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig as pallet_balances::DefaultConfig)]
+#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for TestRuntime {
type ReserveIdentifier = [u8; 8];
type AccountStore = System;
diff --git a/bridges/modules/parachains/src/mock.rs b/bridges/modules/parachains/src/mock.rs
index 143f11d98637..3af3fd3e7639 100644
--- a/bridges/modules/parachains/src/mock.rs
+++ b/bridges/modules/parachains/src/mock.rs
@@ -161,7 +161,7 @@ construct_runtime! {
}
}
-#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
+#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for TestRuntime {
type Block = Block;
}
diff --git a/bridges/modules/relayers/src/mock.rs b/bridges/modules/relayers/src/mock.rs
index 667b10e5c125..3124787896c3 100644
--- a/bridges/modules/relayers/src/mock.rs
+++ b/bridges/modules/relayers/src/mock.rs
@@ -59,14 +59,14 @@ parameter_types! {
pub const Lease: BlockNumber = 8;
}
-#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
+#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for TestRuntime {
type Block = Block;
type AccountData = pallet_balances::AccountData;
type DbWeight = DbWeight;
}
-#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig as pallet_balances::DefaultConfig)]
+#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for TestRuntime {
type ReserveIdentifier = [u8; 8];
type AccountStore = System;
diff --git a/bridges/modules/xcm-bridge-hub-router/src/mock.rs b/bridges/modules/xcm-bridge-hub-router/src/mock.rs
index 6dbfba5f6fdc..54e10966d51b 100644
--- a/bridges/modules/xcm-bridge-hub-router/src/mock.rs
+++ b/bridges/modules/xcm-bridge-hub-router/src/mock.rs
@@ -64,7 +64,7 @@ parameter_types! {
pub UnknownXcmVersionLocation: Location = Location::new(2, [GlobalConsensus(BridgedNetworkId::get()), Parachain(9999)]);
}
-#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
+#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for TestRuntime {
type Block = Block;
}
diff --git a/bridges/modules/xcm-bridge-hub/src/mock.rs b/bridges/modules/xcm-bridge-hub/src/mock.rs
index e40e1f9fb651..4c09bce56d73 100644
--- a/bridges/modules/xcm-bridge-hub/src/mock.rs
+++ b/bridges/modules/xcm-bridge-hub/src/mock.rs
@@ -64,7 +64,7 @@ parameter_types! {
pub const ExistentialDeposit: Balance = 1;
}
-#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
+#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for TestRuntime {
type AccountId = AccountId;
type AccountData = pallet_balances::AccountData;
@@ -72,7 +72,7 @@ impl frame_system::Config for TestRuntime {
type Lookup = IdentityLookup;
}
-#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig as pallet_balances::DefaultConfig)]
+#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
impl pallet_balances::Config for TestRuntime {
type AccountStore = System;
}
diff --git a/bridges/primitives/test-utils/src/lib.rs b/bridges/primitives/test-utils/src/lib.rs
index f23ddd1a10d3..1d80890779bf 100644
--- a/bridges/primitives/test-utils/src/lib.rs
+++ b/bridges/primitives/test-utils/src/lib.rs
@@ -129,7 +129,7 @@ pub fn make_justification_for_header(
votes_ancestries.push(child.clone());
}
- // The header we need to use when pre-commiting is the one at the highest height
+ // The header we need to use when pre-committing is the one at the highest height
// on our chain.
let precommit_candidate = chain.last().map(|h| (h.hash(), *h.number())).unwrap();
unsigned_precommits.push(precommit_candidate);
diff --git a/bridges/snowbridge/pallets/ethereum-client/src/mock.rs b/bridges/snowbridge/pallets/ethereum-client/src/mock.rs
index 3ce34eee191a..799b14f4773e 100644
--- a/bridges/snowbridge/pallets/ethereum-client/src/mock.rs
+++ b/bridges/snowbridge/pallets/ethereum-client/src/mock.rs
@@ -95,7 +95,7 @@ frame_support::construct_runtime!(
}
);
-#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
+#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for Test {
type Block = Block;
}
diff --git a/bridges/snowbridge/pallets/inbound-queue/src/mock.rs b/bridges/snowbridge/pallets/inbound-queue/src/mock.rs
index 749fb0367f33..086b27cb8280 100644
--- a/bridges/snowbridge/pallets/inbound-queue/src/mock.rs
+++ b/bridges/snowbridge/pallets/inbound-queue/src/mock.rs
@@ -47,7 +47,7 @@ parameter_types! {
type Balance = u128;
-#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
+#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = Everything;
type RuntimeOrigin = RuntimeOrigin;
diff --git a/bridges/snowbridge/pallets/outbound-queue/src/mock.rs b/bridges/snowbridge/pallets/outbound-queue/src/mock.rs
index 6e78fb446721..850b13dcf310 100644
--- a/bridges/snowbridge/pallets/outbound-queue/src/mock.rs
+++ b/bridges/snowbridge/pallets/outbound-queue/src/mock.rs
@@ -37,7 +37,7 @@ parameter_types! {
pub const BlockHashCount: u64 = 250;
}
-#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
+#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = Everything;
type RuntimeOrigin = RuntimeOrigin;
diff --git a/bridges/snowbridge/pallets/system/src/mock.rs b/bridges/snowbridge/pallets/system/src/mock.rs
index de2970dd550b..a711eab5d3d4 100644
--- a/bridges/snowbridge/pallets/system/src/mock.rs
+++ b/bridges/snowbridge/pallets/system/src/mock.rs
@@ -95,7 +95,7 @@ frame_support::construct_runtime!(
}
);
-#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
+#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type RuntimeOrigin = RuntimeOrigin;
diff --git a/bridges/snowbridge/parachain/pallets/ethereum-beacon-client/src/mock.rs b/bridges/snowbridge/parachain/pallets/ethereum-beacon-client/src/mock.rs
index 77b5c1aa631d..d2cca373e92b 100644
--- a/bridges/snowbridge/parachain/pallets/ethereum-beacon-client/src/mock.rs
+++ b/bridges/snowbridge/parachain/pallets/ethereum-beacon-client/src/mock.rs
@@ -34,7 +34,7 @@ pub mod minimal {
pub const SS58Prefix: u8 = 42;
}
- #[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
+ #[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type RuntimeOrigin = RuntimeOrigin;
@@ -195,7 +195,7 @@ pub mod mainnet {
pub const SS58Prefix: u8 = 42;
}
- #[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
+ #[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type RuntimeOrigin = RuntimeOrigin;
diff --git a/bridges/testing/tests/0001-asset-transfer/roc-reaches-westend.zndsl b/bridges/testing/tests/0001-asset-transfer/roc-reaches-westend.zndsl
index a58520ccea65..cdb7d28e940c 100644
--- a/bridges/testing/tests/0001-asset-transfer/roc-reaches-westend.zndsl
+++ b/bridges/testing/tests/0001-asset-transfer/roc-reaches-westend.zndsl
@@ -6,7 +6,7 @@ Creds: config
asset-hub-westend-collator1: run {{ENV_PATH}}/helper.sh with "reserve-transfer-assets-from-asset-hub-rococo-local 5000000000000" within 120 seconds
# check that //Alice received at least 4.8 ROC on Westend AH
-asset-hub-westend-collator1: js-script {{FRAMEWORK_PATH}}/js-helpers/wrapped-assets-balance.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY,4800000000000,Rococo" within 300 seconds
+asset-hub-westend-collator1: js-script {{FRAMEWORK_PATH}}/js-helpers/wrapped-assets-balance.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY,4800000000000,Rococo" within 600 seconds
# check that the relayer //Charlie is rewarded by Westend AH
bridge-hub-westend-collator1: js-script {{FRAMEWORK_PATH}}/js-helpers/relayer-rewards.js with "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y,0x00000002,0x6268726F,ThisChain,0" within 30 seconds
diff --git a/bridges/testing/tests/0001-asset-transfer/wnd-reaches-rococo.zndsl b/bridges/testing/tests/0001-asset-transfer/wnd-reaches-rococo.zndsl
index fedb78cc2103..dbc03864e2b6 100644
--- a/bridges/testing/tests/0001-asset-transfer/wnd-reaches-rococo.zndsl
+++ b/bridges/testing/tests/0001-asset-transfer/wnd-reaches-rococo.zndsl
@@ -6,7 +6,7 @@ Creds: config
asset-hub-rococo-collator1: run {{ENV_PATH}}/helper.sh with "reserve-transfer-assets-from-asset-hub-westend-local 5000000000000" within 120 seconds
# check that //Alice received at least 4.8 WND on Rococo AH
-asset-hub-rococo-collator1: js-script {{FRAMEWORK_PATH}}/js-helpers/wrapped-assets-balance.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY,4800000000000,Westend" within 300 seconds
+asset-hub-rococo-collator1: js-script {{FRAMEWORK_PATH}}/js-helpers/wrapped-assets-balance.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY,4800000000000,Westend" within 600 seconds
# check that the relayer //Charlie is rewarded by Rococo AH
bridge-hub-rococo-collator1: js-script {{FRAMEWORK_PATH}}/js-helpers/relayer-rewards.js with "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y,0x00000002,0x62687764,ThisChain,0" within 30 seconds
diff --git a/bridges/testing/tests/0001-asset-transfer/wroc-reaches-rococo.zndsl b/bridges/testing/tests/0001-asset-transfer/wroc-reaches-rococo.zndsl
index 68b888b6858e..9967732cabe1 100644
--- a/bridges/testing/tests/0001-asset-transfer/wroc-reaches-rococo.zndsl
+++ b/bridges/testing/tests/0001-asset-transfer/wroc-reaches-rococo.zndsl
@@ -7,4 +7,4 @@ asset-hub-rococo-collator1: run {{ENV_PATH}}/helper.sh with "withdraw-reserve-as
# check that //Alice received at least 2.8 wROC on Rococo AH
# (we wait until //Alice account increases here - there are no other transactions that may increase it)
-asset-hub-rococo-collator1: js-script {{FRAMEWORK_PATH}}/js-helpers/native-assets-balance-increased.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY,2800000000000" within 300 seconds
+asset-hub-rococo-collator1: js-script {{FRAMEWORK_PATH}}/js-helpers/native-assets-balance-increased.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY,2800000000000" within 600 seconds
diff --git a/bridges/testing/tests/0001-asset-transfer/wwnd-reaches-westend.zndsl b/bridges/testing/tests/0001-asset-transfer/wwnd-reaches-westend.zndsl
index 1a8a16181954..2037b0baf3c0 100644
--- a/bridges/testing/tests/0001-asset-transfer/wwnd-reaches-westend.zndsl
+++ b/bridges/testing/tests/0001-asset-transfer/wwnd-reaches-westend.zndsl
@@ -7,4 +7,4 @@ asset-hub-westend-collator1: run {{ENV_PATH}}/helper.sh with "withdraw-reserve-a
# check that //Alice received at least 2.8 wWND on Westend AH
# (we wait until //Alice account increases here - there are no other transactions that may increase it)
-asset-hub-westend-collator1: js-script {{FRAMEWORK_PATH}}/js-helpers/native-assets-balance-increased.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY,2800000000000" within 300 seconds
+asset-hub-westend-collator1: js-script {{FRAMEWORK_PATH}}/js-helpers/native-assets-balance-increased.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY,2800000000000" within 600 seconds
diff --git a/cumulus/client/parachain-inherent/src/lib.rs b/cumulus/client/parachain-inherent/src/lib.rs
index 57353638e197..051eb6764c8c 100644
--- a/cumulus/client/parachain-inherent/src/lib.rs
+++ b/cumulus/client/parachain-inherent/src/lib.rs
@@ -159,7 +159,7 @@ impl ParachainInherentDataProvider {
target: LOG_TARGET,
relay_parent = ?relay_parent,
error = ?e,
- "An error occured during requesting the downward messages.",
+ "An error occurred during requesting the downward messages.",
);
})
.ok()?;
@@ -171,7 +171,7 @@ impl ParachainInherentDataProvider {
target: LOG_TARGET,
relay_parent = ?relay_parent,
error = ?e,
- "An error occured during requesting the inbound HRMP messages.",
+ "An error occurred during requesting the inbound HRMP messages.",
);
})
.ok()?;
diff --git a/cumulus/pallets/collator-selection/src/benchmarking.rs b/cumulus/pallets/collator-selection/src/benchmarking.rs
index 2c40f4dd0eac..e2af74a6e60e 100644
--- a/cumulus/pallets/collator-selection/src/benchmarking.rs
+++ b/cumulus/pallets/collator-selection/src/benchmarking.rs
@@ -22,9 +22,7 @@ use super::*;
#[allow(unused)]
use crate::Pallet as CollatorSelection;
use codec::Decode;
-use frame_benchmarking::{
- account, impl_benchmark_test_suite, v2::*, whitelisted_caller, BenchmarkError,
-};
+use frame_benchmarking::{account, v2::*, whitelisted_caller, BenchmarkError};
use frame_support::traits::{Currency, EnsureOrigin, Get, ReservableCurrency};
use frame_system::{pallet_prelude::BlockNumberFor, EventRecord, RawOrigin};
use pallet_authorship::EventHandler;
diff --git a/cumulus/pallets/collator-selection/src/lib.rs b/cumulus/pallets/collator-selection/src/lib.rs
index fb4c4a445df2..62c00737f91a 100644
--- a/cumulus/pallets/collator-selection/src/lib.rs
+++ b/cumulus/pallets/collator-selection/src/lib.rs
@@ -495,7 +495,11 @@ pub mod pallet {
})
.unwrap_or_default();
Self::deposit_event(Event::NewCandidacyBond { bond_amount: bond });
- Ok(Some(T::WeightInfo::set_candidacy_bond(initial_len as u32, kicked as u32)).into())
+ Ok(Some(T::WeightInfo::set_candidacy_bond(
+ bond_increased.then(|| initial_len as u32).unwrap_or_default(),
+ kicked as u32,
+ ))
+ .into())
}
/// Register this account as a collator candidate. The account must (a) already have
diff --git a/cumulus/pallets/collator-selection/src/mock.rs b/cumulus/pallets/collator-selection/src/mock.rs
index fe41e7318bcd..061d8b1cb311 100644
--- a/cumulus/pallets/collator-selection/src/mock.rs
+++ b/cumulus/pallets/collator-selection/src/mock.rs
@@ -50,7 +50,7 @@ parameter_types! {
pub const SS58Prefix: u8 = 42;
}
-#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
+#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type BlockWeights = ();
diff --git a/cumulus/pallets/dmp-queue/src/mock.rs b/cumulus/pallets/dmp-queue/src/mock.rs
index 6bd74a047eb7..ed72ce678e3e 100644
--- a/cumulus/pallets/dmp-queue/src/mock.rs
+++ b/cumulus/pallets/dmp-queue/src/mock.rs
@@ -35,7 +35,7 @@ frame_support::construct_runtime!(
}
);
-#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
+#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for Runtime {
type Block = Block;
type RuntimeOrigin = RuntimeOrigin;
diff --git a/cumulus/pallets/parachain-system/src/mock.rs b/cumulus/pallets/parachain-system/src/mock.rs
index b76553a53841..0b1d536ba7cd 100644
--- a/cumulus/pallets/parachain-system/src/mock.rs
+++ b/cumulus/pallets/parachain-system/src/mock.rs
@@ -71,7 +71,7 @@ parameter_types! {
pub const ReservedDmpWeight: Weight = Weight::zero();
}
-#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
+#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for Test {
type Block = Block;
type BlockHashCount = BlockHashCount;
diff --git a/cumulus/pallets/xcmp-queue/src/lib.rs b/cumulus/pallets/xcmp-queue/src/lib.rs
index 5b900769622a..e92169be16b0 100644
--- a/cumulus/pallets/xcmp-queue/src/lib.rs
+++ b/cumulus/pallets/xcmp-queue/src/lib.rs
@@ -600,7 +600,7 @@ impl Pallet {
let QueueConfigData { drop_threshold, .. } = >::get();
let fp = T::XcmpQueue::footprint(sender);
// Assume that it will not fit into the current page:
- let new_pages = fp.pages.saturating_add(1);
+ let new_pages = fp.ready_pages.saturating_add(1);
if new_pages > drop_threshold {
// This should not happen since the channel should have been suspended in
// [`on_queue_changed`].
@@ -663,12 +663,12 @@ impl OnQueueChanged for Pallet {
let mut suspended_channels = >::get();
let suspended = suspended_channels.contains(¶);
- if suspended && fp.pages <= resume_threshold {
+ if suspended && fp.ready_pages <= resume_threshold {
Self::send_signal(para, ChannelSignal::Resume);
suspended_channels.remove(¶);
>::put(suspended_channels);
- } else if !suspended && fp.pages >= suspend_threshold {
+ } else if !suspended && fp.ready_pages >= suspend_threshold {
log::warn!("XCMP queue for sibling {:?} is full; suspending channel.", para);
Self::send_signal(para, ChannelSignal::Suspend);
diff --git a/cumulus/pallets/xcmp-queue/src/mock.rs b/cumulus/pallets/xcmp-queue/src/mock.rs
index 08ab58ce8160..294f978f6ad5 100644
--- a/cumulus/pallets/xcmp-queue/src/mock.rs
+++ b/cumulus/pallets/xcmp-queue/src/mock.rs
@@ -58,7 +58,7 @@ parameter_types! {
type AccountId = u64;
-#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
+#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = Everything;
type BlockWeights = ();
@@ -247,6 +247,7 @@ impl> EnqueueMessage for EnqueueToLocalStorage
}
}
footprint.pages = footprint.storage.size as u32 / 16; // Number does not matter
+ footprint.ready_pages = footprint.pages;
footprint
}
}
diff --git a/cumulus/parachain-template/pallets/template/README.md b/cumulus/parachain-template/pallets/template/README.md
deleted file mode 100644
index 5a6461233465..000000000000
--- a/cumulus/parachain-template/pallets/template/README.md
+++ /dev/null
@@ -1 +0,0 @@
-License: Unlicense
diff --git a/cumulus/parachain-template/pallets/template/src/benchmarking.rs b/cumulus/parachain-template/pallets/template/src/benchmarking.rs
deleted file mode 100644
index 8bba2a09867d..000000000000
--- a/cumulus/parachain-template/pallets/template/src/benchmarking.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-//! Benchmarking setup for pallet-parachain-template
-
-use super::*;
-
-#[allow(unused)]
-use crate::Pallet as Template;
-use frame_benchmarking::{benchmarks, impl_benchmark_test_suite, whitelisted_caller};
-use frame_system::RawOrigin;
-
-benchmarks! {
- do_something {
- let s in 0 .. 100;
- let caller: T::AccountId = whitelisted_caller();
- }: _(RawOrigin::Signed(caller), s)
- verify {
- assert_eq!(Something::::get(), Some(s));
- }
-}
-
-impl_benchmark_test_suite!(Template, crate::mock::new_test_ext(), crate::mock::Test,);
diff --git a/cumulus/parachains/common/src/impls.rs b/cumulus/parachains/common/src/impls.rs
index 957538b7cdad..6a990740f0f1 100644
--- a/cumulus/parachains/common/src/impls.rs
+++ b/cumulus/parachains/common/src/impls.rs
@@ -217,7 +217,7 @@ mod tests {
pub const MaxReserves: u32 = 50;
}
- #[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
+ #[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type RuntimeOrigin = RuntimeOrigin;
diff --git a/cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-rococo/src/genesis.rs b/cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-rococo/src/genesis.rs
index 80db56444696..2acccb9649b8 100644
--- a/cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-rococo/src/genesis.rs
+++ b/cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-rococo/src/genesis.rs
@@ -14,17 +14,24 @@
// limitations under the License.
// Substrate
-use sp_core::storage::Storage;
+use frame_support::parameter_types;
+use sp_core::{sr25519, storage::Storage};
// Cumulus
use emulated_integration_tests_common::{
- accounts, build_genesis_storage, collators, SAFE_XCM_VERSION,
+ accounts, build_genesis_storage, collators, get_account_id_from_seed,
+ PenpalSiblingSovereigAccount, PenpalTeleportableAssetLocation, RESERVABLE_ASSET_ID,
+ SAFE_XCM_VERSION,
};
-use parachains_common::Balance;
+use parachains_common::{AccountId, Balance};
pub const PARA_ID: u32 = 1000;
pub const ED: Balance = testnet_parachains_constants::rococo::currency::EXISTENTIAL_DEPOSIT;
+parameter_types! {
+ pub AssetHubRococoAssetOwner: AccountId = get_account_id_from_seed::("Alice");
+}
+
pub fn genesis() -> Storage {
let genesis_config = asset_hub_rococo_runtime::RuntimeGenesisConfig {
system: asset_hub_rococo_runtime::SystemConfig::default(),
@@ -60,6 +67,22 @@ pub fn genesis() -> Storage {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
},
+ assets: asset_hub_rococo_runtime::AssetsConfig {
+ assets: vec![(RESERVABLE_ASSET_ID, AssetHubRococoAssetOwner::get(), true, ED)],
+ ..Default::default()
+ },
+ foreign_assets: asset_hub_rococo_runtime::ForeignAssetsConfig {
+ assets: vec![
+ // Penpal's teleportable asset representation
+ (
+ PenpalTeleportableAssetLocation::get(),
+ PenpalSiblingSovereigAccount::get(),
+ true,
+ ED,
+ ),
+ ],
+ ..Default::default()
+ },
..Default::default()
};
diff --git a/cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-rococo/src/lib.rs b/cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-rococo/src/lib.rs
index 00f412564205..f1e972e869dc 100644
--- a/cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-rococo/src/lib.rs
+++ b/cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-rococo/src/lib.rs
@@ -21,7 +21,7 @@ use frame_support::traits::OnInitialize;
// Cumulus
use emulated_integration_tests_common::{
impl_accounts_helpers_for_parachain, impl_assert_events_helpers_for_parachain,
- impl_assets_helpers_for_parachain, impl_foreign_assets_helpers_for_parachain,
+ impl_assets_helpers_for_parachain, impl_assets_helpers_for_system_parachain,
impl_xcm_helpers_for_parachain, impls::Parachain, xcm_emulator::decl_test_parachains,
};
use rococo_emulated_chain::Rococo;
@@ -54,6 +54,6 @@ decl_test_parachains! {
// AssetHubRococo implementation
impl_accounts_helpers_for_parachain!(AssetHubRococo);
impl_assert_events_helpers_for_parachain!(AssetHubRococo);
-impl_assets_helpers_for_parachain!(AssetHubRococo, Rococo);
-impl_foreign_assets_helpers_for_parachain!(AssetHubRococo, Rococo);
+impl_assets_helpers_for_system_parachain!(AssetHubRococo, Rococo);
+impl_assets_helpers_for_parachain!(AssetHubRococo);
impl_xcm_helpers_for_parachain!(AssetHubRococo);
diff --git a/cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-westend/src/genesis.rs b/cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-westend/src/genesis.rs
index b2e4645ee076..e30529aff42c 100644
--- a/cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-westend/src/genesis.rs
+++ b/cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-westend/src/genesis.rs
@@ -14,17 +14,24 @@
// limitations under the License.
// Substrate
-use sp_core::storage::Storage;
+use frame_support::parameter_types;
+use sp_core::{sr25519, storage::Storage};
// Cumulus
use emulated_integration_tests_common::{
- accounts, build_genesis_storage, collators, SAFE_XCM_VERSION,
+ accounts, build_genesis_storage, collators, get_account_id_from_seed,
+ PenpalSiblingSovereigAccount, PenpalTeleportableAssetLocation, RESERVABLE_ASSET_ID,
+ SAFE_XCM_VERSION,
};
-use parachains_common::Balance;
+use parachains_common::{AccountId, Balance};
pub const PARA_ID: u32 = 1000;
pub const ED: Balance = testnet_parachains_constants::westend::currency::EXISTENTIAL_DEPOSIT;
+parameter_types! {
+ pub AssetHubWestendAssetOwner: AccountId = get_account_id_from_seed::("Alice");
+}
+
pub fn genesis() -> Storage {
let genesis_config = asset_hub_westend_runtime::RuntimeGenesisConfig {
system: asset_hub_westend_runtime::SystemConfig::default(),
@@ -56,6 +63,22 @@ pub fn genesis() -> Storage {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
},
+ assets: asset_hub_westend_runtime::AssetsConfig {
+ assets: vec![(RESERVABLE_ASSET_ID, AssetHubWestendAssetOwner::get(), true, ED)],
+ ..Default::default()
+ },
+ foreign_assets: asset_hub_westend_runtime::ForeignAssetsConfig {
+ assets: vec![
+ // Penpal's teleportable asset representation
+ (
+ PenpalTeleportableAssetLocation::get(),
+ PenpalSiblingSovereigAccount::get(),
+ true,
+ ED,
+ ),
+ ],
+ ..Default::default()
+ },
..Default::default()
};
diff --git a/cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-westend/src/lib.rs b/cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-westend/src/lib.rs
index 25d7c1079b4d..7f05eefb4c20 100644
--- a/cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-westend/src/lib.rs
+++ b/cumulus/parachains/integration-tests/emulated/chains/parachains/assets/asset-hub-westend/src/lib.rs
@@ -21,7 +21,7 @@ use frame_support::traits::OnInitialize;
// Cumulus
use emulated_integration_tests_common::{
impl_accounts_helpers_for_parachain, impl_assert_events_helpers_for_parachain,
- impl_assets_helpers_for_parachain, impl_foreign_assets_helpers_for_parachain,
+ impl_assets_helpers_for_parachain, impl_assets_helpers_for_system_parachain,
impl_xcm_helpers_for_parachain, impls::Parachain, xcm_emulator::decl_test_parachains,
};
use westend_emulated_chain::Westend;
@@ -54,6 +54,6 @@ decl_test_parachains! {
// AssetHubWestend implementation
impl_accounts_helpers_for_parachain!(AssetHubWestend);
impl_assert_events_helpers_for_parachain!(AssetHubWestend);
-impl_assets_helpers_for_parachain!(AssetHubWestend, Westend);
-impl_foreign_assets_helpers_for_parachain!(AssetHubWestend, Westend);
+impl_assets_helpers_for_system_parachain!(AssetHubWestend, Westend);
+impl_assets_helpers_for_parachain!(AssetHubWestend);
impl_xcm_helpers_for_parachain!(AssetHubWestend);
diff --git a/cumulus/parachains/integration-tests/emulated/chains/parachains/testing/penpal/Cargo.toml b/cumulus/parachains/integration-tests/emulated/chains/parachains/testing/penpal/Cargo.toml
index a853825d8ef6..f47350b00eb1 100644
--- a/cumulus/parachains/integration-tests/emulated/chains/parachains/testing/penpal/Cargo.toml
+++ b/cumulus/parachains/integration-tests/emulated/chains/parachains/testing/penpal/Cargo.toml
@@ -16,10 +16,11 @@ workspace = true
sp-core = { path = "../../../../../../../../substrate/primitives/core", default-features = false }
frame-support = { path = "../../../../../../../../substrate/frame/support", default-features = false }
+# Polkadot
+xcm = { package = "staging-xcm", path = "../../../../../../../../polkadot/xcm", default-features = false }
+
# Cumulus
parachains-common = { path = "../../../../../../../parachains/common" }
cumulus-primitives-core = { path = "../../../../../../../primitives/core", default-features = false }
emulated-integration-tests-common = { path = "../../../../common", default-features = false }
penpal-runtime = { path = "../../../../../../runtimes/testing/penpal" }
-rococo-emulated-chain = { path = "../../../relays/rococo" }
-westend-emulated-chain = { path = "../../../relays/westend" }
diff --git a/cumulus/parachains/integration-tests/emulated/chains/parachains/testing/penpal/src/genesis.rs b/cumulus/parachains/integration-tests/emulated/chains/parachains/testing/penpal/src/genesis.rs
index 9ab32a977d71..48901647fd05 100644
--- a/cumulus/parachains/integration-tests/emulated/chains/parachains/testing/penpal/src/genesis.rs
+++ b/cumulus/parachains/integration-tests/emulated/chains/parachains/testing/penpal/src/genesis.rs
@@ -14,19 +14,27 @@
// limitations under the License.
// Substrate
+use frame_support::parameter_types;
use sp_core::{sr25519, storage::Storage};
+// Polkadot
+use xcm::v3::Location;
// Cumulus
use emulated_integration_tests_common::{
accounts, build_genesis_storage, collators, get_account_id_from_seed, SAFE_XCM_VERSION,
};
-use parachains_common::Balance;
-
+use parachains_common::{AccountId, Balance};
+use penpal_runtime::xcm_config::{LocalReservableFromAssetHub, RelayLocation};
// Penpal
pub const PARA_ID_A: u32 = 2000;
pub const PARA_ID_B: u32 = 2001;
pub const ED: Balance = penpal_runtime::EXISTENTIAL_DEPOSIT;
+parameter_types! {
+ pub PenpalSudoAcccount: AccountId = get_account_id_from_seed::("Alice");
+ pub PenpalAssetOwner: AccountId = PenpalSudoAcccount::get();
+}
+
pub fn genesis(para_id: u32) -> Storage {
let genesis_config = penpal_runtime::RuntimeGenesisConfig {
system: penpal_runtime::SystemConfig::default(),
@@ -58,8 +66,35 @@ pub fn genesis(para_id: u32) -> Storage {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
},
- sudo: penpal_runtime::SudoConfig {
- key: Some(get_account_id_from_seed::("Alice")),
+ sudo: penpal_runtime::SudoConfig { key: Some(PenpalSudoAcccount::get()) },
+ assets: penpal_runtime::AssetsConfig {
+ assets: vec![(
+ penpal_runtime::xcm_config::TELEPORTABLE_ASSET_ID,
+ PenpalAssetOwner::get(),
+ false,
+ ED,
+ )],
+ ..Default::default()
+ },
+ foreign_assets: penpal_runtime::ForeignAssetsConfig {
+ assets: vec![
+ // Relay Native asset representation
+ (
+ Location::try_from(RelayLocation::get()).expect("conversion works"),
+ PenpalAssetOwner::get(),
+ true,
+ ED,
+ ),
+ // Sufficient AssetHub asset representation
+ (
+ Location::try_from(LocalReservableFromAssetHub::get())
+ .expect("conversion works"),
+ PenpalAssetOwner::get(),
+ true,
+ ED,
+ ),
+ ],
+ ..Default::default()
},
..Default::default()
};
diff --git a/cumulus/parachains/integration-tests/emulated/chains/parachains/testing/penpal/src/lib.rs b/cumulus/parachains/integration-tests/emulated/chains/parachains/testing/penpal/src/lib.rs
index 8f586a46a75c..651b3a523067 100644
--- a/cumulus/parachains/integration-tests/emulated/chains/parachains/testing/penpal/src/lib.rs
+++ b/cumulus/parachains/integration-tests/emulated/chains/parachains/testing/penpal/src/lib.rs
@@ -14,9 +14,9 @@
// limitations under the License.
mod genesis;
-pub use genesis::{genesis, ED, PARA_ID_A, PARA_ID_B};
+pub use genesis::{genesis, PenpalAssetOwner, PenpalSudoAcccount, ED, PARA_ID_A, PARA_ID_B};
pub use penpal_runtime::xcm_config::{
- LocalTeleportableToAssetHub, LocalTeleportableToAssetHubV3, XcmConfig,
+ CustomizableAssetFromSystemAssetHub, LocalTeleportableToAssetHub, XcmConfig,
};
// Substrate
@@ -27,8 +27,6 @@ use emulated_integration_tests_common::{
impl_accounts_helpers_for_parachain, impl_assert_events_helpers_for_parachain,
impl_assets_helpers_for_parachain, impls::Parachain, xcm_emulator::decl_test_parachains,
};
-use rococo_emulated_chain::Rococo;
-use westend_emulated_chain::Westend;
// Penpal Parachain declaration
decl_test_parachains! {
@@ -75,7 +73,7 @@ decl_test_parachains! {
// Penpal implementation
impl_accounts_helpers_for_parachain!(PenpalA);
impl_accounts_helpers_for_parachain!(PenpalB);
-impl_assets_helpers_for_parachain!(PenpalA, Rococo);
-impl_assets_helpers_for_parachain!(PenpalB, Westend);
impl_assert_events_helpers_for_parachain!(PenpalA);
impl_assert_events_helpers_for_parachain!(PenpalB);
+impl_assets_helpers_for_parachain!(PenpalA);
+impl_assets_helpers_for_parachain!(PenpalB);
diff --git a/cumulus/parachains/integration-tests/emulated/common/Cargo.toml b/cumulus/parachains/integration-tests/emulated/common/Cargo.toml
index 721c58fd8648..8c44cce7d922 100644
--- a/cumulus/parachains/integration-tests/emulated/common/Cargo.toml
+++ b/cumulus/parachains/integration-tests/emulated/common/Cargo.toml
@@ -27,6 +27,7 @@ pallet-message-queue = { path = "../../../../../substrate/frame/message-queue" }
# Polkadot
polkadot-primitives = { path = "../../../../../polkadot/primitives" }
+polkadot-parachain-primitives = { path = "../../../../../polkadot/parachain" }
polkadot-runtime-parachains = { path = "../../../../../polkadot/runtime/parachains" }
xcm = { package = "staging-xcm", path = "../../../../../polkadot/xcm" }
pallet-xcm = { path = "../../../../../polkadot/xcm/pallet-xcm" }
diff --git a/cumulus/parachains/integration-tests/emulated/common/src/impls.rs b/cumulus/parachains/integration-tests/emulated/common/src/impls.rs
index 4bbb4701e439..5fc08dff32c4 100644
--- a/cumulus/parachains/integration-tests/emulated/common/src/impls.rs
+++ b/cumulus/parachains/integration-tests/emulated/common/src/impls.rs
@@ -265,7 +265,7 @@ macro_rules! impl_assert_events_helpers_for_relay_chain {
$crate::impls::assert_expected_events!(
Self,
vec![
- // XCM is succesfully received and proccessed
+ // XCM is successfully received and proccessed
[<$chain RuntimeEvent>]::::MessageQueue($crate::impls::pallet_message_queue::Event::Processed {
origin: $crate::impls::AggregateMessageOrigin::Ump($crate::impls::UmpQueueId::Para(id)),
weight_used,
@@ -592,7 +592,7 @@ macro_rules! impl_assert_events_helpers_for_parachain {
}
#[macro_export]
-macro_rules! impl_assets_helpers_for_parachain {
+macro_rules! impl_assets_helpers_for_system_parachain {
( $chain:ident, $relay_chain:ident ) => {
$crate::impls::paste::paste! {
impl $chain {
@@ -630,38 +630,6 @@ macro_rules! impl_assets_helpers_for_parachain {
$crate::impls::xcm_transact_unpaid_execution(call, origin_kind)
}
- /// Mint assets making use of the assets pallet
- pub fn mint_asset(
- signed_origin: ::RuntimeOrigin,
- id: u32,
- beneficiary: $crate::impls::AccountId,
- amount_to_mint: u128,
- ) {
- ::execute_with(|| {
- $crate::impls::assert_ok!(]>::Assets::mint(
- signed_origin,
- id.clone().into(),
- beneficiary.clone().into(),
- amount_to_mint
- ));
-
- type RuntimeEvent = <$chain as $crate::impls::Chain>::RuntimeEvent;
-
- $crate::impls::assert_expected_events!(
- Self,
- vec![
- RuntimeEvent::::Assets(
- $crate::impls::pallet_assets::Event::Issued { asset_id, owner, amount }
- ) => {
- asset_id: *asset_id == id,
- owner: *owner == beneficiary.clone().into(),
- amount: *amount == amount_to_mint,
- },
- ]
- );
- });
- }
-
/// Force create and mint assets making use of the assets pallet
pub fn force_create_and_mint_asset(
id: u32,
@@ -727,8 +695,8 @@ macro_rules! impl_assets_helpers_for_parachain {
}
#[macro_export]
-macro_rules! impl_foreign_assets_helpers_for_parachain {
- ( $chain:ident, $relay_chain:ident ) => {
+macro_rules! impl_assets_helpers_for_parachain {
+ ( $chain:ident) => {
$crate::impls::paste::paste! {
impl $chain {
/// Create foreign assets using sudo `ForeignAssets::force_create()`
@@ -803,6 +771,118 @@ macro_rules! impl_foreign_assets_helpers_for_parachain {
);
});
}
+ /// Create assets using sudo `Assets::force_create()`
+ pub fn force_create_asset(
+ id: u32,
+ owner: $crate::impls::AccountId,
+ is_sufficient: bool,
+ min_balance: u128,
+ prefund_accounts: Vec<($crate::impls::AccountId, u128)>,
+ ) {
+ use $crate::impls::Inspect;
+ let sudo_origin = <$chain as $crate::impls::Chain>::RuntimeOrigin::root();
+ ::execute_with(|| {
+ $crate::impls::assert_ok!(
+ ]>::Assets::force_create(
+ sudo_origin,
+ id.clone().into(),
+ owner.clone().into(),
+ is_sufficient,
+ min_balance,
+ )
+ );
+ assert!(]>::Assets::asset_exists(id.clone()));
+ type RuntimeEvent = <$chain as $crate::impls::Chain>::RuntimeEvent;
+ $crate::impls::assert_expected_events!(
+ Self,
+ vec![
+ RuntimeEvent::::Assets(
+ $crate::impls::pallet_assets::Event::ForceCreated {
+ asset_id,
+ ..
+ }
+ ) => { asset_id: *asset_id == id, },
+ ]
+ );
+ });
+ for (beneficiary, amount) in prefund_accounts.into_iter() {
+ let signed_origin =
+ <$chain as $crate::impls::Chain>::RuntimeOrigin::signed(owner.clone());
+ Self::mint_asset(signed_origin, id.clone(), beneficiary, amount);
+ }
+ }
+
+ /// Mint assets making use of the assets pallet
+ pub fn mint_asset(
+ signed_origin: ::RuntimeOrigin,
+ id: u32,
+ beneficiary: $crate::impls::AccountId,
+ amount_to_mint: u128,
+ ) {
+ ::execute_with(|| {
+ $crate::impls::assert_ok!(]>::Assets::mint(
+ signed_origin,
+ id.clone().into(),
+ beneficiary.clone().into(),
+ amount_to_mint
+ ));
+
+ type RuntimeEvent = <$chain as $crate::impls::Chain>::RuntimeEvent;
+
+ $crate::impls::assert_expected_events!(
+ Self,
+ vec![
+ RuntimeEvent::::Assets(
+ $crate::impls::pallet_assets::Event::Issued { asset_id, owner, amount }
+ ) => {
+ asset_id: *asset_id == id,
+ owner: *owner == beneficiary.clone().into(),
+ amount: *amount == amount_to_mint,
+ },
+ ]
+ );
+ });
+ }
+
+ /// Returns the encoded call for `create` from the assets pallet
+ pub fn create_asset_call(
+ asset_id: u32,
+ min_balance: $crate::impls::Balance,
+ admin: $crate::impls::AccountId,
+ ) -> $crate::impls::DoubleEncoded<()> {
+ use $crate::impls::{Chain, Encode};
+
+ ::RuntimeCall::Assets($crate::impls::pallet_assets::Call::<
+ ::Runtime,
+ $crate::impls::pallet_assets::Instance1,
+ >::create {
+ id: asset_id.into(),
+ min_balance,
+ admin: admin.into(),
+ })
+ .encode()
+ .into()
+ }
+
+ /// Returns the encoded call for `create` from the foreign assets pallet
+ pub fn create_foreign_asset_call(
+ asset_id: $crate::impls::v3::Location,
+ min_balance: $crate::impls::Balance,
+ admin: $crate::impls::AccountId,
+ ) -> $crate::impls::DoubleEncoded<()> {
+ use $crate::impls::{Chain, Encode};
+
+ ::RuntimeCall::ForeignAssets($crate::impls::pallet_assets::Call::<
+ ::Runtime,
+ $crate::impls::pallet_assets::Instance2,
+ >::create {
+ id: asset_id.into(),
+ min_balance,
+ admin: admin.into(),
+ })
+ .encode()
+ .into()
+ }
}
}
};
diff --git a/cumulus/parachains/integration-tests/emulated/common/src/lib.rs b/cumulus/parachains/integration-tests/emulated/common/src/lib.rs
index 1a5cc1f6fea6..40204ca297a0 100644
--- a/cumulus/parachains/integration-tests/emulated/common/src/lib.rs
+++ b/cumulus/parachains/integration-tests/emulated/common/src/lib.rs
@@ -21,17 +21,19 @@ pub use xcm_emulator;
// Substrate
use beefy_primitives::ecdsa_crypto::AuthorityId as BeefyId;
+use frame_support::parameter_types;
use grandpa::AuthorityId as GrandpaId;
use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId;
use sp_consensus_babe::AuthorityId as BabeId;
use sp_core::{sr25519, storage::Storage, Pair, Public};
use sp_runtime::{
- traits::{IdentifyAccount, Verify},
+ traits::{AccountIdConversion, IdentifyAccount, Verify},
BuildStorage, MultiSignature,
};
// Polakdot
use parachains_common::BlockNumber;
+use polkadot_parachain_primitives::primitives::Sibling;
use polkadot_runtime_parachains::configuration::HostConfiguration;
// Cumulus
@@ -49,6 +51,25 @@ pub const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION;
type AccountPublic = ::Signer;
+// This asset is added to AH as Asset and reserved transfer between Parachain and AH
+pub const RESERVABLE_ASSET_ID: u32 = 1;
+// This asset is added to AH as ForeignAsset and teleported between Penpal and AH
+pub const TELEPORTABLE_ASSET_ID: u32 = 2;
+
+pub const PENPAL_ID: u32 = 2000;
+pub const ASSETS_PALLET_ID: u8 = 50;
+
+parameter_types! {
+ pub PenpalTeleportableAssetLocation: xcm::v3::Location
+ = xcm::v3::Location::new(1, [
+ xcm::v3::Junction::Parachain(PENPAL_ID),
+ xcm::v3::Junction::PalletInstance(ASSETS_PALLET_ID),
+ xcm::v3::Junction::GeneralIndex(TELEPORTABLE_ASSET_ID.into()),
+ ]
+ );
+ pub PenpalSiblingSovereigAccount: AccountId = Sibling::from(PENPAL_ID).into_account_truncating();
+}
+
/// Helper function to generate a crypto pair from seed
pub fn get_from_seed(seed: &str) -> ::Public {
TPublic::Pair::from_string(&format!("//{}", seed), None)
diff --git a/cumulus/parachains/integration-tests/emulated/common/src/macros.rs b/cumulus/parachains/integration-tests/emulated/common/src/macros.rs
index d3bb3238a3b4..6951de6faa72 100644
--- a/cumulus/parachains/integration-tests/emulated/common/src/macros.rs
+++ b/cumulus/parachains/integration-tests/emulated/common/src/macros.rs
@@ -16,16 +16,26 @@
pub use paste;
// Substrate
+pub use frame_support::{pallet_prelude::Weight, weights::WeightToFee};
+pub use pallet_assets;
pub use pallet_balances;
pub use pallet_message_queue;
pub use pallet_xcm;
// Polkadot
-pub use xcm::prelude::{AccountId32, WeightLimit};
+pub use xcm::{
+ prelude::{
+ AccountId32, All, Asset, AssetId, BuyExecution, DepositAsset, ExpectTransactStatus,
+ Fungible, Here, Location, MaybeErrorCode, OriginKind, RefundSurplus, Transact, Unlimited,
+ VersionedXcm, WeightLimit, WithdrawAsset, Xcm,
+ },
+ v3::Location as V3Location,
+};
// Cumulus
pub use asset_test_utils;
pub use cumulus_pallet_xcmp_queue;
+pub use parachains_common::AccountId;
pub use xcm_emulator::Chain;
#[macro_export]
@@ -120,102 +130,3 @@ macro_rules! test_parachain_is_trusted_teleporter {
}
};
}
-
-#[macro_export]
-macro_rules! include_penpal_create_foreign_asset_on_asset_hub {
- ( $penpal:ident, $asset_hub:ident, $relay_ed:expr, $weight_to_fee:expr) => {
- $crate::impls::paste::paste! {
- pub fn penpal_create_foreign_asset_on_asset_hub(
- asset_id_on_penpal: u32,
- foreign_asset_at_asset_hub: v3::Location,
- ah_as_seen_by_penpal: Location,
- is_sufficient: bool,
- asset_owner: AccountId,
- prefund_amount: u128,
- ) {
- use frame_support::weights::WeightToFee;
- let ah_check_account = $asset_hub::execute_with(|| {
- <$asset_hub as [<$asset_hub Pallet>]>::PolkadotXcm::check_account()
- });
- let penpal_check_account =
- $penpal::execute_with(|| <$penpal as [<$penpal Pallet>]>::PolkadotXcm::check_account());
- let penpal_as_seen_by_ah = $asset_hub::sibling_location_of($penpal::para_id());
-
- // prefund SA of Penpal on AssetHub with enough native tokens to pay for creating
- // new foreign asset, also prefund CheckingAccount with ED, because teleported asset
- // itself might not be sufficient and CheckingAccount cannot be created otherwise
- let sov_penpal_on_ah = $asset_hub::sovereign_account_id_of(penpal_as_seen_by_ah.clone());
- $asset_hub::fund_accounts(vec![
- (sov_penpal_on_ah.clone().into(), $relay_ed * 100_000_000_000),
- (ah_check_account.clone().into(), $relay_ed * 1000),
- ]);
-
- // prefund SA of AssetHub on Penpal with native asset
- let sov_ah_on_penpal = $penpal::sovereign_account_id_of(ah_as_seen_by_penpal.clone());
- $penpal::fund_accounts(vec![
- (sov_ah_on_penpal.into(), $relay_ed * 1_000_000_000),
- (penpal_check_account.clone().into(), $relay_ed * 1000),
- ]);
-
- // Force create asset on $penpal and prefund [<$penpal Sender>]
- $penpal::force_create_and_mint_asset(
- asset_id_on_penpal,
- ASSET_MIN_BALANCE,
- is_sufficient,
- asset_owner,
- None,
- prefund_amount,
- );
-
- let require_weight_at_most = Weight::from_parts(1_100_000_000_000, 30_000);
- // `OriginKind::Xcm` required by ForeignCreators pallet-assets origin filter
- let origin_kind = OriginKind::Xcm;
- let call_create_foreign_assets =
- <$asset_hub as Chain>::RuntimeCall::ForeignAssets(pallet_assets::Call::<
- <$asset_hub as Chain>::Runtime,
- pallet_assets::Instance2,
- >::create {
- id: foreign_asset_at_asset_hub,
- min_balance: ASSET_MIN_BALANCE,
- admin: sov_penpal_on_ah.into(),
- })
- .encode();
- let buy_execution_fee_amount = $weight_to_fee::weight_to_fee(
- &Weight::from_parts(10_100_000_000_000, 300_000),
- );
- let buy_execution_fee = Asset {
- id: AssetId(Location { parents: 1, interior: Here }),
- fun: Fungible(buy_execution_fee_amount),
- };
- let xcm = VersionedXcm::from(Xcm(vec![
- WithdrawAsset { 0: vec![buy_execution_fee.clone()].into() },
- BuyExecution { fees: buy_execution_fee.clone(), weight_limit: Unlimited },
- Transact { require_weight_at_most, origin_kind, call: call_create_foreign_assets.into() },
- ExpectTransactStatus(MaybeErrorCode::Success),
- RefundSurplus,
- DepositAsset { assets: All.into(), beneficiary: penpal_as_seen_by_ah },
- ]));
- // Send XCM message from penpal => asset_hub
- let sudo_penpal_origin = <$penpal as Chain>::RuntimeOrigin::root();
- $penpal::execute_with(|| {
- assert_ok!(<$penpal as [<$penpal Pallet>]>::PolkadotXcm::send(
- sudo_penpal_origin.clone(),
- bx!(ah_as_seen_by_penpal.into()),
- bx!(xcm),
- ));
- type RuntimeEvent = <$penpal as Chain>::RuntimeEvent;
- assert_expected_events!(
- $penpal,
- vec![
- RuntimeEvent::PolkadotXcm(pallet_xcm::Event::Sent { .. }) => {},
- ]
- );
- });
- $asset_hub::execute_with(|| {
- type ForeignAssets = <$asset_hub as [<$asset_hub Pallet>]>::ForeignAssets;
- assert!(ForeignAssets::asset_exists(foreign_asset_at_asset_hub));
- });
- }
- }
- };
-}
diff --git a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/Cargo.toml b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/Cargo.toml
index 0a397c2617b4..13eb7d8dfc49 100644
--- a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/Cargo.toml
+++ b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/Cargo.toml
@@ -34,5 +34,6 @@ parachains-common = { path = "../../../../../../parachains/common" }
cumulus-pallet-parachain-system = { path = "../../../../../../pallets/parachain-system", default-features = false }
testnet-parachains-constants = { path = "../../../../../runtimes/constants", features = ["rococo"] }
asset-hub-rococo-runtime = { path = "../../../../../runtimes/assets/asset-hub-rococo" }
+penpal-runtime = { path = "../../../../../runtimes/testing/penpal" }
emulated-integration-tests-common = { path = "../../../common", default-features = false }
rococo-system-emulated-network = { path = "../../../networks/rococo-system" }
diff --git a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/lib.rs b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/lib.rs
index 1cc25cb54a14..21d858f1fe51 100644
--- a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/lib.rs
+++ b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/lib.rs
@@ -13,59 +13,79 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-pub use codec::Encode;
+#[cfg(test)]
+mod imports {
+ pub use codec::Encode;
+
+ // Substrate
+ pub use frame_support::{
+ assert_err, assert_ok,
+ pallet_prelude::Weight,
+ sp_runtime::{DispatchError, DispatchResult, ModuleError},
+ traits::fungibles::Inspect,
+ };
-// Substrate
-pub use frame_support::{
- assert_err, assert_ok,
- pallet_prelude::Weight,
- sp_runtime::{AccountId32, DispatchError, DispatchResult},
- traits::fungibles::Inspect,
-};
+ // Polkadot
+ pub use xcm::{
+ prelude::{AccountId32 as AccountId32Junction, *},
+ v3,
+ };
-// Polkadot
-pub use xcm::{
- prelude::{AccountId32 as AccountId32Junction, *},
- v3::{self, Error, NetworkId::Rococo as RococoId},
-};
+ // Cumulus
+ pub use asset_test_utils::xcm_helpers;
+ pub use emulated_integration_tests_common::{
+ test_parachain_is_trusted_teleporter,
+ xcm_emulator::{
+ assert_expected_events, bx, Chain, Parachain as Para, RelayChain as Relay, Test,
+ TestArgs, TestContext, TestExt,
+ },
+ xcm_helpers::{non_fee_asset, xcm_transact_paid_execution},
+ ASSETS_PALLET_ID, RESERVABLE_ASSET_ID, XCM_V3,
+ };
+ pub use parachains_common::Balance;
+ pub use rococo_system_emulated_network::{
+ asset_hub_rococo_emulated_chain::{
+ genesis::{AssetHubRococoAssetOwner, ED as ASSET_HUB_ROCOCO_ED},
+ AssetHubRococoParaPallet as AssetHubRococoPallet,
+ },
+ penpal_emulated_chain::{
+ PenpalAParaPallet as PenpalAPallet, PenpalAssetOwner,
+ PenpalBParaPallet as PenpalBPallet, ED as PENPAL_ED,
+ },
+ rococo_emulated_chain::{genesis::ED as ROCOCO_ED, RococoRelayPallet as RococoPallet},
+ AssetHubRococoPara as AssetHubRococo, AssetHubRococoParaReceiver as AssetHubRococoReceiver,
+ AssetHubRococoParaSender as AssetHubRococoSender, BridgeHubRococoPara as BridgeHubRococo,
+ BridgeHubRococoParaReceiver as BridgeHubRococoReceiver, PenpalAPara as PenpalA,
+ PenpalAParaReceiver as PenpalAReceiver, PenpalAParaSender as PenpalASender,
+ PenpalBPara as PenpalB, PenpalBParaReceiver as PenpalBReceiver, RococoRelay as Rococo,
+ RococoRelayReceiver as RococoReceiver, RococoRelaySender as RococoSender,
+ };
-// Cumulus
-pub use asset_test_utils::xcm_helpers;
-pub use emulated_integration_tests_common::{
- test_parachain_is_trusted_teleporter,
- xcm_emulator::{
- assert_expected_events, bx, helpers::weight_within_threshold, Chain, Parachain as Para,
- RelayChain as Relay, Test, TestArgs, TestContext, TestExt,
- },
- xcm_helpers::{xcm_transact_paid_execution, xcm_transact_unpaid_execution},
- PROOF_SIZE_THRESHOLD, REF_TIME_THRESHOLD, XCM_V3,
-};
-pub use parachains_common::{AccountId, Balance};
-pub use rococo_system_emulated_network::{
- asset_hub_rococo_emulated_chain::{
- genesis::ED as ASSET_HUB_ROCOCO_ED, AssetHubRococoParaPallet as AssetHubRococoPallet,
- },
- penpal_emulated_chain::PenpalAParaPallet as PenpalAPallet,
- rococo_emulated_chain::{genesis::ED as ROCOCO_ED, RococoRelayPallet as RococoPallet},
- AssetHubRococoPara as AssetHubRococo, AssetHubRococoParaReceiver as AssetHubRococoReceiver,
- AssetHubRococoParaSender as AssetHubRococoSender, BridgeHubRococoPara as BridgeHubRococo,
- BridgeHubRococoParaReceiver as BridgeHubRococoReceiver, PenpalAPara as PenpalA,
- PenpalAParaReceiver as PenpalAReceiver, PenpalAParaSender as PenpalASender,
- PenpalBPara as PenpalB, PenpalBParaReceiver as PenpalBReceiver, RococoRelay as Rococo,
- RococoRelayReceiver as RococoReceiver, RococoRelaySender as RococoSender,
-};
+ // Runtimes
+ pub use asset_hub_rococo_runtime::xcm_config::{
+ TokenLocation as RelayLocation, UniversalLocation as AssetHubRococoUniversalLocation,
+ XcmConfig as AssetHubRococoXcmConfig,
+ };
+ pub use penpal_runtime::xcm_config::{
+ LocalReservableFromAssetHub as PenpalLocalReservableFromAssetHub,
+ LocalTeleportableToAssetHub as PenpalLocalTeleportableToAssetHub,
+ UniversalLocation as PenpalUniversalLocation, XcmConfig as PenpalRococoXcmConfig,
+ };
+ pub use rococo_runtime::xcm_config::{
+ UniversalLocation as RococoUniversalLocation, XcmConfig as RococoXcmConfig,
+ };
-pub const ASSET_ID: u32 = 1;
-pub const ASSET_MIN_BALANCE: u128 = 1000;
-// `Assets` pallet index
-pub const ASSETS_PALLET_ID: u8 = 50;
+ pub const ASSET_ID: u32 = 3;
+ pub const ASSET_MIN_BALANCE: u128 = 1000;
-pub type RelayToSystemParaTest = Test;
-pub type RelayToParaTest = Test;
-pub type SystemParaToRelayTest = Test;
-pub type SystemParaToParaTest = Test;
-pub type ParaToSystemParaTest = Test;
-pub type ParaToParaTest = Test;
+ pub type RelayToSystemParaTest = Test;
+ pub type RelayToParaTest = Test;
+ pub type ParaToRelayTest = Test;
+ pub type SystemParaToRelayTest = Test;
+ pub type SystemParaToParaTest = Test;
+ pub type ParaToSystemParaTest = Test;
+ pub type ParaToParaThroughRelayTest = Test;
+}
#[cfg(test)]
mod tests;
diff --git a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/mod.rs b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/mod.rs
index 21bed234304e..b3841af0e6c3 100644
--- a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/mod.rs
+++ b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/mod.rs
@@ -18,11 +18,3 @@ mod send;
mod set_xcm_versions;
mod swap;
mod teleport;
-
-use crate::*;
-emulated_integration_tests_common::include_penpal_create_foreign_asset_on_asset_hub!(
- PenpalA,
- AssetHubRococo,
- ROCOCO_ED,
- testnet_parachains_constants::rococo::fee::WeightToFee
-);
diff --git a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/reserve_transfer.rs b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/reserve_transfer.rs
index d2c3a323256c..705c9613b647 100644
--- a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/reserve_transfer.rs
+++ b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/reserve_transfer.rs
@@ -13,14 +13,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-use crate::*;
-use asset_hub_rococo_runtime::xcm_config::XcmConfig as AssetHubRococoXcmConfig;
-use rococo_runtime::xcm_config::XcmConfig as RococoXcmConfig;
-use rococo_system_emulated_network::penpal_emulated_chain::XcmConfig as PenpalRococoXcmConfig;
+use crate::imports::*;
fn relay_to_para_sender_assertions(t: RelayToParaTest) {
type RuntimeEvent = ::RuntimeEvent;
+
Rococo::assert_xcm_pallet_attempted_complete(Some(Weight::from_parts(864_610_000, 8_799)));
+
assert_expected_events!(
Rococo,
vec![
@@ -38,12 +37,32 @@ fn relay_to_para_sender_assertions(t: RelayToParaTest) {
);
}
+fn para_to_relay_sender_assertions(t: ParaToRelayTest) {
+ type RuntimeEvent = ::RuntimeEvent;
+ PenpalA::assert_xcm_pallet_attempted_complete(Some(Weight::from_parts(864_610_000, 8_799)));
+ assert_expected_events!(
+ PenpalA,
+ vec![
+ // Amount to reserve transfer is transferred to Parachain's Sovereign account
+ RuntimeEvent::ForeignAssets(
+ pallet_assets::Event::Burned { asset_id, owner, balance, .. }
+ ) => {
+ asset_id: *asset_id == v3::Location::try_from(RelayLocation::get()).expect("conversion works"),
+ owner: *owner == t.sender.account_id,
+ balance: *balance == t.args.amount,
+ },
+ ]
+ );
+}
+
fn system_para_to_para_sender_assertions(t: SystemParaToParaTest) {
type RuntimeEvent = ::RuntimeEvent;
+
AssetHubRococo::assert_xcm_pallet_attempted_complete(Some(Weight::from_parts(
864_610_000,
8_799,
)));
+
assert_expected_events!(
AssetHubRococo,
vec![
@@ -57,19 +76,29 @@ fn system_para_to_para_sender_assertions(t: SystemParaToParaTest) {
),
amount: *amount == t.args.amount,
},
+ // Transport fees are paid
+ RuntimeEvent::PolkadotXcm(
+ pallet_xcm::Event::FeesPaid { .. }
+ ) => {},
]
);
+ AssetHubRococo::assert_xcm_pallet_sent();
}
-fn para_receiver_assertions(_: Test) {
+fn system_para_to_para_receiver_assertions(t: SystemParaToParaTest) {
type RuntimeEvent = ::RuntimeEvent;
+ let system_para_native_asset_location =
+ v3::Location::try_from(RelayLocation::get()).expect("conversion works");
+
+ PenpalA::assert_xcmp_queue_success(None);
+
assert_expected_events!(
PenpalA,
vec![
- RuntimeEvent::Balances(pallet_balances::Event::Minted { .. }) => {},
- RuntimeEvent::MessageQueue(
- pallet_message_queue::Event::Processed { success: true, .. }
- ) => {},
+ RuntimeEvent::ForeignAssets(pallet_assets::Event::Issued { asset_id, owner, .. }) => {
+ asset_id: *asset_id == system_para_native_asset_location,
+ owner: *owner == t.receiver.account_id,
+ },
]
);
}
@@ -81,12 +110,42 @@ fn para_to_system_para_sender_assertions(t: ParaToSystemParaTest) {
PenpalA,
vec![
// Amount to reserve transfer is transferred to Parachain's Sovereign account
+ RuntimeEvent::ForeignAssets(
+ pallet_assets::Event::Burned { asset_id, owner, balance, .. }
+ ) => {
+ asset_id: *asset_id == v3::Location::try_from(RelayLocation::get()).expect("conversion works"),
+ owner: *owner == t.sender.account_id,
+ balance: *balance == t.args.amount,
+ },
+ ]
+ );
+}
+
+fn para_to_relay_receiver_assertions(t: ParaToRelayTest) {
+ type RuntimeEvent = ::RuntimeEvent;
+ let sov_penpal_on_relay =
+ Rococo::sovereign_account_id_of(Rococo::child_location_of(PenpalA::para_id()));
+
+ Rococo::assert_ump_queue_processed(
+ true,
+ Some(PenpalA::para_id()),
+ Some(Weight::from_parts(306305000, 7_186)),
+ );
+
+ assert_expected_events!(
+ Rococo,
+ vec![
+ // Amount to reserve transfer is withdrawn from Parachain's Sovereign account
RuntimeEvent::Balances(
pallet_balances::Event::Burned { who, amount }
) => {
- who: *who == t.sender.account_id,
+ who: *who == sov_penpal_on_relay.clone().into(),
amount: *amount == t.args.amount,
},
+ RuntimeEvent::Balances(pallet_balances::Event::Minted { .. }) => {},
+ RuntimeEvent::MessageQueue(
+ pallet_message_queue::Event::Processed { success: true, .. }
+ ) => {},
]
);
}
@@ -96,6 +155,9 @@ fn para_to_system_para_receiver_assertions(t: ParaToSystemParaTest) {
let sov_penpal_on_ahr = AssetHubRococo::sovereign_account_id_of(
AssetHubRococo::sibling_location_of(PenpalA::para_id()),
);
+
+ AssetHubRococo::assert_xcmp_queue_success(None);
+
assert_expected_events!(
AssetHubRococo,
vec![
@@ -127,24 +189,124 @@ fn system_para_to_para_assets_sender_assertions(t: SystemParaToParaTest) {
RuntimeEvent::Assets(
pallet_assets::Event::Transferred { asset_id, from, to, amount }
) => {
- asset_id: *asset_id == ASSET_ID,
+ asset_id: *asset_id == RESERVABLE_ASSET_ID,
from: *from == t.sender.account_id,
to: *to == AssetHubRococo::sovereign_account_id_of(
t.args.dest.clone()
),
amount: *amount == t.args.amount,
},
+ // Native asset to pay for fees is transferred to Parachain's Sovereign account
+ RuntimeEvent::Balances(pallet_balances::Event::Minted { who, .. }) => {
+ who: *who == AssetHubRococo::sovereign_account_id_of(
+ t.args.dest.clone()
+ ),
+ },
+ // Transport fees are paid
+ RuntimeEvent::PolkadotXcm(
+ pallet_xcm::Event::FeesPaid { .. }
+ ) => {},
]
);
}
-fn system_para_to_para_assets_receiver_assertions(_: Test) {
+fn para_to_system_para_assets_sender_assertions(t: ParaToSystemParaTest) {
type RuntimeEvent = ::RuntimeEvent;
+ let system_para_native_asset_location =
+ v3::Location::try_from(RelayLocation::get()).expect("conversion works");
+ let reservable_asset_location =
+ v3::Location::try_from(PenpalLocalReservableFromAssetHub::get()).expect("conversion works");
+ PenpalA::assert_xcm_pallet_attempted_complete(Some(Weight::from_parts(864_610_000, 8799)));
assert_expected_events!(
PenpalA,
vec![
- RuntimeEvent::Balances(pallet_balances::Event::Minted { .. }) => {},
- RuntimeEvent::Assets(pallet_assets::Event::Issued { .. }) => {},
+ // Fees amount to reserve transfer is burned from Parachains's sender account
+ RuntimeEvent::ForeignAssets(
+ pallet_assets::Event::Burned { asset_id, owner, .. }
+ ) => {
+ asset_id: *asset_id == system_para_native_asset_location,
+ owner: *owner == t.sender.account_id,
+ },
+ // Amount to reserve transfer is burned from Parachains's sender account
+ RuntimeEvent::ForeignAssets(
+ pallet_assets::Event::Burned { asset_id, owner, balance }
+ ) => {
+ asset_id: *asset_id == reservable_asset_location,
+ owner: *owner == t.sender.account_id,
+ balance: *balance == t.args.amount,
+ },
+ // Transport fees are paid
+ RuntimeEvent::PolkadotXcm(
+ pallet_xcm::Event::FeesPaid { .. }
+ ) => {},
+ ]
+ );
+}
+
+fn system_para_to_para_assets_receiver_assertions(t: SystemParaToParaTest) {
+ type RuntimeEvent = ::RuntimeEvent;
+ let system_para_asset_location =
+ v3::Location::try_from(PenpalLocalReservableFromAssetHub::get()).expect("conversion works");
+ PenpalA::assert_xcmp_queue_success(None);
+ assert_expected_events!(
+ PenpalA,
+ vec![
+ RuntimeEvent::ForeignAssets(pallet_assets::Event::Issued { asset_id, owner, .. }) => {
+ asset_id: *asset_id == v3::Location::try_from(RelayLocation::get()).expect("conversion works"),
+ owner: *owner == t.receiver.account_id,
+ },
+ RuntimeEvent::ForeignAssets(pallet_assets::Event::Issued { asset_id, owner, amount }) => {
+ asset_id: *asset_id == system_para_asset_location,
+ owner: *owner == t.receiver.account_id,
+ amount: *amount == t.args.amount,
+ },
+ ]
+ );
+}
+
+fn para_to_system_para_assets_receiver_assertions(t: ParaToSystemParaTest) {
+ type RuntimeEvent = ::RuntimeEvent;
+ let sov_penpal_on_ahr = AssetHubRococo::sovereign_account_id_of(
+ AssetHubRococo::sibling_location_of(PenpalA::para_id()),
+ );
+ AssetHubRococo::assert_xcmp_queue_success(None);
+ assert_expected_events!(
+ AssetHubRococo,
+ vec![
+ // Amount to reserve transfer is burned from Parachain's Sovereign account
+ RuntimeEvent::Assets(pallet_assets::Event::Burned { asset_id, owner, balance }) => {
+ asset_id: *asset_id == RESERVABLE_ASSET_ID,
+ owner: *owner == sov_penpal_on_ahr,
+ balance: *balance == t.args.amount,
+ },
+ // Fee amount is burned from Parachain's Sovereign account
+ RuntimeEvent::Balances(pallet_balances::Event::Burned { who, .. }) => {
+ who: *who == sov_penpal_on_ahr,
+ },
+ // Amount to reserve transfer is issued for beneficiary
+ RuntimeEvent::Assets(pallet_assets::Event::Issued { asset_id, owner, amount }) => {
+ asset_id: *asset_id == RESERVABLE_ASSET_ID,
+ owner: *owner == t.receiver.account_id,
+ amount: *amount == t.args.amount,
+ },
+ // Remaining fee amount is minted for for beneficiary
+ RuntimeEvent::Balances(pallet_balances::Event::Minted { who, .. }) => {
+ who: *who == t.receiver.account_id,
+ },
+ ]
+ );
+}
+
+fn relay_to_para_assets_receiver_assertions(t: RelayToParaTest) {
+ type RuntimeEvent = ::RuntimeEvent;
+
+ assert_expected_events!(
+ PenpalA,
+ vec![
+ RuntimeEvent::ForeignAssets(pallet_assets::Event::Issued { asset_id, owner, .. }) => {
+ asset_id: *asset_id == v3::Location::try_from(RelayLocation::get()).expect("conversion works"),
+ owner: *owner == t.receiver.account_id,
+ },
RuntimeEvent::MessageQueue(
pallet_message_queue::Event::Processed { success: true, .. }
) => {},
@@ -152,33 +314,38 @@ fn system_para_to_para_assets_receiver_assertions(_: Test) {
);
}
-fn para_to_para_sender_assertions(t: ParaToParaTest) {
+fn para_to_para_through_relay_sender_assertions(t: ParaToParaThroughRelayTest) {
type RuntimeEvent = ::RuntimeEvent;
+
+ let relay_asset_location =
+ v3::Location::try_from(RelayLocation::get()).expect("conversion works");
+
PenpalA::assert_xcm_pallet_attempted_complete(None);
+ // XCM sent to relay reserve
+ PenpalA::assert_parachain_system_ump_sent();
+
assert_expected_events!(
PenpalA,
vec![
// Amount to reserve transfer is transferred to Parachain's Sovereign account
- RuntimeEvent::Balances(
- pallet_balances::Event::Burned { who, amount }
+ RuntimeEvent::ForeignAssets(
+ pallet_assets::Event::Burned { asset_id, owner, balance },
) => {
- who: *who == t.sender.account_id,
- amount: *amount == t.args.amount,
+ asset_id: *asset_id == relay_asset_location,
+ owner: *owner == t.sender.account_id,
+ balance: *balance == t.args.amount,
},
- // XCM sent to relay reserve
- RuntimeEvent::ParachainSystem(
- cumulus_pallet_parachain_system::Event::UpwardMessageSent { .. }
- ) => {},
]
);
}
-fn para_to_para_relay_hop_assertions(t: ParaToParaTest) {
+fn para_to_para_relay_hop_assertions(t: ParaToParaThroughRelayTest) {
type RuntimeEvent = ::RuntimeEvent;
let sov_penpal_a_on_rococo =
Rococo::sovereign_account_id_of(Rococo::child_location_of(PenpalA::para_id()));
let sov_penpal_b_on_rococo =
Rococo::sovereign_account_id_of(Rococo::child_location_of(PenpalB::para_id()));
+
assert_expected_events!(
Rococo,
vec![
@@ -202,15 +369,20 @@ fn para_to_para_relay_hop_assertions(t: ParaToParaTest) {
);
}
-fn para_to_para_receiver_assertions(_: ParaToParaTest) {
+fn para_to_para_through_relay_receiver_assertions(t: ParaToParaThroughRelayTest) {
type RuntimeEvent = ::RuntimeEvent;
+ let relay_asset_location =
+ v3::Location::try_from(RelayLocation::get()).expect("conversion works");
+
+ PenpalB::assert_xcmp_queue_success(None);
+
assert_expected_events!(
PenpalB,
vec![
- RuntimeEvent::Balances(pallet_balances::Event::Minted { .. }) => {},
- RuntimeEvent::MessageQueue(
- pallet_message_queue::Event::Processed { success: true, .. }
- ) => {},
+ RuntimeEvent::ForeignAssets(pallet_assets::Event::Issued { asset_id, owner, .. }) => {
+ asset_id: *asset_id == relay_asset_location,
+ owner: *owner == t.receiver.account_id,
+ },
]
);
}
@@ -226,6 +398,17 @@ fn relay_to_para_reserve_transfer_assets(t: RelayToParaTest) -> DispatchResult {
)
}
+fn para_to_relay_reserve_transfer_assets(t: ParaToRelayTest) -> DispatchResult {
+ ::PolkadotXcm::limited_reserve_transfer_assets(
+ t.signed_origin,
+ bx!(t.args.dest.into()),
+ bx!(t.args.beneficiary.into()),
+ bx!(t.args.assets.into()),
+ t.args.fee_asset_item,
+ t.args.weight_limit,
+ )
+}
+
fn system_para_to_para_reserve_transfer_assets(t: SystemParaToParaTest) -> DispatchResult {
::PolkadotXcm::limited_reserve_transfer_assets(
t.signed_origin,
@@ -248,7 +431,9 @@ fn para_to_system_para_reserve_transfer_assets(t: ParaToSystemParaTest) -> Dispa
)
}
-fn para_to_para_limited_reserve_transfer_assets(t: ParaToParaTest) -> DispatchResult {
+fn para_to_para_through_relay_limited_reserve_transfer_assets(
+ t: ParaToParaThroughRelayTest,
+) -> DispatchResult {
::PolkadotXcm::limited_reserve_transfer_assets(
t.signed_origin,
bx!(t.args.dest.into()),
@@ -262,6 +447,7 @@ fn para_to_para_limited_reserve_transfer_assets(t: ParaToParaTest) -> DispatchRe
/// Reserve Transfers of native asset from Relay Chain to the System Parachain shouldn't work
#[test]
fn reserve_transfer_native_asset_from_relay_to_system_para_fails() {
+ // Init values for Relay Chain
let signed_origin = ::RuntimeOrigin::signed(RococoSender::get().into());
let destination = Rococo::child_location_of(AssetHubRococo::para_id());
let beneficiary: Location =
@@ -328,135 +514,298 @@ fn reserve_transfer_native_asset_from_system_para_to_relay_fails() {
});
}
+// =========================================================================
+// ========= Reserve Transfers - Native Asset - Relay<>Parachain ===========
+// =========================================================================
/// Reserve Transfers of native asset from Relay to Parachain should work
#[test]
fn reserve_transfer_native_asset_from_relay_to_para() {
// Init values for Relay
let destination = Rococo::child_location_of(PenpalA::para_id());
- let beneficiary_id = PenpalAReceiver::get();
+ let sender = RococoSender::get();
let amount_to_send: Balance = ROCOCO_ED * 1000;
+ let assets: Assets = (Here, amount_to_send).into();
+
+ // Init values fot Parachain
+ let relay_native_asset_location =
+ v3::Location::try_from(RelayLocation::get()).expect("conversion works");
+ let receiver = PenpalAReceiver::get();
+ // Init Test
let test_args = TestContext {
- sender: RococoSender::get(),
- receiver: PenpalAReceiver::get(),
- args: TestArgs::new_relay(destination, beneficiary_id, amount_to_send),
+ sender,
+ receiver: receiver.clone(),
+ args: TestArgs::new_relay(destination.clone(), receiver.clone(), amount_to_send),
};
-
let mut test = RelayToParaTest::new(test_args);
+ // Query initial balances
let sender_balance_before = test.sender.balance;
- let receiver_balance_before = test.receiver.balance;
+ let receiver_assets_before = PenpalA::execute_with(|| {
+ type ForeignAssets = ::ForeignAssets;
+ >::balance(relay_native_asset_location.into(), &receiver)
+ });
+ // Set assertions and dispatchables
test.set_assertion::(relay_to_para_sender_assertions);
- test.set_assertion::(para_receiver_assertions);
+ test.set_assertion::(relay_to_para_assets_receiver_assertions);
test.set_dispatchable::(relay_to_para_reserve_transfer_assets);
test.assert();
+ // Calculate delivery fees
let delivery_fees = Rococo::execute_with(|| {
+ let reanchored_assets =
+ assets.reanchored(&destination, &RococoUniversalLocation::get()).unwrap();
xcm_helpers::transfer_assets_delivery_fees::<
::XcmSender,
- >(test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest)
+ >(reanchored_assets, 0, test.args.weight_limit, test.args.beneficiary, test.args.dest)
});
+ // Query final balances
let sender_balance_after = test.sender.balance;
- let receiver_balance_after = test.receiver.balance;
+ let receiver_assets_after = PenpalA::execute_with(|| {
+ type ForeignAssets = ::ForeignAssets;
+ >::balance(relay_native_asset_location.into(), &receiver)
+ });
// Sender's balance is reduced
assert_eq!(sender_balance_before - amount_to_send - delivery_fees, sender_balance_after);
- // Receiver's balance is increased
+ // Receiver's asset balance is increased
+ assert!(receiver_assets_after > receiver_assets_before);
+ // Receiver's asset balance increased by `amount_to_send - delivery_fees - bought_execution`;
+ // `delivery_fees` might be paid from transfer or JIT, also `bought_execution` is unknown but
+ // should be non-zero
+ assert!(receiver_assets_after < receiver_assets_before + amount_to_send);
+}
+
+/// Reserve Transfers of native asset from Parachain to Relay should work
+#[test]
+fn reserve_transfer_native_asset_from_para_to_relay() {
+ // Init values for Parachain
+ let destination = PenpalA::parent_location();
+ let sender = PenpalASender::get();
+ let amount_to_send: Balance = ROCOCO_ED * 1000;
+ let assets: Assets = (Parent, amount_to_send).into();
+ let asset_owner = PenpalAssetOwner::get();
+ let relay_native_asset_location =
+ v3::Location::try_from(RelayLocation::get()).expect("conversion works");
+
+ // fund Parachain's sender account
+ PenpalA::mint_foreign_asset(
+ ::RuntimeOrigin::signed(asset_owner),
+ relay_native_asset_location,
+ sender.clone(),
+ amount_to_send,
+ );
+
+ // Init values for Relay
+ let receiver = RococoReceiver::get();
+ let penpal_location_as_seen_by_relay = Rococo::child_location_of(PenpalA::para_id());
+ let sov_penpal_on_relay = Rococo::sovereign_account_id_of(penpal_location_as_seen_by_relay);
+
+ // fund Parachain's SA on Relay with the native tokens held in reserve
+ Rococo::fund_accounts(vec![(sov_penpal_on_relay.into(), amount_to_send * 2)]);
+
+ // Init Test
+ let test_args = TestContext {
+ sender: sender.clone(),
+ receiver: receiver.clone(),
+ args: TestArgs::new_para(
+ destination.clone(),
+ receiver,
+ amount_to_send,
+ assets.clone(),
+ None,
+ 0,
+ ),
+ };
+ let mut test = ParaToRelayTest::new(test_args);
+
+ // Query initial balances
+ let sender_assets_before = PenpalA::execute_with(|| {
+ type ForeignAssets = ::ForeignAssets;
+ >::balance(relay_native_asset_location.into(), &sender)
+ });
+ let receiver_balance_before = test.receiver.balance;
+
+ // Set assertions and dispatchables
+ test.set_assertion::(para_to_relay_sender_assertions);
+ test.set_assertion::(para_to_relay_receiver_assertions);
+ test.set_dispatchable::(para_to_relay_reserve_transfer_assets);
+ test.assert();
+
+ // Calculate delivery fees
+ let delivery_fees = PenpalA::execute_with(|| {
+ let reanchored_assets =
+ assets.reanchored(&destination, &PenpalUniversalLocation::get()).unwrap();
+ xcm_helpers::transfer_assets_delivery_fees::<
+ ::XcmSender,
+ >(reanchored_assets, 0, test.args.weight_limit, test.args.beneficiary, test.args.dest)
+ });
+
+ // Query final balances
+ let sender_assets_after = PenpalA::execute_with(|| {
+ type ForeignAssets = ::ForeignAssets;
+ >::balance(relay_native_asset_location.into(), &sender)
+ });
+ let receiver_balance_after = test.receiver.balance;
+
+ // Sender's balance is reduced
+ assert_eq!(sender_assets_before - amount_to_send - delivery_fees, sender_assets_after);
+ // Receiver's asset balance is increased
assert!(receiver_balance_after > receiver_balance_before);
- // Receiver's balance increased by `amount_to_send - delivery_fees - bought_execution`;
+ // Receiver's asset balance increased by `amount_to_send - delivery_fees - bought_execution`;
// `delivery_fees` might be paid from transfer or JIT, also `bought_execution` is unknown but
// should be non-zero
assert!(receiver_balance_after < receiver_balance_before + amount_to_send);
}
+// =========================================================================
+// ======= Reserve Transfers - Native Asset - AssetHub<>Parachain ==========
+// =========================================================================
/// Reserve Transfers of native asset from System Parachain to Parachain should work
#[test]
fn reserve_transfer_native_asset_from_system_para_to_para() {
// Init values for System Parachain
let destination = AssetHubRococo::sibling_location_of(PenpalA::para_id());
- let beneficiary_id = PenpalAReceiver::get();
- let amount_to_send: Balance = ASSET_HUB_ROCOCO_ED * 1000;
- let assets = (Parent, amount_to_send).into();
+ let sender = AssetHubRococoSender::get();
+ let amount_to_send: Balance = ASSET_HUB_ROCOCO_ED * 10000;
+ let assets: Assets = (Parent, amount_to_send).into();
+
+ // Init values for Parachain
+ let system_para_native_asset_location =
+ v3::Location::try_from(RelayLocation::get()).expect("conversion works");
+ let receiver = PenpalAReceiver::get();
+ // Init Test
let test_args = TestContext {
- sender: AssetHubRococoSender::get(),
- receiver: PenpalAReceiver::get(),
- args: TestArgs::new_para(destination, beneficiary_id, amount_to_send, assets, None, 0),
+ sender,
+ receiver: receiver.clone(),
+ args: TestArgs::new_para(
+ destination.clone(),
+ receiver.clone(),
+ amount_to_send,
+ assets.clone(),
+ None,
+ 0,
+ ),
};
-
let mut test = SystemParaToParaTest::new(test_args);
+ // Query initial balances
let sender_balance_before = test.sender.balance;
- let receiver_balance_before = test.receiver.balance;
+ let receiver_assets_before = PenpalA::execute_with(|| {
+ type ForeignAssets = ::ForeignAssets;
+ >::balance(system_para_native_asset_location.into(), &receiver)
+ });
+ // Set assertions and dispatchables
test.set_assertion::(system_para_to_para_sender_assertions);
- test.set_assertion::(para_receiver_assertions);
+ test.set_assertion::(system_para_to_para_receiver_assertions);
test.set_dispatchable::(system_para_to_para_reserve_transfer_assets);
test.assert();
- let sender_balance_after = test.sender.balance;
- let receiver_balance_after = test.receiver.balance;
-
+ // Calculate delivery fees
let delivery_fees = AssetHubRococo::execute_with(|| {
+ let reanchored_assets = assets
+ .reanchored(&destination, &AssetHubRococoUniversalLocation::get())
+ .unwrap();
xcm_helpers::transfer_assets_delivery_fees::<
::XcmSender,
- >(test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest)
+ >(reanchored_assets, 0, test.args.weight_limit, test.args.beneficiary, test.args.dest)
+ });
+
+ // Query final balances
+ let sender_balance_after = test.sender.balance;
+ let receiver_assets_after = PenpalA::execute_with(|| {
+ type ForeignAssets = ::ForeignAssets;
+ >::balance(system_para_native_asset_location, &receiver)
});
// Sender's balance is reduced
assert_eq!(sender_balance_before - amount_to_send - delivery_fees, sender_balance_after);
- // Receiver's balance is increased
- assert!(receiver_balance_after > receiver_balance_before);
- // Receiver's balance increased by `amount_to_send - delivery_fees - bought_execution`;
+ // Receiver's assets is increased
+ assert!(receiver_assets_after > receiver_assets_before);
+ // Receiver's assets increased by `amount_to_send - delivery_fees - bought_execution`;
// `delivery_fees` might be paid from transfer or JIT, also `bought_execution` is unknown but
// should be non-zero
- assert!(receiver_balance_after < receiver_balance_before + amount_to_send);
+ assert!(receiver_assets_after < receiver_assets_before + amount_to_send);
}
/// Reserve Transfers of native asset from Parachain to System Parachain should work
#[test]
fn reserve_transfer_native_asset_from_para_to_system_para() {
- // Init values for Penpal Parachain
+ // Init values for Parachain
let destination = PenpalA::sibling_location_of(AssetHubRococo::para_id());
- let beneficiary_id = AssetHubRococoReceiver::get();
+ let sender = PenpalASender::get();
let amount_to_send: Balance = ASSET_HUB_ROCOCO_ED * 1000;
- let assets = (Parent, amount_to_send).into();
+ let assets: Assets = (Parent, amount_to_send).into();
+ let system_para_native_asset_location =
+ v3::Location::try_from(RelayLocation::get()).expect("conversion works");
+ let asset_owner = PenpalAssetOwner::get();
+
+ // fund Parachain's sender account
+ PenpalA::mint_foreign_asset(
+ ::RuntimeOrigin::signed(asset_owner),
+ system_para_native_asset_location,
+ sender.clone(),
+ amount_to_send,
+ );
+ // Init values for System Parachain
+ let receiver = AssetHubRococoReceiver::get();
+ let penpal_location_as_seen_by_ahr = AssetHubRococo::sibling_location_of(PenpalA::para_id());
+ let sov_penpal_on_ahr = AssetHubRococo::sovereign_account_id_of(penpal_location_as_seen_by_ahr);
+
+ // fund Parachain's SA on System Parachain with the native tokens held in reserve
+ AssetHubRococo::fund_accounts(vec![(sov_penpal_on_ahr.into(), amount_to_send * 2)]);
+
+ // Init Test
let test_args = TestContext {
- sender: PenpalASender::get(),
- receiver: AssetHubRococoReceiver::get(),
- args: TestArgs::new_para(destination, beneficiary_id, amount_to_send, assets, None, 0),
+ sender: sender.clone(),
+ receiver: receiver.clone(),
+ args: TestArgs::new_para(
+ destination.clone(),
+ receiver.clone(),
+ amount_to_send,
+ assets.clone(),
+ None,
+ 0,
+ ),
};
-
let mut test = ParaToSystemParaTest::new(test_args);
- let sender_balance_before = test.sender.balance;
+ // Query initial balances
+ let sender_assets_before = PenpalA::execute_with(|| {
+ type ForeignAssets = ::ForeignAssets;
+ >::balance(system_para_native_asset_location, &sender)
+ });
let receiver_balance_before = test.receiver.balance;
- let penpal_location_as_seen_by_ahr = AssetHubRococo::sibling_location_of(PenpalA::para_id());
- let sov_penpal_on_ahr = AssetHubRococo::sovereign_account_id_of(penpal_location_as_seen_by_ahr);
-
- // fund the Penpal's SA on AHR with the native tokens held in reserve
- AssetHubRococo::fund_accounts(vec![(sov_penpal_on_ahr.into(), amount_to_send * 2)]);
-
+ // Set assertions and dispatchables
test.set_assertion::(para_to_system_para_sender_assertions);
test.set_assertion::(para_to_system_para_receiver_assertions);
test.set_dispatchable::(para_to_system_para_reserve_transfer_assets);
test.assert();
- let sender_balance_after = test.sender.balance;
- let receiver_balance_after = test.receiver.balance;
-
+ // Calculate delivery fees
let delivery_fees = PenpalA::execute_with(|| {
+ let reanchored_assets =
+ assets.reanchored(&destination, &PenpalUniversalLocation::get()).unwrap();
xcm_helpers::transfer_assets_delivery_fees::<
::XcmSender,
- >(test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest)
+ >(reanchored_assets, 0, test.args.weight_limit, test.args.beneficiary, test.args.dest)
});
+ // Query final balances
+ let sender_assets_after = PenpalA::execute_with(|| {
+ type ForeignAssets = ::ForeignAssets;
+ >::balance(system_para_native_asset_location, &sender)
+ });
+ let receiver_balance_after = test.receiver.balance;
+
// Sender's balance is reduced
- assert_eq!(sender_balance_before - amount_to_send - delivery_fees, sender_balance_after);
+ assert_eq!(sender_assets_before - amount_to_send - delivery_fees, sender_assets_after);
// Receiver's balance is increased
assert!(receiver_balance_after > receiver_balance_before);
// Receiver's balance increased by `amount_to_send - delivery_fees - bought_execution`;
@@ -465,36 +814,27 @@ fn reserve_transfer_native_asset_from_para_to_system_para() {
assert!(receiver_balance_after < receiver_balance_before + amount_to_send);
}
+// =========================================================================
+// ======= Reserve Transfers - Non-system Asset - AssetHub<>Parachain ======
+// =========================================================================
/// Reserve Transfers of a local asset and native asset from System Parachain to Parachain should
/// work
#[test]
fn reserve_transfer_assets_from_system_para_to_para() {
- // Force create asset on AssetHubRococo and PenpalA from Relay Chain
- AssetHubRococo::force_create_and_mint_asset(
- ASSET_ID,
- ASSET_MIN_BALANCE,
- false,
- AssetHubRococoSender::get(),
- Some(Weight::from_parts(1_019_445_000, 200_000)),
- ASSET_MIN_BALANCE * 1_000_000,
- );
- PenpalA::force_create_and_mint_asset(
- ASSET_ID,
- ASSET_MIN_BALANCE,
- false,
- PenpalASender::get(),
- None,
- 0,
- );
-
// Init values for System Parachain
let destination = AssetHubRococo::sibling_location_of(PenpalA::para_id());
- let beneficiary_id = PenpalAReceiver::get();
- let fee_amount_to_send = ASSET_HUB_ROCOCO_ED * 1000;
- let asset_amount_to_send = ASSET_MIN_BALANCE * 1000;
+ let sov_penpal_on_ahr = AssetHubRococo::sovereign_account_id_of(destination.clone());
+ let sender = AssetHubRococoSender::get();
+ let fee_amount_to_send = ASSET_HUB_ROCOCO_ED * 10000;
+ let asset_amount_to_send = PENPAL_ED * 10000;
+ let asset_owner = AssetHubRococoAssetOwner::get();
+ let asset_owner_signer = ::RuntimeOrigin::signed(asset_owner.clone());
let assets: Assets = vec![
(Parent, fee_amount_to_send).into(),
- ([PalletInstance(ASSETS_PALLET_ID), GeneralIndex(ASSET_ID.into())], asset_amount_to_send)
+ (
+ [PalletInstance(ASSETS_PALLET_ID), GeneralIndex(RESERVABLE_ASSET_ID.into())],
+ asset_amount_to_send,
+ )
.into(),
]
.into();
@@ -503,49 +843,211 @@ fn reserve_transfer_assets_from_system_para_to_para() {
.iter()
.position(|r| r == &(Parent, fee_amount_to_send).into())
.unwrap() as u32;
+ AssetHubRococo::mint_asset(
+ asset_owner_signer,
+ RESERVABLE_ASSET_ID,
+ asset_owner,
+ asset_amount_to_send * 2,
+ );
+ // Create SA-of-Penpal-on-AHR with ED.
+ AssetHubRococo::fund_accounts(vec![(sov_penpal_on_ahr.into(), ASSET_HUB_ROCOCO_ED)]);
+
+ // Init values for Parachain
+ let receiver = PenpalAReceiver::get();
+ let system_para_native_asset_location =
+ v3::Location::try_from(RelayLocation::get()).expect("conversion works");
+ let system_para_foreign_asset_location =
+ v3::Location::try_from(PenpalLocalReservableFromAssetHub::get()).expect("conversion works");
+
+ // Init Test
let para_test_args = TestContext {
- sender: AssetHubRococoSender::get(),
- receiver: PenpalAReceiver::get(),
+ sender: sender.clone(),
+ receiver: receiver.clone(),
args: TestArgs::new_para(
destination,
- beneficiary_id,
+ receiver.clone(),
asset_amount_to_send,
assets,
None,
fee_asset_index,
),
};
-
let mut test = SystemParaToParaTest::new(para_test_args);
- // Create SA-of-Penpal-on-AHR with ED.
- let penpal_location = AssetHubRococo::sibling_location_of(PenpalA::para_id());
- let sov_penpal_on_ahr = AssetHubRococo::sovereign_account_id_of(penpal_location);
- AssetHubRococo::fund_accounts(vec![(sov_penpal_on_ahr.into(), ROCOCO_ED)]);
-
+ // Query initial balances
let sender_balance_before = test.sender.balance;
- let receiver_balance_before = test.receiver.balance;
-
let sender_assets_before = AssetHubRococo::execute_with(|| {
type Assets = ::Assets;
- >::balance(ASSET_ID, &AssetHubRococoSender::get())
+ >::balance(RESERVABLE_ASSET_ID, &sender)
});
- let receiver_assets_before = PenpalA::execute_with(|| {
- type Assets = ::Assets;
- >::balance(ASSET_ID, &PenpalAReceiver::get())
+ let receiver_system_native_assets_before = PenpalA::execute_with(|| {
+ type ForeignAssets = ::ForeignAssets;
+ >::balance(system_para_native_asset_location, &receiver)
+ });
+ let receiver_foreign_assets_before = PenpalA::execute_with(|| {
+ type ForeignAssets = ::ForeignAssets;
+ >::balance(system_para_foreign_asset_location, &receiver)
});
+ // Set assertions and dispatchables
test.set_assertion::(system_para_to_para_assets_sender_assertions);
test.set_assertion::(system_para_to_para_assets_receiver_assertions);
test.set_dispatchable::(system_para_to_para_reserve_transfer_assets);
test.assert();
+ // Query final balances
let sender_balance_after = test.sender.balance;
- let receiver_balance_after = test.receiver.balance;
-
+ let sender_assets_after = AssetHubRococo::execute_with(|| {
+ type Assets = ::Assets;
+ >::balance(RESERVABLE_ASSET_ID, &sender)
+ });
+ let receiver_system_native_assets_after = PenpalA::execute_with(|| {
+ type ForeignAssets = ::ForeignAssets;
+ >::balance(system_para_native_asset_location, &receiver)
+ });
+ let receiver_foreign_assets_after = PenpalA::execute_with(|| {
+ type ForeignAssets = ::ForeignAssets;
+ >::balance(system_para_foreign_asset_location, &receiver)
+ });
// Sender's balance is reduced
assert!(sender_balance_after < sender_balance_before);
+ // Receiver's foreign asset balance is increased
+ assert!(receiver_foreign_assets_after > receiver_foreign_assets_before);
+ // Receiver's system asset balance increased by `amount_to_send - delivery_fees -
+ // bought_execution`; `delivery_fees` might be paid from transfer or JIT, also
+ // `bought_execution` is unknown but should be non-zero
+ assert!(
+ receiver_system_native_assets_after <
+ receiver_system_native_assets_before + fee_amount_to_send
+ );
+
+ // Sender's asset balance is reduced by exact amount
+ assert_eq!(sender_assets_before - asset_amount_to_send, sender_assets_after);
+ // Receiver's foreign asset balance is increased by exact amount
+ assert_eq!(
+ receiver_foreign_assets_after,
+ receiver_foreign_assets_before + asset_amount_to_send
+ );
+}
+
+/// Reserve Transfers of a foreign asset and native asset from Parachain to System Para should
+/// work
+#[test]
+fn reserve_transfer_assets_from_para_to_system_para() {
+ // Init values for Parachain
+ let destination = PenpalA::sibling_location_of(AssetHubRococo::para_id());
+ let sender = PenpalASender::get();
+ let fee_amount_to_send = ASSET_HUB_ROCOCO_ED * 10000;
+ let asset_amount_to_send = ASSET_HUB_ROCOCO_ED * 10000;
+ let penpal_asset_owner = PenpalAssetOwner::get();
+ let penpal_asset_owner_signer = ::RuntimeOrigin::signed(penpal_asset_owner);
+ let asset_location_on_penpal =
+ v3::Location::try_from(PenpalLocalReservableFromAssetHub::get()).expect("conversion works");
+ let asset_location_on_penpal_latest: Location = asset_location_on_penpal.try_into().unwrap();
+ let system_asset_location_on_penpal =
+ v3::Location::try_from(RelayLocation::get()).expect("conversion works");
+ let assets: Assets = vec![
+ (Parent, fee_amount_to_send).into(),
+ (asset_location_on_penpal_latest, asset_amount_to_send).into(),
+ ]
+ .into();
+ let fee_asset_index = assets
+ .inner()
+ .iter()
+ .position(|r| r == &(Parent, fee_amount_to_send).into())
+ .unwrap() as u32;
+ // Fund Parachain's sender account with some foreign assets
+ PenpalA::mint_foreign_asset(
+ penpal_asset_owner_signer.clone(),
+ asset_location_on_penpal,
+ sender.clone(),
+ asset_amount_to_send * 2,
+ );
+ // Fund Parachain's sender account with some system assets
+ PenpalA::mint_foreign_asset(
+ penpal_asset_owner_signer,
+ system_asset_location_on_penpal,
+ sender.clone(),
+ fee_amount_to_send * 2,
+ );
+
+ // Init values for System Parachain
+ let receiver = AssetHubRococoReceiver::get();
+ let penpal_location_as_seen_by_ahr = AssetHubRococo::sibling_location_of(PenpalA::para_id());
+ let sov_penpal_on_ahr = AssetHubRococo::sovereign_account_id_of(penpal_location_as_seen_by_ahr);
+ let system_para_native_asset_location =
+ v3::Location::try_from(RelayLocation::get()).expect("conversion works");
+ let system_para_foreign_asset_location =
+ v3::Location::try_from(PenpalLocalReservableFromAssetHub::get()).expect("conversion works");
+ let ah_asset_owner = AssetHubRococoAssetOwner::get();
+ let ah_asset_owner_signer = ::RuntimeOrigin::signed(ah_asset_owner);
+
+ // Fund SA-of-Penpal-on-AHR to be able to pay for the fees.
+ AssetHubRococo::fund_accounts(vec![(
+ sov_penpal_on_ahr.clone().into(),
+ ASSET_HUB_ROCOCO_ED * 10000000,
+ )]);
+ // Fund SA-of-Penpal-on-AHR to be able to pay for the sent amount.
+ AssetHubRococo::mint_asset(
+ ah_asset_owner_signer,
+ RESERVABLE_ASSET_ID,
+ sov_penpal_on_ahr,
+ asset_amount_to_send * 2,
+ );
+
+ // Init Test
+ let para_test_args = TestContext {
+ sender: sender.clone(),
+ receiver: receiver.clone(),
+ args: TestArgs::new_para(
+ destination,
+ receiver.clone(),
+ asset_amount_to_send,
+ assets,
+ None,
+ fee_asset_index,
+ ),
+ };
+ let mut test = ParaToSystemParaTest::new(para_test_args);
+
+ // Query initial balances
+ let sender_system_assets_before = PenpalA::execute_with(|| {
+ type ForeignAssets = ::ForeignAssets;
+ >::balance(system_para_native_asset_location, &sender)
+ });
+ let sender_foreign_assets_before = PenpalA::execute_with(|| {
+ type ForeignAssets = ::ForeignAssets;
+ >::balance(system_para_foreign_asset_location, &sender)
+ });
+ let receiver_balance_before = test.receiver.balance;
+ let receiver_assets_before = AssetHubRococo::execute_with(|| {
+ type Assets = ::Assets;
+ >::balance(RESERVABLE_ASSET_ID, &receiver)
+ });
+
+ // Set assertions and dispatchables
+ test.set_assertion::(para_to_system_para_assets_sender_assertions);
+ test.set_assertion::(para_to_system_para_assets_receiver_assertions);
+ test.set_dispatchable::(para_to_system_para_reserve_transfer_assets);
+ test.assert();
+
+ // Query final balances
+ let sender_system_assets_after = PenpalA::execute_with(|| {
+ type ForeignAssets = ::ForeignAssets;
+ >::balance(system_para_native_asset_location, &sender)
+ });
+ let sender_foreign_assets_after = PenpalA::execute_with(|| {
+ type ForeignAssets = ::ForeignAssets;
+ >::balance(system_para_foreign_asset_location, &sender)
+ });
+ let receiver_balance_after = test.receiver.balance;
+ let receiver_assets_after = AssetHubRococo::execute_with(|| {
+ type Assets = ::Assets;
+ >::balance(RESERVABLE_ASSET_ID, &receiver)
+ });
+ // Sender's system asset balance is reduced
+ assert!(sender_system_assets_after < sender_system_assets_before);
// Receiver's balance is increased
assert!(receiver_balance_after > receiver_balance_before);
// Receiver's balance increased by `amount_to_send - delivery_fees - bought_execution`;
@@ -553,65 +1055,88 @@ fn reserve_transfer_assets_from_system_para_to_para() {
// should be non-zero
assert!(receiver_balance_after < receiver_balance_before + fee_amount_to_send);
- let sender_assets_after = AssetHubRococo::execute_with(|| {
- type Assets = ::Assets;
- >::balance(ASSET_ID, &AssetHubRococoSender::get())
- });
- let receiver_assets_after = PenpalA::execute_with(|| {
- type Assets = ::Assets;
- >::balance(ASSET_ID, &PenpalAReceiver::get())
- });
-
- // Sender's balance is reduced by exact amount
- assert_eq!(sender_assets_before - asset_amount_to_send, sender_assets_after);
- // Receiver's balance is increased by exact amount
+ // Sender's asset balance is reduced by exact amount
+ assert_eq!(sender_foreign_assets_before - asset_amount_to_send, sender_foreign_assets_after);
+ // Receiver's foreign asset balance is increased by exact amount
assert_eq!(receiver_assets_after, receiver_assets_before + asset_amount_to_send);
}
+// =========================================================================
+// ===== Reserve Transfers - Native Asset - Parachain<>Relay<>Parachain ====
+// =========================================================================
/// Reserve Transfers of native asset from Parachain to Parachain (through Relay reserve) should
/// work
#[test]
-fn reserve_transfer_native_asset_from_para_to_para() {
- // Init values for Penpal Parachain
+fn reserve_transfer_native_asset_from_para_to_para_trough_relay() {
+ // Init values for Parachain Origin
let destination = PenpalA::sibling_location_of(PenpalB::para_id());
- let beneficiary_id = PenpalBReceiver::get();
- let amount_to_send: Balance = ASSET_HUB_ROCOCO_ED * 10000;
+ let sender = PenpalASender::get();
+ let amount_to_send: Balance = ROCOCO_ED * 10000;
+ let asset_owner = PenpalAssetOwner::get();
let assets = (Parent, amount_to_send).into();
+ let relay_native_asset_location =
+ v3::Location::try_from(RelayLocation::get()).expect("conversion works");
+ let sender_as_seen_by_relay = Rococo::child_location_of(PenpalA::para_id());
+ let sov_of_sender_on_relay = Rococo::sovereign_account_id_of(sender_as_seen_by_relay);
- let test_args = TestContext {
- sender: PenpalASender::get(),
- receiver: PenpalBReceiver::get(),
- args: TestArgs::new_para(destination, beneficiary_id, amount_to_send, assets, None, 0),
- };
+ // fund Parachain's sender account
+ PenpalA::mint_foreign_asset(
+ ::RuntimeOrigin::signed(asset_owner),
+ relay_native_asset_location,
+ sender.clone(),
+ amount_to_send,
+ );
- let mut test = ParaToParaTest::new(test_args);
+ // fund the Parachain Origin's SA on Relay Chain with the native tokens held in reserve
+ Rococo::fund_accounts(vec![(sov_of_sender_on_relay.into(), amount_to_send * 2)]);
- let sender_balance_before = test.sender.balance;
- let receiver_balance_before = test.receiver.balance;
+ // Init values for Parachain Desitnation
+ let receiver = PenpalBReceiver::get();
- let sender_as_seen_by_relay = Rococo::child_location_of(PenpalA::para_id());
- let sov_of_sender_on_relay = Rococo::sovereign_account_id_of(sender_as_seen_by_relay);
+ // Init Test
+ let test_args = TestContext {
+ sender: sender.clone(),
+ receiver: receiver.clone(),
+ args: TestArgs::new_para(destination, receiver.clone(), amount_to_send, assets, None, 0),
+ };
+ let mut test = ParaToParaThroughRelayTest::new(test_args);
- // fund the PenpalA's SA on Rococo with the native tokens held in reserve
- Rococo::fund_accounts(vec![(sov_of_sender_on_relay.into(), amount_to_send * 2)]);
+ // Query initial balances
+ let sender_assets_before = PenpalA::execute_with(|| {
+ type ForeignAssets = ::ForeignAssets;
+ >::balance(relay_native_asset_location, &sender)
+ });
+ let receiver_assets_before = PenpalB::execute_with(|| {
+ type ForeignAssets = ::ForeignAssets;
+ >::balance(relay_native_asset_location, &receiver)
+ });
- test.set_assertion::(para_to_para_sender_assertions);
+ // Set assertions and dispatchables
+ test.set_assertion::(para_to_para_through_relay_sender_assertions);
test.set_assertion::(para_to_para_relay_hop_assertions);
- test.set_assertion::(para_to_para_receiver_assertions);
- test.set_dispatchable::(para_to_para_limited_reserve_transfer_assets);
+ test.set_assertion::(para_to_para_through_relay_receiver_assertions);
+ test.set_dispatchable::(para_to_para_through_relay_limited_reserve_transfer_assets);
test.assert();
- let sender_balance_after = test.sender.balance;
- let receiver_balance_after = test.receiver.balance;
-
+ // Calculate delivery fees
let delivery_fees = PenpalA::execute_with(|| {
xcm_helpers::transfer_assets_delivery_fees::<
::XcmSender,
>(test.args.assets.clone(), 0, test.args.weight_limit, test.args.beneficiary, test.args.dest)
});
+ // Query final balances
+ let sender_assets_after = PenpalA::execute_with(|| {
+ type ForeignAssets = ::ForeignAssets;
+ >::balance(relay_native_asset_location, &sender)
+ });
+ let receiver_assets_after = PenpalB::execute_with(|| {
+ type ForeignAssets = ::ForeignAssets;
+ >::balance(relay_native_asset_location, &receiver)
+ });
+
// Sender's balance is reduced
- assert_eq!(sender_balance_before - amount_to_send - delivery_fees, sender_balance_after);
+ assert_eq!(sender_assets_before - amount_to_send - delivery_fees, sender_assets_after);
// Receiver's balance is increased
- assert!(receiver_balance_after > receiver_balance_before);
+ assert!(receiver_assets_after > receiver_assets_before);
}
diff --git a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/send.rs b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/send.rs
index 3c9e76a34e36..364fbd0d439f 100644
--- a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/send.rs
+++ b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/send.rs
@@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-use crate::*;
+use crate::imports::*;
/// Relay Chain should be able to execute `Transact` instructions in System Parachain
/// when `OriginKind::Superuser`.
@@ -28,8 +28,95 @@ fn send_transact_as_superuser_from_relay_to_system_para_works() {
)
}
-/// Parachain should be able to send XCM paying its fee with sufficient asset
-/// in the System Parachain
+/// We tests two things here:
+/// - Parachain should be able to send XCM paying its fee with system asset in the System Parachain
+/// - Parachain should be able to create a new Foreign Asset in the System Parachain
+#[test]
+fn send_xcm_from_para_to_system_para_paying_fee_with_system_assets_works() {
+ let para_sovereign_account = AssetHubRococo::sovereign_account_id_of(
+ AssetHubRococo::sibling_location_of(PenpalA::para_id()),
+ );
+ let asset_location_on_penpal = v3::Location::new(
+ 0,
+ [
+ v3::Junction::PalletInstance(ASSETS_PALLET_ID),
+ v3::Junction::GeneralIndex(ASSET_ID.into()),
+ ],
+ );
+ let foreign_asset_at_asset_hub =
+ v3::Location::new(1, [v3::Junction::Parachain(PenpalA::para_id().into())])
+ .appended_with(asset_location_on_penpal)
+ .unwrap();
+
+ // Encoded `create_asset` call to be executed in AssetHub
+ let call = AssetHubRococo::create_foreign_asset_call(
+ foreign_asset_at_asset_hub,
+ ASSET_MIN_BALANCE,
+ para_sovereign_account.clone(),
+ );
+
+ let origin_kind = OriginKind::Xcm;
+ let fee_amount = ASSET_HUB_ROCOCO_ED * 1000000;
+ let system_asset = (Parent, fee_amount).into();
+
+ let root_origin = ::RuntimeOrigin::root();
+ let system_para_destination = PenpalA::sibling_location_of(AssetHubRococo::para_id()).into();
+ let xcm = xcm_transact_paid_execution(
+ call,
+ origin_kind,
+ system_asset,
+ para_sovereign_account.clone(),
+ );
+
+ // SA-of-Penpal-on-AHR needs to have balance to pay for fees and asset creation deposit
+ AssetHubRococo::fund_accounts(vec![(
+ para_sovereign_account.clone().into(),
+ ASSET_HUB_ROCOCO_ED * 10000000000,
+ )]);
+
+ PenpalA::execute_with(|| {
+ assert_ok!(::PolkadotXcm::send(
+ root_origin,
+ bx!(system_para_destination),
+ bx!(xcm),
+ ));
+
+ PenpalA::assert_xcm_pallet_sent();
+ });
+
+ AssetHubRococo::execute_with(|| {
+ type RuntimeEvent = ::RuntimeEvent;
+
+ AssetHubRococo::assert_xcmp_queue_success(Some(Weight::from_parts(
+ 15_594_564_000,
+ 562_893,
+ )));
+
+ assert_expected_events!(
+ AssetHubRococo,
+ vec![
+ // Burned the fee
+ RuntimeEvent::Balances(pallet_balances::Event::Burned { who, amount }) => {
+ who: *who == para_sovereign_account,
+ amount: *amount == fee_amount,
+ },
+ // Foreign Asset created
+ RuntimeEvent::ForeignAssets(pallet_assets::Event::Created { asset_id, creator, owner }) => {
+ asset_id: *asset_id == foreign_asset_at_asset_hub,
+ creator: *creator == para_sovereign_account.clone(),
+ owner: *owner == para_sovereign_account,
+ },
+ ]
+ );
+
+ type ForeignAssets = ::ForeignAssets;
+ assert!(ForeignAssets::asset_exists(foreign_asset_at_asset_hub));
+ });
+}
+
+/// We tests two things here:
+/// - Parachain should be able to send XCM paying its fee with system assets in the System Parachain
+/// - Parachain should be able to create a new Asset in the System Parachain
#[test]
fn send_xcm_from_para_to_system_para_paying_fee_with_assets_works() {
let para_sovereign_account = AssetHubRococo::sovereign_account_id_of(
@@ -46,28 +133,30 @@ fn send_xcm_from_para_to_system_para_paying_fee_with_assets_works() {
ASSET_MIN_BALANCE * 1000000000,
);
- // We just need a call that can pass the `SafeCallFilter`
- // Call values are not relevant
- let call = AssetHubRococo::force_create_asset_call(
- ASSET_ID,
- para_sovereign_account.clone(),
- true,
+ // Just a different `asset_id`` that does not exist yet
+ let new_asset_id = ASSET_ID + 1;
+
+ // Encoded `create_asset` call to be executed in AssetHub
+ let call = AssetHubRococo::create_asset_call(
+ new_asset_id,
ASSET_MIN_BALANCE,
+ para_sovereign_account.clone(),
);
let origin_kind = OriginKind::SovereignAccount;
let fee_amount = ASSET_MIN_BALANCE * 1000000;
- let native_asset =
+ let asset =
([PalletInstance(ASSETS_PALLET_ID), GeneralIndex(ASSET_ID.into())], fee_amount).into();
let root_origin = ::RuntimeOrigin::root();
let system_para_destination = PenpalA::sibling_location_of(AssetHubRococo::para_id()).into();
- let xcm = xcm_transact_paid_execution(
- call,
- origin_kind,
- native_asset,
- para_sovereign_account.clone(),
- );
+ let xcm = xcm_transact_paid_execution(call, origin_kind, asset, para_sovereign_account.clone());
+
+ // SA-of-Penpal-on-AHR needs to have balance to pay for asset creation deposit
+ AssetHubRococo::fund_accounts(vec![(
+ para_sovereign_account.clone().into(),
+ ASSET_HUB_ROCOCO_ED * 10000000000,
+ )]);
PenpalA::execute_with(|| {
assert_ok!(::PolkadotXcm::send(
@@ -90,13 +179,17 @@ fn send_xcm_from_para_to_system_para_paying_fee_with_assets_works() {
assert_expected_events!(
AssetHubRococo,
vec![
+ // Burned the fee
RuntimeEvent::Assets(pallet_assets::Event::Burned { asset_id, owner, balance }) => {
asset_id: *asset_id == ASSET_ID,
owner: *owner == para_sovereign_account,
balance: *balance == fee_amount,
},
- RuntimeEvent::Assets(pallet_assets::Event::Issued { asset_id, .. }) => {
- asset_id: *asset_id == ASSET_ID,
+ // Asset created
+ RuntimeEvent::Assets(pallet_assets::Event::Created { asset_id, creator, owner }) => {
+ asset_id: *asset_id == new_asset_id,
+ creator: *creator == para_sovereign_account.clone(),
+ owner: *owner == para_sovereign_account,
},
]
);
diff --git a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/set_xcm_versions.rs b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/set_xcm_versions.rs
index 7d630d368051..5662a78ab67f 100644
--- a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/set_xcm_versions.rs
+++ b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/set_xcm_versions.rs
@@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-use crate::*;
+use crate::imports::*;
#[test]
fn relay_sets_system_para_xcm_supported_version() {
diff --git a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/swap.rs b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/swap.rs
index c6a10b252901..87f0b3d9f90a 100644
--- a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/swap.rs
+++ b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/swap.rs
@@ -13,9 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-use crate::*;
-use rococo_system_emulated_network::penpal_emulated_chain::LocalTeleportableToAssetHubV3 as PenpalLocalTeleportableToAssetHubV3;
-use sp_runtime::ModuleError;
+use crate::imports::*;
#[test]
fn swap_locally_on_chain_using_local_assets() {
@@ -114,49 +112,39 @@ fn swap_locally_on_chain_using_local_assets() {
#[test]
fn swap_locally_on_chain_using_foreign_assets() {
- let asset_native = Box::new(asset_hub_rococo_runtime::xcm_config::TokenLocationV3::get());
- let ah_as_seen_by_penpal = PenpalA::sibling_location_of(AssetHubRococo::para_id());
- let asset_location_on_penpal = PenpalLocalTeleportableToAssetHubV3::get();
- let asset_id_on_penpal = match asset_location_on_penpal.last() {
- Some(v3::Junction::GeneralIndex(id)) => *id as u32,
- _ => unreachable!(),
- };
- let asset_owner_on_penpal = PenpalASender::get();
+ let asset_native =
+ Box::new(v3::Location::try_from(RelayLocation::get()).expect("conversion works"));
+ let asset_location_on_penpal =
+ v3::Location::try_from(PenpalLocalTeleportableToAssetHub::get()).expect("conversion works");
let foreign_asset_at_asset_hub_rococo =
v3::Location::new(1, [v3::Junction::Parachain(PenpalA::para_id().into())])
.appended_with(asset_location_on_penpal)
.unwrap();
- // 1. Create asset on penpal and, 2. Create foreign asset on asset_hub_rococo
- super::penpal_create_foreign_asset_on_asset_hub(
- asset_id_on_penpal,
- foreign_asset_at_asset_hub_rococo,
- ah_as_seen_by_penpal,
- true,
- asset_owner_on_penpal,
- ASSET_MIN_BALANCE * 1_000_000,
- );
-
let penpal_as_seen_by_ah = AssetHubRococo::sibling_location_of(PenpalA::para_id());
let sov_penpal_on_ahr = AssetHubRococo::sovereign_account_id_of(penpal_as_seen_by_ah);
AssetHubRococo::fund_accounts(vec![
- (AssetHubRococoSender::get().into(), 5_000_000 * ROCOCO_ED), /* An account to swap dot
- * for something else. */
+ // An account to swap dot for something else.
+ (AssetHubRococoSender::get().into(), 5_000_000 * ASSET_HUB_ROCOCO_ED),
+ // Penpal's sovereign account in AH should have some balance
+ (sov_penpal_on_ahr.clone().into(), 100_000_000 * ASSET_HUB_ROCOCO_ED),
]);
AssetHubRococo::execute_with(|| {
- // 3: Mint foreign asset on asset_hub_rococo:
+ // 0: No need to create foreign asset as it exists in genesis.
+ //
+ // 1: Mint foreign asset on asset_hub_rococo:
//
// (While it might be nice to use batch,
// currently that's disabled due to safe call filters.)
type RuntimeEvent = ::RuntimeEvent;
- // 3. Mint foreign asset (in reality this should be a teleport or some such)
+ // 1. Mint foreign asset (in reality this should be a teleport or some such)
assert_ok!(::ForeignAssets::mint(
::RuntimeOrigin::signed(sov_penpal_on_ahr.clone().into()),
foreign_asset_at_asset_hub_rococo,
sov_penpal_on_ahr.clone().into(),
- 3_000_000_000_000,
+ ASSET_HUB_ROCOCO_ED * 3_000_000_000_000,
));
assert_expected_events!(
@@ -166,7 +154,7 @@ fn swap_locally_on_chain_using_foreign_assets() {
]
);
- // 4. Create pool:
+ // 2. Create pool:
assert_ok!(::AssetConversion::create_pool(
::RuntimeOrigin::signed(AssetHubRococoSender::get()),
asset_native.clone(),
@@ -180,7 +168,7 @@ fn swap_locally_on_chain_using_foreign_assets() {
]
);
- // 5. Add liquidity:
+ // 3. Add liquidity:
assert_ok!(::AssetConversion::add_liquidity(
::RuntimeOrigin::signed(sov_penpal_on_ahr.clone()),
asset_native.clone(),
@@ -201,15 +189,15 @@ fn swap_locally_on_chain_using_foreign_assets() {
]
);
- // 6. Swap!
+ // 4. Swap!
let path = vec![asset_native.clone(), Box::new(foreign_asset_at_asset_hub_rococo)];
assert_ok!(
::AssetConversion::swap_exact_tokens_for_tokens(
::RuntimeOrigin::signed(AssetHubRococoSender::get()),
path,
- 100000,
- 1000,
+ 100000 * ASSET_HUB_ROCOCO_ED,
+ 1000 * ASSET_HUB_ROCOCO_ED,
AssetHubRococoSender::get().into(),
true
)
@@ -219,18 +207,18 @@ fn swap_locally_on_chain_using_foreign_assets() {
AssetHubRococo,
vec![
RuntimeEvent::AssetConversion(pallet_asset_conversion::Event::SwapExecuted { amount_in, amount_out, .. },) => {
- amount_in: *amount_in == 100000,
- amount_out: *amount_out == 199399,
+ amount_in: *amount_in == 333333300000,
+ amount_out: *amount_out == 498874118173,
},
]
);
- // 7. Remove liquidity
+ // 5. Remove liquidity
assert_ok!(::AssetConversion::remove_liquidity(
::RuntimeOrigin::signed(sov_penpal_on_ahr.clone()),
asset_native.clone(),
Box::new(foreign_asset_at_asset_hub_rococo),
- 1414213562273 - 2_000_000_000, // all but the 2 EDs can't be retrieved.
+ 1414213562273 - ASSET_HUB_ROCOCO_ED * 2, // all but the 2 EDs can't be retrieved.
0,
0,
sov_penpal_on_ahr.clone().into(),
diff --git a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/teleport.rs b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/teleport.rs
index dfb5061b55f0..0cc5ddb9f64d 100644
--- a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/teleport.rs
+++ b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/teleport.rs
@@ -13,11 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-use crate::*;
-use asset_hub_rococo_runtime::xcm_config::XcmConfig as AssetHubRococoXcmConfig;
-use emulated_integration_tests_common::xcm_helpers::non_fee_asset;
-use rococo_runtime::xcm_config::XcmConfig as RococoXcmConfig;
-use rococo_system_emulated_network::penpal_emulated_chain::LocalTeleportableToAssetHubV3 as PenpalLocalTeleportableToAssetHubV3;
+use crate::imports::*;
fn relay_origin_assertions(t: RelayToSystemParaTest) {
type RuntimeEvent = ::RuntimeEvent;
@@ -114,18 +110,21 @@ fn para_dest_assertions(t: RelayToSystemParaTest) {
fn penpal_to_ah_foreign_assets_sender_assertions(t: ParaToSystemParaTest) {
type RuntimeEvent = ::RuntimeEvent;
- PenpalA::assert_xcm_pallet_attempted_complete(None);
+ let system_para_native_asset_location =
+ v3::Location::try_from(RelayLocation::get()).expect("conversion works");
let expected_asset_id = t.args.asset_id.unwrap();
let (_, expected_asset_amount) =
non_fee_asset(&t.args.assets, t.args.fee_asset_item as usize).unwrap();
+
+ PenpalA::assert_xcm_pallet_attempted_complete(None);
assert_expected_events!(
PenpalA,
vec![
- RuntimeEvent::Balances(
- pallet_balances::Event::Burned { who, amount }
+ RuntimeEvent::ForeignAssets(
+ pallet_assets::Event::Burned { asset_id, owner, .. }
) => {
- who: *who == t.sender.account_id,
- amount: *amount == t.args.amount,
+ asset_id: *asset_id == system_para_native_asset_location,
+ owner: *owner == t.sender.account_id,
},
RuntimeEvent::Assets(pallet_assets::Event::Burned { asset_id, owner, balance }) => {
asset_id: *asset_id == expected_asset_id,
@@ -144,6 +143,9 @@ fn penpal_to_ah_foreign_assets_receiver_assertions(t: ParaToSystemParaTest) {
let (expected_foreign_asset_id, expected_foreign_asset_amount) =
non_fee_asset(&t.args.assets, t.args.fee_asset_item as usize).unwrap();
let expected_foreign_asset_id_v3: v3::Location = expected_foreign_asset_id.try_into().unwrap();
+
+ AssetHubRococo::assert_xcmp_queue_success(None);
+
assert_expected_events!(
AssetHubRococo,
vec![
@@ -163,9 +165,6 @@ fn penpal_to_ah_foreign_assets_receiver_assertions(t: ParaToSystemParaTest) {
amount: *amount == expected_foreign_asset_amount,
},
RuntimeEvent::Balances(pallet_balances::Event::Deposit { .. }) => {},
- RuntimeEvent::MessageQueue(
- pallet_message_queue::Event::Processed { success: true, .. }
- ) => {},
]
);
}
@@ -205,6 +204,11 @@ fn ah_to_penpal_foreign_assets_receiver_assertions(t: SystemParaToParaTest) {
let (_, expected_asset_amount) =
non_fee_asset(&t.args.assets, t.args.fee_asset_item as usize).unwrap();
let checking_account = ::PolkadotXcm::check_account();
+ let system_para_native_asset_location =
+ v3::Location::try_from(RelayLocation::get()).expect("conversion works");
+
+ PenpalA::assert_xcmp_queue_success(None);
+
assert_expected_events!(
PenpalA,
vec![
@@ -221,12 +225,11 @@ fn ah_to_penpal_foreign_assets_receiver_assertions(t: SystemParaToParaTest) {
amount: *amount == expected_asset_amount,
},
// native asset for fee is deposited to receiver
- RuntimeEvent::Balances(pallet_balances::Event::Minted { who, .. }) => {
- who: *who == t.receiver.account_id,
+ RuntimeEvent::ForeignAssets(pallet_assets::Event::Issued { asset_id, owner, amount }) => {
+ asset_id: *asset_id == system_para_native_asset_location,
+ owner: *owner == t.receiver.account_id,
+ amount: *amount == expected_asset_amount,
},
- RuntimeEvent::MessageQueue(
- pallet_message_queue::Event::Processed { success: true, .. }
- ) => {},
]
);
}
@@ -558,30 +561,21 @@ fn teleport_to_other_system_parachains_works() {
/// (using native reserve-based transfer for fees)
#[test]
fn bidirectional_teleport_foreign_assets_between_para_and_asset_hub() {
- let ah_as_seen_by_penpal = PenpalA::sibling_location_of(AssetHubRococo::para_id());
- let asset_location_on_penpal = PenpalLocalTeleportableToAssetHubV3::get();
+ // Init values for Parachain
+ let fee_amount_to_send: Balance = ASSET_HUB_ROCOCO_ED * 10000;
+ let asset_location_on_penpal =
+ v3::Location::try_from(PenpalLocalTeleportableToAssetHub::get()).expect("conversion works");
let asset_id_on_penpal = match asset_location_on_penpal.last() {
Some(v3::Junction::GeneralIndex(id)) => *id as u32,
_ => unreachable!(),
};
- let asset_owner_on_penpal = PenpalASender::get();
- let foreign_asset_at_asset_hub_rococo =
- v3::Location::new(1, [v3::Junction::Parachain(PenpalA::para_id().into())])
- .appended_with(asset_location_on_penpal)
- .unwrap();
- super::penpal_create_foreign_asset_on_asset_hub(
- asset_id_on_penpal,
- foreign_asset_at_asset_hub_rococo,
- ah_as_seen_by_penpal.clone(),
- false,
- asset_owner_on_penpal,
- ASSET_MIN_BALANCE * 1_000_000,
- );
- let penpal_to_ah_beneficiary_id = AssetHubRococoReceiver::get();
-
- let fee_amount_to_send = ASSET_HUB_ROCOCO_ED * 10_000;
- let asset_amount_to_send = ASSET_MIN_BALANCE * 1000;
-
+ let asset_amount_to_send = ASSET_HUB_ROCOCO_ED * 1000;
+ let asset_owner = PenpalAssetOwner::get();
+ let system_para_native_asset_location =
+ v3::Location::try_from(RelayLocation::get()).expect("conversion works");
+ let sender = PenpalASender::get();
+ let penpal_check_account = ::PolkadotXcm::check_account();
+ let ah_as_seen_by_penpal = PenpalA::sibling_location_of(AssetHubRococo::para_id());
let asset_location_on_penpal_latest: Location = asset_location_on_penpal.try_into().unwrap();
let penpal_assets: Assets = vec![
(Parent, fee_amount_to_send).into(),
@@ -594,6 +588,38 @@ fn bidirectional_teleport_foreign_assets_between_para_and_asset_hub() {
.position(|r| r == &(Parent, fee_amount_to_send).into())
.unwrap() as u32;
+ // fund Parachain's sender account
+ PenpalA::mint_foreign_asset(
+ ::RuntimeOrigin::signed(asset_owner.clone()),
+ system_para_native_asset_location,
+ sender.clone(),
+ fee_amount_to_send,
+ );
+ // No need to create the asset (only mint) as it exists in genesis.
+ PenpalA::mint_asset(
+ ::RuntimeOrigin::signed(asset_owner.clone()),
+ asset_id_on_penpal,
+ sender.clone(),
+ asset_amount_to_send,
+ );
+ // fund Parachain's check account to be able to teleport
+ PenpalA::fund_accounts(vec![(penpal_check_account.clone().into(), ASSET_HUB_ROCOCO_ED * 1000)]);
+
+ // prefund SA of Penpal on AssetHub with enough native tokens to pay for fees
+ let penpal_as_seen_by_ah = AssetHubRococo::sibling_location_of(PenpalA::para_id());
+ let sov_penpal_on_ah = AssetHubRococo::sovereign_account_id_of(penpal_as_seen_by_ah);
+ AssetHubRococo::fund_accounts(vec![(
+ sov_penpal_on_ah.clone().into(),
+ ASSET_HUB_ROCOCO_ED * 100_000_000_000,
+ )]);
+
+ // Init values for System Parachain
+ let foreign_asset_at_asset_hub_rococo =
+ v3::Location::new(1, [v3::Junction::Parachain(PenpalA::para_id().into())])
+ .appended_with(asset_location_on_penpal)
+ .unwrap();
+ let penpal_to_ah_beneficiary_id = AssetHubRococoReceiver::get();
+
// Penpal to AH test args
let penpal_to_ah_test_args = TestContext {
sender: PenpalASender::get(),
@@ -608,8 +634,14 @@ fn bidirectional_teleport_foreign_assets_between_para_and_asset_hub() {
),
};
let mut penpal_to_ah = ParaToSystemParaTest::new(penpal_to_ah_test_args);
+ let penpal_sender_balance_before = PenpalA::execute_with(|| {
+ type ForeignAssets = ::ForeignAssets;
+ >::balance(
+ system_para_native_asset_location,
+ &PenpalASender::get(),
+ )
+ });
- let penpal_sender_balance_before = penpal_to_ah.sender.balance;
let ah_receiver_balance_before = penpal_to_ah.receiver.balance;
let penpal_sender_assets_before = PenpalA::execute_with(|| {
@@ -629,7 +661,14 @@ fn bidirectional_teleport_foreign_assets_between_para_and_asset_hub() {
penpal_to_ah.set_dispatchable::(para_to_system_para_transfer_assets);
penpal_to_ah.assert();
- let penpal_sender_balance_after = penpal_to_ah.sender.balance;
+ let penpal_sender_balance_after = PenpalA::execute_with(|| {
+ type ForeignAssets = ::ForeignAssets;
+ >::balance(
+ system_para_native_asset_location,
+ &PenpalASender::get(),
+ )
+ });
+
let ah_receiver_balance_after = penpal_to_ah.receiver.balance;
let penpal_sender_assets_after = PenpalA::execute_with(|| {
@@ -704,7 +743,13 @@ fn bidirectional_teleport_foreign_assets_between_para_and_asset_hub() {
let mut ah_to_penpal = SystemParaToParaTest::new(ah_to_penpal_test_args);
let ah_sender_balance_before = ah_to_penpal.sender.balance;
- let penpal_receiver_balance_before = ah_to_penpal.receiver.balance;
+ let penpal_receiver_balance_before = PenpalA::execute_with(|| {
+ type ForeignAssets = ::ForeignAssets;
+ >::balance(
+ system_para_native_asset_location,
+ &PenpalAReceiver::get(),
+ )
+ });
let ah_sender_assets_before = AssetHubRococo::execute_with(|| {
type ForeignAssets = ::ForeignAssets;
@@ -724,7 +769,13 @@ fn bidirectional_teleport_foreign_assets_between_para_and_asset_hub() {
ah_to_penpal.assert();
let ah_sender_balance_after = ah_to_penpal.sender.balance;
- let penpal_receiver_balance_after = ah_to_penpal.receiver.balance;
+ let penpal_receiver_balance_after = PenpalA::execute_with(|| {
+ type ForeignAssets = ::ForeignAssets;
+ >::balance(
+ system_para_native_asset_location,
+ &PenpalAReceiver::get(),
+ )
+ });
let ah_sender_assets_after = AssetHubRococo::execute_with(|| {
type ForeignAssets = ::ForeignAssets;
diff --git a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/Cargo.toml b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/Cargo.toml
index 0c920730d0fe..8ac8efb5218f 100644
--- a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/Cargo.toml
+++ b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/Cargo.toml
@@ -33,6 +33,7 @@ westend-runtime = { path = "../../../../../../../polkadot/runtime/westend" }
# Cumulus
parachains-common = { path = "../../../../../../parachains/common" }
testnet-parachains-constants = { path = "../../../../../runtimes/constants", features = ["westend"] }
+penpal-runtime = { path = "../../../../../runtimes/testing/penpal" }
asset-hub-westend-runtime = { path = "../../../../../runtimes/assets/asset-hub-westend" }
asset-test-utils = { path = "../../../../../runtimes/assets/test-utils" }
cumulus-pallet-xcmp-queue = { default-features = false, path = "../../../../../../pallets/xcmp-queue" }
diff --git a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/lib.rs b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/lib.rs
index 409369df7bb0..3f899d1dbdbc 100644
--- a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/lib.rs
+++ b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/lib.rs
@@ -13,67 +13,83 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-pub use codec::Encode;
+#[cfg(test)]
+mod imports {
+ pub use codec::Encode;
+
+ // Substrate
+ pub use frame_support::{
+ assert_err, assert_ok,
+ pallet_prelude::Weight,
+ sp_runtime::{DispatchError, DispatchResult, ModuleError},
+ traits::fungibles::Inspect,
+ };
-// Substrate
-pub use frame_support::{
- assert_err, assert_ok,
- instances::Instance2,
- pallet_prelude::Weight,
- sp_runtime::{AccountId32, DispatchError, DispatchResult, ModuleError},
- traits::fungibles::Inspect,
- BoundedVec,
-};
+ // Polkadot
+ pub use xcm::{
+ prelude::{AccountId32 as AccountId32Junction, *},
+ v3,
+ };
-// Polkadot
-pub use xcm::{
- prelude::{AccountId32 as AccountId32Junction, *},
- v3::{self, Error, NetworkId::Westend as WestendId},
-};
+ // Cumulus
+ pub use asset_test_utils::xcm_helpers;
+ pub use emulated_integration_tests_common::{
+ test_parachain_is_trusted_teleporter,
+ xcm_emulator::{
+ assert_expected_events, bx, Chain, Parachain as Para, RelayChain as Relay, Test,
+ TestArgs, TestContext, TestExt,
+ },
+ xcm_helpers::{non_fee_asset, xcm_transact_paid_execution},
+ ASSETS_PALLET_ID, RESERVABLE_ASSET_ID, XCM_V3,
+ };
+ pub use parachains_common::{AccountId, Balance};
+ pub use westend_system_emulated_network::{
+ asset_hub_westend_emulated_chain::{
+ genesis::{AssetHubWestendAssetOwner, ED as ASSET_HUB_WESTEND_ED},
+ AssetHubWestendParaPallet as AssetHubWestendPallet,
+ },
+ collectives_westend_emulated_chain::CollectivesWestendParaPallet as CollectivesWestendPallet,
+ penpal_emulated_chain::{
+ PenpalAParaPallet as PenpalAPallet, PenpalAssetOwner,
+ PenpalBParaPallet as PenpalBPallet,
+ },
+ westend_emulated_chain::{genesis::ED as WESTEND_ED, WestendRelayPallet as WestendPallet},
+ AssetHubWestendPara as AssetHubWestend,
+ AssetHubWestendParaReceiver as AssetHubWestendReceiver,
+ AssetHubWestendParaSender as AssetHubWestendSender,
+ BridgeHubWestendPara as BridgeHubWestend,
+ BridgeHubWestendParaReceiver as BridgeHubWestendReceiver,
+ CollectivesWestendPara as CollectivesWestend, PenpalAPara as PenpalA,
+ PenpalAParaReceiver as PenpalAReceiver, PenpalAParaSender as PenpalASender,
+ PenpalBPara as PenpalB, PenpalBParaReceiver as PenpalBReceiver, WestendRelay as Westend,
+ WestendRelayReceiver as WestendReceiver, WestendRelaySender as WestendSender,
+ };
-// Cumulus
-pub use asset_test_utils::xcm_helpers;
-pub use emulated_integration_tests_common::{
- test_parachain_is_trusted_teleporter,
- xcm_emulator::{
- assert_expected_events, bx, helpers::weight_within_threshold, Chain, Parachain as Para,
- RelayChain as Relay, Test, TestArgs, TestContext, TestExt,
- },
- xcm_helpers::{xcm_transact_paid_execution, xcm_transact_unpaid_execution},
- PROOF_SIZE_THRESHOLD, REF_TIME_THRESHOLD, XCM_V3,
-};
-pub use parachains_common::{AccountId, Balance};
-pub use westend_system_emulated_network::{
- asset_hub_westend_emulated_chain::{
- genesis::ED as ASSET_HUB_WESTEND_ED, AssetHubWestendParaPallet as AssetHubWestendPallet,
- },
- collectives_westend_emulated_chain::{
- genesis::ED as COLLECTIVES_WESTEND_ED,
- CollectivesWestendParaPallet as CollectivesWestendPallet,
- },
- penpal_emulated_chain::PenpalBParaPallet as PenpalBPallet,
- westend_emulated_chain::{genesis::ED as WESTEND_ED, WestendRelayPallet as WestendPallet},
- AssetHubWestendPara as AssetHubWestend, AssetHubWestendParaReceiver as AssetHubWestendReceiver,
- AssetHubWestendParaSender as AssetHubWestendSender, BridgeHubWestendPara as BridgeHubWestend,
- BridgeHubWestendParaReceiver as BridgeHubWestendReceiver,
- CollectivesWestendPara as CollectivesWestend, PenpalAPara as PenpalA,
- PenpalAParaReceiver as PenpalAReceiver, PenpalBPara as PenpalB,
- PenpalBParaReceiver as PenpalBReceiver, PenpalBParaSender as PenpalBSender,
- WestendRelay as Westend, WestendRelayReceiver as WestendReceiver,
- WestendRelaySender as WestendSender,
-};
+ // Runtimes
+ pub use asset_hub_westend_runtime::xcm_config::{
+ UniversalLocation as AssetHubWestendUniversalLocation, WestendLocation as RelayLocation,
+ XcmConfig as AssetHubWestendXcmConfig,
+ };
+ pub use penpal_runtime::xcm_config::{
+ LocalReservableFromAssetHub as PenpalLocalReservableFromAssetHub,
+ LocalTeleportableToAssetHub as PenpalLocalTeleportableToAssetHub,
+ UniversalLocation as PenpalUniversalLocation, XcmConfig as PenpalWestendXcmConfig,
+ };
+ pub use westend_runtime::xcm_config::{
+ UniversalLocation as WestendUniversalLocation, XcmConfig as WestendXcmConfig,
+ };
-pub const ASSET_ID: u32 = 1;
-pub const ASSET_MIN_BALANCE: u128 = 1000;
-// `Assets` pallet index
-pub const ASSETS_PALLET_ID: u8 = 50;
+ pub const ASSET_ID: u32 = 3;
+ pub const ASSET_MIN_BALANCE: u128 = 1000;
-pub type RelayToSystemParaTest = Test;
-pub type RelayToParaTest = Test;
-pub type SystemParaToRelayTest = Test;
-pub type SystemParaToParaTest = Test;
-pub type ParaToSystemParaTest = Test;
-pub type ParaToParaTest = Test;
+ pub type RelayToSystemParaTest = Test;
+ pub type RelayToParaTest = Test;
+ pub type ParaToRelayTest = Test;
+ pub type SystemParaToRelayTest = Test;
+ pub type SystemParaToParaTest = Test;
+ pub type ParaToSystemParaTest = Test;
+ pub type ParaToParaThroughRelayTest = Test;
+}
#[cfg(test)]
mod tests;
diff --git a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/fellowship_treasury.rs b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/fellowship_treasury.rs
index 11e1e1762dbb..2d02e90f47fb 100644
--- a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/fellowship_treasury.rs
+++ b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/fellowship_treasury.rs
@@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-use crate::*;
+use crate::imports::*;
use emulated_integration_tests_common::accounts::{ALICE, BOB};
use frame_support::traits::fungibles::{Create, Inspect, Mutate};
use polkadot_runtime_common::impls::VersionedLocatableAsset;
diff --git a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/mod.rs b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/mod.rs
index a56cde8f2a2c..3cd7c9c46d69 100644
--- a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/mod.rs
+++ b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/mod.rs
@@ -20,11 +20,3 @@ mod set_xcm_versions;
mod swap;
mod teleport;
mod treasury;
-
-use crate::*;
-emulated_integration_tests_common::include_penpal_create_foreign_asset_on_asset_hub!(
- PenpalB,
- AssetHubWestend,
- WESTEND_ED,
- testnet_parachains_constants::westend::fee::WeightToFee
-);
diff --git a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/reserve_transfer.rs b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/reserve_transfer.rs
index a29cd10ba833..8c836132b546 100644
--- a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/reserve_transfer.rs
+++ b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/reserve_transfer.rs
@@ -13,10 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-use crate::*;
-use asset_hub_westend_runtime::xcm_config::XcmConfig as AssetHubWestendXcmConfig;
-use westend_runtime::xcm_config::XcmConfig as WestendXcmConfig;
-use westend_system_emulated_network::penpal_emulated_chain::XcmConfig as PenpalWestendXcmConfig;
+use crate::imports::*;
fn relay_to_para_sender_assertions(t: RelayToParaTest) {
type RuntimeEvent = ::RuntimeEvent;
@@ -40,12 +37,30 @@ fn relay_to_para_sender_assertions(t: RelayToParaTest) {
);
}
+fn para_to_relay_sender_assertions(t: ParaToRelayTest) {
+ type RuntimeEvent = ::RuntimeEvent;
+ PenpalA::assert_xcm_pallet_attempted_complete(Some(Weight::from_parts(864_610_000, 8_799)));
+ assert_expected_events!(
+ PenpalA,
+ vec![
+ // Amount to reserve transfer is transferred to Parachain's Sovereign account
+ RuntimeEvent::ForeignAssets(
+ pallet_assets::Event::Burned { asset_id, owner, balance, .. }
+ ) => {
+ asset_id: *asset_id == v3::Location::try_from(RelayLocation::get()).expect("conversion works"),
+ owner: *owner == t.sender.account_id,
+ balance: *balance == t.args.amount,
+ },
+ ]
+ );
+}
+
fn system_para_to_para_sender_assertions(t: SystemParaToParaTest) {
type RuntimeEvent = ::RuntimeEvent;
AssetHubWestend::assert_xcm_pallet_attempted_complete(Some(Weight::from_parts(
- 676_119_000,
- 6196,
+ 864_610_000,
+ 8_799,
)));
assert_expected_events!(
@@ -61,57 +76,96 @@ fn system_para_to_para_sender_assertions(t: SystemParaToParaTest) {
),
amount: *amount == t.args.amount,
},
+ // Transport fees are paid
+ RuntimeEvent::PolkadotXcm(
+ pallet_xcm::Event::FeesPaid { .. }
+ ) => {},
]
);
+ AssetHubWestend::assert_xcm_pallet_sent();
}
-fn para_receiver_assertions(_: Test) {
- type RuntimeEvent = ::RuntimeEvent;
+fn system_para_to_para_receiver_assertions(t: SystemParaToParaTest) {
+ type RuntimeEvent = ::RuntimeEvent;
+ let system_para_native_asset_location =
+ v3::Location::try_from(RelayLocation::get()).expect("conversion works");
+
+ PenpalA::assert_xcmp_queue_success(None);
+
assert_expected_events!(
- PenpalB,
+ PenpalA,
vec![
- RuntimeEvent::Balances(pallet_balances::Event::Minted { .. }) => {},
- RuntimeEvent::MessageQueue(
- pallet_message_queue::Event::Processed { success: true, .. }
- ) => {},
+ RuntimeEvent::ForeignAssets(pallet_assets::Event::Issued { asset_id, owner, .. }) => {
+ asset_id: *asset_id == system_para_native_asset_location,
+ owner: *owner == t.receiver.account_id,
+ },
]
);
}
fn para_to_system_para_sender_assertions(t: ParaToSystemParaTest) {
- type RuntimeEvent = ::RuntimeEvent;
+ type RuntimeEvent = ::RuntimeEvent;
+ PenpalA::assert_xcm_pallet_attempted_complete(Some(Weight::from_parts(864_610_000, 8_799)));
+ assert_expected_events!(
+ PenpalA,
+ vec![
+ // Amount to reserve transfer is transferred to Parachain's Sovereign account
+ RuntimeEvent::ForeignAssets(
+ pallet_assets::Event::Burned { asset_id, owner, balance, .. }
+ ) => {
+ asset_id: *asset_id == v3::Location::try_from(RelayLocation::get()).expect("conversion works"),
+ owner: *owner == t.sender.account_id,
+ balance: *balance == t.args.amount,
+ },
+ ]
+ );
+}
+
+fn para_to_relay_receiver_assertions(t: ParaToRelayTest) {
+ type RuntimeEvent = ::RuntimeEvent;
+ let sov_penpal_on_relay =
+ Westend::sovereign_account_id_of(Westend::child_location_of(PenpalA::para_id()));
- PenpalB::assert_xcm_pallet_attempted_complete(Some(Weight::from_parts(864_610_000, 8_799)));
+ Westend::assert_ump_queue_processed(
+ true,
+ Some(PenpalA::para_id()),
+ Some(Weight::from_parts(306305000, 7_186)),
+ );
assert_expected_events!(
- PenpalB,
+ Westend,
vec![
- // Amount to reserve transfer is transferred to Parachain's Sovereign account
+ // Amount to reserve transfer is withdrawn from Parachain's Sovereign account
RuntimeEvent::Balances(
pallet_balances::Event::Burned { who, amount }
) => {
- who: *who == t.sender.account_id,
+ who: *who == sov_penpal_on_relay.clone().into(),
amount: *amount == t.args.amount,
},
+ RuntimeEvent::Balances(pallet_balances::Event::Minted { .. }) => {},
+ RuntimeEvent::MessageQueue(
+ pallet_message_queue::Event::Processed { success: true, .. }
+ ) => {},
]
);
}
fn para_to_system_para_receiver_assertions(t: ParaToSystemParaTest) {
type RuntimeEvent = ::RuntimeEvent;
-
- let sov_penpal_on_ahw = AssetHubWestend::sovereign_account_id_of(
- AssetHubWestend::sibling_location_of(PenpalB::para_id()),
+ let sov_penpal_on_ahr = AssetHubWestend::sovereign_account_id_of(
+ AssetHubWestend::sibling_location_of(PenpalA::para_id()),
);
+ AssetHubWestend::assert_xcmp_queue_success(None);
+
assert_expected_events!(
AssetHubWestend,
vec![
- // Amount to reserve transfer is transferred to Parachain's Sovereign account
+ // Amount to reserve transfer is withdrawn from Parachain's Sovereign account
RuntimeEvent::Balances(
pallet_balances::Event::Burned { who, amount }
) => {
- who: *who == sov_penpal_on_ahw.clone().into(),
+ who: *who == sov_penpal_on_ahr.clone().into(),
amount: *amount == t.args.amount,
},
RuntimeEvent::Balances(pallet_balances::Event::Minted { .. }) => {},
@@ -124,12 +178,10 @@ fn para_to_system_para_receiver_assertions(t: ParaToSystemParaTest) {
fn system_para_to_para_assets_sender_assertions(t: SystemParaToParaTest) {
type RuntimeEvent = ::RuntimeEvent;
-
AssetHubWestend::assert_xcm_pallet_attempted_complete(Some(Weight::from_parts(
- 676_119_000,
- 6196,
+ 864_610_000,
+ 8799,
)));
-
assert_expected_events!(
AssetHubWestend,
vec![
@@ -137,24 +189,124 @@ fn system_para_to_para_assets_sender_assertions(t: SystemParaToParaTest) {
RuntimeEvent::Assets(
pallet_assets::Event::Transferred { asset_id, from, to, amount }
) => {
- asset_id: *asset_id == ASSET_ID,
+ asset_id: *asset_id == RESERVABLE_ASSET_ID,
from: *from == t.sender.account_id,
to: *to == AssetHubWestend::sovereign_account_id_of(
t.args.dest.clone()
),
amount: *amount == t.args.amount,
},
+ // Native asset to pay for fees is transferred to Parachain's Sovereign account
+ RuntimeEvent::Balances(pallet_balances::Event::Minted { who, .. }) => {
+ who: *who == AssetHubWestend::sovereign_account_id_of(
+ t.args.dest.clone()
+ ),
+ },
+ // Transport fees are paid
+ RuntimeEvent::PolkadotXcm(
+ pallet_xcm::Event::FeesPaid { .. }
+ ) => {},
]
);
}
-fn system_para_to_para_assets_receiver_assertions(_: Test) {
- type RuntimeEvent = ::RuntimeEvent;
+fn para_to_system_para_assets_sender_assertions(t: ParaToSystemParaTest) {
+ type RuntimeEvent = ::RuntimeEvent;
+ let system_para_native_asset_location =
+ v3::Location::try_from(RelayLocation::get()).expect("conversion works");
+ let reservable_asset_location =
+ v3::Location::try_from(PenpalLocalReservableFromAssetHub::get()).expect("coversion works");
+ PenpalA::assert_xcm_pallet_attempted_complete(Some(Weight::from_parts(864_610_000, 8799)));
assert_expected_events!(
- PenpalB,
+ PenpalA,
vec![
- RuntimeEvent::Balances(pallet_balances::Event::Minted { .. }) => {},
- RuntimeEvent::Assets(pallet_assets::Event::Issued { .. }) => {},
+ // Fees amount to reserve transfer is burned from Parachains's sender account
+ RuntimeEvent::ForeignAssets(
+ pallet_assets::Event::Burned { asset_id, owner, .. }
+ ) => {
+ asset_id: *asset_id == system_para_native_asset_location,
+ owner: *owner == t.sender.account_id,
+ },
+ // Amount to reserve transfer is burned from Parachains's sender account
+ RuntimeEvent::ForeignAssets(
+ pallet_assets::Event::Burned { asset_id, owner, balance }
+ ) => {
+ asset_id: *asset_id == reservable_asset_location,
+ owner: *owner == t.sender.account_id,
+ balance: *balance == t.args.amount,
+ },
+ // Transport fees are paid
+ RuntimeEvent::PolkadotXcm(
+ pallet_xcm::Event::FeesPaid { .. }
+ ) => {},
+ ]
+ );
+}
+
+fn system_para_to_para_assets_receiver_assertions(t: SystemParaToParaTest) {
+ type RuntimeEvent = ::RuntimeEvent;
+ let system_para_asset_location =
+ v3::Location::try_from(PenpalLocalReservableFromAssetHub::get()).expect("coversion works");
+ PenpalA::assert_xcmp_queue_success(None);
+ assert_expected_events!(
+ PenpalA,
+ vec![
+ RuntimeEvent::ForeignAssets(pallet_assets::Event::Issued { asset_id, owner, .. }) => {
+ asset_id: *asset_id == v3::Location::try_from(RelayLocation::get()).expect("conversion works"),
+ owner: *owner == t.receiver.account_id,
+ },
+ RuntimeEvent::ForeignAssets(pallet_assets::Event::Issued { asset_id, owner, amount }) => {
+ asset_id: *asset_id == system_para_asset_location,
+ owner: *owner == t.receiver.account_id,
+ amount: *amount == t.args.amount,
+ },
+ ]
+ );
+}
+
+fn para_to_system_para_assets_receiver_assertions(t: ParaToSystemParaTest) {
+ type RuntimeEvent = ::RuntimeEvent;
+ let sov_penpal_on_ahr = AssetHubWestend::sovereign_account_id_of(
+ AssetHubWestend::sibling_location_of(PenpalA::para_id()),
+ );
+ AssetHubWestend::assert_xcmp_queue_success(None);
+ assert_expected_events!(
+ AssetHubWestend,
+ vec![
+ // Amount to reserve transfer is burned from Parachain's Sovereign account
+ RuntimeEvent::Assets(pallet_assets::Event::Burned { asset_id, owner, balance }) => {
+ asset_id: *asset_id == RESERVABLE_ASSET_ID,
+ owner: *owner == sov_penpal_on_ahr,
+ balance: *balance == t.args.amount,
+ },
+ // Fee amount is burned from Parachain's Sovereign account
+ RuntimeEvent::Balances(pallet_balances::Event::Burned { who, .. }) => {
+ who: *who == sov_penpal_on_ahr,
+ },
+ // Amount to reserve transfer is issued for beneficiary
+ RuntimeEvent::Assets(pallet_assets::Event::Issued { asset_id, owner, amount }) => {
+ asset_id: *asset_id == RESERVABLE_ASSET_ID,
+ owner: *owner == t.receiver.account_id,
+ amount: *amount == t.args.amount,
+ },
+ // Remaining fee amount is minted for for beneficiary
+ RuntimeEvent::Balances(pallet_balances::Event::Minted { who, .. }) => {
+ who: *who == t.receiver.account_id,
+ },
+ ]
+ );
+}
+
+fn relay_to_para_assets_receiver_assertions(t: RelayToParaTest) {
+ type RuntimeEvent = ::RuntimeEvent;
+
+ assert_expected_events!(
+ PenpalA,
+ vec![
+ RuntimeEvent::ForeignAssets(pallet_assets::Event::Issued { asset_id, owner, .. }) => {
+ asset_id: *asset_id == v3::Location::try_from(RelayLocation::get()).expect("conversion works"),
+ owner: *owner == t.receiver.account_id,
+ },
RuntimeEvent::MessageQueue(
pallet_message_queue::Event::Processed { success: true, .. }
) => {},
@@ -162,33 +314,38 @@ fn system_para_to_para_assets_receiver_assertions(_: Test) {
);
}
-fn para_to_para_sender_assertions(t: ParaToParaTest) {
- type RuntimeEvent = ::RuntimeEvent;
- PenpalB::assert_xcm_pallet_attempted_complete(None);
+fn para_to_para_through_relay_sender_assertions(t: ParaToParaThroughRelayTest) {
+ type RuntimeEvent = ::RuntimeEvent;
+
+ let relay_asset_location =
+ v3::Location::try_from(RelayLocation::get()).expect("conversion works");
+
+ PenpalA::assert_xcm_pallet_attempted_complete(None);
+ // XCM sent to relay reserve
+ PenpalA::assert_parachain_system_ump_sent();
+
assert_expected_events!(
- PenpalB,
+ PenpalA,
vec![
// Amount to reserve transfer is transferred to Parachain's Sovereign account
- RuntimeEvent::Balances(
- pallet_balances::Event::Burned { who, amount }
+ RuntimeEvent::ForeignAssets(
+ pallet_assets::Event::Burned { asset_id, owner, balance },
) => {
- who: *who == t.sender.account_id,
- amount: *amount == t.args.amount,
+ asset_id: *asset_id == relay_asset_location,
+ owner: *owner == t.sender.account_id,
+ balance: *balance == t.args.amount,
},
- // XCM sent to relay reserve
- RuntimeEvent::ParachainSystem(
- cumulus_pallet_parachain_system::Event::UpwardMessageSent { .. }
- ) => {},
]
);
}
-fn para_to_para_relay_hop_assertions(t: ParaToParaTest) {
+fn para_to_para_relay_hop_assertions(t: ParaToParaThroughRelayTest) {
type RuntimeEvent = ::RuntimeEvent;
- let sov_penpal_b_on_westend =
- Westend::sovereign_account_id_of(Westend::child_location_of(PenpalB::para_id()));
let sov_penpal_a_on_westend =
Westend::sovereign_account_id_of(Westend::child_location_of(PenpalA::para_id()));
+ let sov_penpal_b_on_westend =
+ Westend::sovereign_account_id_of(Westend::child_location_of(PenpalB::para_id()));
+
assert_expected_events!(
Westend,
vec![
@@ -196,14 +353,14 @@ fn para_to_para_relay_hop_assertions(t: ParaToParaTest) {
RuntimeEvent::Balances(
pallet_balances::Event::Burned { who, amount }
) => {
- who: *who == sov_penpal_b_on_westend,
+ who: *who == sov_penpal_a_on_westend,
amount: *amount == t.args.amount,
},
// Deposited to receiver parachain SA
RuntimeEvent::Balances(
pallet_balances::Event::Minted { who, .. }
) => {
- who: *who == sov_penpal_a_on_westend,
+ who: *who == sov_penpal_b_on_westend,
},
RuntimeEvent::MessageQueue(
pallet_message_queue::Event::Processed { success: true, .. }
@@ -212,15 +369,20 @@ fn para_to_para_relay_hop_assertions(t: ParaToParaTest) {
);
}
-fn para_to_para_receiver_assertions(_: ParaToParaTest) {
- type RuntimeEvent = ::RuntimeEvent;
+fn para_to_para_through_relay_receiver_assertions(t: ParaToParaThroughRelayTest) {
+ type RuntimeEvent = ::RuntimeEvent;
+ let relay_asset_location =
+ v3::Location::try_from(RelayLocation::get()).expect("conversion works");
+
+ PenpalB::assert_xcmp_queue_success(None);
+
assert_expected_events!(
- PenpalA,
+ PenpalB,
vec![
- RuntimeEvent::Balances(pallet_balances::Event::Minted { .. }) => {},
- RuntimeEvent::MessageQueue(
- pallet_message_queue::Event::Processed { success: true, .. }
- ) => {},
+ RuntimeEvent::ForeignAssets(pallet_assets::Event::Issued { asset_id, owner, .. }) => {
+ asset_id: *asset_id == relay_asset_location,
+ owner: *owner == t.receiver.account_id,
+ },
]
);
}
@@ -236,6 +398,17 @@ fn relay_to_para_reserve_transfer_assets(t: RelayToParaTest) -> DispatchResult {
)
}
+fn para_to_relay_reserve_transfer_assets(t: ParaToRelayTest) -> DispatchResult {
+ ::PolkadotXcm::limited_reserve_transfer_assets(
+ t.signed_origin,
+ bx!(t.args.dest.into()),
+ bx!(t.args.beneficiary.into()),
+ bx!(t.args.assets.into()),
+ t.args.fee_asset_item,
+ t.args.weight_limit,
+ )
+}
+
fn system_para_to_para_reserve_transfer_assets(t: SystemParaToParaTest) -> DispatchResult {
::PolkadotXcm::limited_reserve_transfer_assets(
t.signed_origin,
@@ -248,7 +421,7 @@ fn system_para_to_para_reserve_transfer_assets(t: SystemParaToParaTest) -> Dispa
}
fn para_to_system_para_reserve_transfer_assets(t: ParaToSystemParaTest) -> DispatchResult {
- ::PolkadotXcm::limited_reserve_transfer_assets(
+ ::PolkadotXcm::limited_reserve_transfer_assets(
t.signed_origin,
bx!(t.args.dest.into()),
bx!(t.args.beneficiary.into()),
@@ -258,8 +431,10 @@ fn para_to_system_para_reserve_transfer_assets(t: ParaToSystemParaTest) -> Dispa
)
}
-fn para_to_para_limited_reserve_transfer_assets(t: ParaToParaTest) -> DispatchResult {
- ::PolkadotXcm::limited_reserve_transfer_assets(
+fn para_to_para_through_relay_limited_reserve_transfer_assets(
+ t: ParaToParaThroughRelayTest,
+) -> DispatchResult {
+