Skip to content

Commit

Permalink
Merge branch 'daan/api' into chungquantin/refactor-duplicate_chain_ex…
Browse files Browse the repository at this point in the history
…tensions
  • Loading branch information
chungquantin authored Aug 13, 2024
2 parents c3b586c + 1acbd21 commit 240d00f
Show file tree
Hide file tree
Showing 48 changed files with 2,144 additions and 25,772 deletions.
22 changes: 22 additions & 0 deletions .chopsticks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Chopsticks

A brief guide on testing a runtime upgrade with [Chopsticks](https://github.com/AcalaNetwork/chopsticks/).

## Runtime Upgrade

1. Launch local network with forks of Pop and Paseo state:
```shell
npx @acala-network/chopsticks@latest xcm -r ./.chopsticks/paseo.yml -p ./.chopsticks/testnet.yml
```
2. Authorise and apply the authorised runtime upgrade on the local Pop fork.
3. Build a block on the local relay chain to build a block (using [websocat](https://github.com/vi/websocat)).
```shell
websocat ws://localhost:8001
{"jsonrpc":"2.0","id":2,"method":"dev_newBlock","params":[{"count":1}]}
```
4. Build blocks on Pop to complete the upgrade:
```shell
websocat ws://localhost:8000
{"jsonrpc":"2.0","id":2,"method":"dev_newBlock","params":[{"count":10}]}
```
5. Verify that the runtime upgrade completed successfully.
14 changes: 14 additions & 0 deletions .chopsticks/devnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
endpoint: wss://rpc2.paseo.popnetwork.xyz
mock-signature-host: true
db: ./db.sqlite
wasm-override: ../pop-node/target/release/wbuild/pop-runtime-devnet/pop_runtime_devnet.wasm

import-storage:
System:
Account:
- - - 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
- providers: 1
data:
free: 1000000000000000
Sudo:
Key: 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY # Alice
13 changes: 13 additions & 0 deletions .chopsticks/paseo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
endpoint: wss://rpc.ibp.network/paseo
mock-signature-host: true
db: ./db.sqlite

import-storage:
System:
Account:
- - - 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
- providers: 1
data:
free: 1000000000000000
Sudo:
Key: 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY # Alice
13 changes: 13 additions & 0 deletions .chopsticks/testnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
endpoint: wss://rpc2.paseo.popnetwork.xyz
mock-signature-host: true
db: ./db.sqlite

import-storage:
System:
Account:
- - - 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
- providers: 1
data:
free: 1000000000000000
Sudo:
Key: 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY # Alice
27 changes: 27 additions & 0 deletions .github/actions/init/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Initialize
description: This action initializes a runner for use in other actions.
inputs:
cache-key:
description: "The key to be used for the cache"

runs:
using: "composite"
steps:
- name: Setup Ubuntu dependencies
shell: bash
run: sudo apt update && sudo apt install -y protobuf-compiler

- name: Free up space on runner
shell: bash
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Rust Cache
uses: Swatinem/[email protected]
with:
cache-on-failure: true
cache-all-crates: true
key: ${{ inputs.cache-key }}
32 changes: 0 additions & 32 deletions .github/templates/setup-worker/action.yaml

This file was deleted.

127 changes: 0 additions & 127 deletions .github/workflows/build.yml

This file was deleted.

89 changes: 89 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: ci

on:
push:
branches: [ main ]
pull_request:
types: [ opened, synchronize, reopened, ready_for_review ]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Check formatting
run: cargo +stable fmt --all -- --check

check:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: "./.github/actions/init"

- name: Check Build
run: |
cargo check --release --locked --features=runtime-benchmarks,try-runtime
clippy:
needs: lint
runs-on: ubuntu-latest
permissions:
checks: write
env:
SKIP_WASM_BUILD: 1
steps:
- uses: actions/checkout@v4

- uses: "./.github/actions/init"

- name: Annotate with Clippy warnings
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --release --locked --features=runtime-benchmarks

test:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: "./.github/actions/init"

- name: Run tests
run: cargo test --release --locked --workspace --features=runtime-benchmarks --exclude integration-tests

integration-tests:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: "./.github/actions/init"

- name: Run integration tests
run: cargo test --release --locked --package integration-tests

coverage:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: "./.github/actions/init"

- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov

- name: Generate code coverage
run: cargo llvm-cov --all-features --workspace --exclude integration-tests --lib --bins --codecov --output-path codecov.json

- name: Upload to codecov.io
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: codecov.json
fail_ci_if_error: true
Loading

0 comments on commit 240d00f

Please sign in to comment.