difftreelog
Merge pull request #905 from UniqueNetwork/feature/astar-barrier
in: master
Configure astar barrier
21 files changed
.docker/Dockerfile-acala.j2diffbeforeafterboth--- a/.docker/Dockerfile-acala.j2
+++ b/.docker/Dockerfile-acala.j2
@@ -38,4 +38,4 @@
FROM ubuntu:22.04 as builder-acala
-COPY --from=builder-acala-bin /unique_parachain/Acala/target/production/acala /unique_parachain/Acala/target/production/acala
+COPY --from=builder-acala-bin /unique_parachain/Acala/target/production/acala /unique_parachain/acala/target/production/acala
.docker/Dockerfile-astar.j2diffbeforeafterboth--- /dev/null
+++ b/.docker/Dockerfile-astar.j2
@@ -0,0 +1,40 @@
+# ===== Rust builder =====
+FROM ubuntu:22.04 as rust-builder
+LABEL maintainer="Unique.Network"
+
+ENV CARGO_HOME="/cargo-home"
+ENV PATH="/cargo-home/bin:$PATH"
+ENV TZ=UTC
+RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
+
+RUN apt-get update && \
+ apt-get install -y curl cmake pkg-config libssl-dev git clang llvm libudev-dev protobuf-compiler && \
+ apt-get clean && \
+ rm -r /var/lib/apt/lists/*
+
+RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain none
+
+RUN rustup toolchain uninstall $(rustup toolchain list) && \
+ rustup toolchain install {{ RUST_TOOLCHAIN }} && \
+ rustup default {{ RUST_TOOLCHAIN }} && \
+ rustup target list --installed && \
+ rustup show
+RUN rustup target add wasm32-unknown-unknown --toolchain {{ RUST_TOOLCHAIN }}
+
+RUN mkdir /unique_parachain
+WORKDIR /unique_parachain
+
+# ===== BUILD ACALA =====
+FROM rust-builder as builder-astar-bin
+
+WORKDIR /unique_parachain
+
+RUN git clone --recurse-submodules -b {{ ASTAR_BUILD_BRANCH }} --depth 1 https://github.com/AstarNetwork/Astar.git && \
+ cd Astar && \
+ cargo build --release
+
+# ===== BIN ======
+
+FROM ubuntu:22.04 as builder-astar
+
+COPY --from=builder-astar-bin /unique_parachain/Astar/target/release/astar-collator /unique_parachain/astar/target/release/astar
.docker/Dockerfile-xcm.j2diffbeforeafterboth--- a/.docker/Dockerfile-xcm.j2
+++ b/.docker/Dockerfile-xcm.j2
@@ -23,6 +23,7 @@
COPY ./xcm-config/launch-config-xcm-{{ NETWORK }}.json ./launch-config-xcm-{{ NETWORK }}.json
COPY ./xcm-config/5validators.jsonnet ./5validators.jsonnet
+COPY ./xcm-config/6validators.jsonnet ./6validators.jsonnet
RUN git clone -b {{ BRANCH }} https://github.com/UniqueNetwork/unique-chain.git && \
cd unique-chain && \
@@ -50,6 +51,7 @@
COPY --from=builder-unique /unique_parachain/launch-config-xcm-{{ NETWORK }}.json /polkadot-launch/
COPY --from=builder-unique /unique_parachain/5validators.jsonnet /polkadot-launch/5validators.jsonnet
+COPY --from=builder-unique /unique_parachain/6validators.jsonnet /polkadot-launch/6validators.jsonnet
COPY --from=builder-unique /unique_parachain/unique-chain/target/release/unique-collator /unique-chain/target/release/
@@ -57,6 +59,7 @@
COPY --from=uniquenetwork/builder-moonbeam:{{ MOONBEAM_BUILD_BRANCH }} /unique_parachain/moonbeam/target/release/moonbeam /moonbeam/target/release/
COPY --from=uniquenetwork/builder-cumulus:{{ CUMULUS_BUILD_BRANCH }} /unique_parachain/cumulus/target/release/polkadot-parachain /cumulus/target/release/cumulus
COPY --from=uniquenetwork/builder-acala:{{ ACALA_BUILD_BRANCH }} /unique_parachain/Acala/target/production/acala /acala/target/release/
+COPY --from=uniquenetwork/builder-astar:{{ ASTAR_BUILD_BRANCH }} /unique_parachain/astar/target/release/astar /astar/target/release/
COPY --from=uniquenetwork/builder-chainql:latest /chainql/target/release/chainql /chainql/target/release/
EXPOSE 9844
@@ -65,6 +68,7 @@
EXPOSE 9946
EXPOSE 9947
EXPOSE 9948
+EXPOSE 9949
CMD export NVM_DIR="$HOME/.nvm" PATH="$PATH:/chainql/target/release" && \
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \
.docker/additional/xcm-rococo/Dockerfile-xcm-quartz-rococo.tempdiffbeforeafterboth--- a/.docker/additional/xcm-rococo/Dockerfile-xcm-quartz-rococo.temp
+++ b/.docker/additional/xcm-rococo/Dockerfile-xcm-quartz-rococo.temp
@@ -2,6 +2,7 @@
FROM uniquenetwork/builder-moonbeam:{{ MOONRIVER_BUILD_BRANCH }} as moonbeam
FROM uniquenetwork/builder-cumulus:{{ STATEMINE_BUILD_BRANCH }} as cumulus
FROM uniquenetwork/builder-acala:{{ KARURA_BUILD_BRANCH }} as acala
+FROM uniquenetwork/builder-astar:{{ SHIDEN_BUILD_BRANCH }} as astar
# ===== Rust builder =====
FROM ubuntu:22.04 as rust-builder
@@ -62,13 +63,14 @@
yarn install
COPY --from=builder-unique /unique_parachain/.docker/additional/xcm-rococo/launch-config-xcm-quartz-rococo.json /polkadot-launch/launch-config.json
-COPY --from=builder-unique /unique_parachain/.docker/xcm-config/5validators.jsonnet /polkadot-launch/5validators.jsonnet
+COPY --from=builder-unique /unique_parachain/.docker/xcm-config/6validators.jsonnet /polkadot-launch/6validators.jsonnet
COPY --from=builder-unique /unique_parachain/target/release/unique-collator /unique-chain/target/release/
COPY --from=polkadot /unique_parachain/polkadot/target/release/polkadot /polkadot/target/release/
COPY --from=moonbeam /unique_parachain/moonbeam/target/release/moonbeam /moonbeam/target/release/
COPY --from=cumulus /unique_parachain/cumulus/target/release/polkadot-parachain /cumulus/target/release/cumulus
COPY --from=acala /unique_parachain/Acala/target/production/acala /acala/target/release/
+COPY --from=astar /unique_parachain/astar/target/release/astar /astar/target/release/
COPY --from=uniquenetwork/builder-chainql:latest /chainql/target/release/chainql /chainql/target/release/
EXPOSE 9844
@@ -76,6 +78,7 @@
EXPOSE 9946
EXPOSE 9947
EXPOSE 9948
+EXPOSE 9949
CMD export NVM_DIR="$HOME/.nvm" PATH="$PATH:/chainql/target/release" && \
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \
.docker/additional/xcm-rococo/Dockerfile-xcm-unique-rococo.tempdiffbeforeafterboth--- a/.docker/additional/xcm-rococo/Dockerfile-xcm-unique-rococo.temp
+++ b/.docker/additional/xcm-rococo/Dockerfile-xcm-unique-rococo.temp
@@ -2,6 +2,7 @@
FROM uniquenetwork/builder-moonbeam:{{ MOONBEAM_BUILD_BRANCH }} as moonbeam
FROM uniquenetwork/builder-cumulus:{{ STATEMINT_BUILD_BRANCH }} as cumulus
FROM uniquenetwork/builder-acala:{{ ACALA_BUILD_BRANCH }} as acala
+FROM uniquenetwork/builder-astar:{{ ASTAR_BUILD_BRANCH }} as astar
# ===== Rust builder =====
FROM ubuntu:22.04 as rust-builder
@@ -62,13 +63,14 @@
yarn install
COPY --from=builder-unique /unique_parachain/.docker/additional/xcm-rococo/launch-config-xcm-unique-rococo.json /polkadot-launch/launch-config.json
-COPY --from=builder-unique /unique_parachain/.docker/xcm-config/5validators.jsonnet /polkadot-launch/5validators.jsonnet
+COPY --from=builder-unique /unique_parachain/.docker/xcm-config/6validators.jsonnet /polkadot-launch/6validators.jsonnet
COPY --from=builder-unique /unique_parachain/target/release/unique-collator /unique-chain/target/release/
COPY --from=polkadot /unique_parachain/polkadot/target/release/polkadot /polkadot/target/release/
COPY --from=moonbeam /unique_parachain/moonbeam/target/release/moonbeam /moonbeam/target/release/
COPY --from=cumulus /unique_parachain/cumulus/target/release/polkadot-parachain /cumulus/target/release/cumulus
COPY --from=acala /unique_parachain/Acala/target/production/acala /acala/target/release/
+COPY --from=astar /unique_parachain/astar/target/release/astar /astar/target/release/
COPY --from=uniquenetwork/builder-chainql:latest /chainql/target/release/chainql /chainql/target/release/
EXPOSE 9844
@@ -76,6 +78,7 @@
EXPOSE 9946
EXPOSE 9947
EXPOSE 9948
+EXPOSE 9949
CMD export NVM_DIR="$HOME/.nvm" PATH="$PATH:/chainql/target/release" && \
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \
.docker/additional/xcm-rococo/docker-compose-xcm-quartz-rococo.ymldiffbeforeafterboth--- a/.docker/additional/xcm-rococo/docker-compose-xcm-quartz-rococo.yml
+++ b/.docker/additional/xcm-rococo/docker-compose-xcm-quartz-rococo.yml
@@ -13,10 +13,12 @@
- 9946
- 9947
- 9948
+ - 9949
ports:
- 127.0.0.1:9844:9844
- 127.0.0.1:9944:9944
- 127.0.0.1:9946:9946
- 127.0.0.1:9947:9947
- 127.0.0.1:9948:9948
+ - 127.0.0.1:9949:9949
.docker/additional/xcm-rococo/docker-compose-xcm-unique-rococo.ymldiffbeforeafterboth--- a/.docker/additional/xcm-rococo/docker-compose-xcm-unique-rococo.yml
+++ b/.docker/additional/xcm-rococo/docker-compose-xcm-unique-rococo.yml
@@ -13,10 +13,12 @@
- 9946
- 9947
- 9948
+ - 9949
ports:
- 127.0.0.1:9844:9844
- 127.0.0.1:9944:9944
- 127.0.0.1:9946:9946
- 127.0.0.1:9947:9947
- 127.0.0.1:9948:9948
+ - 127.0.0.1:9949:9949
.docker/additional/xcm-rococo/launch-config-xcm-quartz-rococo.jsondiffbeforeafterboth--- a/.docker/additional/xcm-rococo/launch-config-xcm-quartz-rococo.json
+++ b/.docker/additional/xcm-rococo/launch-config-xcm-quartz-rococo.json
@@ -5,7 +5,7 @@
"chainInitializer": [
"chainql",
"--tla-code=spec=import '${spec}'",
- "5validators.jsonnet"
+ "6validators.jsonnet"
],
"nodes": [
{
@@ -62,8 +62,18 @@
"--unsafe-ws-external",
"-lparachain::candidate_validation=debug"
]
+ },
+ {
+ "name": "ferdie",
+ "wsPort": 9899,
+ "rpcPort": 9898,
+ "port": 30999,
+ "flags": [
+ "--unsafe-rpc-external",
+ "--unsafe-ws-external",
+ "-lparachain::candidate_validation=debug"
+ ]
}
-
],
"genesis": {
"runtime": {
@@ -155,6 +165,23 @@
]
}
]
+ },
+ {
+ "bin": "/astar/target/release/astar",
+ "id": "2007",
+ "chain": "shiden-dev",
+ "balance": "1000000000000000000000000",
+ "nodes": [
+ {
+ "wsPort": 9949,
+ "port": 31205,
+ "name": "alice",
+ "flags": [
+ "--unsafe-rpc-external",
+ "--unsafe-ws-external"
+ ]
+ }
+ ]
}
],
"simpleParachains": [],
@@ -194,7 +221,19 @@
"recipient": 2095,
"maxCapacity": 8,
"maxMessageSize": 512
- }
+ },
+ {
+ "sender": 2007,
+ "recipient": 2095,
+ "maxCapacity": 8,
+ "maxMessageSize": 512
+ },
+ {
+ "sender": 2095,
+ "recipient": 2007,
+ "maxCapacity": 8,
+ "maxMessageSize": 512
+ }
],
"finalization": false
}
.docker/additional/xcm-rococo/launch-config-xcm-unique-rococo.jsondiffbeforeafterboth--- a/.docker/additional/xcm-rococo/launch-config-xcm-unique-rococo.json
+++ b/.docker/additional/xcm-rococo/launch-config-xcm-unique-rococo.json
@@ -5,7 +5,7 @@
"chainInitializer": [
"chainql",
"--tla-code=spec=import '${spec}'",
- "5validators.jsonnet"
+ "6validators.jsonnet"
],
"nodes": [
{
@@ -62,8 +62,18 @@
"--unsafe-ws-external",
"-lparachain::candidate_validation=debug"
]
+ },
+ {
+ "name": "ferdie",
+ "wsPort": 9899,
+ "rpcPort": 9898,
+ "port": 30999,
+ "flags": [
+ "--unsafe-rpc-external",
+ "--unsafe-ws-external",
+ "-lparachain::candidate_validation=debug"
+ ]
}
-
],
"genesis": {
"runtime": {
@@ -155,6 +165,23 @@
]
}
]
+ },
+ {
+ "bin": "/astar/target/release/astar",
+ "id": "2006",
+ "chain": "astar-dev",
+ "balance": "1000000000000000000000000",
+ "nodes": [
+ {
+ "wsPort": 9949,
+ "port": 31205,
+ "name": "alice",
+ "flags": [
+ "--unsafe-rpc-external",
+ "--unsafe-ws-external"
+ ]
+ }
+ ]
}
],
"simpleParachains": [],
@@ -194,7 +221,19 @@
"recipient": 2037,
"maxCapacity": 8,
"maxMessageSize": 512
- }
+ },
+ {
+ "sender": 2006,
+ "recipient": 2037,
+ "maxCapacity": 8,
+ "maxMessageSize": 512
+ },
+ {
+ "sender": 2037,
+ "recipient": 2006,
+ "maxCapacity": 8,
+ "maxMessageSize": 512
+ }
],
"finalization": false
}
.docker/docker-compose.tmp-xcm-tests.j2diffbeforeafterboth--- a/.docker/docker-compose.tmp-xcm-tests.j2
+++ b/.docker/docker-compose.tmp-xcm-tests.j2
@@ -11,6 +11,7 @@
- 9946
- 9947
- 9948
+ - 9949
ports:
- 127.0.0.1:9844:9844
- 127.0.0.1:9933:9933
@@ -18,6 +19,7 @@
- 127.0.0.1:9946:9946
- 127.0.0.1:9947:9947
- 127.0.0.1:9948:9948
+ - 127.0.0.1:9949:9949
logging:
options:
max-size: "1m"
.docker/xcm-config/6validators.jsonnetdiffbeforeafterboth--- /dev/null
+++ b/.docker/xcm-config/6validators.jsonnet
@@ -0,0 +1,57 @@
+
+function(spec)
+ spec {
+ genesis+: {
+ runtime+: {
+ staking+: {
+ validatorCount: 6,
+ invulnerables: [
+ '5GNJqTPyNqANBkUVMN1LPPrxXnFouWXoe2wNSmmEoLctxiZY',
+ '5HpG9w8EBLe5XCrbczpwq5TSXvedjrBGCwqxK1iQ7qUsSWFc',
+ '5Ck5SLSHYac6WFt5UZRSsdJjwmpSZq85fd5TRNAdZQVzEAPT',
+ '5HKPmK9GYtE1PSLsS1qiYU9xQ9Si1NcEhdeCq9sw5bqu4ns8',
+ '5FCfAonRZgTFrTd9HREEyeJjDpT397KMzizE6T3DvebLFE7n',
+ '5CRmqmsiNFExV6VbdmPJViVxrWmkaXXvBrSX8oqBT8R9vmWk',
+ ],
+ stakers: [
+ [
+ '5GNJqTPyNqANBkUVMN1LPPrxXnFouWXoe2wNSmmEoLctxiZY',
+ '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY',
+ 100000000000000,
+ 'Validator',
+ ],
+ [
+ '5HpG9w8EBLe5XCrbczpwq5TSXvedjrBGCwqxK1iQ7qUsSWFc',
+ '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty',
+ 100000000000000,
+ 'Validator',
+ ],
+ [
+ '5Ck5SLSHYac6WFt5UZRSsdJjwmpSZq85fd5TRNAdZQVzEAPT',
+ '5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y',
+ 100000000000000,
+ 'Validator',
+ ],
+ [
+ '5HKPmK9GYtE1PSLsS1qiYU9xQ9Si1NcEhdeCq9sw5bqu4ns8',
+ '5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy',
+ 100000000000000,
+ 'Validator',
+ ],
+ [
+ '5FCfAonRZgTFrTd9HREEyeJjDpT397KMzizE6T3DvebLFE7n',
+ '5HGjWAeFDfFCWPsjFQdVV2Msvz2XtMktvgocEZcCj68kUMaw',
+ 100000000000000,
+ 'Validator',
+ ],
+ [
+ '5CRmqmsiNFExV6VbdmPJViVxrWmkaXXvBrSX8oqBT8R9vmWk',
+ '5CiPPseXPECbkjWCa6MnjNokrgYjMqmKndv2rSnekmSK2DjL',
+ 100000000000000,
+ 'Validator',
+ ],
+ ],
+ },
+ },
+ },
+ }
.docker/xcm-config/launch-config-xcm-quartz.j2diffbeforeafterboth--- a/.docker/xcm-config/launch-config-xcm-quartz.j2
+++ b/.docker/xcm-config/launch-config-xcm-quartz.j2
@@ -5,7 +5,7 @@
"chainInitializer": [
"chainql",
"--tla-code=spec=import '${spec}'",
- "5validators.jsonnet"
+ "6validators.jsonnet"
],
"nodes": [
{
@@ -62,8 +62,18 @@
"--unsafe-ws-external",
"-lparachain::candidate_validation=debug"
]
+ },
+ {
+ "name": "ferdie",
+ "wsPort": 9899,
+ "rpcPort": 9898,
+ "port": 30999,
+ "flags": [
+ "--unsafe-rpc-external",
+ "--unsafe-ws-external",
+ "-lparachain::candidate_validation=debug"
+ ]
}
-
],
"genesis": {
"runtime": {
@@ -155,6 +165,23 @@
]
}
]
+ },
+ {
+ "bin": "/astar/target/release/astar",
+ "id": "2007",
+ "chain": "shiden-dev",
+ "balance": "1000000000000000000000000",
+ "nodes": [
+ {
+ "wsPort": 9949,
+ "port": 31205,
+ "name": "alice",
+ "flags": [
+ "--unsafe-rpc-external",
+ "--unsafe-ws-external"
+ ]
+ }
+ ]
}
],
"simpleParachains": [],
@@ -194,7 +221,19 @@
"recipient": 2095,
"maxCapacity": 8,
"maxMessageSize": 512
- }
+ },
+ {
+ "sender": 2007,
+ "recipient": 2095,
+ "maxCapacity": 8,
+ "maxMessageSize": 512
+ },
+ {
+ "sender": 2095,
+ "recipient": 2007,
+ "maxCapacity": 8,
+ "maxMessageSize": 512
+ }
],
"finalization": false
}
.docker/xcm-config/launch-config-xcm-unique.j2diffbeforeafterboth--- a/.docker/xcm-config/launch-config-xcm-unique.j2
+++ b/.docker/xcm-config/launch-config-xcm-unique.j2
@@ -5,7 +5,7 @@
"chainInitializer": [
"chainql",
"--tla-code=spec=import '${spec}'",
- "5validators.jsonnet"
+ "6validators.jsonnet"
],
"nodes": [
{
@@ -62,8 +62,18 @@
"--unsafe-ws-external",
"-lparachain::candidate_validation=debug"
]
- }
-
+ },
+ {
+ "name": "ferdie",
+ "wsPort": 9899,
+ "rpcPort": 9898,
+ "port": 30999,
+ "flags": [
+ "--unsafe-rpc-external",
+ "--unsafe-ws-external",
+ "-lparachain::candidate_validation=debug"
+ ]
+ }
],
"genesis": {
"runtime": {
@@ -93,7 +103,7 @@
"-lxcm=trace,parity_ws::handler=debug,jsonrpsee_core=trace,jsonrpsee-core=trace,jsonrpsee_ws_server=debug",
"--unsafe-rpc-external",
"--unsafe-ws-external"
- ]
+ ]
}
]
},
@@ -115,7 +125,7 @@
"flags": [
"--unsafe-rpc-external",
"--unsafe-ws-external"
- ]
+ ]
}
]
},
@@ -133,7 +143,7 @@
"flags": [
"--unsafe-rpc-external",
"--unsafe-ws-external",
- "--",
+ "--",
"--execution=wasm"
]
}
@@ -152,9 +162,26 @@
"flags": [
"--unsafe-rpc-external",
"--unsafe-ws-external"
- ]
+ ]
}
]
+ },
+ {
+ "bin": "/astar/target/release/astar",
+ "id": "2006",
+ "chain": "astar-dev",
+ "balance": "1000000000000000000000000",
+ "nodes": [
+ {
+ "wsPort": 9949,
+ "port": 31205,
+ "name": "alice",
+ "flags": [
+ "--unsafe-rpc-external",
+ "--unsafe-ws-external"
+ ]
+ }
+ ]
}
],
"simpleParachains": [],
@@ -194,7 +221,19 @@
"recipient": 2037,
"maxCapacity": 8,
"maxMessageSize": 512
- }
+ },
+ {
+ "sender": 2006,
+ "recipient": 2037,
+ "maxCapacity": 8,
+ "maxMessageSize": 512
+ },
+ {
+ "sender": 2037,
+ "recipient": 2006,
+ "maxCapacity": 8,
+ "maxMessageSize": 512
+ }
],
"finalization": false
}
.envdiffbeforeafterboth--- a/.env
+++ b/.env
@@ -7,6 +7,7 @@
STATEMINT_BUILD_BRANCH=release-parachains-v9370
ACALA_BUILD_BRANCH=2.12.0
MOONBEAM_BUILD_BRANCH=runtime-2100
+ASTAR_BUILD_BRANCH=v4.49.0
UNIQUE_MAINNET_BRANCH=release-v930033-fix-gas-price
UNIQUE_REPLICA_FROM=wss://ws.unique.network:443
@@ -14,6 +15,7 @@
STATEMINE_BUILD_BRANCH=release-parachains-v9370
KARURA_BUILD_BRANCH=release-karura-2.15.0
MOONRIVER_BUILD_BRANCH=runtime-2201
+SHIDEN_BUILD_BRANCH=v4.49.0
QUARTZ_MAINNET_BRANCH=release-v930034-fix-gas-price
QUARTZ_REPLICA_FROM=wss://ws-quartz.unique.network:443
.github/workflows/xcm.ymldiffbeforeafterboth1name: xcm-testnet-build23# Controls when the action will run.4on:5 workflow_call:6 7 # Allows you to run this workflow manually from the Actions tab8 workflow_dispatch:910#Define Workflow variables11env:12 REPO_URL: ${{ github.server_url }}/${{ github.repository }}1314# A workflow run is made up of one or more jobs that can run sequentially or in parallel15jobs:1617 prepare-execution-marix:1819 name: Prepare execution matrix2021 runs-on: [XL]22 outputs:23 matrix: ${{ steps.create_matrix.outputs.matrix }}2425 steps:2627 - name: Clean Workspace28 uses: AutoModality/action-clean@v1.1.02930 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it31 - uses: actions/checkout@v332 with:33 ref: ${{ github.head_ref }} #Checking out head commit3435 - name: Read .env file36 uses: xom9ikk/dotenv@v23738 - name: Create Execution matrix39 uses: fabiocaccamo/create-matrix-action@v240 id: create_matrix41 with:42 matrix: |43 network {opal}, relay_branch {${{ env.UNIQUEWEST_MAINNET_BRANCH }}}, acala_version {${{ env.ACALA_BUILD_BRANCH }}}, moonbeam_version {${{ env.MOONBEAM_BUILD_BRANCH }}}, cumulus_version {${{ env.WESTMINT_BUILD_BRANCH }}}, runtest {testXcmOpal}44 network {quartz}, relay_branch {${{ env.KUSAMA_MAINNET_BRANCH }}}, acala_version {${{ env.KARURA_BUILD_BRANCH }}}, moonbeam_version {${{ env.MOONRIVER_BUILD_BRANCH }}}, cumulus_version {${{ env.STATEMINE_BUILD_BRANCH }}}, runtest {testXcmQuartz}45 network {unique}, relay_branch {${{ env.POLKADOT_MAINNET_BRANCH }}}, acala_version {${{ env.ACALA_BUILD_BRANCH }}}, moonbeam_version {${{ env.MOONBEAM_BUILD_BRANCH }}}, cumulus_version {${{ env.STATEMINT_BUILD_BRANCH }}}, runtest {testXcmUnique}4647 xcm-build:48 49 needs: prepare-execution-marix50 # The type of runner that the job will run on51 runs-on: [XL]5253 timeout-minutes: 6005455 name: ${{ matrix.network }}-build5657 continue-on-error: true #Do not stop testing of matrix runs failed. As it decided during PR review - it required 50/50& Let's check it with false.5859 strategy:60 matrix:61 include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}6263 steps:64 - name: Skip if pull request is in Draft65 if: github.event.pull_request.draft == true66 run: exit 16768 - name: Clean Workspace69 uses: AutoModality/action-clean@v1.1.07071 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it72 - uses: actions/checkout@v373 with:74 ref: ${{ github.head_ref }} #Checking out head commit7576 - name: Read .env file77 uses: xom9ikk/dotenv@v27879 - name: Log in to Docker Hub80 uses: docker/login-action@v2.0.081 with:82 username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}83 password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}8485 - name: Install jq86 run: sudo apt install jq -y8788 # Check POLKADOT version and build it if it doesn't exist in repository89 - name: Generate ENV related extend Dockerfile file for POLKADOT90 uses: cuchi/jinja2-action@v1.2.091 with:92 template: .docker/Dockerfile-polkadot.j293 output_file: .docker/Dockerfile-polkadot.${{ matrix.relay_branch }}.yml94 variables: |95 RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}96 POLKADOT_BUILD_BRANCH=${{ matrix.relay_branch }}9798 - name: Check if the dockerhub repository contains the needed version POLKADOT99 run: |100 # aquire token101 TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${{ secrets.CORE_DOCKERHUB_USERNAME }}'", "password": "'${{ secrets.CORE_DOCKERHUB_TOKEN }}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)102 export TOKEN=$TOKEN103104 # Get TAGS from DOCKERHUB POLKADOT repository105 POLKADOT_TAGS=$(curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/uniquenetwork/builder-polkadot/tags/?page_size=100 | jq -r '."results"[]["name"]')106 # Show TAGS107 echo "POLKADOT TAGS:"108 echo $POLKADOT_TAGS109 # Check correct version POLKADOT and build it if it doesn't exist in POLKADOT TAGS110 if [[ ${POLKADOT_TAGS[*]} =~ (^|[[:space:]])"${{ matrix.relay_branch }}"($|[[:space:]]) ]]; then111 echo "Repository has needed POLKADOT version";112 docker pull uniquenetwork/builder-polkadot:${{ matrix.relay_branch }}113 else114 echo "Repository has not needed POLKADOT version, so build it";115 cd .docker/ && docker build --no-cache --file ./Dockerfile-polkadot.${{ matrix.relay_branch }}.yml --tag uniquenetwork/builder-polkadot:${{ matrix.relay_branch }} .116 echo "Push needed POLKADOT version to the repository";117 docker push uniquenetwork/builder-polkadot:${{ matrix.relay_branch }}118 fi119 shell: bash120121 # Check ACALA version and build it if it doesn't exist in repository122 - name: Generate ENV related extend Dockerfile file for ACALA123 uses: cuchi/jinja2-action@v1.2.0124 with:125 template: .docker/Dockerfile-acala.j2126 output_file: .docker/Dockerfile-acala.${{ matrix.acala_version }}.yml127 variables: |128 RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}129 ACALA_BUILD_BRANCH=${{ matrix.acala_version }}130131 - name: Check if the dockerhub repository contains the needed ACALA version132 run: |133 # aquire token134 TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${{ secrets.CORE_DOCKERHUB_USERNAME }}'", "password": "'${{ secrets.CORE_DOCKERHUB_TOKEN }}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)135 export TOKEN=$TOKEN136137 # Get TAGS from DOCKERHUB repository138 ACALA_TAGS=$(curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/uniquenetwork/builder-acala/tags/?page_size=100 | jq -r '."results"[]["name"]')139 # Show TAGS140 echo "ACALA TAGS:"141 echo $ACALA_TAGS142 # Check correct version ACALA and build it if it doesn't exist in ACALA TAGS143 if [[ ${ACALA_TAGS[*]} =~ (^|[[:space:]])"${{ matrix.acala_version }}"($|[[:space:]]) ]]; then144 echo "Repository has needed ACALA version";145 docker pull uniquenetwork/builder-acala:${{ matrix.acala_version }}146 else147 echo "Repository has not needed ACALA version, so build it";148 cd .docker/ && docker build --no-cache --file ./Dockerfile-acala.${{ matrix.acala_version }}.yml --tag uniquenetwork/builder-acala:${{ matrix.acala_version }} .149 echo "Push needed ACALA version to the repository";150 docker push uniquenetwork/builder-acala:${{ matrix.acala_version }}151 fi152 shell: bash153154 # Check MOONBEAM version and build it if it doesn't exist in repository155 - name: Generate ENV related extend Dockerfile file for MOONBEAM156 uses: cuchi/jinja2-action@v1.2.0157 with:158 template: .docker/Dockerfile-moonbeam.j2159 output_file: .docker/Dockerfile-moonbeam.${{ matrix.moonbeam_version }}.yml160 variables: |161 RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}162 MOONBEAM_BUILD_BRANCH=${{ matrix.moonbeam_version }}163164 - name: Check if the dockerhub repository contains the needed MOONBEAM version165 run: |166 # aquire token167 TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${{ secrets.CORE_DOCKERHUB_USERNAME }}'", "password": "'${{ secrets.CORE_DOCKERHUB_TOKEN }}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)168 export TOKEN=$TOKEN169170 # Get TAGS from DOCKERHUB repository171 MOONBEAM_TAGS=$(curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/uniquenetwork/builder-moonbeam/tags/?page_size=100 | jq -r '."results"[]["name"]')172 # Show TAGS173 echo "MOONBEAM TAGS:"174 echo $MOONBEAM_TAGS175 # Check correct version MOONBEAM and build it if it doesn't exist in MOONBEAM TAGS176 if [[ ${MOONBEAM_TAGS[*]} =~ (^|[[:space:]])"${{ matrix.moonbeam_version }}"($|[[:space:]]) ]]; then177 echo "Repository has needed MOONBEAM version";178 docker pull uniquenetwork/builder-moonbeam:${{ matrix.moonbeam_version }}179 else180 echo "Repository has not needed MOONBEAM version, so build it";181 cd .docker/ && docker build --no-cache --file ./Dockerfile-moonbeam.${{ matrix.moonbeam_version }}.yml --tag uniquenetwork/builder-moonbeam:${{ matrix.moonbeam_version }} .182 echo "Push needed MOONBEAM version to the repository";183 docker push uniquenetwork/builder-moonbeam:${{ matrix.moonbeam_version }}184 fi185 shell: bash186187188 # Check CUMULUS version and build it if it doesn't exist in repository189 - name: Generate ENV related extend Dockerfile file for CUMULUS190 uses: cuchi/jinja2-action@v1.2.0191 with:192 template: .docker/Dockerfile-cumulus.j2193 output_file: .docker/Dockerfile-cumulus.${{ matrix.cumulus_version }}.yml194 variables: |195 RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}196 CUMULUS_BUILD_BRANCH=${{ matrix.cumulus_version }}197198 - name: Check if the dockerhub repository contains the needed CUMULUS version199 run: | 200 # aquire token201 TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${{ secrets.CORE_DOCKERHUB_USERNAME }}'", "password": "'${{ secrets.CORE_DOCKERHUB_TOKEN }}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)202 export TOKEN=$TOKEN203204 # Get TAGS from DOCKERHUB repository205 CUMULUS_TAGS=$(curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/uniquenetwork/builder-cumulus/tags/?page_size=100 | jq -r '."results"[]["name"]')206 # Show TAGS207 echo "CUMULUS TAGS:"208 echo $CUMULUS_TAGS209 # Check correct version CUMULUS and build it if it doesn't exist in CUMULUS TAGS210 if [[ ${CUMULUS_TAGS[*]} =~ (^|[[:space:]])"${{ matrix.cumulus_version }}"($|[[:space:]]) ]]; then211 echo "Repository has needed CUMULUS version";212 docker pull uniquenetwork/builder-cumulus:${{ matrix.cumulus_version }}213 else214 echo "Repository has not needed CUMULUS version, so build it";215 cd .docker/ && docker build --no-cache --file ./Dockerfile-cumulus.${{ matrix.cumulus_version }}.yml --tag uniquenetwork/builder-cumulus:${{ matrix.cumulus_version }} .216 echo "Push needed CUMULUS version to the repository";217 docker push uniquenetwork/builder-cumulus:${{ matrix.cumulus_version }}218 fi219 shell: bash220221 - name: Generate ENV related extend launch-config file222 uses: cuchi/jinja2-action@v1.2.0223 with:224 template: .docker/xcm-config/launch-config-xcm-${{ matrix.network }}.j2225 output_file: .docker/xcm-config/launch-config-xcm-${{ matrix.network }}.json226 variables: |227 RELAY_CHAIN_TYPE=${{ env.RELAY_CHAIN_TYPE }} 228229 - name: Show launch-config-xcm-${{ matrix.network }} configuration230 run: cat .docker/xcm-config/launch-config-xcm-${{ matrix.network }}.json231232 # Build main image for XCM 233 - name: Generate ENV related extend Dockerfile file234 uses: cuchi/jinja2-action@v1.2.0235 with:236 template: .docker/Dockerfile-xcm.j2237 output_file: .docker/Dockerfile-xcm.${{ matrix.network }}.yml238 variables: |239 RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}240 NETWORK=${{ matrix.network }}241 POLKADOT_BUILD_BRANCH=${{ matrix.relay_branch }}242 POLKADOT_LAUNCH_BRANCH=${{ env.POLKADOT_LAUNCH_BRANCH }} 243 BRANCH=${{ github.head_ref }}244 ACALA_BUILD_BRANCH=${{ matrix.acala_version }}245 MOONBEAM_BUILD_BRANCH=${{ matrix.moonbeam_version }}246 CUMULUS_BUILD_BRANCH=${{ matrix.cumulus_version }}247248 - name: Show build Dockerfile249 run: cat .docker/Dockerfile-xcm.${{ matrix.network }}.yml250251 - name: Run find-and-replace to remove slashes from branch name252 uses: mad9000/actions-find-and-replace-string@2253 id: branchname254 with:255 source: ${{ github.head_ref }}256 find: '/'257 replace: '-'258259 - name: Pull chainql docker image260 run: docker pull uniquenetwork/builder-chainql:latest261262 - name: Build the stack263 run: cd .docker/ && docker build --no-cache --file ./Dockerfile-xcm.${{ matrix.network }}.yml --tag uniquenetwork/xcm-${{ matrix.network }}-testnet-local:nightly-${{ steps.branchname.outputs.value }}-${{ github.sha }} --tag uniquenetwork/xcm-${{ matrix.network }}-testnet-local:latest .264265 - name: Push docker image version266 run: docker push uniquenetwork/xcm-${{ matrix.network }}-testnet-local:nightly-${{ steps.branchname.outputs.value }}-${{ github.sha }}267268 - name: Push docker image latest269 run: docker push uniquenetwork/xcm-${{ matrix.network }}-testnet-local:latest270271 - name: Remove builder cache272 if: always() # run this step always273 run: |274 docker builder prune -f275 docker system prune -f276277 xcm-tests:278 needs: [prepare-execution-marix, xcm-build]279 # The type of runner that the job will run on280 runs-on: [XL]281282 timeout-minutes: 600283284 name: ${{ matrix.network }}-tests285286 continue-on-error: true #Do not stop testing of matrix runs failed. As it decided during PR review - it required 50/50& Let's check it with false.287288 strategy:289 matrix:290 include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}291292 steps:293 - name: Skip if pull request is in Draft294 if: github.event.pull_request.draft == true295 run: exit 1296297 - name: Clean Workspace298 uses: AutoModality/action-clean@v1.1.0299300 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it301 - uses: actions/checkout@v3302 with:303 ref: ${{ github.head_ref }} #Checking out head commit304305 - name: Read .env file306 uses: xom9ikk/dotenv@v2307308 - name: Generate ENV related extend file for docker-compose309 uses: cuchi/jinja2-action@v1.2.0310 with:311 template: .docker/docker-compose.tmp-xcm-tests.j2312 output_file: .docker/docker-compose.xcm-tests.${{ matrix.network }}.yml313 variables: |314 NETWORK=${{ matrix.network }}315316 - name: Show build configuration317 run: cat .docker/docker-compose.xcm-tests.${{ matrix.network }}.yml318319 - uses: actions/setup-node@v3320 with:321 node-version: 16322323 - name: Build the stack324 run: docker-compose -f ".docker/docker-compose.xcm-tests.${{ matrix.network }}.yml" up -d --remove-orphans --force-recreate --timeout 300325326 # 🚀 POLKADOT LAUNCH COMPLETE 🚀327 - name: Check if docker logs consist messages related to testing of xcm tests 328 if: success()329 run: |330 counter=160331 function check_container_status {332 docker inspect -f {{.State.Running}} xcm-${{ matrix.network }}-testnet-local333 }334 function do_docker_logs {335 docker logs --details xcm-${{ matrix.network }}-testnet-local 2>&1336 }337 function is_started {338 if [ "$(check_container_status)" == "true" ]; then339 echo "Container: xcm-${{ matrix.network }}-testnet-local RUNNING";340 echo "Check Docker logs"341 DOCKER_LOGS=$(do_docker_logs)342 if [[ ${DOCKER_LOGS} = *"POLKADOT LAUNCH COMPLETE"* ]];then343 echo "🚀 POLKADOT LAUNCH COMPLETE 🚀"344 return 0345 else346 echo "Message not found in logs output, repeating..."347 return 1348 fi349 else350 echo "Container xcm-${{ matrix.network }}-testnet-local NOT RUNNING"351 echo "Halting all future checks"352 exit 1353 fi354 echo "something goes wrong"355 exit 1356 }357 while ! is_started; do358 echo "Waiting for special message in log files "359 sleep 30s360 counter=$(( $counter - 1 ))361 echo "Counter: $counter"362 if [ "$counter" -gt "0" ]; then363 continue364 else365 break366 fi367 done368 echo "Halting script"369 exit 0370 shell: bash371372 - name: Run XCM tests 373 working-directory: tests374 run: |375 yarn install376 yarn add mochawesome377 node scripts/readyness.js378 echo "Ready to start tests"379 yarn polkadot-types 380 NOW=$(date +%s) && yarn ${{ matrix.runtest }} --reporter mochawesome --reporter-options reportFilename=test-${NOW}381 env:382 RPC_URL: http://127.0.0.1:9933/383384 - name: XCM Test Report385 uses: phoenix-actions/test-reporting@v8386 id: test-report387 if: success() || failure() # run this step even if previous step failed388 with:389 name: XCM Tests ${{ matrix.network }} # Name of the check run which will be created390 path: tests/mochawesome-report/test-*.json # Path to test results391 reporter: mochawesome-json392 fail-on-error: 'false'393394 - name: Show container logs395 if: always() # run this step always396 run: docker-compose -f ".docker/docker-compose.xcm-tests.${{ matrix.network }}.yml" logs397398 - name: Stop running containers399 if: always() # run this step always400 run: docker-compose -f ".docker/docker-compose.xcm-tests.${{ matrix.network }}.yml" down401402 - name: Clean Workspace403 if: always()404 uses: AutoModality/action-clean@v1.1.0405406 - name: Remove builder cache407 if: always() # run this step always408 run: |409 docker system prune -a -f1name: xcm-testnet-build23# Controls when the action will run.4on:5 workflow_call:6 7 # Allows you to run this workflow manually from the Actions tab8 workflow_dispatch:910#Define Workflow variables11env:12 REPO_URL: ${{ github.server_url }}/${{ github.repository }}1314# A workflow run is made up of one or more jobs that can run sequentially or in parallel15jobs:1617 prepare-execution-marix:1819 name: Prepare execution matrix2021 runs-on: [self-hosted-ci]22 outputs:23 matrix: ${{ steps.create_matrix.outputs.matrix }}2425 steps:2627 - name: Clean Workspace28 uses: AutoModality/action-clean@v1.1.02930 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it31 - uses: actions/checkout@v332 with:33 ref: ${{ github.head_ref }} #Checking out head commit3435 - name: Read .env file36 uses: xom9ikk/dotenv@v23738 - name: Create Execution matrix39 uses: fabiocaccamo/create-matrix-action@v240 id: create_matrix41 with:42 matrix: |43 network {opal}, relay_branch {${{ env.UNIQUEWEST_MAINNET_BRANCH }}}, acala_version {${{ env.ACALA_BUILD_BRANCH }}}, moonbeam_version {${{ env.MOONBEAM_BUILD_BRANCH }}}, cumulus_version {${{ env.WESTMINT_BUILD_BRANCH }}}, runtest {testXcmOpal}44 network {quartz}, relay_branch {${{ env.KUSAMA_MAINNET_BRANCH }}}, acala_version {${{ env.KARURA_BUILD_BRANCH }}}, moonbeam_version {${{ env.MOONRIVER_BUILD_BRANCH }}}, cumulus_version {${{ env.STATEMINE_BUILD_BRANCH }}}, astar_version {${{ env.SHIDEN_BUILD_BRANCH }}}, runtest {testXcmQuartz}45 network {unique}, relay_branch {${{ env.POLKADOT_MAINNET_BRANCH }}}, acala_version {${{ env.ACALA_BUILD_BRANCH }}}, moonbeam_version {${{ env.MOONBEAM_BUILD_BRANCH }}}, cumulus_version {${{ env.STATEMINT_BUILD_BRANCH }}}, astar_version {${{ env.ASTAR_BUILD_BRANCH }}}, runtest {testXcmUnique}4647 xcm-build:48 49 needs: prepare-execution-marix50 # The type of runner that the job will run on51 runs-on: [XL]5253 timeout-minutes: 6005455 name: ${{ matrix.network }}-build5657 continue-on-error: true #Do not stop testing of matrix runs failed. As it decided during PR review - it required 50/50& Let's check it with false.5859 strategy:60 matrix:61 include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}6263 steps:64 - name: Skip if pull request is in Draft65 if: github.event.pull_request.draft == true66 run: exit 16768 - name: Clean Workspace69 uses: AutoModality/action-clean@v1.1.07071 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it72 - uses: actions/checkout@v373 with:74 ref: ${{ github.head_ref }} #Checking out head commit7576 - name: Read .env file77 uses: xom9ikk/dotenv@v27879 - name: Log in to Docker Hub80 uses: docker/login-action@v2.0.081 with:82 username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}83 password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}8485 - name: Install jq86 run: sudo apt install jq -y8788 # Check POLKADOT version and build it if it doesn't exist in repository89 - name: Generate ENV related extend Dockerfile file for POLKADOT90 uses: cuchi/jinja2-action@v1.2.091 with:92 template: .docker/Dockerfile-polkadot.j293 output_file: .docker/Dockerfile-polkadot.${{ matrix.relay_branch }}.yml94 variables: |95 RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}96 POLKADOT_BUILD_BRANCH=${{ matrix.relay_branch }}9798 - name: Check if the dockerhub repository contains the needed version POLKADOT99 run: |100 # aquire token101 TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${{ secrets.CORE_DOCKERHUB_USERNAME }}'", "password": "'${{ secrets.CORE_DOCKERHUB_TOKEN }}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)102 export TOKEN=$TOKEN103104 # Get TAGS from DOCKERHUB POLKADOT repository105 POLKADOT_TAGS=$(curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/uniquenetwork/builder-polkadot/tags/?page_size=100 | jq -r '."results"[]["name"]')106 # Show TAGS107 echo "POLKADOT TAGS:"108 echo $POLKADOT_TAGS109 # Check correct version POLKADOT and build it if it doesn't exist in POLKADOT TAGS110 if [[ ${POLKADOT_TAGS[*]} =~ (^|[[:space:]])"${{ matrix.relay_branch }}"($|[[:space:]]) ]]; then111 echo "Repository has needed POLKADOT version";112 docker pull uniquenetwork/builder-polkadot:${{ matrix.relay_branch }}113 else114 echo "Repository has not needed POLKADOT version, so build it";115 cd .docker/ && docker build --no-cache --file ./Dockerfile-polkadot.${{ matrix.relay_branch }}.yml --tag uniquenetwork/builder-polkadot:${{ matrix.relay_branch }} .116 echo "Push needed POLKADOT version to the repository";117 docker push uniquenetwork/builder-polkadot:${{ matrix.relay_branch }}118 fi119 shell: bash120121 # Check ACALA version and build it if it doesn't exist in repository122 - name: Generate ENV related extend Dockerfile file for ACALA123 uses: cuchi/jinja2-action@v1.2.0124 with:125 template: .docker/Dockerfile-acala.j2126 output_file: .docker/Dockerfile-acala.${{ matrix.acala_version }}.yml127 variables: |128 RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}129 ACALA_BUILD_BRANCH=${{ matrix.acala_version }}130131 - name: Check if the dockerhub repository contains the needed ACALA version132 run: |133 # aquire token134 TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${{ secrets.CORE_DOCKERHUB_USERNAME }}'", "password": "'${{ secrets.CORE_DOCKERHUB_TOKEN }}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)135 export TOKEN=$TOKEN136137 # Get TAGS from DOCKERHUB repository138 ACALA_TAGS=$(curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/uniquenetwork/builder-acala/tags/?page_size=100 | jq -r '."results"[]["name"]')139 # Show TAGS140 echo "ACALA TAGS:"141 echo $ACALA_TAGS142 # Check correct version ACALA and build it if it doesn't exist in ACALA TAGS143 if [[ ${ACALA_TAGS[*]} =~ (^|[[:space:]])"${{ matrix.acala_version }}"($|[[:space:]]) ]]; then144 echo "Repository has needed ACALA version";145 docker pull uniquenetwork/builder-acala:${{ matrix.acala_version }}146 else147 echo "Repository has not needed ACALA version, so build it";148 cd .docker/ && docker build --no-cache --file ./Dockerfile-acala.${{ matrix.acala_version }}.yml --tag uniquenetwork/builder-acala:${{ matrix.acala_version }} .149 echo "Push needed ACALA version to the repository";150 docker push uniquenetwork/builder-acala:${{ matrix.acala_version }}151 fi152 shell: bash153154 # Check MOONBEAM version and build it if it doesn't exist in repository155 - name: Generate ENV related extend Dockerfile file for MOONBEAM156 uses: cuchi/jinja2-action@v1.2.0157 with:158 template: .docker/Dockerfile-moonbeam.j2159 output_file: .docker/Dockerfile-moonbeam.${{ matrix.moonbeam_version }}.yml160 variables: |161 RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}162 MOONBEAM_BUILD_BRANCH=${{ matrix.moonbeam_version }}163164 - name: Check if the dockerhub repository contains the needed MOONBEAM version165 run: |166 # aquire token167 TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${{ secrets.CORE_DOCKERHUB_USERNAME }}'", "password": "'${{ secrets.CORE_DOCKERHUB_TOKEN }}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)168 export TOKEN=$TOKEN169170 # Get TAGS from DOCKERHUB repository171 MOONBEAM_TAGS=$(curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/uniquenetwork/builder-moonbeam/tags/?page_size=100 | jq -r '."results"[]["name"]')172 # Show TAGS173 echo "MOONBEAM TAGS:"174 echo $MOONBEAM_TAGS175 # Check correct version MOONBEAM and build it if it doesn't exist in MOONBEAM TAGS176 if [[ ${MOONBEAM_TAGS[*]} =~ (^|[[:space:]])"${{ matrix.moonbeam_version }}"($|[[:space:]]) ]]; then177 echo "Repository has needed MOONBEAM version";178 docker pull uniquenetwork/builder-moonbeam:${{ matrix.moonbeam_version }}179 else180 echo "Repository has not needed MOONBEAM version, so build it";181 cd .docker/ && docker build --no-cache --file ./Dockerfile-moonbeam.${{ matrix.moonbeam_version }}.yml --tag uniquenetwork/builder-moonbeam:${{ matrix.moonbeam_version }} .182 echo "Push needed MOONBEAM version to the repository";183 docker push uniquenetwork/builder-moonbeam:${{ matrix.moonbeam_version }}184 fi185 shell: bash186187 # Check CUMULUS version and build it if it doesn't exist in repository188 - name: Generate ENV related extend Dockerfile file for CUMULUS189 uses: cuchi/jinja2-action@v1.2.0190 with:191 template: .docker/Dockerfile-cumulus.j2192 output_file: .docker/Dockerfile-cumulus.${{ matrix.cumulus_version }}.yml193 variables: |194 RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}195 CUMULUS_BUILD_BRANCH=${{ matrix.cumulus_version }}196197 - name: Check if the dockerhub repository contains the needed CUMULUS version198 run: | 199 # aquire token200 TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${{ secrets.CORE_DOCKERHUB_USERNAME }}'", "password": "'${{ secrets.CORE_DOCKERHUB_TOKEN }}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)201 export TOKEN=$TOKEN202203 # Get TAGS from DOCKERHUB repository204 CUMULUS_TAGS=$(curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/uniquenetwork/builder-cumulus/tags/?page_size=100 | jq -r '."results"[]["name"]')205 # Show TAGS206 echo "CUMULUS TAGS:"207 echo $CUMULUS_TAGS208 # Check correct version CUMULUS and build it if it doesn't exist in CUMULUS TAGS209 if [[ ${CUMULUS_TAGS[*]} =~ (^|[[:space:]])"${{ matrix.cumulus_version }}"($|[[:space:]]) ]]; then210 echo "Repository has needed CUMULUS version";211 docker pull uniquenetwork/builder-cumulus:${{ matrix.cumulus_version }}212 else213 echo "Repository has not needed CUMULUS version, so build it";214 cd .docker/ && docker build --no-cache --file ./Dockerfile-cumulus.${{ matrix.cumulus_version }}.yml --tag uniquenetwork/builder-cumulus:${{ matrix.cumulus_version }} .215 echo "Push needed CUMULUS version to the repository";216 docker push uniquenetwork/builder-cumulus:${{ matrix.cumulus_version }}217 fi218 shell: bash219220221 # Check ASTAR version and build it if it doesn't exist in repository222 - name: Generate ENV related extend Dockerfile file for ASTAR223 uses: cuchi/jinja2-action@v1.2.0224 with:225 template: .docker/Dockerfile-astar.j2226 output_file: .docker/Dockerfile-astar.${{ matrix.astar_version }}.yml227 variables: |228 RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}229 ASTAR_BUILD_BRANCH=${{ matrix.astar_version }}230231 - name: Check if the dockerhub repository contains the needed ASTAR version232 run: |233 # aquire token234 TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${{ secrets.CORE_DOCKERHUB_USERNAME }}'", "password": "'${{ secrets.CORE_DOCKERHUB_TOKEN }}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)235 export TOKEN=$TOKEN236237 # Get TAGS from DOCKERHUB repository238 ASTAR_TAGS=$(curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/uniquenetwork/builder-astar/tags/?page_size=100 | jq -r '."results"[]["name"]')239 # Show TAGS240 echo "ASTAR TAGS:"241 echo $ASTAR_TAGS242 # Check correct version ASTAR and build it if it doesn't exist in ASTAR TAGS243 if [[ ${ASTAR_TAGS[*]} =~ (^|[[:space:]])"${{ matrix.astar_version }}"($|[[:space:]]) ]]; then244 echo "Repository has needed ASTAR version";245 docker pull uniquenetwork/builder-astar:${{ matrix.astar_version }}246 else247 echo "Repository has not needed ASTAR version, so build it";248 cd .docker/ && docker build --no-cache --file ./Dockerfile-astar.${{ matrix.astar_version }}.yml --tag uniquenetwork/builder-astar:${{ matrix.astar_version }} .249 echo "Push needed ASTAR version to the repository";250 docker push uniquenetwork/builder-astar:${{ matrix.astar_version }}251 fi252 shell: bash253254255 - name: Generate ENV related extend launch-config file256 uses: cuchi/jinja2-action@v1.2.0257 with:258 template: .docker/xcm-config/launch-config-xcm-${{ matrix.network }}.j2259 output_file: .docker/xcm-config/launch-config-xcm-${{ matrix.network }}.json260 variables: |261 RELAY_CHAIN_TYPE=${{ env.RELAY_CHAIN_TYPE }} 262263 - name: Show launch-config-xcm-${{ matrix.network }} configuration264 run: cat .docker/xcm-config/launch-config-xcm-${{ matrix.network }}.json265266 # Build main image for XCM 267 - name: Generate ENV related extend Dockerfile file268 uses: cuchi/jinja2-action@v1.2.0269 with:270 template: .docker/Dockerfile-xcm.j2271 output_file: .docker/Dockerfile-xcm.${{ matrix.network }}.yml272 variables: |273 RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}274 NETWORK=${{ matrix.network }}275 POLKADOT_BUILD_BRANCH=${{ matrix.relay_branch }}276 POLKADOT_LAUNCH_BRANCH=${{ env.POLKADOT_LAUNCH_BRANCH }} 277 BRANCH=${{ github.head_ref }}278 ACALA_BUILD_BRANCH=${{ matrix.acala_version }}279 ASTAR_BUILD_BRANCH=${{ matrix.astar_version }}280 MOONBEAM_BUILD_BRANCH=${{ matrix.moonbeam_version }}281 CUMULUS_BUILD_BRANCH=${{ matrix.cumulus_version }}282283 - name: Show build Dockerfile284 run: cat .docker/Dockerfile-xcm.${{ matrix.network }}.yml285286 - name: Run find-and-replace to remove slashes from branch name287 uses: mad9000/actions-find-and-replace-string@2288 id: branchname289 with:290 source: ${{ github.head_ref }}291 find: '/'292 replace: '-'293294 - name: Pull chainql docker image295 run: docker pull uniquenetwork/builder-chainql:latest296297 - name: Build the stack298 run: cd .docker/ && docker build --no-cache --file ./Dockerfile-xcm.${{ matrix.network }}.yml --tag uniquenetwork/xcm-${{ matrix.network }}-testnet-local:nightly-${{ steps.branchname.outputs.value }}-${{ github.sha }} --tag uniquenetwork/xcm-${{ matrix.network }}-testnet-local:latest .299300 - name: Push docker image version301 run: docker push uniquenetwork/xcm-${{ matrix.network }}-testnet-local:nightly-${{ steps.branchname.outputs.value }}-${{ github.sha }}302303 - name: Push docker image latest304 run: docker push uniquenetwork/xcm-${{ matrix.network }}-testnet-local:latest305306 - name: Remove builder cache307 if: always() # run this step always308 run: |309 docker builder prune -f310 docker system prune -f311312 xcm-tests:313 needs: [prepare-execution-marix, xcm-build]314 # The type of runner that the job will run on315 runs-on: [XL]316317 timeout-minutes: 600318319 name: ${{ matrix.network }}-tests320321 continue-on-error: true #Do not stop testing of matrix runs failed. As it decided during PR review - it required 50/50& Let's check it with false.322323 strategy:324 matrix:325 include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}326327 steps:328 - name: Skip if pull request is in Draft329 if: github.event.pull_request.draft == true330 run: exit 1331332 - name: Clean Workspace333 uses: AutoModality/action-clean@v1.1.0334335 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it336 - uses: actions/checkout@v3337 with:338 ref: ${{ github.head_ref }} #Checking out head commit339340 - name: Read .env file341 uses: xom9ikk/dotenv@v2342343 - name: Generate ENV related extend file for docker-compose344 uses: cuchi/jinja2-action@v1.2.0345 with:346 template: .docker/docker-compose.tmp-xcm-tests.j2347 output_file: .docker/docker-compose.xcm-tests.${{ matrix.network }}.yml348 variables: |349 NETWORK=${{ matrix.network }}350351 - name: Show build configuration352 run: cat .docker/docker-compose.xcm-tests.${{ matrix.network }}.yml353354 - uses: actions/setup-node@v3355 with:356 node-version: 16357358 - name: Build the stack359 run: docker-compose -f ".docker/docker-compose.xcm-tests.${{ matrix.network }}.yml" up -d --remove-orphans --force-recreate --timeout 300360361 # 🚀 POLKADOT LAUNCH COMPLETE 🚀362 - name: Check if docker logs consist messages related to testing of xcm tests 363 if: success()364 run: |365 counter=160366 function check_container_status {367 docker inspect -f {{.State.Running}} xcm-${{ matrix.network }}-testnet-local368 }369 function do_docker_logs {370 docker logs --details xcm-${{ matrix.network }}-testnet-local 2>&1371 }372 function is_started {373 if [ "$(check_container_status)" == "true" ]; then374 echo "Container: xcm-${{ matrix.network }}-testnet-local RUNNING";375 echo "Check Docker logs"376 DOCKER_LOGS=$(do_docker_logs)377 if [[ ${DOCKER_LOGS} = *"POLKADOT LAUNCH COMPLETE"* ]];then378 echo "🚀 POLKADOT LAUNCH COMPLETE 🚀"379 return 0380 else381 echo "Message not found in logs output, repeating..."382 return 1383 fi384 else385 echo "Container xcm-${{ matrix.network }}-testnet-local NOT RUNNING"386 echo "Halting all future checks"387 exit 1388 fi389 echo "something goes wrong"390 exit 1391 }392 while ! is_started; do393 echo "Waiting for special message in log files "394 sleep 30s395 counter=$(( $counter - 1 ))396 echo "Counter: $counter"397 if [ "$counter" -gt "0" ]; then398 continue399 else400 break401 fi402 done403 echo "Halting script"404 exit 0405 shell: bash406407 - name: Run XCM tests 408 working-directory: tests409 run: |410 yarn install411 yarn add mochawesome412 node scripts/readyness.js413 echo "Ready to start tests"414 yarn polkadot-types 415 NOW=$(date +%s) && yarn ${{ matrix.runtest }} --reporter mochawesome --reporter-options reportFilename=test-${NOW}416 env:417 RPC_URL: http://127.0.0.1:9933/418419 - name: XCM Test Report420 uses: phoenix-actions/test-reporting@v8421 id: test-report422 if: success() || failure() # run this step even if previous step failed423 with:424 name: XCM Tests ${{ matrix.network }} # Name of the check run which will be created425 path: tests/mochawesome-report/test-*.json # Path to test results426 reporter: mochawesome-json427 fail-on-error: 'false'428429 - name: Show container logs430 if: always() # run this step always431 run: docker-compose -f ".docker/docker-compose.xcm-tests.${{ matrix.network }}.yml" logs432433 - name: Stop running containers434 if: always() # run this step always435 run: docker-compose -f ".docker/docker-compose.xcm-tests.${{ matrix.network }}.yml" down436437 - name: Clean Workspace438 if: always()439 uses: AutoModality/action-clean@v1.1.0440441 - name: Remove builder cache442 if: always() # run this step always443 run: |444 docker system prune -a -ftests/src/config.tsdiffbeforeafterboth--- a/tests/src/config.ts
+++ b/tests/src/config.ts
@@ -24,6 +24,8 @@
karuraUrl: process.env.acalaUrl || 'ws://127.0.0.1:9946',
moonbeamUrl: process.env.moonbeamUrl || 'ws://127.0.0.1:9947',
moonriverUrl: process.env.moonbeamUrl || 'ws://127.0.0.1:9947',
+ astarUrl: process.env.astarUrl || 'ws://127.0.0.1:9949',
+ shidenUrl: process.env.shidenUrl || 'ws://127.0.0.1:9949',
westmintUrl: process.env.westmintUrl || 'ws://127.0.0.1:9948',
statemineUrl: process.env.statemineUrl || 'ws://127.0.0.1:9948',
statemintUrl: process.env.statemintUrl || 'ws://127.0.0.1:9948',
tests/src/util/index.tsdiffbeforeafterboth--- a/tests/src/util/index.ts
+++ b/tests/src/util/index.ts
@@ -11,7 +11,7 @@
import config from '../config';
import {ChainHelperBase} from './playgrounds/unique';
import {ILogger} from './playgrounds/types';
-import {DevUniqueHelper, SilentLogger, SilentConsole, DevMoonbeamHelper, DevMoonriverHelper, DevAcalaHelper, DevKaruraHelper, DevRelayHelper, DevWestmintHelper, DevStatemineHelper, DevStatemintHelper} from './playgrounds/unique.dev';
+import {DevUniqueHelper, SilentLogger, SilentConsole, DevMoonbeamHelper, DevMoonriverHelper, DevAcalaHelper, DevKaruraHelper, DevRelayHelper, DevWestmintHelper, DevStatemineHelper, DevStatemintHelper, DevAstarHelper, DevShidenHelper} from './playgrounds/unique.dev';
import {dirname} from 'path';
import {fileURLToPath} from 'url';
@@ -101,6 +101,14 @@
return usingPlaygroundsGeneral<DevMoonriverHelper>(DevMoonriverHelper, url, code);
};
+export const usingAstarPlaygrounds = (url: string, code: (helper: DevAstarHelper, privateKey: (seed: string) => Promise<IKeyringPair>) => Promise<void>) => {
+ return usingPlaygroundsGeneral<DevAstarHelper>(DevAstarHelper, url, code);
+};
+
+export const usingShidenPlaygrounds = (url: string, code: (helper: DevShidenHelper, privateKey: (seed: string) => Promise<IKeyringPair>) => Promise<void>) => {
+ return usingPlaygroundsGeneral<DevShidenHelper>(DevShidenHelper, url, code);
+};
+
export const MINIMUM_DONOR_FUND = 100_000n;
export const DONOR_FUNDING = 2_000_000n;
tests/src/util/playgrounds/unique.dev.tsdiffbeforeafterboth--- a/tests/src/util/playgrounds/unique.dev.ts
+++ b/tests/src/util/playgrounds/unique.dev.ts
@@ -3,7 +3,7 @@
import {stringToU8a} from '@polkadot/util';
import {encodeAddress, mnemonicGenerate} from '@polkadot/util-crypto';
-import {UniqueHelper, MoonbeamHelper, ChainHelperBase, AcalaHelper, RelayHelper, WestmintHelper} from './unique';
+import {UniqueHelper, MoonbeamHelper, ChainHelperBase, AcalaHelper, RelayHelper, WestmintHelper, AstarHelper} from './unique';
import {ApiPromise, Keyring, WsProvider} from '@polkadot/api';
import * as defs from '../../interfaces/definitions';
import {IKeyringPair} from '@polkadot/types/types';
@@ -173,6 +173,28 @@
}
}
+export class DevAstarHelper extends AstarHelper {
+ wait: WaitGroup;
+
+ constructor(logger: { log: (msg: any, level: any) => void, level: any }, options: {[key: string]: any} = {}) {
+ options.helperBase = options.helperBase ?? DevAstarHelper;
+
+ super(logger, options);
+ this.wait = new WaitGroup(this);
+ }
+}
+
+export class DevShidenHelper extends AstarHelper {
+ wait: WaitGroup;
+
+ constructor(logger: { log: (msg: any, level: any) => void, level: any }, options: {[key: string]: any} = {}) {
+ options.helperBase = options.helperBase ?? DevShidenHelper;
+
+ super(logger, options);
+ this.wait = new WaitGroup(this);
+ }
+}
+
export class DevAcalaHelper extends AcalaHelper {
wait: WaitGroup;
tests/src/util/playgrounds/unique.tsdiffbeforeafterboth--- a/tests/src/util/playgrounds/unique.ts
+++ b/tests/src/util/playgrounds/unique.ts
@@ -3243,6 +3243,26 @@
}
}
+export class AstarHelper extends XcmChainHelper {
+ balance: SubstrateBalanceGroup<AstarHelper>;
+ assets: AssetsGroup<AstarHelper>;
+ xcm: XcmGroup<AstarHelper>;
+
+ constructor(logger?: ILogger, options: {[key: string]: any} = {}) {
+ super(logger, options.helperBase ?? AstarHelper);
+
+ this.balance = new SubstrateBalanceGroup(this);
+ this.assets = new AssetsGroup(this);
+ this.xcm = new XcmGroup(this, 'polkadotXcm');
+ }
+
+ getSudo<T extends UniqueHelper>() {
+ // eslint-disable-next-line @typescript-eslint/naming-convention
+ const SudoHelperType = SudoHelper(this.helperBase);
+ return this.clone(SudoHelperType) as T;
+ }
+}
+
export class AcalaHelper extends XcmChainHelper {
balance: SubstrateBalanceGroup<AcalaHelper>;
assetRegistry: AcalaAssetRegistryGroup;
tests/src/xcm/xcmQuartz.test.tsdiffbeforeafterboth--- a/tests/src/xcm/xcmQuartz.test.ts
+++ b/tests/src/xcm/xcmQuartz.test.ts
@@ -18,12 +18,13 @@
import {blake2AsHex} from '@polkadot/util-crypto';
import config from '../config';
import {XcmV2TraitsError} from '../interfaces';
-import {itSub, expect, describeXCM, usingPlaygrounds, usingKaruraPlaygrounds, usingRelayPlaygrounds, usingMoonriverPlaygrounds, usingStateminePlaygrounds} from '../util';
+import {itSub, expect, describeXCM, usingPlaygrounds, usingKaruraPlaygrounds, usingRelayPlaygrounds, usingMoonriverPlaygrounds, usingStateminePlaygrounds, usingShidenPlaygrounds} from '../util';
const QUARTZ_CHAIN = 2095;
const STATEMINE_CHAIN = 1000;
const KARURA_CHAIN = 2000;
const MOONRIVER_CHAIN = 2023;
+const SHIDEN_CHAIN = 2007;
const STATEMINE_PALLET_INSTANCE = 50;
@@ -31,10 +32,13 @@
const statemineUrl = config.statemineUrl;
const karuraUrl = config.karuraUrl;
const moonriverUrl = config.moonriverUrl;
+const shidenUrl = config.shidenUrl;
const RELAY_DECIMALS = 12;
const STATEMINE_DECIMALS = 12;
const KARURA_DECIMALS = 12;
+const SHIDEN_DECIMALS = 18n;
+const QTZ_DECIMALS = 18n;
const TRANSFER_AMOUNT = 2000000000000000000000000n;
@@ -978,3 +982,216 @@
expect(qtzFees == 0n).to.be.true;
});
});
+
+describeXCM('[XCM] Integration test: Exchanging tokens with Shiden', () => {
+ let alice: IKeyringPair;
+ let sender: IKeyringPair;
+
+ const QTZ_ASSET_ID_ON_SHIDEN = 1;
+ const QTZ_MINIMAL_BALANCE_ON_SHIDEN = 1n;
+
+ // Quartz -> Shiden
+ const shidenInitialBalance = 1n * (10n ** SHIDEN_DECIMALS); // 1 SHD, existential deposit required to actually create the account on Shiden
+ const unitsPerSecond = 228_000_000_000n; // This is Phala's value. What will be ours?
+ const qtzToShidenTransferred = 10n * (10n ** QTZ_DECIMALS); // 10 QTZ
+ const qtzToShidenArrived = 9_999_999_999_088_000_000n; // 9.999 ... QTZ, Shiden takes a commision in foreign tokens
+ const senderIinitialBalanceQTZ = 100n * (10n ** QTZ_DECIMALS); // How many QTZ sender has initially
+ const senderBalanceAfterXCM = 89_946678090945539197n; // 89.94... QTZ after XCM call
+
+ // Shiden -> Quartz
+ const qtzFromShidenTransfered = 5n * (10n ** QTZ_DECIMALS); // 5 QTZ
+ const qtzOnShidenLeft = qtzToShidenArrived - qtzFromShidenTransfered; // 4.999_999_999_088_000_000n QTZ
+
+ before(async () => {
+ await usingPlaygrounds(async (helper, privateKey) => {
+ alice = await privateKey('//Alice');
+ [sender] = await helper.arrange.createAccounts([100n], alice);
+ console.log('sender', sender.address);
+
+ // Set the default version to wrap the first message to other chains.
+ await helper.getSudo().xcm.setSafeXcmVersion(alice, SAFE_XCM_VERSION);
+ });
+
+ await usingShidenPlaygrounds(shidenUrl, async (helper) => {
+ console.log('1. Create foreign asset and metadata');
+ // TODO update metadata with values from production
+ await helper.assets.create(
+ alice,
+ QTZ_ASSET_ID_ON_SHIDEN,
+ alice.address,
+ QTZ_MINIMAL_BALANCE_ON_SHIDEN,
+ );
+
+ await helper.assets.setMetadata(
+ alice,
+ QTZ_ASSET_ID_ON_SHIDEN,
+ 'Cross chain QTZ',
+ 'xcQTZ',
+ Number(QTZ_DECIMALS),
+ );
+
+ console.log('2. Register asset location on Shiden');
+ const assetLocation = {
+ V1: {
+ parents: 1,
+ interior: {
+ X1: {
+ Parachain: QUARTZ_CHAIN,
+ },
+ },
+ },
+ };
+
+ await helper.getSudo().executeExtrinsic(alice, 'api.tx.xcAssetConfig.registerAssetLocation', [assetLocation, QTZ_ASSET_ID_ON_SHIDEN]);
+
+ console.log('3. Set QTZ payment for XCM execution on Shiden');
+ await helper.getSudo().executeExtrinsic(alice, 'api.tx.xcAssetConfig.setAssetUnitsPerSecond', [assetLocation, unitsPerSecond]);
+
+ console.log('4. Transfer 1 SDN to recipient to create the account (needed due to existential balance)');
+ await helper.balance.transferToSubstrate(alice, sender.address, shidenInitialBalance);
+ });
+ });
+
+ itSub('Should connect and send QTZ to Shiden', async ({helper}) => {
+ const destination = {
+ V2: {
+ parents: 1,
+ interior: {
+ X1: {
+ Parachain: SHIDEN_CHAIN,
+ },
+ },
+ },
+ };
+
+ const beneficiary = {
+ V2: {
+ parents: 0,
+ interior: {
+ X1: {
+ AccountId32: {
+ network: 'Any',
+ id: sender.addressRaw,
+ },
+ },
+ },
+ },
+ };
+
+ const assets = {
+ V2: [
+ {
+ id: {
+ Concrete: {
+ parents: 0,
+ interior: 'Here',
+ },
+ },
+ fun: {
+ Fungible: qtzToShidenTransferred,
+ },
+ },
+ ],
+ };
+
+ // Initial balance is 100 QTZ
+ const balanceBefore = await helper.balance.getSubstrate(sender.address);
+ console.log(`Initial balance is: ${balanceBefore}`);
+ expect(balanceBefore).to.eq(senderIinitialBalanceQTZ);
+
+ const feeAssetItem = 0;
+ await helper.xcm.limitedReserveTransferAssets(sender, destination, beneficiary, assets, feeAssetItem, 'Unlimited');
+
+ // Balance after reserve transfer is less than 90
+ const balanceAfter = await helper.balance.getSubstrate(sender.address);
+ console.log(`QTZ Balance on Quartz after XCM is: ${balanceAfter}`);
+ console.log(`Quartz's QTZ commission is: ${balanceBefore - balanceAfter}`);
+ expect(balanceAfter).to.eq(senderBalanceAfterXCM);
+
+ await usingShidenPlaygrounds(shidenUrl, async (helper) => {
+ await helper.wait.newBlocks(3);
+ const xcQTZbalance = await helper.assets.account(QTZ_ASSET_ID_ON_SHIDEN, sender.address);
+ const shidenBalance = await helper.balance.getSubstrate(sender.address);
+
+ console.log(`xcQTZ balance on Shiden after XCM is: ${xcQTZbalance}`);
+ console.log(`Shiden's QTZ commission is: ${qtzToShidenTransferred - xcQTZbalance!}`);
+
+ expect(xcQTZbalance).to.eq(qtzToShidenArrived);
+ // SHD balance does not changed:
+ expect(shidenBalance).to.eq(shidenInitialBalance);
+ });
+ });
+
+ itSub('Should connect to Shiden and send QTZ back', async ({helper}) => {
+ await usingShidenPlaygrounds(shidenUrl, async (helper) => {
+ const destination = {
+ V1: {
+ parents: 1,
+ interior: {
+ X1: {
+ Parachain: QUARTZ_CHAIN,
+ },
+ },
+ },
+ };
+
+ const beneficiary = {
+ V1: {
+ parents: 0,
+ interior: {
+ X1: {
+ AccountId32: {
+ network: 'Any',
+ id: sender.addressRaw,
+ },
+ },
+ },
+ },
+ };
+
+ const assets = {
+ V1: [
+ {
+ id: {
+ Concrete: {
+ parents: 1,
+ interior: {
+ X1: {
+ Parachain: QUARTZ_CHAIN,
+ },
+ },
+ },
+ },
+ fun: {
+ Fungible: qtzFromShidenTransfered,
+ },
+ },
+ ],
+ };
+
+ // Initial balance is 1 SDN
+ const balanceSDNbefore = await helper.balance.getSubstrate(sender.address);
+ console.log(`SDN balance is: ${balanceSDNbefore}, it does not changed`);
+ expect(balanceSDNbefore).to.eq(shidenInitialBalance);
+
+ const feeAssetItem = 0;
+ // this is non-standard polkadotXcm extension for Astar only. It calls InitiateReserveWithdraw
+ await helper.executeExtrinsic(sender, 'api.tx.polkadotXcm.reserveWithdrawAssets', [destination, beneficiary, assets, feeAssetItem]);
+
+ // Balance after reserve transfer is less than 1 SDN
+ const xcQTZbalance = await helper.assets.account(QTZ_ASSET_ID_ON_SHIDEN, sender.address);
+ const balanceSDN = await helper.balance.getSubstrate(sender.address);
+ console.log(`xcQTZ balance on Shiden after XCM is: ${xcQTZbalance}`);
+
+ // Assert: xcQTZ balance correctly decreased
+ expect(xcQTZbalance).to.eq(qtzOnShidenLeft);
+ // Assert: SDN balance is 0.996...
+ expect(balanceSDN / (10n ** (SHIDEN_DECIMALS - 3n))).to.eq(996n);
+ });
+
+ await helper.wait.newBlocks(3);
+ const balanceQTZ = await helper.balance.getSubstrate(sender.address);
+ console.log(`QTZ Balance on Quartz after XCM is: ${balanceQTZ}`);
+ expect(balanceQTZ).to.eq(senderBalanceAfterXCM + qtzFromShidenTransfered);
+ });
+});
tests/src/xcm/xcmUnique.test.tsdiffbeforeafterboth--- a/tests/src/xcm/xcmUnique.test.ts
+++ b/tests/src/xcm/xcmUnique.test.ts
@@ -18,12 +18,13 @@
import {blake2AsHex} from '@polkadot/util-crypto';
import config from '../config';
import {XcmV2TraitsError} from '../interfaces';
-import {itSub, expect, describeXCM, usingPlaygrounds, usingAcalaPlaygrounds, usingRelayPlaygrounds, usingMoonbeamPlaygrounds, usingStatemintPlaygrounds} from '../util';
+import {itSub, expect, describeXCM, usingPlaygrounds, usingAcalaPlaygrounds, usingRelayPlaygrounds, usingMoonbeamPlaygrounds, usingStatemintPlaygrounds, usingAstarPlaygrounds} from '../util';
const UNIQUE_CHAIN = 2037;
const STATEMINT_CHAIN = 1000;
const ACALA_CHAIN = 2000;
const MOONBEAM_CHAIN = 2004;
+const ASTAR_CHAIN = 2006;
const STATEMINT_PALLET_INSTANCE = 50;
@@ -31,10 +32,13 @@
const statemintUrl = config.statemintUrl;
const acalaUrl = config.acalaUrl;
const moonbeamUrl = config.moonbeamUrl;
+const astarUrl = config.astarUrl;
const RELAY_DECIMALS = 12;
const STATEMINT_DECIMALS = 12;
const ACALA_DECIMALS = 12;
+const ASTAR_DECIMALS = 18n;
+const UNQ_DECIMALS = 18n;
const TRANSFER_AMOUNT = 2000000000000000000000000n;
@@ -980,3 +984,271 @@
expect(unqFees == 0n).to.be.true;
});
});
+
+describeXCM('[XCM] Integration test: Exchanging tokens with Astar', () => {
+ let alice: IKeyringPair;
+ let randomAccount: IKeyringPair;
+
+ const UNQ_ASSET_ID_ON_SHIDEN = 1;
+ const UNQ_MINIMAL_BALANCE_ON_SHIDEN = 1n;
+
+ // Unique -> Astar
+ const astarInitialBalance = 1n * (10n ** ASTAR_DECIMALS); // 1 ASTR, existential deposit required to actually create the account on Shiden.
+ const unitsPerSecond = 228_000_000_000n; // This is Phala's value. What will be ours?
+ const unqToAstarTransferred = 10n * (10n ** UNQ_DECIMALS); // 10 UNQ
+ const unqToAstarArrived = 9_999_999_999_088_000_000n; // 9.999 ... UNQ, Shiden takes a commision in foreign tokens
+ const senderIinitialBalanceUNQ = 100n * (10n ** UNQ_DECIMALS); // How many UNQ sender has initially
+ const senderBalanceAfterXCM = 89_946678090945539197n; // 89.94... UNQ after XCM call
+
+ // Astar -> Unique
+ const unqFromAstarTransfered = 5n * (10n ** UNQ_DECIMALS); // 5 UNQ
+ const unqOnAstarLeft = unqToAstarArrived - unqFromAstarTransfered; // 4.999_999_999_088_000_000n UNQ
+
+ before(async () => {
+ await usingPlaygrounds(async (helper, privateKey) => {
+ alice = await privateKey('//Alice');
+ [randomAccount] = await helper.arrange.createAccounts([100n], alice);
+ console.log('randomAccount', randomAccount.address);
+
+ // Set the default version to wrap the first message to other chains.
+ await helper.getSudo().xcm.setSafeXcmVersion(alice, SAFE_XCM_VERSION);
+ });
+
+ await usingAstarPlaygrounds(astarUrl, async (helper) => {
+ console.log('1. Create foreign asset and metadata');
+ // TODO update metadata with values from production
+ await helper.assets.create(
+ alice,
+ UNQ_ASSET_ID_ON_SHIDEN,
+ alice.address,
+ UNQ_MINIMAL_BALANCE_ON_SHIDEN,
+ );
+
+ await helper.assets.setMetadata(
+ alice,
+ UNQ_ASSET_ID_ON_SHIDEN,
+ 'Cross chain UNQ',
+ 'xcUNQ',
+ Number(UNQ_DECIMALS),
+ );
+
+ console.log('2. Register asset location on Astar');
+ const assetLocation = {
+ V1: {
+ parents: 1,
+ interior: {
+ X1: {
+ Parachain: UNIQUE_CHAIN,
+ },
+ },
+ },
+ };
+
+ await helper.getSudo().executeExtrinsic(alice, 'api.tx.xcAssetConfig.registerAssetLocation', [assetLocation, UNQ_ASSET_ID_ON_SHIDEN]);
+
+ console.log('3. Set UNQ payment for XCM execution on Astar');
+ await helper.getSudo().executeExtrinsic(alice, 'api.tx.xcAssetConfig.setAssetUnitsPerSecond', [assetLocation, unitsPerSecond]);
+
+ console.log('4. Transfer 1 ASTR to recipient to create the account (needed due to existential balance)');
+ await helper.balance.transferToSubstrate(alice, randomAccount.address, astarInitialBalance);
+ });
+ });
+
+ itSub('Should connect and send UNQ to Astar', async ({helper}) => {
+ const destination = {
+ V2: {
+ parents: 1,
+ interior: {
+ X1: {
+ Parachain: ASTAR_CHAIN,
+ },
+ },
+ },
+ };
+
+ const beneficiary = {
+ V2: {
+ parents: 0,
+ interior: {
+ X1: {
+ AccountId32: {
+ network: 'Any',
+ id: randomAccount.addressRaw,
+ },
+ },
+ },
+ },
+ };
+
+ const assets = {
+ V2: [
+ {
+ id: {
+ Concrete: {
+ parents: 0,
+ interior: 'Here',
+ },
+ },
+ fun: {
+ Fungible: unqToAstarTransferred,
+ },
+ },
+ ],
+ };
+
+ // Initial balance is 100 UNQ
+ const balanceBefore = await helper.balance.getSubstrate(randomAccount.address);
+ console.log(`Initial balance is: ${balanceBefore}`);
+ expect(balanceBefore).to.eq(senderIinitialBalanceUNQ);
+
+ const feeAssetItem = 0;
+ await helper.xcm.limitedReserveTransferAssets(randomAccount, destination, beneficiary, assets, feeAssetItem, 'Unlimited');
+
+ // Balance after reserve transfer is less than 90
+ const balanceAfter = await helper.balance.getSubstrate(randomAccount.address);
+ console.log(`UNQ Balance on Unique after XCM is: ${balanceAfter}`);
+ console.log(`Unique's UNQ commission is: ${balanceBefore - balanceAfter}`);
+ expect(balanceAfter).to.eq(senderBalanceAfterXCM);
+
+ await usingAstarPlaygrounds(astarUrl, async (helper) => {
+ await helper.wait.newBlocks(3);
+ const xcUNQbalance = await helper.assets.account(UNQ_ASSET_ID_ON_SHIDEN, randomAccount.address);
+ const astarBalance = await helper.balance.getSubstrate(randomAccount.address);
+
+ console.log(`xcUNQ balance on Astar after XCM is: ${xcUNQbalance}`);
+ console.log(`Astar's UNQ commission is: ${unqToAstarTransferred - xcUNQbalance!}`);
+
+ expect(xcUNQbalance).to.eq(unqToAstarArrived);
+ // Astar balance does not changed
+ expect(astarBalance).to.eq(astarInitialBalance);
+ });
+ });
+
+ itSub('Should connect to Astar and send UNQ back', async ({helper}) => {
+ await usingAstarPlaygrounds(astarUrl, async (helper) => {
+ const destination = {
+ V1: {
+ parents: 1,
+ interior: {
+ X1: {
+ Parachain: UNIQUE_CHAIN,
+ },
+ },
+ },
+ };
+
+ const beneficiary = {
+ V1: {
+ parents: 0,
+ interior: {
+ X1: {
+ AccountId32: {
+ network: 'Any',
+ id: randomAccount.addressRaw,
+ },
+ },
+ },
+ },
+ };
+
+ const assets = {
+ V1: [
+ {
+ id: {
+ Concrete: {
+ parents: 1,
+ interior: {
+ X1: {
+ Parachain: UNIQUE_CHAIN,
+ },
+ },
+ },
+ },
+ fun: {
+ Fungible: unqFromAstarTransfered,
+ },
+ },
+ ],
+ };
+
+ // Initial balance is 1 ASTR
+ const balanceASTRbefore = await helper.balance.getSubstrate(randomAccount.address);
+ console.log(`ASTR balance is: ${balanceASTRbefore}, it does not changed`);
+ expect(balanceASTRbefore).to.eq(astarInitialBalance);
+
+ const feeAssetItem = 0;
+ // this is non-standard polkadotXcm extension for Astar only. It calls InitiateReserveWithdraw
+ await helper.executeExtrinsic(randomAccount, 'api.tx.polkadotXcm.reserveWithdrawAssets', [destination, beneficiary, assets, feeAssetItem]);
+
+ const xcUNQbalance = await helper.assets.account(UNQ_ASSET_ID_ON_SHIDEN, randomAccount.address);
+ const balanceAstar = await helper.balance.getSubstrate(randomAccount.address);
+ console.log(`xcUNQ balance on Astar after XCM is: ${xcUNQbalance}`);
+
+ // Assert: xcUNQ balance correctly decreased
+ expect(xcUNQbalance).to.eq(unqOnAstarLeft);
+ // Assert: ASTR balance is 0.996...
+ expect(balanceAstar / (10n ** (ASTAR_DECIMALS - 3n))).to.eq(996n);
+ });
+
+ await helper.wait.newBlocks(3);
+ const balanceUNQ = await helper.balance.getSubstrate(randomAccount.address);
+ console.log(`UNQ Balance on Unique after XCM is: ${balanceUNQ}`);
+ expect(balanceUNQ).to.eq(senderBalanceAfterXCM + unqFromAstarTransfered);
+ });
+
+ itSub.skip('Should not accept limitedReserveTransfer of UNQ from ASTAR', async ({helper}) => {
+ await usingAstarPlaygrounds(astarUrl, async (helper) => {
+ const destination = {
+ V1: {
+ parents: 1,
+ interior: {
+ X1: {
+ Parachain: UNIQUE_CHAIN,
+ },
+ },
+ },
+ };
+
+ const beneficiary = {
+ V1: {
+ parents: 0,
+ interior: {
+ X1: {
+ AccountId32: {
+ network: 'Any',
+ id: randomAccount.addressRaw,
+ },
+ },
+ },
+ },
+ };
+
+ const assets = {
+ V1: [
+ {
+ id: {
+ Concrete: {
+ parents: 1,
+ interior: {
+ X1: {
+ Parachain: UNIQUE_CHAIN,
+ },
+ },
+ },
+ },
+ fun: {
+ Fungible: unqFromAstarTransfered,
+ },
+ },
+ ],
+ };
+
+ // Initial balance is 1 ASTAR
+ expect(await helper.balance.getSubstrate(randomAccount.address)).to.eq(astarInitialBalance);
+
+ const feeAssetItem = 0;
+ // TODO: expect rejected:
+ await helper.xcm.limitedReserveTransferAssets(randomAccount, destination, beneficiary, assets, feeAssetItem, 'Unlimited');
+ });
+ });
+});