-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: e2e tests ah between current spiritnet runtime (#668)
## fixes [#3507](KILTprotocol/ticket#3507) Checks possible interaction between AH and Spiritnet. In the emulated tests, it is checked that messages with the `Transact` instruction are filtered out. Currently, there are only tests for extrinsics which require sudo rights. If it is wished, I can add a test for that too.
- Loading branch information
Showing
19 changed files
with
852 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { setupContext, SetupOption } from '@acala-network/chopsticks-testing' | ||
|
||
import type { Config } from './types.js' | ||
import { initialBalanceDOT, toNumber } from '../utils.js' | ||
|
||
/// Options used to create the Spiritnet context | ||
export const getSetupOptions = ({ | ||
blockNumber = undefined, | ||
wasmOverride = undefined, | ||
}: { | ||
blockNumber?: number | ||
wasmOverride?: string | ||
}) => | ||
({ | ||
endpoint: process.env.ASSETHUB_WSS || 'wss://asset-hub-polkadot-rpc.dwellir.com', | ||
db: './db/assethub.db.sqlite', | ||
port: toNumber(process.env.ASSETHUB_PORT) || 9003, | ||
wasmOverride, | ||
blockNumber, | ||
}) as SetupOption | ||
|
||
export function assignKSMtoAccounts(addr: string[], balance: bigint = initialBalanceDOT) { | ||
return { | ||
foreignAssets: { | ||
account: addr.map((addr) => [ | ||
[KSMAssetLocation, addr], | ||
{ | ||
balance: balance, | ||
status: 'Liquid', | ||
reason: 'Consumer', | ||
extra: null, | ||
}, | ||
]), | ||
}, | ||
} | ||
} | ||
|
||
/// AssetHub has no own coin. Teleported dots are used as the native token. | ||
export function assignDotTokensToAccounts(addr: string[], balance: bigint = initialBalanceDOT) { | ||
return { | ||
System: { | ||
Account: addr.map((address) => [[address], { providers: 1, data: { free: balance.toString() } }]), | ||
}, | ||
} | ||
} | ||
|
||
/// AssetHub ParaId | ||
export const paraId = 1000 | ||
|
||
export const KSMAssetLocation = { | ||
parents: 2, | ||
interior: { | ||
X1: { | ||
GlobalConsensus: 'Kusama', | ||
}, | ||
}, | ||
} | ||
|
||
// Sibling Sovereign Account | ||
export const sovereignAccountOnSiblingChains = '4qXPdpimHh8TR24RSk994yVzxx4TLfvKj5i1qH5puvWmfAqy' | ||
|
||
export async function getContext(): Promise<Config> { | ||
const options = getSetupOptions({}) | ||
return setupContext(options) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
194 changes: 194 additions & 0 deletions
194
...src/tests/xcm/assetHub/__snapshots__/limitedReserveTransferAssetHubSpiritnet.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,194 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`Limited Reserve Transfers from AH Account Alice -> Spiritnet Account Alice > receiver spiritnet::XcmpQueue::[Fail] asset {"V3":[{"id":{"Concrete":{"parents":2,"interior":{"X1":{"GlobalConsensus":"Kusama"}}}},"fun":{"Fungible":"10000000000"}}]} 1`] = ` | ||
[ | ||
{ | ||
"data": { | ||
"error": "UntrustedReserveLocation", | ||
"messageHash": "(hash)", | ||
"messageId": "(hash)", | ||
"weight": { | ||
"proofSize": 0, | ||
"refTime": 200000000, | ||
}, | ||
}, | ||
"method": "Fail", | ||
"section": "xcmpQueue", | ||
}, | ||
] | ||
`; | ||
|
||
exports[`Limited Reserve Transfers from AH Account Alice -> Spiritnet Account Alice > sender assetHub::foreignAssets::[Transferred] asset {"V3":[{"id":{"Concrete":{"parents":2,"interior":{"X1":{"GlobalConsensus":"Kusama"}}}},"fun":{"Fungible":"10000000000"}}]} 1`] = ` | ||
[ | ||
{ | ||
"data": { | ||
"amount": 10000000000, | ||
"assetId": { | ||
"interior": { | ||
"X1": { | ||
"GlobalConsensus": "Kusama", | ||
}, | ||
}, | ||
"parents": 2, | ||
}, | ||
"from": "15jSz35ugoWTc61xHPoxEkHte4o7UanKCk1gx1dizA8yuNs8", | ||
"to": "13cKp88mpGREFCq8KsJEFjpSBnjFuCNWq6bmD3js7fu4f66e", | ||
}, | ||
"method": "Transferred", | ||
"section": "foreignAssets", | ||
}, | ||
] | ||
`; | ||
|
||
exports[`Limited Reserve Transfers from AH Account Alice -> Spiritnet Account Alice > sender assetHub::polkadotXcm::[Sent,FeesPaid,Attempted] asset {"V3":[{"id":{"Concrete":{"parents":2,"interior":{"X1":{"GlobalConsensus":"Kusama"}}}},"fun":{"Fungible":"10000000000"}}]} 1`] = ` | ||
[ | ||
{ | ||
"data": { | ||
"outcome": { | ||
"Complete": { | ||
"used": { | ||
"proofSize": "(rounded 6200)", | ||
"refTime": "(rounded 290000000)", | ||
}, | ||
}, | ||
}, | ||
}, | ||
"method": "Attempted", | ||
"section": "polkadotXcm", | ||
}, | ||
{ | ||
"data": { | ||
"fees": [ | ||
{ | ||
"fun": { | ||
"Fungible": 310000000, | ||
}, | ||
"id": { | ||
"interior": "Here", | ||
"parents": 1, | ||
}, | ||
}, | ||
], | ||
"paying": { | ||
"interior": { | ||
"X1": [ | ||
{ | ||
"AccountId32": { | ||
"id": "(hash)", | ||
"network": "Polkadot", | ||
}, | ||
}, | ||
], | ||
}, | ||
"parents": 0, | ||
}, | ||
}, | ||
"method": "FeesPaid", | ||
"section": "polkadotXcm", | ||
}, | ||
{ | ||
"data": { | ||
"destination": { | ||
"interior": { | ||
"X1": [ | ||
{ | ||
"Parachain": "(rounded 2100)", | ||
}, | ||
], | ||
}, | ||
"parents": 1, | ||
}, | ||
"message": [ | ||
{ | ||
"ReserveAssetDeposited": [ | ||
{ | ||
"fun": { | ||
"Fungible": 10000000000, | ||
}, | ||
"id": { | ||
"interior": { | ||
"X1": [ | ||
{ | ||
"GlobalConsensus": "Kusama", | ||
}, | ||
], | ||
}, | ||
"parents": 2, | ||
}, | ||
}, | ||
], | ||
}, | ||
"ClearOrigin", | ||
{ | ||
"BuyExecution": { | ||
"fees": { | ||
"fun": { | ||
"Fungible": 10000000000, | ||
}, | ||
"id": { | ||
"interior": { | ||
"X1": [ | ||
{ | ||
"GlobalConsensus": "Kusama", | ||
}, | ||
], | ||
}, | ||
"parents": 2, | ||
}, | ||
}, | ||
"weightLimit": "Unlimited", | ||
}, | ||
}, | ||
{ | ||
"DepositAsset": { | ||
"assets": { | ||
"Wild": "All", | ||
}, | ||
"beneficiary": { | ||
"interior": { | ||
"X1": [ | ||
{ | ||
"AccountId32": { | ||
"id": "(hash)", | ||
"network": null, | ||
}, | ||
}, | ||
], | ||
}, | ||
"parents": 0, | ||
}, | ||
}, | ||
}, | ||
], | ||
"messageId": "(hash)", | ||
"origin": { | ||
"interior": { | ||
"X1": [ | ||
{ | ||
"AccountId32": { | ||
"id": "(hash)", | ||
"network": "Polkadot", | ||
}, | ||
}, | ||
], | ||
}, | ||
"parents": 0, | ||
}, | ||
}, | ||
"method": "Sent", | ||
"section": "polkadotXcm", | ||
}, | ||
] | ||
`; | ||
|
||
exports[`Limited Reserve Transfers from AH Account Alice -> Spiritnet Account Alice > sender assetHub::xcmpQueue::[XcmpMessageSent] asset {"V3":[{"id":{"Concrete":{"parents":2,"interior":{"X1":{"GlobalConsensus":"Kusama"}}}},"fun":{"Fungible":"10000000000"}}]} 1`] = ` | ||
[ | ||
{ | ||
"data": { | ||
"messageHash": "(hash)", | ||
}, | ||
"method": "XcmpMessageSent", | ||
"section": "xcmpQueue", | ||
}, | ||
] | ||
`; |
Oops, something went wrong.