mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-25 03:35:43 +00:00
b7082d1a9d
* [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>
402 lines
16 KiB
YAML
402 lines
16 KiB
YAML
---
|
|
settings:
|
|
chains:
|
|
relay_chain: &relay_chain
|
|
wsPort: 9800
|
|
assets_parachain: &assets_parachain
|
|
wsPort: 9810
|
|
paraId: &ap_id 1000
|
|
penpal_parachain: &penpal_parachain
|
|
wsPort: 9820
|
|
paraId: &pp_id 2000
|
|
variables:
|
|
common:
|
|
mint_amount: &mint_amount 1000000000000
|
|
amount: &amount 1000000000000
|
|
require_weight_at_most: &weight_at_most {refTime: 1200000000, proofSize: 20000}
|
|
amount_to_send: &amount_to_send 500000000000
|
|
chains:
|
|
relay_chain:
|
|
signer: &rc_signer //Alice
|
|
assets_parachain_destination: &ap_dest { v3: { 0, interior: { x1: { parachain: *ap_id }}}}
|
|
assets_parachain_dest_routed: &ap_dest_routed { v3: { parents: 1, interior: { x1: { parachain: *ap_id } }}}
|
|
assets_parachain_account:
|
|
signer: &ap_signer //Alice
|
|
wallet: &ap_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F
|
|
asset_id: &asset_id 2
|
|
assets_pallet_id: &assets_pallet_id 50
|
|
asset_min_balance: &asset_ed 1000
|
|
penpal_parachain_destination: &pp_dest { v3: { parents: 1, interior: { x1: { parachain: *pp_id } }}}
|
|
ksm: &ap_ksm { concrete: { parents: 1, interior: { here: true }}}
|
|
ksm_fungible: &ap_ksm_fungible { id: *ap_ksm, fun: { fungible: *amount }}
|
|
suff_asset: &suff_asset { concrete: { parents: 0, interior: { x2: [ { PalletInstance: *assets_pallet_id }, { GeneralIndex: *asset_id } ] }}}
|
|
suff_asset_fail: &suff_asset_fail { concrete: { parents: 0, interior: { x2: [ { PalletInstance: *assets_pallet_id }, { GeneralIndex: 3 } ] }}}
|
|
suff_asset_fungible_fail: &ap_suff_asset_fungible_fail { id: *suff_asset_fail, fun: { fungible: 200000000000 }}
|
|
penpal_parachain:
|
|
sovereign_account: &pp_sovereign_sibl 13cKp89Msu7M2PiaCuuGr1BzAsD5V3vaVbDMs3YtjMZHdGwR
|
|
signer: &pp_signer //Alice
|
|
penpal_parachain_account: &pp_acc '0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d'
|
|
decodedCalls:
|
|
force_create_asset:
|
|
chain: *assets_parachain
|
|
pallet: assets
|
|
call: forceCreate
|
|
args: [
|
|
*asset_id,
|
|
{ Id: *ap_wallet }, # owner
|
|
true, # isSufficient
|
|
*asset_ed # minBalance
|
|
]
|
|
force_create_asset2:
|
|
chain: *assets_parachain
|
|
pallet: assets
|
|
call: forceCreate
|
|
args: [
|
|
*asset_id,
|
|
{ Id: *ap_wallet }, # owner
|
|
true, # isSufficient
|
|
*asset_ed # minBalance
|
|
]
|
|
|
|
tests:
|
|
- name: HRMP
|
|
describes:
|
|
- name: polkadotXcm.limitedReserveTransferAssets (Asset) | Assets Parachain -> Penpal Parachain
|
|
before:
|
|
- name: DEPENDENCY | A sufficient Asset should exist in the Assets Parachain
|
|
actions:
|
|
- extrinsics:
|
|
- chain: *relay_chain
|
|
signer: *rc_signer
|
|
sudo: true
|
|
pallet: xcmPallet
|
|
call: send
|
|
args: [
|
|
*ap_dest, # destination
|
|
{
|
|
v3: [ #message
|
|
{
|
|
UnpaidExecution: {
|
|
weightLimit: Unlimited
|
|
}
|
|
},
|
|
{
|
|
SetTopic: "0x0123456789012345678901234567891201234567890123456789012345678912"
|
|
},
|
|
{
|
|
Transact: {
|
|
originKind: Superuser,
|
|
requireWeightAtMost: *weight_at_most,
|
|
call: $force_create_asset
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
events:
|
|
- name: xcmPallet.Sent
|
|
- name: dmpQueue.ExecutedDownward
|
|
chain: *assets_parachain
|
|
attributes:
|
|
- type: XcmV3TraitsOutcome
|
|
xcmOutcome: Complete
|
|
threshold: [10, 10]
|
|
value: {"refTime":"1,218,405,000","proofSize":"20,000"}
|
|
- queries:
|
|
forced_created_asset:
|
|
chain: *assets_parachain
|
|
pallet: assets
|
|
call: asset
|
|
args: [ *asset_id ]
|
|
- asserts:
|
|
isSome:
|
|
args: [ $forced_created_asset ]
|
|
|
|
- name: DEPENDENCY | Some Assets should be minted for the sender
|
|
actions:
|
|
- extrinsics:
|
|
- chain: *assets_parachain
|
|
signer: *ap_signer
|
|
pallet: assets
|
|
call: mint
|
|
args: [
|
|
*asset_id,
|
|
*ap_wallet,
|
|
*mint_amount
|
|
]
|
|
events:
|
|
- name: assets.Issued
|
|
|
|
its:
|
|
- name: Assets Parachain should be able to reserve transfer an Asset to Penpal Parachain
|
|
actions:
|
|
- extrinsics:
|
|
- chain: *assets_parachain
|
|
signer: *ap_signer
|
|
pallet: polkadotXcm
|
|
call: limitedReserveTransferAssets
|
|
args: [
|
|
*pp_dest, # destination
|
|
{ # beneficiary
|
|
V3: {
|
|
parents: 0,
|
|
interior: {
|
|
X1: {
|
|
AccountId32: {
|
|
id: *pp_acc
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{ # assets
|
|
V3: [
|
|
{
|
|
id: {
|
|
Concrete: {
|
|
parents: 0,
|
|
interior: {
|
|
X2: [
|
|
{
|
|
PalletInstance: *assets_pallet_id
|
|
},
|
|
{
|
|
GeneralIndex: *asset_id
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
fun: {
|
|
Fungible: *amount_to_send
|
|
}
|
|
}
|
|
]
|
|
},
|
|
0, # feeAssetItem
|
|
Unlimited # weightLimit
|
|
]
|
|
events:
|
|
- name: polkadotXcm.Attempted
|
|
attributes:
|
|
- type: XcmV3TraitsOutcome
|
|
xcmOutcome: Complete
|
|
threshold: [10, 10]
|
|
value: {"refTime":"673,627,000","proofSize":"6,196"}
|
|
- name: assets.Transferred
|
|
attributes:
|
|
- type: AccountId32
|
|
value: *pp_sovereign_sibl
|
|
- name: assets.Transferred
|
|
attributes:
|
|
- type: u128
|
|
value: *amount_to_send
|
|
|
|
- name: polkadotXcm.limitedReserveTransferAssets (KSM) | Assets Parachain -> Penpal Parachain
|
|
its:
|
|
- name: Assets Parachain should be able to reserve transfer KSM to Penpal Parachain
|
|
actions:
|
|
- extrinsics:
|
|
- chain: *assets_parachain
|
|
signer: *ap_signer
|
|
pallet: polkadotXcm
|
|
call: limitedReserveTransferAssets
|
|
args: [
|
|
*pp_dest, # destination
|
|
{ # beneficiary
|
|
V3: {
|
|
parents: 0,
|
|
interior: {
|
|
X1: {
|
|
AccountId32: {
|
|
id: *pp_acc
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{ # assets
|
|
V3: [
|
|
*ap_ksm_fungible
|
|
]
|
|
},
|
|
0, # feeAssetItem
|
|
Unlimited # weightLimit
|
|
]
|
|
events:
|
|
- name: polkadotXcm.Attempted
|
|
attributes:
|
|
- type: XcmV3TraitsOutcome
|
|
xcmOutcome: Complete
|
|
threshold: [10, 10]
|
|
value: {"refTime":"673,627,000","proofSize":"6,196"}
|
|
- name: balances.Endowed
|
|
attributes:
|
|
- type: AccountId32
|
|
value: *pp_sovereign_sibl
|
|
- name: balances.Endowed
|
|
attributes:
|
|
- type: u128
|
|
value: *amount
|
|
|
|
- name: polkadotXcm.send( assets.forceCreateAsset ) | Penpal Parachain -> Assets Parachain
|
|
before:
|
|
- name: Get the asset balance of the Penpal Parachain Sovereign account in Assets Parachain
|
|
actions:
|
|
- queries:
|
|
assets_balance_pp_sovereign_before:
|
|
chain: *assets_parachain
|
|
pallet: assets
|
|
call: account
|
|
args: [
|
|
*asset_id,
|
|
*pp_sovereign_sibl
|
|
]
|
|
its:
|
|
- name: Penpal Parachain should be able to send XCM message paying its fee with sufficient asset in Assets Parachain
|
|
actions:
|
|
- extrinsics:
|
|
- chain: *penpal_parachain
|
|
signer: *pp_signer
|
|
sudo: true
|
|
pallet: polkadotXcm
|
|
call: send
|
|
args: [
|
|
*ap_dest_routed, # destination
|
|
{
|
|
v3: [ #message
|
|
{
|
|
WithdrawAsset: [
|
|
{
|
|
id: {
|
|
concrete: {
|
|
parents: 0,
|
|
interior: {
|
|
X2: [
|
|
{ PalletInstance: *assets_pallet_id },
|
|
{ GeneralIndex: *asset_id }
|
|
]
|
|
}
|
|
}
|
|
},
|
|
fun: { fungible: *amount_to_send }}
|
|
]
|
|
},
|
|
{
|
|
BuyExecution: {
|
|
fees: { id: *suff_asset, fun: { fungible: *amount_to_send }},
|
|
weightLimit: Unlimited
|
|
}
|
|
},
|
|
{
|
|
Transact: {
|
|
originKind: SovereignAccount,
|
|
requireWeightAtMost: *weight_at_most,
|
|
call: $force_create_asset2
|
|
}
|
|
},
|
|
{
|
|
RefundSurplus
|
|
},
|
|
{
|
|
DepositAsset: {
|
|
assets: { Wild: All },
|
|
beneficiary: {
|
|
parents: 0,
|
|
interior: {
|
|
X1: {
|
|
AccountId32: {
|
|
network: , # None
|
|
id: *pp_acc
|
|
}
|
|
}
|
|
}}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
events:
|
|
- name: sudo.Sudid
|
|
attributes:
|
|
- type: Result<Null, SpRuntimeDispatchError>
|
|
value: Ok
|
|
- name: polkadotXcm.Sent
|
|
- name: assets.Burned
|
|
chain: *assets_parachain
|
|
attributes:
|
|
- type: AccountId32
|
|
value: *pp_sovereign_sibl
|
|
- name: assets.Issued
|
|
chain: *assets_parachain
|
|
attributes:
|
|
- type: u32
|
|
value: *asset_id
|
|
- queries:
|
|
assets_balance_pp_sovereign_after:
|
|
chain: *assets_parachain
|
|
pallet: assets
|
|
call: account
|
|
args: [
|
|
*asset_id,
|
|
*pp_sovereign_sibl
|
|
]
|
|
forced_created_asset2:
|
|
chain: *assets_parachain
|
|
pallet: assets
|
|
call: asset
|
|
args: [ 3 ]
|
|
- asserts:
|
|
isSome:
|
|
args: [ $forced_created_asset2 ]
|
|
- name: Should reduce the assets balance of the Penpal Parachain's SovereignAccount in the Assets Parachain
|
|
actions:
|
|
- asserts:
|
|
assetsDecreased:
|
|
args: [
|
|
{
|
|
balances: {
|
|
before: $assets_balance_pp_sovereign_before,
|
|
after: $assets_balance_pp_sovereign_after,
|
|
},
|
|
}
|
|
]
|
|
|
|
- name: Penpal Parachain SHOULD NOT be able to send XCM message paying its fee with sufficient assets if not enough balance
|
|
actions:
|
|
- extrinsics:
|
|
- chain: *penpal_parachain
|
|
signer: *pp_signer
|
|
sudo: true
|
|
pallet: polkadotXcm
|
|
call: send
|
|
args: [
|
|
*ap_dest_routed, # destination
|
|
{
|
|
v3: [ #message
|
|
{
|
|
WithdrawAsset: [*ap_suff_asset_fungible_fail]
|
|
},
|
|
{
|
|
BuyExecution: {
|
|
fees: *ap_suff_asset_fungible_fail,
|
|
weightLimit: Unlimited
|
|
}
|
|
},
|
|
{
|
|
Transact: {
|
|
originKind: SovereignAccount,
|
|
requireWeightAtMost: *weight_at_most,
|
|
call: $force_create_asset2
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
events:
|
|
- name: xcmpQueue.Fail
|
|
chain: *assets_parachain
|
|
attributes:
|
|
- type: XcmV3TraitsError
|
|
value: FailedToTransactAsset
|