mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 11:41:02 +00:00
Collectives integration tests (#1979)
Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
---
|
||||
settings:
|
||||
chains:
|
||||
relay_chain: &relay_chain
|
||||
wsPort: 9700
|
||||
collectives_parachain: &collectives_parachain
|
||||
wsPort: 9710
|
||||
paraId: &cp_id 1001
|
||||
variables:
|
||||
xcm_version: &xcm_version '2'
|
||||
chains:
|
||||
accounts:
|
||||
alice_signer: &alice_signer //Alice
|
||||
decodedCalls:
|
||||
ap_force_xcm_version:
|
||||
chain: *collectives_parachain
|
||||
pallet: polkadotXcm
|
||||
call: forceXcmVersion
|
||||
args: [
|
||||
{ # location
|
||||
parents: 1,
|
||||
interior: Here
|
||||
},
|
||||
*xcm_version
|
||||
]
|
||||
|
||||
tests:
|
||||
- name: Initialize Chains
|
||||
its:
|
||||
- name: XCM supported versions between chains
|
||||
actions:
|
||||
- extrinsics: # Relay Chain sets supported version for Collectives Parachain
|
||||
- chain: *relay_chain
|
||||
sudo: true
|
||||
signer: *alice_signer
|
||||
pallet: xcmPallet
|
||||
call: forceXcmVersion
|
||||
args: [
|
||||
{ # location
|
||||
parents: 0,
|
||||
interior: {
|
||||
X1: {
|
||||
Parachain: *cp_id
|
||||
}
|
||||
}
|
||||
},
|
||||
*xcm_version
|
||||
]
|
||||
events:
|
||||
- name: sudo.Sudid
|
||||
attributes:
|
||||
- type: Result<Null, SpRuntimeDispatchError>
|
||||
value: Ok
|
||||
- name: xcmPallet.SupportedVersionChanged
|
||||
attributes:
|
||||
- type: u32
|
||||
value: *xcm_version
|
||||
- extrinsics: # Collectives Parachain sets supported version for Relay Chain through it
|
||||
- chain: *relay_chain
|
||||
signer: *alice_signer
|
||||
sudo: true
|
||||
pallet: xcmPallet
|
||||
call: send
|
||||
args: [
|
||||
{ v1: { 0, interior: { x1: { parachain: *cp_id }}}}, # destination
|
||||
{
|
||||
v2: [ # message
|
||||
{
|
||||
Transact: {
|
||||
originType: Superuser,
|
||||
requireWeightAtMost: 1000000000, # 1_000_000_000
|
||||
call: $ap_force_xcm_version
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
events:
|
||||
- name: sudo.Sudid
|
||||
attributes:
|
||||
- type: Result<Null, SpRuntimeDispatchError>
|
||||
value: Ok
|
||||
- name: xcmPallet.Sent
|
||||
- name: polkadotXcm.SupportedVersionChanged
|
||||
chain: *collectives_parachain
|
||||
attributes:
|
||||
- type: u32
|
||||
value: *xcm_version
|
||||
- name: dmpQueue.ExecutedDownward
|
||||
chain: *collectives_parachain
|
||||
attributes:
|
||||
- type: XcmV2TraitsOutcome
|
||||
xcmOutcome: Complete
|
||||
# the weight must be static
|
||||
value: 2,000,000,000
|
||||
@@ -0,0 +1,126 @@
|
||||
---
|
||||
settings:
|
||||
chains:
|
||||
relay_chain: &relay_chain
|
||||
wsPort: 9700
|
||||
collectives_parachain: &collectives_parachain
|
||||
wsPort: 9710
|
||||
paraId: &cp_id 1001
|
||||
variables:
|
||||
xcm_version: &xcm_version '2'
|
||||
weight_to_send_teleport: &weight_to_send_teleport 2,000,000,000 # must be same for both chains
|
||||
weight_to_receive_teleport: &weight_to_receive_teleport 4,000,000,000 # must be same for both chains
|
||||
chains:
|
||||
accounts:
|
||||
alice_signer: &alice_signer //Alice
|
||||
alice_account32: &alice_acc32 '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d'
|
||||
alice_ss58: &acc_alice_ss58 '15oF4uVJwmo4TdGW7VfQxNLavjCXviqxT9S1MgbjMNHr6Sp5'
|
||||
|
||||
tests:
|
||||
- name: Teleport assets from Relay Chain to Collectives Parachain successful
|
||||
its:
|
||||
- name: Teleport assets from Relay Chain to Collectives Parachain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *alice_signer
|
||||
pallet: xcmPallet
|
||||
call: teleportAssets
|
||||
args: [
|
||||
{ v1: { 0, interior: { x1: { parachain: *cp_id }}}}, # destination
|
||||
{ v1: { parents: 0, interior: { x1: { accountId32: { network: { any: true }, id: *alice_acc32 }}}}}, # beneficiary
|
||||
{
|
||||
v1: [
|
||||
# {
|
||||
# # TODO use a separate Assets to pay a fee, to receive an exact amount of assets on beneficiary account.
|
||||
# # a call with two assets fails with an error right now.
|
||||
# id: { concrete: { 0, interior: { here: true }}},
|
||||
# fun: { fungible: 1000000000000 } # 1_000_000_000_000
|
||||
# },
|
||||
{
|
||||
id: { concrete: { 0, interior: { here: true }}},
|
||||
fun: { fungible: 20000000000000 } # 20_000_000_000_000
|
||||
}
|
||||
]
|
||||
}, # assets
|
||||
0, # feeAssetItem
|
||||
]
|
||||
events:
|
||||
- name: xcmPallet.Attempted
|
||||
chain: *relay_chain
|
||||
attributes:
|
||||
- type: XcmV2TraitsOutcome
|
||||
xcmOutcome: Complete
|
||||
# the weight must be static
|
||||
value: *weight_to_send_teleport
|
||||
- name: balances.Deposit
|
||||
chain: *collectives_parachain
|
||||
attributes:
|
||||
- type: u128
|
||||
# TODO (P2)
|
||||
# Flaky assert since sent assets used to pay a fee
|
||||
# query and assert Alice balance before and after teleport (see example in kick_member test)
|
||||
# drop this event assert
|
||||
value: 19,999,953,648,988 # amount received
|
||||
- name: dmpQueue.ExecutedDownward
|
||||
chain: *collectives_parachain
|
||||
attributes:
|
||||
- type: XcmV2TraitsOutcome
|
||||
xcmOutcome: Complete
|
||||
# the weight must be static
|
||||
value: *weight_to_receive_teleport
|
||||
|
||||
- name: Teleport assets from Collectives Parachain to Relay Chain successful
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *collectives_parachain
|
||||
signer: *alice_signer
|
||||
pallet: polkadotXcm
|
||||
call: teleportAssets
|
||||
args: [
|
||||
{ v1: { parents: 1, interior: { here: true }}}, # destination
|
||||
{ v1: { parents: 0, interior: { x1: { accountId32: { network: { any: true }, id: *alice_acc32 }}}}}, # beneficiary
|
||||
{
|
||||
v1: [
|
||||
{
|
||||
id: { concrete: { parents: 1, interior: { here: true }}},
|
||||
fun: { fungible: 10000000000000 } # 10_000_000_000_000
|
||||
}
|
||||
]
|
||||
}, # assets
|
||||
0, # feeAssetItem
|
||||
]
|
||||
events:
|
||||
# TODO assert balance.Deposit event on relay chain
|
||||
# not possible now / issue - https://github.com/paritytech/parachains-integration-tests/issues/58
|
||||
- name: balances.Withdraw
|
||||
attributes:
|
||||
- type: AccountId32
|
||||
key: who
|
||||
value: *acc_alice_ss58
|
||||
- type: u128
|
||||
key: amount
|
||||
value: 10000000000000
|
||||
- name: polkadotXcm.Attempted
|
||||
attributes:
|
||||
- type: XcmV2TraitsOutcome
|
||||
xcmOutcome: Complete
|
||||
# the weight must be static
|
||||
value: *weight_to_send_teleport
|
||||
- name: balances.Withdraw
|
||||
chain: *relay_chain
|
||||
attributes:
|
||||
- type: u128
|
||||
key: amount
|
||||
value: 10000000000000 # amount received and withdrawn from registry account
|
||||
- name: ump.ExecutedUpward
|
||||
chain: *relay_chain
|
||||
attributes:
|
||||
- type: XcmV2TraitsOutcome
|
||||
xcmOutcome: Complete
|
||||
# the weight must be static
|
||||
value: *weight_to_receive_teleport
|
||||
|
||||
# TODO (P2) assert Alice balance before and after teleport (see example in kick_member test)
|
||||
|
||||
#TODO (P1) test: teleport of non relay chain assets fails
|
||||
@@ -0,0 +1,84 @@
|
||||
---
|
||||
settings:
|
||||
chains:
|
||||
relay_chain: &relay_chain
|
||||
wsPort: 9700
|
||||
collectives_parachain: &collectives_parachain
|
||||
wsPort: 9710
|
||||
paraId: &cp_id 1001
|
||||
variables:
|
||||
xcm_version: &xcm_version '2'
|
||||
weight_to_send_reserve: &weight_to_send_reserve 1,000,000,000 # must be same for both chains
|
||||
chains:
|
||||
accounts:
|
||||
alice_signer: &alice_signer //Alice
|
||||
alice_account32: &alice_acc32 '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d'
|
||||
alice_ss58: &acc_alice_ss58 '15oF4uVJwmo4TdGW7VfQxNLavjCXviqxT9S1MgbjMNHr6Sp5'
|
||||
|
||||
tests:
|
||||
- name: Reserve assets from Relay Chain to Collectives Parachain fails
|
||||
its:
|
||||
- name: Reserve assets from Relay Chain to Collectives Parachain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *alice_signer
|
||||
pallet: xcmPallet
|
||||
call: reserveTransferAssets
|
||||
args: [
|
||||
{ v1: { 0, interior: { x1: { parachain: *cp_id }}}}, # destination
|
||||
{ v1: { parents: 0, interior: { x1: { accountId32: { network: { any: true }, id: *alice_acc32 }}}}}, # beneficiary
|
||||
{
|
||||
v1: [
|
||||
{
|
||||
id: { concrete: { 0, interior: { here: true }}},
|
||||
fun: { fungible: 20000000000000 } # 20_000_000_000_000
|
||||
}
|
||||
]
|
||||
}, # assets
|
||||
0, # feeAssetItem
|
||||
]
|
||||
events:
|
||||
- name: xcmPallet.Attempted
|
||||
chain: *relay_chain
|
||||
attributes:
|
||||
- type: XcmV2TraitsOutcome
|
||||
xcmOutcome: Complete
|
||||
# the weight must be static
|
||||
value: *weight_to_send_reserve
|
||||
- name: dmpQueue.ExecutedDownward
|
||||
chain: *collectives_parachain
|
||||
attributes:
|
||||
- type: XcmV2TraitsOutcome
|
||||
xcmOutcome: Incomplete
|
||||
# the weight must be static
|
||||
value: [1000000000, UntrustedReserveLocation]
|
||||
|
||||
- name: Reserve assets from Collectives Parachain to Relay Chain fails
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *collectives_parachain
|
||||
signer: *alice_signer
|
||||
pallet: polkadotXcm
|
||||
call: reserveTransferAssets
|
||||
args: [
|
||||
{ v1: { parents: 1, interior: { here: true }}}, # destination
|
||||
{ v1: { parents: 0, interior: { x1: { accountId32: { network: { any: true }, id: *alice_acc32 }}}}}, # beneficiary
|
||||
{
|
||||
v1: [
|
||||
{
|
||||
id: { concrete: { parents: 1, interior: { here: true }}},
|
||||
fun: { fungible: 10000000000000 } # 10_000_000_000_000
|
||||
}
|
||||
]
|
||||
}, # assets
|
||||
0, # feeAssetItem
|
||||
]
|
||||
events:
|
||||
- name: system.ExtrinsicFailed
|
||||
attributes:
|
||||
- type: SpRuntimeDispatchError
|
||||
key: dispatchError
|
||||
# TODO assert variant
|
||||
# issue - https://github.com/paritytech/parachains-integration-tests/issues/59
|
||||
value: {"Module":{"index":"31","error":"0x02000000"}}
|
||||
Reference in New Issue
Block a user