mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 09:21:04 +00:00
[Feature] XCM-Emulator (#2447)
* [Feature] XCM-Emulator * ".git/.scripts/commands/fmt/fmt.sh" * rename * readme * more rename * rename directory * implement AssetTransactor * Update xcm/xcm-emulator/README.md Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com> * address review comments (#2502) * Update xcm/xcm-emulator/example/src/lib.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Update xcm/xcm-emulator/README.md * Use 2d weights. * Point out nearer the failure why it should fail * Move test-runtime to under examples * Walk through how to use it * proof needs to be non-zero * Apply suggestions from code review * Update xcm/xcm-emulator/README.md Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Improve xcm emulator (#2593) * folder restructutre * common created * make macros repetitions * messenger traits for relay and para * default Messenger impls * messenger traits refactor * declared two networks * init network approach works * queues use HashMap but relay block number * init and reset refactor * messengers trait name changed * relay block number suboptimal * fix reset hashmap keys * genesis added * test ext added for parachains * genesis added relay chains * genesis to storage * new_ext replaced by on_init * new relay block number approach * ext_wrapper added * added types to Parachain trait * relay chain with types * restructure * para_ids working * replace para_id getter * replace para_id getter 2 * tests restructure + common variables * added sovereign and balances helpers * more helpers + tess pass * expected events macro added * added events trait method * expect_events macro improve * expect_events macro done * network traits added * reserve_transfer test added * para & relay macro inputs redefined * added collectives & BH paras * test restructure * statemine removed * nitpick * rename test folder + events logs * clean * weight threshold helper * update readme * remove cumulus-test-service dependancy * fmt * comment docs * update e2e tests to xcm v3 * clippy + runtime-benchmark + clean docs --------- Co-authored-by: command-bot <> Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com> Co-authored-by: Squirrel <gilescope@gmail.com> Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Co-authored-by: Ignacio Palacios <ignacio.palacios.santos@gmail.com>
This commit is contained in:
+106
@@ -0,0 +1,106 @@
|
||||
---
|
||||
settings:
|
||||
chains:
|
||||
relay_chain: &relay_chain
|
||||
wsPort: 9700
|
||||
collectives_parachain: &collectives_parachain
|
||||
wsPort: 9710
|
||||
paraId: &cp_id 1001
|
||||
variables:
|
||||
xcm_version: &xcm_version '3'
|
||||
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: [
|
||||
{ v3: { 0, interior: { x1: { parachain: *cp_id }}}}, # destination
|
||||
{
|
||||
v3: [ # message
|
||||
{
|
||||
UnpaidExecution: {
|
||||
weightLimit: {
|
||||
limited: {
|
||||
refTime: 2200000000, # 2_200_000_000
|
||||
proofSize: 200000, # 200_000
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
Transact: {
|
||||
originKind: Superuser,
|
||||
requireWeightAtMost: {
|
||||
refTime: 200000000, # 200_000_000
|
||||
proofSize: 0,
|
||||
},
|
||||
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: XcmV3TraitsOutcome
|
||||
xcmOutcome: Complete
|
||||
+180
@@ -0,0 +1,180 @@
|
||||
---
|
||||
settings:
|
||||
chains:
|
||||
relay_chain: &relay_chain
|
||||
wsPort: 9700
|
||||
collectives_parachain: &collectives_parachain
|
||||
wsPort: 9710
|
||||
paraId: &cp_id 1001
|
||||
variables:
|
||||
accounts:
|
||||
alice_signer: &acc_alice_signer //Alice
|
||||
alice_account32: &acc_alice_acc32 '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d'
|
||||
alice_ss58: &acc_alice_ss58 '15oF4uVJwmo4TdGW7VfQxNLavjCXviqxT9S1MgbjMNHr6Sp5'
|
||||
|
||||
tests:
|
||||
- name: Teleport assets from Relay Chain to Collectives Parachain successful.
|
||||
before:
|
||||
- name: Get the Alice balances on Relay & Collectives Chains.
|
||||
actions:
|
||||
- queries:
|
||||
balance_rc_alice_1:
|
||||
chain: *relay_chain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *acc_alice_acc32 ]
|
||||
balance_cp_alice_1:
|
||||
chain: *collectives_parachain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *acc_alice_acc32 ]
|
||||
its:
|
||||
- name: Teleport assets from Relay Chain to Collectives Parachain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *acc_alice_signer
|
||||
pallet: xcmPallet
|
||||
call: teleportAssets
|
||||
args: [
|
||||
{ v3: { 0, interior: { x1: { parachain: *cp_id }}}}, # destination
|
||||
{ v3: { parents: 0, interior: { x1: { accountId32: { id: *acc_alice_acc32 }}}}}, # beneficiary
|
||||
{
|
||||
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.
|
||||
# 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: XcmV3TraitsOutcome
|
||||
xcmOutcome: Complete
|
||||
- name: dmpQueue.ExecutedDownward
|
||||
chain: *collectives_parachain
|
||||
attributes:
|
||||
- type: XcmV3TraitsOutcome
|
||||
xcmOutcome: Complete
|
||||
- queries:
|
||||
balance_rc_alice_2:
|
||||
chain: *relay_chain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *acc_alice_acc32 ]
|
||||
balance_cp_alice_2:
|
||||
chain: *collectives_parachain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *acc_alice_acc32 ]
|
||||
- name: Alice deposit check, balance decreased on Relay Chain, increased on Collectives.
|
||||
actions:
|
||||
- asserts:
|
||||
balanceDecreased:
|
||||
args: [
|
||||
{
|
||||
balances: {
|
||||
before: $balance_rc_alice_1,
|
||||
after: $balance_rc_alice_2,
|
||||
}
|
||||
}
|
||||
]
|
||||
balanceIncreased:
|
||||
args: [
|
||||
{
|
||||
balances: {
|
||||
before: $balance_cp_alice_1,
|
||||
after: $balance_cp_alice_2,
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
- name: Teleport assets from Collectives Parachain to Relay Chain successful
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *collectives_parachain
|
||||
signer: *acc_alice_signer
|
||||
pallet: polkadotXcm
|
||||
call: teleportAssets
|
||||
args: [
|
||||
{ v3: { parents: 1, interior: { here: true }}}, # destination
|
||||
{ v3: { parents: 0, interior: { x1: { accountId32: { id: *acc_alice_acc32 }}}}}, # beneficiary
|
||||
{
|
||||
v3: [
|
||||
{
|
||||
id: { concrete: { parents: 1, interior: { here: true }}},
|
||||
fun: { fungible: 10000000000000 } # 10_000_000_000_000
|
||||
}
|
||||
]
|
||||
}, # assets
|
||||
0, # feeAssetItem
|
||||
]
|
||||
events:
|
||||
- name: balances.Withdraw
|
||||
attributes:
|
||||
- type: AccountId32
|
||||
key: who
|
||||
value: *acc_alice_ss58
|
||||
- type: u128
|
||||
key: amount
|
||||
value: 10000000000000
|
||||
- name: polkadotXcm.Attempted
|
||||
attributes:
|
||||
- type: XcmV3TraitsOutcome
|
||||
xcmOutcome: Complete
|
||||
- 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: XcmV3TraitsOutcome
|
||||
xcmOutcome: Complete
|
||||
- queries:
|
||||
balance_rc_alice_3:
|
||||
chain: *relay_chain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *acc_alice_acc32 ]
|
||||
balance_cp_alice_3:
|
||||
chain: *collectives_parachain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *acc_alice_acc32 ]
|
||||
|
||||
- name: Alice deposit check, balance decreased on Collectives, increased on Relay Chain.
|
||||
actions:
|
||||
- asserts:
|
||||
balanceDecreased:
|
||||
args: [
|
||||
{
|
||||
balances: {
|
||||
before: $balance_cp_alice_2,
|
||||
after: $balance_cp_alice_3,
|
||||
}
|
||||
}
|
||||
]
|
||||
balanceIncreased:
|
||||
args: [
|
||||
{
|
||||
balances: {
|
||||
before: $balance_rc_alice_2,
|
||||
after: $balance_rc_alice_3,
|
||||
}
|
||||
}
|
||||
]
|
||||
# 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
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
---
|
||||
settings:
|
||||
chains:
|
||||
relay_chain: &relay_chain
|
||||
wsPort: 9700
|
||||
collectives_parachain: &collectives_parachain
|
||||
wsPort: 9710
|
||||
paraId: &cp_id 1001
|
||||
variables:
|
||||
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: [
|
||||
{ v3: { 0, interior: { x1: { parachain: *cp_id }}}}, # destination
|
||||
{ v3: { parents: 0, interior: { x1: { accountId32: { id: *alice_acc32 }}}}}, # beneficiary
|
||||
{
|
||||
v3: [
|
||||
{
|
||||
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: XcmV3TraitsOutcome
|
||||
xcmOutcome: Complete
|
||||
- name: dmpQueue.ExecutedDownward
|
||||
chain: *collectives_parachain
|
||||
attributes:
|
||||
- type: XcmV3TraitsOutcome
|
||||
xcmOutcome: Incomplete
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
---
|
||||
settings:
|
||||
chains:
|
||||
relay_chain: &relay_chain
|
||||
wsPort: 9700
|
||||
collectives_parachain: &collectives_parachain
|
||||
wsPort: 9710
|
||||
paraId: &cp_id 1001
|
||||
variables:
|
||||
accounts:
|
||||
alice_signer: &alice_signer //Alice
|
||||
alice_account32: &cp_alice_acc32 '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d'
|
||||
|
||||
tests:
|
||||
- name: Alice fails to join an the Alliance, since it is not initialized yet.
|
||||
its:
|
||||
- name: Alice joins alliance
|
||||
actions:
|
||||
- extrinsics: # Relay Chain sets supported version for Asset Parachain
|
||||
- chain: *collectives_parachain
|
||||
signer: *alice_signer
|
||||
pallet: alliance
|
||||
call: joinAlliance
|
||||
args: []
|
||||
events:
|
||||
- name: system.ExtrinsicFailed
|
||||
attributes:
|
||||
- type: SpRuntimeDispatchError
|
||||
key: dispatchError
|
||||
# TODO assert with Alliance Error variant - alliance.AllianceNotYetInitialized
|
||||
# issue - https://github.com/paritytech/parachains-integration-tests/issues/59
|
||||
value: {"Module":{"index":"50","error":"0x00000000"}}
|
||||
|
||||
|
||||
+280
@@ -0,0 +1,280 @@
|
||||
---
|
||||
settings:
|
||||
chains:
|
||||
relay_chain: &relay_chain
|
||||
wsPort: 9700
|
||||
collectives_parachain: &collectives_parachain
|
||||
wsPort: 9710
|
||||
paraId: &coll_para_id 1001
|
||||
variables:
|
||||
accounts:
|
||||
alice_signer: &acc_alice_signer //Alice
|
||||
alice_account32: &acc_alice_acc32 "0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d"
|
||||
liam_signer: &acc_liam_signer //Liam
|
||||
liam_account32: &acc_liam_acc32 "0x3614671a5de540d891eb8c4939c8153a4aa790602b347c18177b86d0fc546221"
|
||||
olivia_signer: &acc_olivia_signer //Olivia
|
||||
olivia_account32: &acc_olivia_acc32 "0x24ee8a659c6716fe9f7cb4e9e028602aa12867654ca02737da9171b7ff697d5c"
|
||||
noah_signer: &acc_noah_signer //Noah
|
||||
noah_account32: &acc_noah_acc32 "0x9c6ad3bc3aa2f1b2e837898e6da9980445f7ef8b3eee0b8c8e305f8cfae68517"
|
||||
emma_signer: &acc_emma_signer //Emma
|
||||
emma_account32: &acc_emma_acc32 "0x8ac272b333ba1127c8db57fa777ec820b24598a236efa648caf0d26d86f64572"
|
||||
james_signer: &acc_james_signer //James
|
||||
james_account32: &acc_james_acc32 "0x9a52805151a0b5effc084af9264011139872a21a3950cb9ae0b2955c4bf92c18"
|
||||
ava_signer: &acc_ava_signer //Ava
|
||||
ava_account32: &acc_ava_acc32 "0x348ef0b8776adbc09c862ddc29b1d193b9e24738e54eea3b0609c83856dc101c"
|
||||
mia_signer: &acc_mia_signer //Mia
|
||||
mia_account32: &acc_mia_acc32 "0xaebf15374cf7e758d10232514c569a7abf81cc1b8f1e81a73dbc608a0e335264"
|
||||
decodedCalls:
|
||||
init_alliance_members:
|
||||
chain: *collectives_parachain
|
||||
pallet: alliance
|
||||
call: initMembers
|
||||
args: [
|
||||
[
|
||||
*acc_liam_acc32,
|
||||
*acc_olivia_acc32,
|
||||
*acc_noah_acc32,
|
||||
*acc_emma_acc32,
|
||||
*acc_james_acc32,
|
||||
*acc_ava_acc32
|
||||
],
|
||||
[
|
||||
*acc_mia_acc32
|
||||
]
|
||||
]
|
||||
init_alliance_voting_members:
|
||||
chain: *collectives_parachain
|
||||
pallet: alliance
|
||||
call: initMembers
|
||||
args: [
|
||||
[
|
||||
*acc_liam_acc32,
|
||||
*acc_olivia_acc32,
|
||||
*acc_noah_acc32,
|
||||
*acc_emma_acc32,
|
||||
*acc_james_acc32,
|
||||
*acc_ava_acc32,
|
||||
*acc_mia_acc32
|
||||
],
|
||||
[]
|
||||
]
|
||||
disband:
|
||||
chain: *collectives_parachain
|
||||
pallet: alliance
|
||||
call: disband
|
||||
args: [
|
||||
{
|
||||
fellowMembers: 6,
|
||||
allyMembers: 1
|
||||
}
|
||||
]
|
||||
|
||||
tests:
|
||||
- name: Alliance initiated with the root call, second init call fails. Alliance disband and set again.
|
||||
its:
|
||||
- name: Alliance initiated, founders and fellows are set.
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *acc_alice_signer
|
||||
sudo: true
|
||||
pallet: xcmPallet
|
||||
call: send
|
||||
args: [
|
||||
{ v3: { parents: 0, interior: { x1: { parachain: *coll_para_id }}}}, # destination
|
||||
{
|
||||
v3: [ # message
|
||||
{
|
||||
UnpaidExecution: {
|
||||
weightLimit: {
|
||||
limited: {
|
||||
refTime: 3000000000, # 3_000_000_000
|
||||
proofSize: 2000000, # 2_000_000
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
Transact: {
|
||||
originKind: Superuser,
|
||||
requireWeightAtMost: {
|
||||
refTime: 1000000000, # 1_000_000_000
|
||||
proofSize: 1000000, # 1_000_000
|
||||
},
|
||||
call: $init_alliance_members
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
events:
|
||||
- name: sudo.Sudid
|
||||
attributes:
|
||||
- type: Result<Null, SpRuntimeDispatchError>
|
||||
value: Ok
|
||||
- name: xcmPallet.Sent
|
||||
- name: alliance.MembersInitialized
|
||||
chain: *collectives_parachain
|
||||
- name: dmpQueue.ExecutedDownward
|
||||
chain: *collectives_parachain
|
||||
attributes:
|
||||
- type: XcmV3TraitsOutcome
|
||||
xcmOutcome: Complete
|
||||
|
||||
- name: Alliance init call fails.
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *acc_alice_signer
|
||||
sudo: true
|
||||
pallet: xcmPallet
|
||||
call: send
|
||||
args: [
|
||||
{ v3: { parents: 0, interior: { x1: { parachain: *coll_para_id }}}}, # destination
|
||||
{
|
||||
v3: [ # message
|
||||
{
|
||||
UnpaidExecution: {
|
||||
weightLimit: {
|
||||
limited: {
|
||||
refTime: 3000000000, # 3_000_000_000
|
||||
proofSize: 2000000, # 2_000_000
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
Transact: {
|
||||
originKind: Superuser,
|
||||
requireWeightAtMost: {
|
||||
refTime: 1000000000, # 1_000_000_000
|
||||
proofSize: 1000000, # 1_000_000
|
||||
},
|
||||
call: $init_alliance_voting_members
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
events:
|
||||
# TODO can not currently assert variant AllianceAlreadyInitialized, XCM Transact fails silently
|
||||
# issue - https://github.com/paritytech/polkadot/issues/4623
|
||||
# Next test with a disband call will fail, if this call does not fail,
|
||||
# since a witness data from a disband call will be invalid.
|
||||
- name: sudo.Sudid
|
||||
attributes:
|
||||
- type: Result<Null, SpRuntimeDispatchError>
|
||||
value: Ok
|
||||
- name: xcmPallet.Sent
|
||||
- name: dmpQueue.ExecutedDownward
|
||||
chain: *collectives_parachain
|
||||
attributes:
|
||||
- type: XcmV3TraitsOutcome
|
||||
xcmOutcome: Complete
|
||||
|
||||
- name: Alliance disbanded and initialized again.
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *acc_alice_signer
|
||||
sudo: true
|
||||
pallet: xcmPallet
|
||||
call: send
|
||||
args: [
|
||||
{ v3: { parents: 0, interior: { x1: { parachain: *coll_para_id }}}}, # destination
|
||||
{
|
||||
v3: [ # message
|
||||
{
|
||||
UnpaidExecution: {
|
||||
weightLimit: {
|
||||
limited: {
|
||||
refTime: 5000000000, # 3_000_000_000
|
||||
proofSize: 1000000, # 1_000_000
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
Transact: {
|
||||
originKind: Superuser,
|
||||
requireWeightAtMost: {
|
||||
refTime: 3000000000, # 3_000_000_000
|
||||
proofSize: 200000, # 200_000
|
||||
},
|
||||
call: $disband
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
events:
|
||||
- name: sudo.Sudid
|
||||
attributes:
|
||||
- type: Result<Null, SpRuntimeDispatchError>
|
||||
value: Ok
|
||||
- name: xcmPallet.Sent
|
||||
- name: alliance.AllianceDisbanded
|
||||
chain: *collectives_parachain
|
||||
attributes:
|
||||
- type: u32
|
||||
key: fellowMembers
|
||||
value: 6
|
||||
- type: u32
|
||||
key: allyMembers
|
||||
value: 1
|
||||
- type: u32
|
||||
key: unreserved
|
||||
value: 0
|
||||
- name: dmpQueue.ExecutedDownward
|
||||
chain: *collectives_parachain
|
||||
attributes:
|
||||
- type: XcmV3TraitsOutcome
|
||||
xcmOutcome: Complete
|
||||
- name: Alliance initiated, founders and fellows are set.
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *acc_alice_signer
|
||||
sudo: true
|
||||
pallet: xcmPallet
|
||||
call: send
|
||||
args: [
|
||||
{ v3: { parents: 0, interior: { x1: { parachain: *coll_para_id }}}}, # destination
|
||||
{
|
||||
v3: [ # message
|
||||
{
|
||||
UnpaidExecution: {
|
||||
weightLimit: {
|
||||
limited: {
|
||||
refTime: 3000000000, # 3_000_000_000
|
||||
proofSize: 2000000, # 2_000_000
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
Transact: {
|
||||
originKind: Superuser,
|
||||
requireWeightAtMost: {
|
||||
refTime: 1000000000, # 1_000_000_000
|
||||
proofSize: 1000000, # 1_000_000
|
||||
},
|
||||
call: $init_alliance_members
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
events:
|
||||
- name: sudo.Sudid
|
||||
attributes:
|
||||
- type: Result<Null, SpRuntimeDispatchError>
|
||||
value: Ok
|
||||
- name: xcmPallet.Sent
|
||||
- name: alliance.MembersInitialized
|
||||
chain: *collectives_parachain
|
||||
- name: dmpQueue.ExecutedDownward
|
||||
chain: *collectives_parachain
|
||||
attributes:
|
||||
- type: XcmV3TraitsOutcome
|
||||
xcmOutcome: Complete
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
---
|
||||
settings:
|
||||
chains:
|
||||
relay_chain: &relay_chain
|
||||
wsPort: 9700
|
||||
collectives_parachain: &collectives_parachain
|
||||
wsPort: 9710
|
||||
paraId: &cp_id 1001
|
||||
variables:
|
||||
accounts:
|
||||
liam_signer: &acc_liam_signer //Liam
|
||||
liam_account32: &acc_liam_acc32 "0x3614671a5de540d891eb8c4939c8153a4aa790602b347c18177b86d0fc546221"
|
||||
|
||||
tests:
|
||||
- name: Liam fails to join an the Alliance, Liam is already a member.
|
||||
its:
|
||||
- name: Alice joins alliance
|
||||
actions:
|
||||
- extrinsics: # Relay Chain sets supported version for Asset Parachain
|
||||
- chain: *collectives_parachain
|
||||
signer: *acc_liam_signer
|
||||
pallet: alliance
|
||||
call: joinAlliance
|
||||
args: []
|
||||
events:
|
||||
- name: system.ExtrinsicFailed
|
||||
attributes:
|
||||
- type: SpRuntimeDispatchError
|
||||
key: dispatchError
|
||||
# TODO assert with Alliance Error variant - alliance.AllianceNotYetInitialized
|
||||
# issue - https://github.com/paritytech/parachains-integration-tests/issues/59
|
||||
value: {"Module":{"index":"50","error":"0x02000000"}}
|
||||
|
||||
|
||||
+185
@@ -0,0 +1,185 @@
|
||||
---
|
||||
settings:
|
||||
chains:
|
||||
relay_chain: &relay_chain
|
||||
wsPort: 9700
|
||||
collectives_parachain: &collectives_parachain
|
||||
wsPort: 9710
|
||||
paraId: &cp_id 1001
|
||||
variables:
|
||||
init_teleport_amount: &init_teleport_amount 20000000000000 # 20_000_000_000_000
|
||||
accounts:
|
||||
alice_signer: &acc_alice_signer //Alice
|
||||
treasury_account32: &acc_treasury_acc32 '0x6d6f646c70792f74727372790000000000000000000000000000000000000000'
|
||||
alice_account32: &acc_alice_acc32 '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d'
|
||||
alice_ss58: &acc_alice_ss58 '15oF4uVJwmo4TdGW7VfQxNLavjCXviqxT9S1MgbjMNHr6Sp5'
|
||||
decodedCalls:
|
||||
alliance_kick_member:
|
||||
chain: *collectives_parachain
|
||||
pallet: alliance
|
||||
call: kickMember
|
||||
args: [
|
||||
{Id: *acc_alice_acc32}
|
||||
]
|
||||
|
||||
tests:
|
||||
- name: Member kicked out, deposited assets slashed and teleported to Relay Chain treasury.
|
||||
before:
|
||||
- name: DEPENDENCY | Do a 'limitedTeleportAssets' from the Relay Chain to the Collectives Parachain
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *relay_chain
|
||||
signer: *acc_alice_signer
|
||||
pallet: xcmPallet
|
||||
call: limitedTeleportAssets
|
||||
args: [
|
||||
{ v3: { 0, interior: { x1: { parachain: *cp_id }}}}, # destination
|
||||
{ v3: { parents: 0, interior: { x1: { accountId32: { id: *acc_alice_acc32 }}}}}, # beneficiary
|
||||
{ v3: [ { id: { concrete: { 0, interior: { here: true }}}, fun: { fungible: *init_teleport_amount }} ] }, # assets
|
||||
0, # feeAssetItem
|
||||
{ unlimited: true } # weightLimit
|
||||
]
|
||||
events:
|
||||
- name: xcmPallet.Attempted
|
||||
attributes:
|
||||
- type: XcmV3TraitsOutcome
|
||||
xcmOutcome: Complete
|
||||
- name: balances.Deposit
|
||||
chain: *collectives_parachain
|
||||
attributes:
|
||||
- type: AccountId32
|
||||
key: who
|
||||
value: *acc_alice_ss58
|
||||
- name: dmpQueue.ExecutedDownward
|
||||
chain: *collectives_parachain
|
||||
attributes:
|
||||
- type: XcmV3TraitsOutcome
|
||||
xcmOutcome: Complete
|
||||
- name: Get the balances of the Relay Chain's treasury & Collectives parachain's future alliance member
|
||||
actions:
|
||||
- queries:
|
||||
balance_rc_treasury_before:
|
||||
chain: *relay_chain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *acc_treasury_acc32 ]
|
||||
balance_cp_alice_before:
|
||||
chain: *collectives_parachain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *acc_alice_acc32 ]
|
||||
its:
|
||||
- name: Alice joins alliance
|
||||
actions:
|
||||
- extrinsics:
|
||||
- chain: *collectives_parachain
|
||||
signer: *acc_alice_signer
|
||||
pallet: alliance
|
||||
call: joinAlliance
|
||||
args: []
|
||||
events:
|
||||
- name: balances.Reserved
|
||||
chain: *collectives_parachain
|
||||
attributes:
|
||||
- type: AccountId32
|
||||
key: who
|
||||
value: *acc_alice_ss58
|
||||
- type: u128
|
||||
key: amount
|
||||
value: 10,000,000,000,000
|
||||
- name: alliance.NewAllyJoined
|
||||
attributes:
|
||||
- type: AccountId32
|
||||
key: ally
|
||||
value: *acc_alice_ss58
|
||||
- queries:
|
||||
balance_cp_alice_after:
|
||||
chain: *collectives_parachain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *acc_alice_acc32 ]
|
||||
- name: Alice deposit check, balance decreased
|
||||
actions:
|
||||
- asserts:
|
||||
balanceDecreased:
|
||||
args: [
|
||||
{
|
||||
balances: {
|
||||
before: $balance_cp_alice_before,
|
||||
after: $balance_cp_alice_after,
|
||||
}
|
||||
# TODO (P3) set `amount` and `fee` for more strict assert
|
||||
}
|
||||
]
|
||||
- name: Kick Alice from alliance
|
||||
actions:
|
||||
- extrinsics: # Asset Parachain sets supported version for Relay Chain through it
|
||||
- chain: *relay_chain
|
||||
signer: *acc_alice_signer
|
||||
sudo: true
|
||||
pallet: xcmPallet
|
||||
call: send
|
||||
args: [
|
||||
{ v3: { parents: 0, interior: { x1: { parachain: *cp_id }}}}, # destination
|
||||
{
|
||||
v3: [ #message
|
||||
{
|
||||
UnpaidExecution: {
|
||||
weightLimit: {
|
||||
limited: {
|
||||
refTime: 4000000000, # 4_000_000_000
|
||||
proofSize: 2000000, # 2_000_000
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
Transact: {
|
||||
originKind: Superuser,
|
||||
requireWeightAtMost: {
|
||||
refTime: 2000000000, # 2_000_000_000
|
||||
proofSize: 1000000, # 1_000_000
|
||||
},
|
||||
call: $alliance_kick_member
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
events:
|
||||
- name: sudo.Sudid
|
||||
attributes:
|
||||
- type: Result<Null, SpRuntimeDispatchError>
|
||||
value: Ok
|
||||
- name: xcmPallet.Sent
|
||||
- name: alliance.MemberKicked
|
||||
chain: *collectives_parachain
|
||||
attributes:
|
||||
- type: AccountId32
|
||||
key: member
|
||||
value: *acc_alice_ss58
|
||||
- name: dmpQueue.ExecutedDownward
|
||||
chain: *collectives_parachain
|
||||
attributes:
|
||||
- type: XcmV3TraitsOutcome
|
||||
xcmOutcome: Complete
|
||||
|
||||
- queries:
|
||||
balance_rc_treasury_after:
|
||||
chain: *relay_chain
|
||||
pallet: system
|
||||
call: account
|
||||
args: [ *acc_treasury_acc32 ]
|
||||
- name: Slashed balance appears on the relay chain treasury account
|
||||
actions:
|
||||
- asserts:
|
||||
balanceIncreased:
|
||||
args: [
|
||||
{
|
||||
balances: {
|
||||
before: $balance_rc_treasury_before,
|
||||
after: $balance_rc_treasury_after,
|
||||
}
|
||||
# TODO (P3) set `amount` and `fee` for more strict assert
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,41 @@
|
||||
[relaychain]
|
||||
default_command = "./bin/polkadot"
|
||||
default_args = [ "-lparachain=trace", "-lxcm=trace" ]
|
||||
chain = "polkadot-local"
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "alice"
|
||||
ws_port = 9700
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "bob"
|
||||
ws_port = 9701
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "charlie"
|
||||
ws_port = 9702
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "dave"
|
||||
ws_port = 9703
|
||||
validator = true
|
||||
|
||||
[[parachains]]
|
||||
id = 1001
|
||||
chain = "collectives-polkadot-local"
|
||||
cumulus_based = true
|
||||
|
||||
[[parachains.collators]]
|
||||
name = "collator1"
|
||||
ws_port = 9710
|
||||
command = "./bin/polkadot-parachain"
|
||||
args = ["-lxcm=trace"]
|
||||
|
||||
[[parachains.collators]]
|
||||
name = "collator2"
|
||||
ws_port = 9711
|
||||
command = "./bin/polkadot-parachain"
|
||||
args = ["-lxcm=trace"]
|
||||
Reference in New Issue
Block a user