Skip to content

Commit

Permalink
add chopsticks CI/CD run
Browse files Browse the repository at this point in the history
  • Loading branch information
samelamin committed Sep 10, 2023
1 parent bf6da3c commit 78ef010
Show file tree
Hide file tree
Showing 6 changed files with 466 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/chopsticks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: "Run Chopsticks E2E Integration Tests"
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:

jobs:
e2e_integration_tests:
runs-on: ubuntu-22.04

steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 # v0.11.0
with:
access_token: ${{ github.token }}

- name: Install updates and protobuf-compiler
run: sudo apt update && sudo apt install --assume-yes cmake protobuf-compiler wget curl git python3 make build-essential

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: wasm32-unknown-unknown

- name: Install nightly toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
target: wasm32-unknown-unknown

- name: Checkout
uses: actions/checkout@v4

- name: Install e2e tests repo
run: git clone https://github.com/AcalaNetwork/e2e-tests && yarn --cwd e2e-tests/ && yarn --cwd e2e-tests/ update-env

- name: Build runtimes
run: cargo build --release

- name: Install e2e tests repo
run: yarn --cwd e2e-tests/ && yarn --cwd e2e-tests/ update-env

- name: Run e2e tests
env:
KUSAMA_WASM: "../target/release/wbuild/kusama-runtime/kusama_runtime.compact.compressed.wasm"
POLKADOT_WASM: "../target/release/wbuild/polkadot-runtime/polkadot_runtime.compact.compressed.wasm"
STATEMINE_WASM: "../target/release/wbuild/asset-hub-kusama-runtime/asset_hub_kusama_runtime.compact.compressed.wasm"
STATEMINT_WASM: "../target/release/wbuild/asset-hub-polkadot-runtime/asset_hub_polkadot_runtime.compact.compressed.wasm"
run: find e2e-tests/tests/ -name '*.test.*' | xargs rm -rf && cp -r chopsticks/* e2e-tests/tests/ && yarn --cwd e2e-tests test
88 changes: 88 additions & 0 deletions chopsticks/xcm-transfer/__snapshots__/kusama-assethub.test.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`'kusama' -> 'statemine' xcm transfer 'KSM' > xcmPallet transfer > balance on from chain 1`] = `
{
"consumers": 0,
"data": {
"flags": "0x80000000000000000000000000000000",
"free": "(rounded 9000000000000)",
"frozen": 0,
"reserved": 0,
},
"nonce": 1,
"providers": 1,
"sufficients": 0,
}
`;

exports[`'kusama' -> 'statemine' xcm transfer 'KSM' > xcmPallet transfer > balance on to chain 1`] = `
{
"consumers": 0,
"data": {
"flags": 0,
"free": 10000000000000,
"frozen": 0,
"reserved": 0,
},
"nonce": 0,
"providers": 1,
"sufficients": 0,
}
`;

exports[`'kusama' -> 'statemine' xcm transfer 'KSM' > xcmPallet transfer > to chain dmp events 1`] = `
[
{
"data": {
"count": 1,
},
"method": "DownwardMessagesReceived",
"section": "parachainSystem",
},
{
"data": {
"messageHash": "(hash)",
"messageId": "(hash)",
"outcome": {
"Incomplete": [
{
"proofSize": 0,
"refTime": 1000000000,
},
"UntrustedReserveLocation",
],
},
},
"method": "ExecutedDownward",
"section": "dmpQueue",
},
{
"data": {
"dmqHead": "(hash)",
"weightUsed": {
"proofSize": 0,
"refTime": 1000000000,
},
},
"method": "DownwardMessagesProcessed",
"section": "parachainSystem",
},
]
`;

exports[`'kusama' -> 'statemine' xcm transfer 'KSM' > xcmPallet transfer > tx events 1`] = `
[
{
"data": {
"outcome": {
"Complete": {
"proofSize": 0,
"refTime": "(rounded 753000000)",
},
},
},
"method": "Attempted",
"section": "xcmPallet",
},
]
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`'polkadot' -> 'statemint' xcm transfer 'DOT' > xcmPallet transfer > balance on from chain 1`] = `
{
"consumers": 0,
"data": {
"flags": "0x80000000000000000000000000000000",
"free": "(rounded 9000000000000)",
"frozen": 0,
"reserved": 0,
},
"nonce": 1,
"providers": 1,
"sufficients": 0,
}
`;

exports[`'polkadot' -> 'statemint' xcm transfer 'DOT' > xcmPallet transfer > balance on to chain 1`] = `
{
"consumers": 0,
"data": {
"flags": 0,
"free": 10000000000000,
"frozen": 0,
"reserved": 0,
},
"nonce": 0,
"providers": 1,
"sufficients": 0,
}
`;

exports[`'polkadot' -> 'statemint' xcm transfer 'DOT' > xcmPallet transfer > to chain dmp events 1`] = `
[
{
"data": {
"count": 1,
},
"method": "DownwardMessagesReceived",
"section": "parachainSystem",
},
{
"data": {
"messageId": "(hash)",
"outcome": {
"Incomplete": [
{
"proofSize": 0,
"refTime": 1000000000,
},
"UntrustedReserveLocation",
],
},
},
"method": "ExecutedDownward",
"section": "dmpQueue",
},
{
"data": {
"dmqHead": "(hash)",
"weightUsed": {
"proofSize": 0,
"refTime": 1000000000,
},
},
"method": "DownwardMessagesProcessed",
"section": "parachainSystem",
},
]
`;

exports[`'polkadot' -> 'statemint' xcm transfer 'DOT' > xcmPallet transfer > tx events 1`] = `
[
{
"data": [
{
"Complete": {
"proofSize": 0,
"refTime": 2000000000,
},
},
],
"method": "Attempted",
"section": "xcmPallet",
},
]
`;
25 changes: 25 additions & 0 deletions chopsticks/xcm-transfer/kusama-assethub.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { query, tx } from '../../helpers/api'

import { kusama } from '../../networks/polkadot'
import { statemine } from '../../networks/statemint'

import buildTest from './shared'

const tests = [
{
from: 'kusama',
to: 'statemine',
name: 'KSM',
test: {
xcmPalletDown: {
tx: tx.xcmPallet.limitedReserveTransferAssetsV3(kusama.ksm, 1e12, tx.xcmPallet.parachainV3(0, statemine.paraId)),
balance: query.balances,
},
},
},
] as const


export type TestType = (typeof tests)[number]

buildTest(tests)
25 changes: 25 additions & 0 deletions chopsticks/xcm-transfer/polkadot-assethub.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { query, tx } from '../../helpers/api'

import { polkadot } from '../../networks/polkadot'
import { statemint } from '../../networks/statemint'

import buildTest from './shared'

const tests = [
{
from: 'polkadot',
to: 'statemint',
name: 'DOT',
test: {
xcmPalletDown: {
tx: tx.xcmPallet.limitedReserveTransferAssetsV3(polkadot.dot, 1e12, tx.xcmPallet.parachainV3(0, statemint.paraId)),
balance: query.balances,
},
},
},
] as const


export type TestType = (typeof tests)[number]

buildTest(tests)
Loading

0 comments on commit 78ef010

Please sign in to comment.