git.delta.rocks / unique-network / refs/commits / 4a38064d3943

difftreelog

ci(forkless-data) replace polkadot-launch with zombienet

Fahrrader2023-04-28parent: #45fd3eb.patch.diff
in: master

3 files changed

modified.docker/Dockerfile-parachain-upgrade-data.j2diffbeforeafterboth
--- a/.docker/Dockerfile-parachain-upgrade-data.j2
+++ b/.docker/Dockerfile-parachain-upgrade-data.j2
@@ -41,6 +41,8 @@
 FROM ubuntu:22.04
 
 ENV REPLICA_FROM={{ REPLICA_FROM }}
+ENV NEW_PARA_BIN=/unique-chain/target/release/unique-collator
+ENV NEW_PARA_WASM=/unique-chain/target/release/wbuild/{{ WASM_NAME }}-runtime/{{ WASM_NAME }}_runtime.compact.compressed.wasm
 
 RUN apt-get -y update && \
     apt-get -y install curl git && \
@@ -50,28 +52,25 @@
     nvm install v16.16.0 && \
     nvm use v16.16.0
 
-RUN git clone https://github.com/uniquenetwork/polkadot-launch.git -b {{ POLKADOT_LAUNCH_BRANCH }}
-
 RUN export NVM_DIR="$HOME/.nvm" && \
     [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \
-    cd /polkadot-launch && \
+    cd /unique-chain/tests && \
     npm install --global yarn && \
     yarn install
 
 COPY --from=builder-unique-current /unique_parachain/target/release/unique-collator /unique-chain/current/release/
 COPY --from=builder-unique-target /unique_parachain/target/release/unique-collator /unique-chain/target/release/
-COPY --from=builder-unique-target /unique_parachain/target/release/wbuild/{{ WASM_NAME }}-runtime/{{ WASM_NAME }}_runtime.compact.compressed.wasm /unique-chain/target/release/wbuild/{{ WASM_NAME }}-runtime/{{ WASM_NAME }}_runtime.compact.compressed.wasm
+COPY --from=builder-unique-target /unique_parachain/target/release/wbuild/{{ WASM_NAME }}-runtime/{{ WASM_NAME }}_runtime.compact.compressed.wasm {{ NEW_PARA_WASM }}
 
-COPY --from=builder-unique-target /unique_parachain/.docker/forkless-config/launch-config-forkless-data.json /polkadot-launch/launch-config.json
-COPY --from=builder-unique-target /unique_parachain/.docker/forkless-config/fork.jsonnet /polkadot-launch/fork.jsonnet
-COPY --from=builder-unique-target /unique_parachain/.docker/forkless-config/typeNames.jsonnet /polkadot-launch/typeNames.jsonnet
+COPY --from=builder-unique-target /unique_parachain/.docker/forkless-config/zombienet-forkless-data.toml /unique-chain/zombienet-forkless.toml
+COPY --from=builder-unique-target /unique_parachain/.docker/forkless-config/fork.jsonnet /unique-chain/tests/fork.jsonnet
 
 COPY --from=uniquenetwork/builder-chainql:{{ CHAINQL }} /chainql/target/release/chainql /chainql/target/release/
 
 COPY --from=polkadot /unique_parachain/polkadot/target/release/polkadot /polkadot/target/release/
 COPY --from=polkadot /unique_parachain/polkadot/target/release/wbuild/westend-runtime/westend_runtime.compact.compressed.wasm /polkadot/target/release/wbuild/westend-runtime/westend_runtime.compact.compressed.wasm
 
-CMD export NVM_DIR="$HOME/.nvm" PATH="$PATH:/chainql/target/release" REPLICA_FROM && \
+CMD export NVM_DIR="$HOME/.nvm" PATH="$PATH:/chainql/target/release" REPLICA_FROM NEW_PARA_BIN NEW_PARA_WASM && \
     [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \
-    cd /polkadot-launch && \
-    yarn start launch-config.json --test-upgrade-parachains
+    cd /unique-chain/tests && \
+    yarn frankenstein zombienet-forkless.json
deleted.docker/forkless-config/launch-config-forkless-data.j2diffbeforeafterboth
--- a/.docker/forkless-config/launch-config-forkless-data.j2
+++ /dev/null
@@ -1,135 +0,0 @@
-{
-      "relaychain": {
-        "bin": "/polkadot/target/release/polkadot",
-        "upgradeBin": "/polkadot/target/release/polkadot",
-        "upgradeWasm": "/polkadot/target/release/wbuild/{{ RELAY_CHAIN_TYPE }}-runtime/{{ RELAY_CHAIN_TYPE }}_runtime.compact.compressed.wasm",
-        "chain": "{{ RELAY_CHAIN_TYPE }}-local",
-        "nodes": [
-            {
-                "name": "alice",
-                "wsPort": 9844,
-                "rpcPort": 9843,
-                "port": 30444,
-                "flags": [
-                    "-lparachain::candidate_validation=debug",
-                    "-lxcm=trace",
-                    "--rpc-cors=all",
-                    "--unsafe-rpc-external",
-                    "--unsafe-ws-external"
-                ]
-            },
-            {
-                "name": "bob",
-                "wsPort": 9855,
-                "rpcPort": 9854,
-                "port": 30555,
-                "flags": [
-                    "-lparachain::candidate_validation=debug",
-                    "-lxcm=trace",
-                    "--rpc-cors=all",
-                    "--unsafe-rpc-external",
-                    "--unsafe-ws-external"
-                ]
-            },
-            {
-                "name": "charlie",
-                "wsPort": 9866,
-                "rpcPort": 9865,
-                "port": 30666,
-                "flags": [
-                    "-lparachain::candidate_validation=debug",
-                    "-lxcm=trace",
-                    "--rpc-cors=all",
-                    "--unsafe-rpc-external",
-                    "--unsafe-ws-external"
-                ]
-            },
-            {
-                "name": "dave",
-                "wsPort": 9877,
-                "rpcPort": 9876,
-                "port": 30777,
-                "flags": [
-                    "-lparachain::candidate_validation=debug",
-                    "-lxcm=trace",
-                    "--rpc-cors=all",
-                    "--unsafe-rpc-external",
-                    "--unsafe-ws-external"
-                ]
-            },
-            {
-                "name": "eve",
-                "wsPort": 9888,
-                "rpcPort": 9887,
-                "port": 30888,
-                "flags": [
-                    "-lparachain::candidate_validation=debug",
-                    "-lxcm=trace",
-                    "--rpc-cors=all",
-                    "--unsafe-rpc-external",
-                    "--unsafe-ws-external"
-                ]
-            }
-        ],
-        "genesis": {
-            "runtime": {
-                "runtime_genesis_config": {
-                    "parachainsConfiguration": {
-                        "config": {
-                            "validation_upgrade_frequency": 1,
-                            "validation_upgrade_delay": 1
-                        }
-                    }
-                }
-            }
-        }
-    },
-      "parachains": [
-        {
-            "bin": "/unique-chain/current/release/unique-collator",
-            "upgradeBin": "/unique-chain/target/release/unique-collator",
-            "upgradeWasm": "/unique-chain/target/release/wbuild/{{ WASM_NAME }}-runtime/{{ WASM_NAME }}_runtime.compact.compressed.wasm",
-            "id": "1000",
-            "balance": "1000000000000000000000000",
-            "chainRawInitializer": [
-                "chainql",
-                "--tla-code=rawSpec=import '${rawSpec}'",
-                "--tla-str=forkFrom={{ REPLICA_FROM }}",
-                "fork.jsonnet"
-            ],
-            "nodes": [
-                {
-                    "port": 31200,
-                    "wsPort": 9944,
-                    "rpcPort": 9933,
-                    "name": "alice",
-                    "flags": [
-                        "--rpc-cors=all",
-                        "--unsafe-rpc-external",
-                        "--unsafe-ws-external",
-                        "-lxcm=trace,parity_ws::handler=debug,jsonrpsee_core=trace,jsonrpsee-core=trace,jsonrpsee_ws_server=debug",
-                        "--",
-                        "--port=31335",
-                        "--ws-port=9745",
-                        "--rpc-port=9734"
-                    ]
-                },
-                {
-                    "port": 31201,
-                    "wsPort": 9945,
-                    "rpcPort": 9934,
-                    "name": "bob",
-                    "flags": [
-                        "--rpc-cors=all",
-                        "--unsafe-rpc-external",
-                        "--unsafe-ws-external",
-                        "-lxcm=trace,parity_ws::handler=debug,jsonrpsee_core=trace,jsonrpsee-core=trace,jsonrpsee_ws_server=debug"
-                    ]
-                }
-            ]
-        }
-    ],
-    "simpleParachains": [],
-    "hrmpChannels": [],
-    "finalization": false
-}
modified.github/workflows/forkless-update-data.ymldiffbeforeafterboth
before · .github/workflows/forkless-update-data.yml
1# Forkless update with data replication2# https://cryptousetech.atlassian.net/wiki/spaces/CI/pages/2586869792/Forkless+update+with+data34# Triger: only call from main workflow(re-usable workflows)5on:6  workflow_call:789# A workflow run is made up of one or more jobs that can run sequentially or in parallel10jobs:1112  prepare-execution-marix:1314    name: Prepare execution matrix1516    runs-on: self-hosted-ci17    outputs:18      matrix: ${{ steps.create_matrix.outputs.matrix }}1920    steps:2122      - name: Clean Workspace23        uses: AutoModality/action-clean@v1.1.02425      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it26      - uses: actions/checkout@v3.1.027        with:28          ref: ${{ github.head_ref }}  #Checking out head commit2930      - name: Read .env file31        uses: xom9ikk/dotenv@v23233      - name: Create Execution matrix34        uses: CertainLach/create-matrix-action@v435        id: create_matrix36        with:37          # TODO: Remove state-version-0 after mainnet upgrade38          matrix: |39            network {quartz}, wasm_name {quartz}, mainnet_branch {${{ env.QUARTZ_MAINNET_BRANCH }}}, replica_from_address {${{ env.QUARTZ_REPLICA_FROM }}}, relay_branch {${{ env.KUSAMA_MAINNET_BRANCH }}}, extra_features {,state-version-0}40            network {unique}, wasm_name {unique}, mainnet_branch {${{ env.UNIQUE_MAINNET_BRANCH }}}, replica_from_address {${{ env.UNIQUE_REPLICA_FROM }}}, relay_branch {${{ env.POLKADOT_MAINNET_BRANCH }}}, extra_features {,state-version-0}41            network {opal}, wasm_name {opal}, mainnet_branch {${{ env.OPAL_MAINNET_BRANCH }}}, replica_from_address {${{ env.OPAL_REPLICA_FROM }}}, relay_branch {${{ env.UNIQUEWEST_MAINNET_BRANCH }}}, extra_features {,state-version-0}42            network {sapphire}, wasm_name {quartz}, mainnet_branch {${{ env.SAPPHIRE_MAINNET_BRANCH }}}, replica_from_address {${{ env.SAPPHIRE_REPLICA_FROM }}}, relay_branch {${{ env.UNIQUEEAST_MAINNET_BRANCH }}}, extra_features {,state-version-0}4344  forkless-data-build:45    needs: prepare-execution-marix46    # The type of runner that the job will run on47    runs-on: [self-hosted-ci,large]48    timeout-minutes: 13804950    name: ${{ matrix.network }}-data-build51    strategy:52      matrix:53        include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}5455    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.5657    steps:58      - name: Clean Workspace59        uses: AutoModality/action-clean@v1.1.06061      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it62      - uses: actions/checkout@v3.1.063        with:64          ref: ${{ github.head_ref }}  #Checking out head commit6566      - name: Read .env file67        uses: xom9ikk/dotenv@v26869      # Prepare SHA  70      - name: Prepare SHA71        uses: ./.github/actions/prepare7273      # Build main image for FORKLESS-UPDATE-NODATA74      - name: Generate ENV related extend Dockerfile file75        uses: cuchi/jinja2-action@v1.2.076        with:77          template: .docker/Dockerfile-parachain-upgrade-data.j278          output_file: .docker/Dockerfile-parachain-upgrade-data.${{ matrix.network }}.yml79          variables: |80            RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}81            NETWORK=${{ matrix.network }}82            MAINNET_BRANCH=${{ matrix.mainnet_branch }}83            WASM_NAME=${{ matrix.wasm_name }}84            POLKADOT_BUILD_BRANCH=${{ matrix.relay_branch }}85            POLKADOT_LAUNCH_BRANCH=${{ env.POLKADOT_LAUNCH_BRANCH }}86            REPLICA_FROM=${{ matrix.replica_from_address }}87            CHAINQL=${{ env.CHAINQL }}88            EXTRA_FEATURES=${{ matrix.extra_features }}8990      - name: Show build configuration91        run: cat .docker/Dockerfile-parachain-upgrade-data.${{ matrix.network }}.yml9293      - name: Generate launch-config-forkless-data.json94        uses: cuchi/jinja2-action@v1.2.095        with:96          template: .docker/forkless-config/launch-config-forkless-data.j297          output_file: .docker/forkless-config/launch-config-forkless-data.json98          variables: |99            WASM_NAME=${{ matrix.wasm_name }}100            RELAY_CHAIN_TYPE=${{ env.RELAY_CHAIN_TYPE }}101            REPLICA_FROM=${{ matrix.replica_from_address }}            102103      - name: Show launch-config-forkless configuration104        run: cat .docker/forkless-config/launch-config-forkless-data.json105106      - name: Run find-and-replace to remove slashes from branch name107        uses: mad9000/actions-find-and-replace-string@4108        id: branchname109        with:110          source: ${{ github.head_ref }}111          find: '/'112          replace: '-'113114      - name: Set build SHA115        shell: bash116        run: |117          echo "BUILD_SHA=${LAST_COMMIT_SHA:0:8}" >> $GITHUB_ENV118119      - name: Build the stack120        run: cd .docker/ && docker build --no-cache --file ./Dockerfile-parachain-upgrade-data.${{ matrix.network }}.yml --tag uniquenetwork/ci-forkless-data-local:${{ matrix.network }}-${{ steps.branchname.outputs.value }}-$BUILD_SHA ../121122      - name: Log in to Docker Hub123        uses: docker/login-action@v2.1.0124        with:125          username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}126          password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}127128      - name: Push docker image version129        run: docker push uniquenetwork/ci-forkless-data-local:${{ matrix.network }}-${{ steps.branchname.outputs.value }}-$BUILD_SHA130131      - name: Remove builder cache132        if: always()                   # run this step always133        run: |134          docker builder prune -f135          docker system prune -f136137  forkless-data-tests:138    needs: [prepare-execution-marix, forkless-data-build]139    # The type of runner that the job will run on140    runs-on: [self-hosted-ci, large]141142    timeout-minutes: 600143144    name: ${{ matrix.network }}-data-tests145146    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.147148    strategy:149      matrix:150        include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}151152    steps:153      - name: Skip if pull request is in Draft154        if: github.event.pull_request.draft == true155        run: exit 1156157      - name: Clean Workspace158        uses: AutoModality/action-clean@v1.1.0159160      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it161      - uses: actions/checkout@v3.1.0162        with:163          ref: ${{ github.head_ref }}  #Checking out head commit164165      - name: Prepare166        uses: ./.github/actions/prepare167168      - name: Set build SHA169        shell: bash170        run: |171          echo "BUILD_SHA=${LAST_COMMIT_SHA:0:8}" >> $GITHUB_ENV172173      - name: Run find-and-replace to remove slashes from branch name174        uses: mad9000/actions-find-and-replace-string@4175        id: branchname176        with:177          source: ${{ github.head_ref }}178          find: '/'179          replace: '-'180181      - name: Read .env file182        uses: xom9ikk/dotenv@v2183184      - name: Generate ENV related extend file for docker-compose185        uses: cuchi/jinja2-action@v1.2.0186        with:187          template: .docker/docker-compose.forkless-data.j2188          output_file: .docker/docker-compose.forkless-data.${{ matrix.network }}.yml189          variables: |190            NETWORK=${{ matrix.network }}191            BUILD_TAG=${{ steps.branchname.outputs.value }}-$BUILD_SHA192193      - name: Show build configuration194        run: cat .docker/docker-compose.forkless-data.${{ matrix.network }}.yml195196      - name: Log in to Docker Hub197        uses: docker/login-action@v2.1.0198        with:199          username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}200          password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}201202      - name: Build the stack203        run: docker-compose -f ".docker/docker-compose.forkless-data.${{ matrix.network }}.yml" up -d --remove-orphans --force-recreate --timeout 300204205      - uses: actions/setup-node@v3.5.1206        with:207          node-version: 16208209      - name: Check if docker logs consist logs related to Runtime Upgrade testing.210        if: success()211        run: |212          counter=160213          function check_container_status {214                docker inspect -f {{.State.Running}} forkless-data215          }216          function do_docker_logs {217                docker logs --details forkless-data  2>&1218          }219          function is_started {220                if [ "$(check_container_status)" == "true" ]; then221                        echo "Container: forkless-data RUNNING";222                        echo "Check Docker logs"223                        DOCKER_LOGS=$(do_docker_logs)224                        if [[ ${DOCKER_LOGS} = *"🛸 PARACHAINS' RUNTIME UPGRADE TESTING COMPLETE 🛸"* ]];then225                                echo "🛸 PARACHAINS' RUNTIME UPGRADE TESTING COMPLETE 🛸"226                                return 0227                        elif [[ ${DOCKER_LOGS} = *"🚧 PARACHAINS' RUNTIME UPGRADE TESTING FAILED 🚧"* ]];then228                                echo "🚧 PARACHAINS' RUNTIME UPGRADE TESTING FAILED 🚧"229                                return 1230                        else231                                echo "Message not found in logs output, repeating..."232                                return 1233                        fi234                else235                        echo "Container forkless-data not RUNNING"236                        echo "Halting all future checks"237                        exit 1238                fi239          exit 0240          }241          while ! is_started; do242                echo "Waiting for special message in log files "243                sleep 30s244                counter=$(( $counter - 1 ))245                echo "Counter: $counter"246                if [ "$counter" -gt "0" ]; then247                         continue248                else249                         echo "Counter reached zero, yet upgrade is not finished"250                         exit 1251                fi252          done253          echo "Halting script"254          exit 0255        shell: bash256257      - name: Collect Docker Logs258        if: success() || failure()259        uses: jwalton/gh-docker-logs@v2.2.1260        with:261          dest: './forkless-parachain-upgrade-data-logs.${{ matrix.features }}'262263      - name: Show Docker logs264        if: success() || failure()265        run: cat './forkless-parachain-upgrade-data-logs.${{ matrix.features }}/forkless-data.log'266267      - name: Stop running containers268        if: always()                   # run this step always269        run: docker-compose -f ".docker/docker-compose.forkless-data.${{ matrix.network }}.yml" down --volumes270271      - name: Remove builder cache272        if: always()                   # run this step always273        run: |274          docker builder prune -f -a275          docker system prune -f276          docker image prune -f -a