Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test: Reenable HydraDX chopsticks tests #143

Merged
merged 8 commits into from
Dec 21, 2023
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
18 changes: 16 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.WARN
};
}
await sendTx(fromChain, toChain, token, bridge, amountToSend, TestCase.ExistentialDeposit);

return ret;
Expand All @@ -158,7 +171,8 @@ async function retryCheckTransfer(
): Promise<Awaited<ReturnType<typeof checkTransfer>>> {
const result = await checkTransfer(fromChain, toChain, token, bridge);

if (result.result === ResultCode.OK) {
// OK or WARN are fine, only retry on failures
if (result.result === ResultCode.OK || result.result === ResultCode.WARN) {
return result;
}

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
Loading