Skip to content

Commit

Permalink
Merge pull request #143 from bvotteler/test-reenable-hydra-chopsticks
Browse files Browse the repository at this point in the history
Test: Reenable HydraDX chopsticks tests
  • Loading branch information
bvotteler authored Dec 21, 2023
2 parents 04ab71c + 3a2f5c5 commit d092599
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 13 deletions.
1 change: 1 addition & 0 deletions .github/workflows/xcm-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ jobs:
-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 \
Expand Down
20 changes: 18 additions & 2 deletions scripts/chopsticks-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions scripts/configs/kusama.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# endpoint: wss://kusama-rpc.dwellir.com
endpoint: wss://kusama-rpc.polkadot.io
endpoint:
- wss://kusama-rpc.dwellir.com
- wss://kusama-rpc.dwellir.com
mock-signature-host: true
block: ${env.KUSAMA_BLOCK_NUMBER}
db: ./db.sqlite
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/polkadot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
endpoint:
- wss://rpc.polkadot.io
- wss://polkadot-rpc.dwellir.com
- wss://rpc.polkadot.io
mock-signature-host: true
block: ${env.POLKADOT_BLOCK_NUMBER}
db: ./db.sqlite
Expand Down
14 changes: 6 additions & 8 deletions scripts/interlay-chopsticks-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { PolkadotAdapter } from "../src/adapters/polkadot";
import { InterlayAdapter } from "../src/adapters/interlay";
import { StatemintAdapter } from "../src/adapters/statemint";
import { HydraAdapter } from "../src/adapters/hydradx";
import { AcalaAdapter } from "../src/adapters/acala";
import { ParallelAdapter } from "../src/adapters/parallel";
import { BifrostPolkadotAdapter } from "../src/adapters/bifrost";
Expand All @@ -24,21 +25,18 @@ async function main(): Promise<void> {
// relaychain gets its port last after all parachains.
interlay: { adapter: new InterlayAdapter(), endpoints: ['ws://127.0.0.1:8000'] },
statemint: { adapter: new StatemintAdapter(), endpoints: ['ws://127.0.0.1:8001'] },
// disable hydra - rpc too flaky to use in regular test runs
// hydra: { adapter: new HydraAdapter(), endpoints: ['ws://127.0.0.1:8002'] },
acala: { adapter: new AcalaAdapter(), endpoints: ['ws://127.0.0.1:8002'] },
hydra: { adapter: new HydraAdapter(), endpoints: ['ws://127.0.0.1:8002'] },
acala: { adapter: new AcalaAdapter(), endpoints: ['ws://127.0.0.1:8003'] },
// disable astar - rpc currently is too fragile for use in recurring tests
// astar: { adapter: new AstarAdapter(), endpoints: ['ws://127.0.0.1:8004'] },
parallel: { adapter: new ParallelAdapter(), endpoints: ['ws://127.0.0.1:8003'] },
bifrost_polkadot: { adapter: new BifrostPolkadotAdapter(), endpoints: ['ws://127.0.0.1:8004']},
polkadot: { adapter: new PolkadotAdapter(), endpoints: ['ws://127.0.0.1:8005'] },
parallel: { adapter: new ParallelAdapter(), endpoints: ['ws://127.0.0.1:8004'] },
bifrost_polkadot: { adapter: new BifrostPolkadotAdapter(), endpoints: ['ws://127.0.0.1:8005']},
polkadot: { adapter: new PolkadotAdapter(), endpoints: ['ws://127.0.0.1:8006'] },
};

const filterCases: Partial<RouterTestCase>[] = [
{from: "astar"},
{to: "astar"},
{from: "hydra"},
{to: "hydra"},
];

await runTestCasesAndExit(adaptersEndpoints, filterCases);
Expand Down

0 comments on commit d092599

Please sign in to comment.