Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feat/punish-broadcast…
Browse files Browse the repository at this point in the history
…-timeout

* origin/main:
  feat: end to end network upgrade github action (#4274)
  feat: spec_version of PR is greater than spec version of current release (#4355)
  feat: enforce version is greater than release version on PRs to main (#4351)
  fix: btc witnesser test failing sometimes (#4353)
  fix: connections can become stale when reconnecting (#4310)
  chore: add `chainflip-rpc-node` systemd file 🚀 (#4352)
  feat: API Bins check SC compatibility (#4342)
  chore: update runtime spec checks ⛓️ (#4349)
  feat: Add version cmd to all bins (#4343)
  fix: changelog check 🤫 (#4348)
  chore: update docker tags 🐳 (#4347)
  chore: add runtime version check 👀 (#4344)
  feat: shave fees on ingress (#4335)
  pick/persa fixes (#4329)
  feat: track btc fees on success (#4334)
  ensure we dont create BTC transaction outputs below the bitcoin dust limit (#4340)
  fix: sweeping before withdrawal (#4337)
  • Loading branch information
syan095 committed Dec 18, 2023
2 parents 6b6a3d1 + f59ae16 commit 4f88078
Show file tree
Hide file tree
Showing 87 changed files with 1,852 additions and 444 deletions.
Empty file added .github/toml_version.ts
Empty file.
22 changes: 21 additions & 1 deletion .github/workflows/_03_release_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
type: string
required: false
default: ${{ github.ref_name }}
network:
type: string
required: false
default: perseverance

env:
FORCE_COLOR: 1
Expand All @@ -14,7 +18,13 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
manifest: [state-chain/node/Cargo.toml, engine/Cargo.toml, api/bin/chainflip-cli/Cargo.toml, api/bin/chainflip-broker-api/Cargo.toml, api/bin/chainflip-lp-api/Cargo.toml]
manifest:
- state-chain/node/Cargo.toml
- engine/Cargo.toml
- api/bin/chainflip-cli/Cargo.toml
- api/bin/chainflip-broker-api/Cargo.toml
- api/bin/chainflip-lp-api/Cargo.toml
- state-chain/runtime/Cargo.toml
steps:
- name: Checkout 🏁
uses: actions/checkout@v3
Expand Down Expand Up @@ -62,3 +72,13 @@ jobs:
- name: Check changelog 📝
shell: bash
run: ./ci/scripts/check_changelog.sh ${{ inputs.tag }}

check-runtime-spec-version:
runs-on: ubuntu-latest
steps:
- name: Checkout 🏁
uses: actions/checkout@v3

- name: Check changelog 📝
shell: bash
run: ./ci/scripts/check_runtime_spec_version.sh ${{ inputs.network }}
48 changes: 48 additions & 0 deletions .github/workflows/_05_force_version_bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

on:
workflow_call:

jobs:
force-version-bump:
runs-on: [digitalocean]
steps:
- name: Checkout backend
uses: actions/checkout@v2

- name: Configure NodeJS
uses: actions/setup-node@v3
with:
node-version: 18
cache: "pnpm"
registry-url: "https://npm.pkg.github.com"
scope: "@chainflip-io"
cache-dependency-path: "bouncer/pnpm-lock.yaml"
- name: Download latest release binaries
uses: dawidd6/action-download-artifact@v2
with:
workflow: release-perseverance.yml
name: chainflip-backend-bin-ubuntu-22.04
github_token: ${{ secrets.CF_BACKEND_GITHUB_TOKEN }}
path: latest-release-bins
- name: Permissions for latest binaries
run: |
chmod +x ./latest-release-bins/chainflip-*
- name: Version of the latest release
run: |
set -x
echo $(pwd)
RELEASE_VERSION=$(./latest-release-bins/chainflip-engine --version)
echo $RELEASE_VERSION
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV
- name: Install node dependencies
working-directory: bouncer
run: pnpm install

- name: Check the version of the branch is greater than the current release
working-directory: bouncer
run: |
set -x
echo ${{ env.RELEASE_VERSION }}
./commands/read_workspace_tomls.ts ${{ github.workspace }} "${{ env.RELEASE_VERSION }}"
28 changes: 23 additions & 5 deletions .github/workflows/_24_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,23 @@ jobs:
run: |
echo "date=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT"
echo "time=$(date +'%H:%M:%S')" >> "$GITHUB_OUTPUT"
get-version-from-branch-name:
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout 🏁
uses: actions/checkout@v3
- name: Get version from branch name
id: version
run: |
version=$(./ci/scripts/extract_version.sh ${{ github.ref }})
echo "Extracted version: $version"
if [[ "$version" == "" ]]; then
echo "version=0.0.0" >> "$GITHUB_OUTPUT"
else
echo "version=$version" >> "$GITHUB_OUTPUT"
fi
set-dockerfile-name:
runs-on: ubuntu-22.04
outputs:
Expand All @@ -54,7 +70,7 @@ jobs:
fi
private-images:
needs: [get-date-time, set-dockerfile-name]
needs: [get-date-time, set-dockerfile-name, get-version-from-branch-name]
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -98,7 +114,8 @@ jobs:
type=raw,value=${{ github.sha }}
type=raw,value=${{ inputs.network }}
type=ref,event=branch
type=ref,event=tag
type=ref,event=tag,prefix=${{ inputs.network }}-
type=raw,value=${{ needs.get-version-from-branch-name.outputs.version }},prefix=${{ inputs.network }}-,enable=${{ needs.get-version-from-branch-name.outputs.version != '0.0.0' }}
type=ref,event=pr
- name: Login to Github Container Registry 🔑
Expand Down Expand Up @@ -140,7 +157,7 @@ jobs:

public-images:
if: inputs.publish_public_images || inputs.save_tags != ''
needs: [get-date-time, set-dockerfile-name]
needs: [get-date-time, set-dockerfile-name, get-version-from-branch-name]
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -181,7 +198,8 @@ jobs:
type=raw,value=${{ github.sha }}
type=raw,value=${{ inputs.network }}
type=ref,event=branch
type=ref,event=tag
type=ref,event=tag,prefix=${{ inputs.network }}-
type=raw,value=${{ needs.get-version-from-branch-name.outputs.version }},prefix=${{ inputs.network }}-,enable=${{ needs.get-version-from-branch-name.outputs.version != '0.0.0' }}
type=ref,event=pr
- name: Login to DockerHub 🔑
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/ci-development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
branches:
- main
- 'release/*'
- "release/*"
concurrency:
group: ${{ github.ref }}-release-development
cancel-in-progress: true
Expand All @@ -13,6 +13,9 @@ jobs:
pre-check:
uses: ./.github/workflows/_01_pre_check.yml
secrets: inherit
force-version-bump:
uses: ./.github/workflows/_05_force_version_bump.yml
secrets: inherit
test:
uses: ./.github/workflows/_10_test.yml
secrets: inherit
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/release-berghain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ concurrency:
cancel-in-progress: true

jobs:
release-checks:
uses: ./.github/workflows/_03_release_checks.yml
with:
network: "berghain"
build:
needs: [release-checks]
uses: ./.github/workflows/_20_build.yml
secrets: inherit
with:
Expand Down
186 changes: 186 additions & 0 deletions .github/workflows/upgrade-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
name: Test upgrade from latest release to main

on:
workflow_dispatch:

env:
FORCE_COLOR: 1

permissions:
packages: read
contents: read

jobs:
upgrade_test:
runs-on: [digitalocean]
# conservatively 1.5 hours. 2 bouncer runs need to occur.
timeout-minutes: 90
steps:

- name: Checkout chainflip-backend
uses: actions/checkout@v3

- name: Login to Github Container Registry 🔑
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Configure NodeJS
uses: actions/setup-node@v3
with:
node-version: 18
cache: "pnpm"
registry-url: "https://npm.pkg.github.com"
scope: "@chainflip-io"
cache-dependency-path: "bouncer/pnpm-lock.yaml"

- name: Set NPM registry
run: |
pnpm set @chainflip-io:registry=https://npm.pkg.github.com/
pnpm set //npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}
- name: Install system packages
run: |
sudo apt update
sudo apt install -y bc xxd
- name: Install wscat
run: |
npm install -g wscat
- name: Download try-runtime binary
uses: jaxxstorm/action-install-gh-release@v1.10.0
with:
repo: paritytech/try-runtime-cli
tag: v0.5.0
extension-matching: disable
rename-to: try-runtime
chmod: 0755

- name: Download latest release binaries
uses: dawidd6/action-download-artifact@v2
with:
workflow: release-perseverance.yml
name: chainflip-backend-bin-ubuntu-22.04
github_token: ${{ secrets.CF_BACKEND_GITHUB_TOKEN }}
path: latest-release-bins

- name: Permissions for latest binaries
run: |
chmod +x ./latest-release-bins/chainflip-*
- name: Version of the latest release
run: |
set -x
RELEASE_VERSION=$(./latest-release-bins/chainflip-engine --version)
echo $RELEASE_VERSION
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV
- name: Download latest main binaries
uses: dawidd6/action-download-artifact@v2
with:
workflow: ci-main.yml
name: chainflip-backend-bin-try-runtime-ubuntu-22.04
path: main-bins

- name: Permissions for latest binaries
run: |
chmod +x ./main-bins/chainflip-*
- name: Download latest main runtime
uses: dawidd6/action-download-artifact@v2
with:
workflow: ci-main.yml
name: chainflip-node-runtime-try-runtime
path: main-runtime

- name: Install node dependencies
working-directory: bouncer
run: pnpm install

- name: Start a localnet from current release
env:
BINARY_ROOT_PATH: ./latest-release-bins
run: |
set -x
mkdir -p /tmp/chainflip/bashful
mkdir -p /tmp/chainflip/doc
mkdir -p /tmp/chainflip/dopey
touch ./localnet/.setup_complete
./localnet/manage.sh
- name: Run bouncer on latest release
id: pre-upgrade-bouncer
working-directory: bouncer
run: |
./run.sh
# we need to be sure that when this fails, we catch the error, any panics etc. that occur
# TODO: Run swaps simultaneously to the upgrade - we could do that inside the `upgrade_network` command itself.
- name: Upgrade network
shell: bash
id: upgrade-network
working-directory: bouncer
run: |
./commands/upgrade_network.ts prebuilt \
--runtime ./../main-runtime/state_chain_runtime.compact.compressed.wasm \
--bins ./../main-bins \
--localnet_init ./../localnet/init \
--oldVersion "${{ env.RELEASE_VERSION }}"
- name: Run bouncer after upgrade
id: post-upgrade-bouncer
working-directory: bouncer
run: |
./run-no-setup.sh
- name: Print chainflip-engine logs
if: failure()
run: |
cat /tmp/chainflip/*/chainflip-engine.log
- name: Print chainflip-node logs
if: failure()
run: |
cat /tmp/chainflip/*/chainflip-node.log
- name: Print broker logs
if: failure()
run: |
cat /tmp/chainflip/chainflip-broker-api.log
- name: Print lp-api logs
if: failure()
run: |
cat /tmp/chainflip/chainflip-lp-api.log
- name: Upload Localnet Logs 💾
if: always()
continue-on-error: true
uses: actions/upload-artifact@v3
with:
name: localnet-logs
path: |
/tmp/chainflip/*/chainflip-*.log
- name: Clean Up docker containers 🧹
if: always()
continue-on-error: true
run: |
ls -alR /tmp/chainflip
docker compose -f localnet/docker-compose.yml -p "chainflip-localnet" logs
docker compose -f localnet/docker-compose.yml -p "chainflip-localnet" down --rmi all --volumes --remove-orphans
- name: Notify on failed upgrade test
if: failure() && github.ref_name == 'main' || cancelled() && github.ref_name == 'main'
env:
DISCORD_USERNAME: "Upgrade Test"
DISCORD_WEBHOOK: ${{ secrets.CF_DISCORD_ALERTS_CRITICAL }}
uses: Ilshidur/action-discord@0.3.2
with:
args: |
❗️❗️❗️❗️ Sorry **${{ github.actor }}**, The Upgrade Test has not passed ❗️❗️❗️❗️
👾 Link to job: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
#️⃣ Tagging: <@&939151218708709416>
Loading

0 comments on commit 4f88078

Please sign in to comment.