Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: interlay/bridge
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: e344c8b468eb238601825be35c61f6e547ed7558
Choose a base ref
..
head repository: interlay/bridge
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 37af1de3fe5f819a45d5491dd732bcbc46858994
Choose a head ref
4 changes: 2 additions & 2 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
@@ -9,8 +9,8 @@ jobs:
publish:
runs-on: [self-hosted, linux]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
registry-url: "https://registry.npmjs.org"
4 changes: 2 additions & 2 deletions .github/workflows/pr-any.yml
Original file line number Diff line number Diff line change
@@ -10,8 +10,8 @@ jobs:
name: ${{ matrix.step }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
registry-url: "https://registry.npmjs.org"
2 changes: 1 addition & 1 deletion .github/workflows/projects.yml
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ jobs:
name: Add issue and pull request to project
runs-on: ubuntu-latest
steps:
- uses: actions/add-to-project@v0.4.0
- uses: actions/add-to-project@v0.5.0
with:
project-url: https://github.com/orgs/interlay/projects/3
github-token: ${{ secrets.PROJECTS }}
4 changes: 2 additions & 2 deletions .github/workflows/push-master.yml
Original file line number Diff line number Diff line change
@@ -12,8 +12,8 @@ jobs:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: yarn
117 changes: 53 additions & 64 deletions .github/workflows/xcm-tests.yml
Original file line number Diff line number Diff line change
@@ -13,41 +13,35 @@ on:

jobs:
chopsticks_kintsugi_test:
runs-on: [self-hosted, linux]
runs-on: ubuntu-latest
timeout-minutes: 30
container:
image: ghcr.io/interlay/chopsticks:master
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Run Kintsugi tests
uses: nick-fields/retry@v2
with:
max_attempts: 3
retry_on: error
timeout_minutes: 10
on_retry_command: pkill node; sleep 2
command: |
echo "Launching chopsticks..."
cd /app
echo "Start..." > log.txt
yarn start xcm \
--relaychain=configs/kusama.yml \
--parachain=configs/kintsugi.yml \
--parachain=configs/statemine.yml \
--parachain=configs/karura.yml \
--parachain=configs/parallel-heiko.yml \
--parachain=configs/bifrost.yml \
&> log.txt &
echo "Waiting for log to show chopsticks is ready..."
tail -f log.txt | grep -q "Connected parachains"
echo "Chopsticks launched, start tests."
cd -
yarn install --frozen-lockfile
npx ts-node scripts/kintsugi-chopsticks-test.ts
- name: Launch chopsticks
run: |
npx --yes @acala-network/chopsticks@0.9.3 \
xcm \
-r scripts/configs/kusama.yml \
-p scripts/configs/kintsugi.yml \
-p scripts/configs/statemine.yml \
-p scripts/configs/karura.yml \
-p scripts/configs/parallel-heiko.yml \
-p scripts/configs/bifrost.yml \
&> log.txt &
echo "Waiting for log to show chopsticks is ready..."
tail -f log.txt | grep -q "Connected parachains"
echo "... detected chopsticks is ready."
- name: Run Kintsugi tests
run: |
yarn install --frozen-lockfile
npx ts-node scripts/kintsugi-chopsticks-test.ts
- name: Show error log
if: failure()
run: |
tail -n 100 log.txt
- name: Report status to Discord
uses: sarisia/actions-status-discord@v1
if: failure()
@@ -58,46 +52,41 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: kintsugi-chopsticks-logs
path: /app/log.txt
retention-days: 14
path: log.txt
retention-days: 7

chopsticks_interlay_test:
runs-on: [self-hosted, linux]
runs-on: ubuntu-latest
timeout-minutes: 30
container:
image: ghcr.io/interlay/chopsticks:master
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Run Interlay tests
uses: nick-fields/retry@v2
with:
max_attempts: 3
retry_on: error
timeout_minutes: 10
on_retry_command: pkill node; sleep 2
command: |
echo "Launching chopsticks..."
cd /app
echo "Start..." > log.txt
yarn start xcm \
--relaychain=configs/polkadot.yml \
--parachain=configs/interlay.yml \
--parachain=configs/statemint.yml \
--parachain=configs/hydradx.yml \
--parachain=configs/acala.yml \
--parachain=configs/parallel.yml \
--parachain=configs/bifrost-polkadot.yml \
&> log.txt &
echo "Waiting for log to show chopsticks is ready..."
tail -f log.txt | grep -q "Connected parachains"
echo "Chopsticks launched, start tests."
cd -
- name: Launch chopsticks
run: |
npx --yes @acala-network/chopsticks@0.9.3 \
xcm \
-r scripts/configs/polkadot.yml \
-p scripts/configs/interlay.yml \
-p scripts/configs/statemint.yml \
-p scripts/configs/hydradx.yml \
-p scripts/configs/acala.yml \
-p scripts/configs/parallel.yml \
-p scripts/configs/bifrost-polkadot.yml \
&> log.txt &
echo "Waiting for log to show chopsticks is ready..."
tail -f log.txt | grep -q "Connected parachains"
echo "... detected chopsticks is ready."
yarn install --frozen-lockfile
npx ts-node scripts/interlay-chopsticks-test.ts
- name: Run Interlay tests
run: |
yarn install --frozen-lockfile
npx ts-node scripts/interlay-chopsticks-test.ts
- name: Show error log
if: failure()
run: |
tail -n 100 log.txt
- name: Report status to Discord
uses: sarisia/actions-status-discord@v1
if: failure()
@@ -108,5 +97,5 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: interlay-chopsticks-logs
path: /app/log.txt
retention-days: 14
path: log.txt
retention-days: 7
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -14,6 +14,9 @@ yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# local chopsticks test files
db.sqlite*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@ All channels support transfers in both directions.
| ------------------ | --------- |
| acala | INTR IBTC |
| astar | INTR IBTC |
| bifrost | VDOT |
| parallel | INTR IBTC |
| polkadot | DOT |
| polkadot asset hub | USDT |
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@interlay/bridge",
"version": "0.4.0",
"version": "0.4.1",
"description": "polkawallet bridge sdk",
"main": "build/index.js",
"typings": "build/index.d.ts",
@@ -45,7 +45,7 @@
"@polkadot/api": "^10.9.1",
"@polkadot/apps-config": "^0.132.1",
"@polkadot/types": "^10.9.1",
"axios": "^0.27.2",
"axios": "^1.6.2",
"lodash": "^4.17.20"
},
"devDependencies": {
20 changes: 18 additions & 2 deletions scripts/chopsticks-test.ts
Original file line number Diff line number Diff line change
@@ -136,7 +136,20 @@ async function checkTransfer(fromChain: ChainName, toChain: ChainName, token: st

// check existential deposit by sending exactly `actualFee + ed + [1 planck]`. The function
// will throw an error if the ed is set too low.
let amountToSend = actualFee.add(expectedEd).add(FN.fromInner("1", actualFee.getPrecision()));
const dust = FN.fromInner("1", actualFee.getPrecision());
let amountToSend = actualFee.add(expectedEd).add(dust);

if (toChain === "hydra") {
// bump fees in amount to send by a few percent for XCM to HydraDX
// token/HDX price pair changes can make this fail due to pair changes from previous tx increasing fee required
const bumpRate = new FN(1.1);
const bumpedFee = actualFee.mul(bumpRate);
amountToSend = bumpedFee.add(expectedEd).add(dust);
ret = {
message: `Modified ED check for ${token} to ${toChain} - price changes in ${token}/HDX can cause false negatives. Bumped assumed fees by ${bumpRate.minus(FN.ONE).toNumber() * 100}%`,
result: ResultCode.OK
};
}
await sendTx(fromChain, toChain, token, bridge, amountToSend, TestCase.ExistentialDeposit);

return ret;
@@ -260,8 +273,11 @@ export async function runTestCasesAndExit(
process.stdout.write(`Testing ${token} transfer from ${from} to ${to}... `);
const result = await retryCheckTransfer(from, to, token, bridge, 2);
console.log(ResultCode[result.result]);
if (result.result != ResultCode.OK) {
if (result.message?.length > 0) {
console.log(iconOf(result.result), result.message);
}

if (result.result != ResultCode.OK) {
problematicTestCases.push({from: from as ChainName, to: to as ChainName, token, icon: iconOf(result.result), message: result.message});
if (aggregateTestResult == ResultCode.OK || (aggregateTestResult == ResultCode.WARN && result.result == ResultCode.FAIL)) {
// only 'increase' the aggregate error
41 changes: 41 additions & 0 deletions scripts/configs/acala.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
endpoint:
- wss://acala-rpc.aca-api.network
- wss://acala-rpc.dwellir.com
mock-signature-host: true
block: ${env.ACALA_BLOCK_NUMBER}
db: ./db.sqlite
# wasm-override: acala-2150.wasm

import-storage:
Sudo:
Key: 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY # Alice
System:
Account:
-
-
- 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
- providers: 1
data:
free: '1000000000000000'
Tokens:
Accounts:
-
-
- 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
- token: AUSD
- free: '1000000000000000'
-
-
- 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
- token: DOT
- free: '1000000000000000'
-
-
- 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
- foreignAsset: 4 # INTR
- free: '500000000000000'
-
-
- 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
- foreignAsset: 3 # IBTC
- free: '10000000000'
27 changes: 27 additions & 0 deletions scripts/configs/astar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
endpoint:
- wss://rpc.astar.network
- wss://astar-rpc.dwellir.com
- wss://astar.public.curie.radiumblock.co/ws
mock-signature-host: true

import-storage:
System:
Account:
-
-
- 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY # Alice
- providers: 1
data:
free: '1000000000000000000000'
Assets:
Account:
-
-
- '18446744073709551620' # IBTC
- 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY # Alice
- balance: '10000000000'
-
-
- '18446744073709551621' # INTR
- 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY # Alice
- balance: '500000000000000'
29 changes: 29 additions & 0 deletions scripts/configs/bifrost-polkadot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
endpoint:
- wss://hk.p.bifrost-rpc.liebi.com/ws
- wss://bifrost-polkadot-rpc.dwellir.com
- wss://eu.bifrost-polkadot-rpc.liebi.com/ws
mock-signature-host: true

import-storage:
# Sudo:
# Key: 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY # Alice
System:
Account:
-
-
- 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
- providers: 1
data:
free: '1000000000000000'
Tokens:
Accounts:
-
-
- 5Eg2fntQS1bgCgPtXQ9Ysip6RUQkQJEMZqZ9u9qX6fcnhB4H # sibl 2032 (interlay sov)
- vtoken2: 0 #VDOT
- free: '100000000000'
-
-
- 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY # Alice
- vtoken2: 0 # VDOT
- free: '100000000000000000'
29 changes: 29 additions & 0 deletions scripts/configs/bifrost.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
endpoint:
- wss://bifrost-rpc.dwellir.com
- wss://bifrost-rpc.liebi.com/ws
- wss://us.bifrost-rpc.liebi.com/ws
mock-signature-host: true

import-storage:
# Sudo:
# Key: 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY # Alice
System:
Account:
-
-
- 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
- providers: 1
data:
free: '1000000000000000'
Tokens:
Accounts:
-
-
- 5Eg2fnsjADUqvPPTJ17bGgphuxi754R7LsCCqPjt7M5MqVKB # sibl 2092 (kintsugi sov)
- vtoken: KSM #VKSM
- free: '10000000000000'
-
-
- 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY # Alice
- vtoken: KSM # VKSM
- free: '10000000000000000000'
Loading