Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Collectives integration tests xcm v3 (#2221)
Browse files Browse the repository at this point in the history
* Collectives integration tests xcm v3

* remove comment

* review fixs

---------

Co-authored-by: parity-processbot <>
  • Loading branch information
muharem authored May 16, 2023
1 parent 02b7034 commit c409dc1
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 117 deletions.
27 changes: 19 additions & 8 deletions parachains/integration-tests/collectives/0_xcm/0_init.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ settings:
wsPort: 9710
paraId: &cp_id 1001
variables:
xcm_version: &xcm_version '2'
xcm_version: &xcm_version '3'
chains:
accounts:
alice_signer: &alice_signer //Alice
Expand Down Expand Up @@ -62,13 +62,26 @@ tests:
pallet: xcmPallet
call: send
args: [
{ v1: { 0, interior: { x1: { parachain: *cp_id }}}}, # destination
{ v3: { 0, interior: { x1: { parachain: *cp_id }}}}, # destination
{
v2: [ # message
v3: [ # message
{
UnpaidExecution: {
weightLimit: {
limited: {
refTime: 2200000000, # 2_200_000_000
proofSize: 200000, # 200_000
},
}
}
},
{
Transact: {
originType: Superuser,
requireWeightAtMost: 1000000000, # 1_000_000_000
originKind: Superuser,
requireWeightAtMost: {
refTime: 200000000, # 200_000_000
proofSize: 0,
},
call: $ap_force_xcm_version
}
}
Expand All @@ -89,7 +102,5 @@ tests:
- name: dmpQueue.ExecutedDownward
chain: *collectives_parachain
attributes:
- type: XcmV2TraitsOutcome
- type: XcmV3TraitsOutcome
xcmOutcome: Complete
# the weight must be static
value: 2,000,000,000
30 changes: 10 additions & 20 deletions parachains/integration-tests/collectives/0_xcm/1_teleport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ settings:
wsPort: 9710
paraId: &cp_id 1001
variables:
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
accounts:
alice_signer: &acc_alice_signer //Alice
alice_account32: &acc_alice_acc32 '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d'
Expand Down Expand Up @@ -39,10 +37,10 @@ tests:
pallet: xcmPallet
call: teleportAssets
args: [
{ v1: { 0, interior: { x1: { parachain: *cp_id }}}}, # destination
{ v1: { parents: 0, interior: { x1: { accountId32: { network: { any: true }, id: *acc_alice_acc32 }}}}}, # beneficiary
{ v3: { 0, interior: { x1: { parachain: *cp_id }}}}, # destination
{ v3: { parents: 0, interior: { x1: { accountId32: { id: *acc_alice_acc32 }}}}}, # beneficiary
{
v1: [
v3: [
# {
# # 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.
Expand All @@ -61,17 +59,13 @@ tests:
- name: xcmPallet.Attempted
chain: *relay_chain
attributes:
- type: XcmV2TraitsOutcome
- type: XcmV3TraitsOutcome
xcmOutcome: Complete
# the weight must be static
value: *weight_to_send_teleport
- name: dmpQueue.ExecutedDownward
chain: *collectives_parachain
attributes:
- type: XcmV2TraitsOutcome
- type: XcmV3TraitsOutcome
xcmOutcome: Complete
# the weight must be static
value: *weight_to_receive_teleport
- queries:
balance_rc_alice_2:
chain: *relay_chain
Expand Down Expand Up @@ -113,10 +107,10 @@ tests:
pallet: polkadotXcm
call: teleportAssets
args: [
{ v1: { parents: 1, interior: { here: true }}}, # destination
{ v1: { parents: 0, interior: { x1: { accountId32: { network: { any: true }, id: *acc_alice_acc32 }}}}}, # beneficiary
{ v3: { parents: 1, interior: { here: true }}}, # destination
{ v3: { parents: 0, interior: { x1: { accountId32: { id: *acc_alice_acc32 }}}}}, # beneficiary
{
v1: [
v3: [
{
id: { concrete: { parents: 1, interior: { here: true }}},
fun: { fungible: 10000000000000 } # 10_000_000_000_000
Expand All @@ -136,10 +130,8 @@ tests:
value: 10000000000000
- name: polkadotXcm.Attempted
attributes:
- type: XcmV2TraitsOutcome
- type: XcmV3TraitsOutcome
xcmOutcome: Complete
# the weight must be static
value: *weight_to_send_teleport
- name: balances.Withdraw
chain: *relay_chain
attributes:
Expand All @@ -149,10 +141,8 @@ tests:
- name: ump.ExecutedUpward
chain: *relay_chain
attributes:
- type: XcmV2TraitsOutcome
- type: XcmV3TraitsOutcome
xcmOutcome: Complete
# the weight must be static
value: *weight_to_receive_teleport
- queries:
balance_rc_alice_3:
chain: *relay_chain
Expand Down
45 changes: 5 additions & 40 deletions parachains/integration-tests/collectives/0_xcm/2_reserve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ settings:
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
Expand All @@ -26,10 +24,10 @@ tests:
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
{ v3: { 0, interior: { x1: { parachain: *cp_id }}}}, # destination
{ v3: { parents: 0, interior: { x1: { accountId32: { id: *alice_acc32 }}}}}, # beneficiary
{
v1: [
v3: [
{
id: { concrete: { 0, interior: { here: true }}},
fun: { fungible: 20000000000000 } # 20_000_000_000_000
Expand All @@ -42,43 +40,10 @@ tests:
- name: xcmPallet.Attempted
chain: *relay_chain
attributes:
- type: XcmV2TraitsOutcome
- type: XcmV3TraitsOutcome
xcmOutcome: Complete
# the weight must be static
value: *weight_to_send_reserve
- name: dmpQueue.ExecutedDownward
chain: *collectives_parachain
attributes:
- type: XcmV2TraitsOutcome
- type: XcmV3TraitsOutcome
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"}}
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,26 @@ tests:
pallet: xcmPallet
call: send
args: [
{ v1: { parents: 0, interior: { x1: { parachain: *coll_para_id }}}}, # destination
{ v3: { parents: 0, interior: { x1: { parachain: *coll_para_id }}}}, # destination
{
v2: [ # message
v3: [ # message
{
UnpaidExecution: {
weightLimit: {
limited: {
refTime: 3000000000, # 3_000_000_000
proofSize: 2000000, # 2_000_000
},
}
}
},
{
Transact: {
originType: Superuser,
requireWeightAtMost: 1000000000, # 1_000_000_000
originKind: Superuser,
requireWeightAtMost: {
refTime: 1000000000, # 1_000_000_000
proofSize: 1000000, # 1_000_000
},
call: $init_alliance_members
}
}
Expand All @@ -105,10 +118,8 @@ tests:
- name: dmpQueue.ExecutedDownward
chain: *collectives_parachain
attributes:
- type: XcmV2TraitsOutcome
- type: XcmV3TraitsOutcome
xcmOutcome: Complete
# we don't know how much weight will be spent for custom call within Transact operation
# value: skipping the assertion

- name: Alliance init call fails.
actions:
Expand All @@ -119,13 +130,26 @@ tests:
pallet: xcmPallet
call: send
args: [
{ v1: { parents: 0, interior: { x1: { parachain: *coll_para_id }}}}, # destination
{ v3: { parents: 0, interior: { x1: { parachain: *coll_para_id }}}}, # destination
{
v2: [ # message
v3: [ # message
{
UnpaidExecution: {
weightLimit: {
limited: {
refTime: 3000000000, # 3_000_000_000
proofSize: 2000000, # 2_000_000
},
}
}
},
{
Transact: {
originType: Superuser,
requireWeightAtMost: 1000000000, # 1_000_000_000
originKind: Superuser,
requireWeightAtMost: {
refTime: 1000000000, # 1_000_000_000
proofSize: 1000000, # 1_000_000
},
call: $init_alliance_voting_members
}
}
Expand All @@ -145,10 +169,8 @@ tests:
- name: dmpQueue.ExecutedDownward
chain: *collectives_parachain
attributes:
- type: XcmV2TraitsOutcome
- type: XcmV3TraitsOutcome
xcmOutcome: Complete
# the call must fail, the weight spent is static
value: 2,000,000,000

- name: Alliance disbanded and initialized again.
actions:
Expand All @@ -159,13 +181,26 @@ tests:
pallet: xcmPallet
call: send
args: [
{ v1: { parents: 0, interior: { x1: { parachain: *coll_para_id }}}}, # destination
{ v3: { parents: 0, interior: { x1: { parachain: *coll_para_id }}}}, # destination
{
v2: [ # message
v3: [ # message
{
UnpaidExecution: {
weightLimit: {
limited: {
refTime: 5000000000, # 3_000_000_000
proofSize: 1000000, # 1_000_000
},
}
}
},
{
Transact: {
originType: Superuser,
requireWeightAtMost: 100000000000, # 100_000_000_000
originKind: Superuser,
requireWeightAtMost: {
refTime: 3000000000, # 3_000_000_000
proofSize: 200000, # 200_000
},
call: $disband
}
}
Expand Down Expand Up @@ -193,10 +228,8 @@ tests:
- name: dmpQueue.ExecutedDownward
chain: *collectives_parachain
attributes:
- type: XcmV2TraitsOutcome
- type: XcmV3TraitsOutcome
xcmOutcome: Complete
# we don't know how much weight will be spent for custom call within Transact operation
# value: skipping the assertion
- name: Alliance initiated, founders and fellows are set.
actions:
- extrinsics:
Expand All @@ -206,13 +239,26 @@ tests:
pallet: xcmPallet
call: send
args: [
{ v1: { parents: 0, interior: { x1: { parachain: *coll_para_id }}}}, # destination
{ v3: { parents: 0, interior: { x1: { parachain: *coll_para_id }}}}, # destination
{
v2: [ # message
v3: [ # message
{
UnpaidExecution: {
weightLimit: {
limited: {
refTime: 3000000000, # 3_000_000_000
proofSize: 2000000, # 2_000_000
},
}
}
},
{
Transact: {
originType: Superuser,
requireWeightAtMost: 1000000000, # 1_000_000_000
originKind: Superuser,
requireWeightAtMost: {
refTime: 1000000000, # 1_000_000_000
proofSize: 1000000, # 1_000_000
},
call: $init_alliance_members
}
}
Expand All @@ -230,8 +276,6 @@ tests:
- name: dmpQueue.ExecutedDownward
chain: *collectives_parachain
attributes:
- type: XcmV2TraitsOutcome
- type: XcmV3TraitsOutcome
xcmOutcome: Complete
# we don't know how much weight will be spent for custom call within Transact operation
# value: skipping the assertion

Loading

0 comments on commit c409dc1

Please sign in to comment.