Skip to content

[MGX-522] Simplify XYK RPC api (#535) #1111

[MGX-522] Simplify XYK RPC api (#535)

[MGX-522] Simplify XYK RPC api (#535) #1111

This check has been archived and is scheduled for deletion. Learn more about checks retention
GitHub Actions / E2E report yarn test-multiswap failed Sep 22, 2023 in 0s

E2E report yarn test-multiswap ❌

Tests failed

❌ e2eTests/reports/junit-51d287a0-5933-11ee-a3ad-331806ec6c03.xml

44 tests were completed in 974s with 42 passed, 1 failed and 1 skipped.

Test suite Passed Failed Skipped Time
test/parallel/utility-pallet.swapOperations.test.ts 24✔️ 1✖️ 973s
test/parallel/xyk-pallet.multiswap.errors.test.ts 6✔️ 1❌ 577s
test/parallel/xyk-pallet.multiswap.test.ts 7✔️ 433s
test/parallel/xyk-pallet.multiswap2hops.test.ts 5✔️ 289s

✔️ test/parallel/utility-pallet.swapOperations.test.ts

✖️ Validate that the error enum is about filtered call
Utility - batched swaps are not allowed
  ✔️ multiswapSellAsset operation is not allowed in batchAll
  ✔️ multiswapBuyAsset operation is not allowed in batchAll
  ✔️ sellAsset operation is not allowed in batchAll
  ✔️ buyAsset operation is not allowed in batchAll
  ✔️ compoundRewards operation is not allowed in batchAll
  ✔️ provideLiquidity operation is not allowed in batchAll
  ✔️ multiswapSellAsset operation is not allowed in batch
  ✔️ multiswapBuyAsset operation is not allowed in batch
  ✔️ sellAsset operation is not allowed in batch
  ✔️ buyAsset operation is not allowed in batch
  ✔️ compoundRewards operation is not allowed in batch
  ✔️ provideLiquidity operation is not allowed in batch
  ✔️ multiswapSellAsset operation is not allowed in forceBatch
  ✔️ multiswapBuyAsset operation is not allowed in forceBatch
  ✔️ sellAsset operation is not allowed in forceBatch
  ✔️ buyAsset operation is not allowed in forceBatch
  ✔️ compoundRewards operation is not allowed in forceBatch
  ✔️ provideLiquidity operation is not allowed in forceBatch
  ✔️ multiswapSellAsset operation is not allowed in singleBatch with some allowed
  ✔️ multiswapBuyAsset operation is not allowed in singleBatch with some allowed
  ✔️ sellAsset operation is not allowed in singleBatch with some allowed
  ✔️ buyAsset operation is not allowed in singleBatch with some allowed
  ✔️ compoundRewards operation is not allowed in singleBatch with some allowed
  ✔️ provideLiquidity operation is not allowed in singleBatch with some allowed

❌ test/parallel/xyk-pallet.multiswap.errors.test.ts

Multiswap - error cases: disabled tokens
  ✔️ [gasless] disabled on token of the chained polls
  ✔️ [gasless] disabled on token of the chained polls - Fail on tx execution-2
  ✔️ [gasless] disabled on token of the chained polls - Fail on tx execution-4
Multiswap - error cases: pool status & gasless integration
  ✔️ [gasless] High value swaps are disabled on multiswap
  ✔️ [gasless] Fail on client when not enough MGAs to lock AND tokens that exist whitelist
  ✔️ [gasless] Fail on swap when selling remove all MGAs
  ❌ [gasless] Fails on client when pool does not exist
	Error: expect(received).rejects.toThrow()

✔️ test/parallel/xyk-pallet.multiswap.test.ts

Multiswap - happy paths
  ✔️ [gasless] Happy path - multi-swap - buy
  ✔️ [gasless] Happy path - multi-swap - sell
  ✔️ [gasless] Happy path - multi-swap uses feeLocks
  ✔️ [gasless] Fees - multi-swap roll backs all the swaps when one fail but 0.3% is charged
  ✔️ [gasless] accuracy - Sum of calculate_sell_asset chained is equal to the multiswap operation
  ✔️ [gasless] accuracy - Sum of calculate_buy_asset chained is equal to the multiswap operation
  ✔️ [gasless] alternative scenario - one pool is highly unbalanced -> zero swap output

✔️ test/parallel/xyk-pallet.multiswap2hops.test.ts

Multiswap [2 hops] - happy paths
  ✔️ [gasless] Happy path - multi-swap - buy
  ✔️ [gasless] Happy path - multi-swap - sell
  ✔️ [gasless] Happy path - multi-swap uses feeLocks
  ✔️ [gasless] Fees - multi-swap roll backs all the swaps when one fail but 0.3% is charged
  ✔️ [gasless] accuracy - Sum of calculate_sell_asset chained is equal to the multiswap operation

Annotations

Check failure on line 0 in e2eTests/reports/junit-51d287a0-5933-11ee-a3ad-331806ec6c03.xml

See this annotation in the file changed.

@github-actions github-actions / E2E report yarn test-multiswap

test/parallel/xyk-pallet.multiswap.errors.test.ts ► Multiswap - error cases: pool status & gasless integration ► [gasless] Fails on client when pool does not exist

Failed test found in:
  e2eTests/reports/junit-51d287a0-5933-11ee-a3ad-331806ec6c03.xml
Error:
  Error: expect(received).rejects.toThrow()
Raw output
Error: expect(received).rejects.toThrow()

Received promise resolved instead of rejected
Resolved to value: [{"error": null, "event": {"data": [0, "5GCXhkSVkag3dwDcXQEv1VPUzXT8rcbWW56wfmiKPSmFDjGh", "0x0000000000000002b5e3af16b1880000"], "index": "0x0a03"}, "eventData": [{"data": 0, "lookupName": undefined}, {"data": "5GCXhkSVkag3dwDcXQEv1VPUzXT8rcbWW56wfmiKPSmFDjGh", "lookupName": undefined}, {"data": "0x0000000000000002b5e3af16b1880000", "lookupName": undefined}], "metaDocumentation": "[Some balance was reserved (moved from free to reserved).]", "method": "Reserved", "phase": {"applyExtrinsic": 3}, "section": "tokens"}, {"error": null, "event": {"data": ["5GCXhkSVkag3dwDcXQEv1VPUzXT8rcbWW56wfmiKPSmFDjGh", "0x0000000000000002b5e3af16b1880000", "0x00000000000000056bc75e2d63100000"], "index": "0x0f02"}, "eventData": [{"data": "5GCXhkSVkag3dwDcXQEv1VPUzXT8rcbWW56wfmiKPSmFDjGh", "lookupName": undefined}, {"data": "0x0000000000000002b5e3af16b1880000", "lookupName": undefined}, {"data": "0x00000000000000056bc75e2d63100000", "lookupName": undefined}], "metaDocumentation": "[]", "method": "FeeLocked", "phase": {"applyExtrinsic": 3}, "section": "feeLock"}, {"error": null, "event": {"data": [50, "5GCXhkSVkag3dwDcXQEv1VPUzXT8rcbWW56wfmiKPSmFDjGh", "5EYCAe5XGPRojsCSi9p1ZZQ5qgeJGFcTxPxrsFRzkASu6bT2", 25], "index": "0x0a02"}, "eventData": [{"data": 50, "lookupName": undefined}, {"data": "5GCXhkSVkag3dwDcXQEv1VPUzXT8rcbWW56wfmiKPSmFDjGh", "lookupName": undefined}, {"data": "5EYCAe5XGPRojsCSi9p1ZZQ5qgeJGFcTxPxrsFRzkASu6bT2", "lookupName": undefined}, {"data": 25, "lookupName": undefined}], "metaDocumentation": "[Transfer succeeded.]", "method": "Transfer", "phase": {"applyExtrinsic": 3}, "section": "tokens"}, {"error": null, "event": {"data": [50, "5EYCAe5ijiYfyeZ2JJCGq56LmPyNRAKzpG4QkoQkkQNB5e6Z", 7], "index": "0x0a00"}, "eventData": [{"data": 50, "lookupName": undefined}, {"data": "5EYCAe5ijiYfyeZ2JJCGq56LmPyNRAKzpG4QkoQkkQNB5e6Z", "lookupName": undefined}, {"data": 7, "lookupName": undefined}], "metaDocumentation": "[An account was created with some free balance.]", "method": "Endowed", "phase": {"applyExtrinsic": 3}, "section": "tokens"}, {"error": null, "event": {"data": [50, "5GCXhkSVkag3dwDcXQEv1VPUzXT8rcbWW56wfmiKPSmFDjGh", "5EYCAe5ijiYfyeZ2JJCGq56LmPyNRAKzpG4QkoQkkQNB5e6Z", 7], "index": "0x0a02"}, "eventData": [{"data": 50, "lookupName": undefined}, {"data": "5GCXhkSVkag3dwDcXQEv1VPUzXT8rcbWW56wfmiKPSmFDjGh", "lookupName": undefined}, {"data": "5EYCAe5ijiYfyeZ2JJCGq56LmPyNRAKzpG4QkoQkkQNB5e6Z", "lookupName": undefined}, {"data": 7, "lookupName": undefined}], "metaDocumentation": "[Transfer succeeded.]", "method": "Transfer", "phase": {"applyExtrinsic": 3}, "section": "tokens"}, {"error": null, "event": {"data": [50, "5EYCAe5ijiYfyeZ2JJezKNMZfdbiFMyQc4YVzxaiMebAZBcm", 7], "index": "0x0a00"}, "eventData": [{"data": 50, "lookupName": undefined}, {"data": "5EYCAe5ijiYfyeZ2JJezKNMZfdbiFMyQc4YVzxaiMebAZBcm", "lookupName": undefined}, {"data": 7, "lookupName": undefined}], "metaDocumentation": "[An account was created with some free balance.]", "method": "Endowed", "phase": {"applyExtrinsic": 3}, "section": "tokens"}, {"error": null, "event": {"data": [50, "5GCXhkSVkag3dwDcXQEv1VPUzXT8rcbWW56wfmiKPSmFDjGh", "5EYCAe5ijiYfyeZ2JJezKNMZfdbiFMyQc4YVzxaiMebAZBcm", 7], "index": "0x0a02"}, "eventData": [{"data": 50, "lookupName": undefined}, {"data": "5GCXhkSVkag3dwDcXQEv1VPUzXT8rcbWW56wfmiKPSmFDjGh", "lookupName": undefined}, {"data": "5EYCAe5ijiYfyeZ2JJezKNMZfdbiFMyQc4YVzxaiMebAZBcm", "lookupName": undefined}, {"data": 7, "lookupName": undefined}], "metaDocumentation": "[Transfer succeeded.]", "method": "Transfer", "phase": {"applyExtrinsic": 3}, "section": "tokens"}, {"error": null, "event": {"data": ["5GCXhkSVkag3dwDcXQEv1VPUzXT8rcbWW56wfmiKPSmFDjGh", [50, 51, 52, 53, 54, 1000000000], 12345, {"error": "0x02000000", "index": 13}], "index": "0x0d0a"}, "eventData": [{"data": "5GCXhkSVkag3dwDcXQEv1VPUzXT8rcbWW56wfmiKPSmFDjGh", "lookupName": undefined}, {"data": [50, 51, 52, 53, 54, 1000000000], "lookupName": undefined}, {"data": 12345, "lookupName": undefined}, {"data": {"error": "0x02000000", "index": 13}, "lookupName": "SpRuntimeModuleError"}], "metaDocumentation": "[]", "method": "MultiSwapAssetFailedOnAtomicSwap", "phase": {"applyExtrinsic": 3}, "section": "xyk"}, {"error": null, "event": {"data": [{"class": "Operational", "paysFee": "No", "weight": {"proofSize": 0, "refTime": 7130654040}}], "index": "0x0000"}, "eventData": [{"data": {"class": "Operational", "paysFee": "No", "weight": {"proofSize": 0, "refTime": 7130654040}}, "lookupName": "FrameSupportDispatchDispatchInfo"}], "metaDocumentation": "[An extrinsic completed successfully.]", "method": "ExtrinsicSuccess", "phase": {"applyExtrinsic": 3}, "section": "system"}]
    at expect (/home/github/runner/_work/mangata-node/mangata-node/e2eTests/node_modules/expect/build/index.js:113:15)
    at /home/github/runner/_work/mangata-node/mangata-node/e2eTests/test/parallel/xyk-pallet.multiswap.errors.test.ts:187:11
    at Generator.next (<anonymous>)
    at fulfilled (/home/github/runner/_work/mangata-node/mangata-node/e2eTests/test/parallel/xyk-pallet.multiswap.errors.test.ts:4:58)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)