mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 17:31:03 +00:00
Adding integration tests (#1426)
* adding parachains integration tests * final integration-tests * Update parachains/integration-tests/statemine/xcm/2_ump.yml Co-authored-by: Chevdor <chevdor@users.noreply.github.com> * Update parachains/integration-tests/statemine/xcm/1_dmp.yml Co-authored-by: Chevdor <chevdor@users.noreply.github.com> * Update parachains/integration-tests/statemine/xcm/4_hrmp.yml Co-authored-by: Chevdor <chevdor@users.noreply.github.com> * Update parachains/integration-tests/statemint/xcm/1_dmp.yml Co-authored-by: Chevdor <chevdor@users.noreply.github.com> * Update parachains/integration-tests/statemint/xcm/2_ump.yml Co-authored-by: Chevdor <chevdor@users.noreply.github.com> * Update parachains/integration-tests/statemint/xcm/4_hrmp.yml Co-authored-by: Chevdor <chevdor@users.noreply.github.com> * Update parachains/integration-tests/statemine/xcm/3_hrmp-open-channels.yml Co-authored-by: Chevdor <chevdor@users.noreply.github.com> * Update parachains/integration-tests/statemint/xcm/3_hrmp-open-channels.yml Co-authored-by: Chevdor <chevdor@users.noreply.github.com> * clean up & trailling spaces * leftovers Co-authored-by: Chevdor <chevdor@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,254 @@
|
||||
---
|
||||
settings:
|
||||
chains:
|
||||
relay_chain: &relay_chain
|
||||
wsPort: 9900
|
||||
assets_parachain: &assets_parachain
|
||||
wsPort: 9910
|
||||
paraId: &ap_id 1000
|
||||
variables:
|
||||
relay_chain:
|
||||
signer: &rc_signer //Alice
|
||||
wallet: &rc_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F
|
||||
assets_parachain_destination: &ap_dest { v1: { parents: 0, interior: { x1: { parachain: *ap_id }}}}
|
||||
assets_parachain_account: &ap_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d'
|
||||
assets_parachain_beneficiary: &ap_benf {v1: { parents: 0, interior: { x1: { accountId32: { network: { any: true }, id: *ap_acc }}}}}
|
||||
ksm: &rc_ksm { concrete: { parents: 0, interior: { here: true }}}
|
||||
amount: &amount 1000000000000
|
||||
ksm_fungible: &rc_ksm_fungible { id: *rc_ksm, fun: { fungible: *amount }}
|
||||
require_weight_at_most: &rc_weight_at_most 1000000000
|
||||
assets_parachain_account:
|
||||
wallet: &ap_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F
|
||||
asset_id: &asset_id 1
|
||||
asset_min_balance: &asset_ed 1000
|
||||
decodedCalls:
|
||||
force_create_asset:
|
||||
chain: *assets_parachain
|
||||
pallet: assets
|
||||
call: forceCreate
|
||||
args: [
|
||||
*asset_id,
|
||||
{ Id: *ap_wallet }, # owner
|
||||
true, # isSufficient
|
||||
*asset_ed # minBalance
|
||||
]
|
||||
|
||||
tests:
|
||||
- name: DMP
|
||||
its: []
|
||||
describes:
|
||||
- name: xcmPallet.limitedTeleportAssets
|
||||
before: &before_get_balances
|
||||
- name: Get the balances of the Relay Chain's sender & Assets Parachain's receiver
|
||||
actions:
|
||||
- queries:
|
||||
balance_rc_sender_before:
|
||||
chain: *relay_chain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *rc_wallet ]
|
||||
balance_ap_receiver_before:
|
||||
chain: *assets_parachain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *ap_wallet ]
|
||||
its:
|
||||
- name: Should teleport native assets from the Relay Chain to the Assets Parachain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *rc_signer
|
||||
pallet: xcmPallet
|
||||
call: limitedTeleportAssets
|
||||
args: [
|
||||
*ap_dest, # destination
|
||||
*ap_benf, # beneficiary
|
||||
{ v1: [ *rc_ksm_fungible ] }, # assets
|
||||
0, # feeAssetItem
|
||||
{ unlimited: true } # weightLimit
|
||||
]
|
||||
events:
|
||||
- name: xcmPallet.Attempted
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
- name: dmpQueue.ExecutedDownward
|
||||
chain: *assets_parachain
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 4,000,000,000
|
||||
- queries:
|
||||
balance_rc_sender_after:
|
||||
chain: *relay_chain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *rc_wallet ]
|
||||
balance_ap_receiver_after:
|
||||
chain: *assets_parachain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *ap_wallet ]
|
||||
|
||||
- name: Should reduce the balance of the sender
|
||||
actions:
|
||||
- asserts:
|
||||
balanceDecreased:
|
||||
args: [
|
||||
{
|
||||
balances: {
|
||||
before: $balance_rc_sender_before,
|
||||
after: $balance_rc_sender_after,
|
||||
},
|
||||
amount: *amount
|
||||
}
|
||||
]
|
||||
|
||||
- name: Should increase the balance of the receiver
|
||||
actions:
|
||||
- asserts:
|
||||
balanceIncreased:
|
||||
args: [
|
||||
{
|
||||
balances: {
|
||||
before: $balance_ap_receiver_before,
|
||||
after: $balance_ap_receiver_after,
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
- name: xcmPallet.send | Superuser - Transact(assets.forceCreate)
|
||||
its:
|
||||
- name: Relay Chain Superuser account SHOULD be able to execute a XCM Transact instruction in the Assets Parachain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *rc_signer
|
||||
sudo: true
|
||||
pallet: xcmPallet
|
||||
call: send
|
||||
args: [
|
||||
*ap_dest, # destination
|
||||
{
|
||||
v2: [ #message
|
||||
{
|
||||
Transact: {
|
||||
originType: Superuser,
|
||||
requireWeightAtMost: *rc_weight_at_most,
|
||||
call: $force_create_asset
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
events:
|
||||
- name: xcmPallet.Sent
|
||||
- name: dmpQueue.ExecutedDownward
|
||||
chain: *assets_parachain
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 2,000,000,000
|
||||
- queries:
|
||||
forced_created_asset:
|
||||
chain: *assets_parachain
|
||||
pallet: assets
|
||||
call: asset
|
||||
args: [ *asset_id ]
|
||||
- asserts:
|
||||
isSome:
|
||||
args: [ $forced_created_asset ]
|
||||
|
||||
- name: xcmPallet.send | Native - Transact(assets.forceCreate)
|
||||
its:
|
||||
- name: Relay Chain Native account SHOULD NOT be able to execute a XCM Transact instruction in the Assets Parachain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *rc_signer
|
||||
pallet: xcmPallet
|
||||
call: send
|
||||
args: [
|
||||
*ap_dest, # destination
|
||||
{
|
||||
v2: [ #message
|
||||
{
|
||||
Transact: {
|
||||
originType: Native,
|
||||
requireWeightAtMost: *rc_weight_at_most,
|
||||
call: $force_create_asset
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
events:
|
||||
- name: system.ExtrinsicFailed
|
||||
attribute:
|
||||
type: SpRuntimeDispatchError
|
||||
value: BadOrigin
|
||||
|
||||
- name: xcmPallet.limitedReserveTransferAssets
|
||||
before: *before_get_balances
|
||||
its:
|
||||
- name: SHOULD NOT reserved transfer native assets from the Relay Chain to the Assets Parachain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *rc_signer
|
||||
pallet: xcmPallet
|
||||
call: limitedReserveTransferAssets
|
||||
args: [
|
||||
*ap_dest, # destination
|
||||
*ap_benf, # beneficiary
|
||||
{ v1: [ *rc_ksm_fungible ] }, # assets
|
||||
0, # feeAssetItem
|
||||
{ unlimited: true } # weightLimit
|
||||
]
|
||||
events:
|
||||
- name: xcmPallet.Attempted
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isComplete: true
|
||||
value: 750,645,000
|
||||
- name: dmpQueue.ExecutedDownward
|
||||
chain: *assets_parachain
|
||||
attribute:
|
||||
type: XcmV2TraitsOutcome
|
||||
isIncomplete: true
|
||||
value: ['1,000,000,000' , UntrustedReserveLocation]
|
||||
- queries:
|
||||
balance_rc_sender_after:
|
||||
chain: *relay_chain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *rc_wallet ]
|
||||
balance_ap_receiver_after:
|
||||
chain: *assets_parachain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *ap_wallet ]
|
||||
|
||||
- name: Should reduce the balance of the sender
|
||||
actions:
|
||||
- asserts:
|
||||
balanceDecreased:
|
||||
args: [
|
||||
{
|
||||
balances: {
|
||||
before: $balance_rc_sender_before,
|
||||
after: $balance_rc_sender_after,
|
||||
},
|
||||
amount: *amount
|
||||
}
|
||||
]
|
||||
|
||||
- name: Should keep the balance of the receiver
|
||||
actions:
|
||||
- asserts:
|
||||
equal:
|
||||
args:
|
||||
[
|
||||
$balance_ap_receiver_before,
|
||||
$balance_ap_receiver_after
|
||||
]
|
||||
Reference in New Issue
Block a user