This repository has been archived by the owner on May 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* bootstrap pallet_asset_registry * rm change_foreign_asset fn * fix AsAssetMultiLocation implementation * avoid creating/destroying assets for registry * use loose coupling with Assets pallet * split unit tests * bootstrap xcm-simulator unit tests * rustfmt * rm change_foreign_asset extrinsic * rename Foreign Asset -> Reserve Asset * rm xcm-simulator from unit tests * rename ForeignFungiblesTransactor->ReservedFungiblesTransactor * add comments to asset-registry pallet errors * bootstrap integration-tests * asset-registry pallet README * zombienet with 2 collators per para * bootstrap benchmarks * upgrade zombienet config camel_case * update weights with GCP c2d-highcpu-8 * integration test: rm XcmV1MultiLocation attribute from ReserveAssetRegistered event * rm unused StatemineAssetIdInfoB * add WeightInfo to asset-registry mock * Run cargo fmt & clippy * More clippy smartness * lint pallets/asset-registry/README.md Co-authored-by: Adam Wierzbicki <[email protected]> * lint pallets/asset-registry/README.md Co-authored-by: Adam Wierzbicki <[email protected]> * lint pallets/asset-registry/README.md Co-authored-by: Adam Wierzbicki <[email protected]> * lint pallets/asset-registry/README.md Co-authored-by: Adam Wierzbicki <[email protected]> * lint pallets/asset-registry/src/benchmarking.rs Co-authored-by: Adam Wierzbicki <[email protected]> * lint pallets/asset-registry/src/tests.rs Co-authored-by: Adam Wierzbicki <[email protected]> * lint pallets/asset-registry/src/tests.rs Co-authored-by: Adam Wierzbicki <[email protected]> * lint primitives/xcm/Cargo.toml Co-authored-by: Adam Wierzbicki <[email protected]> * lint primitives/xcm/src/lib.rs Co-authored-by: Adam Wierzbicki <[email protected]> * lint primitives/xcm/src/lib.rs Co-authored-by: Adam Wierzbicki <[email protected]> * lint pallets/asset-registry/src/benchmarking.rs Co-authored-by: Adam Wierzbicki <[email protected]> * lint pallets/asset-registry/src/lib.rs Co-authored-by: Adam Wierzbicki <[email protected]> * lint pallets/asset-registry/src/lib.rs Co-authored-by: Adam Wierzbicki <[email protected]> * lint pallets/asset-registry/src/tests.rs Co-authored-by: Adam Wierzbicki <[email protected]> * fix ReserveAssetRegistered field * add comment explaining fn asset_exists * fix asset-registry pallet README * set LOCAL_ASSET_ID to 10 * change &trappist_asset_id on integration test Co-authored-by: Steve Degosserie <[email protected]> Co-authored-by: Adam Wierzbicki <[email protected]>
- Loading branch information
1 parent
8725dba
commit 9b092be
Showing
19 changed files
with
1,371 additions
and
217 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
members = [ | ||
"node", | ||
"runtime", | ||
"primitives/xcm", | ||
] | ||
exclude = [ | ||
"contracts" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[`parachains-integration-tests`](https://github.com/paritytech/parachains-integration-tests) is a tool designed to test interactions between Substrate blockchains. | ||
|
||
Trappist uses it to ensure the correctness of some of its features. | ||
|
||
# Setup | ||
|
||
Install `parachains-integration-tests` into your system: | ||
``` | ||
$ yarn global add @parity/parachains-integration-tests | ||
``` | ||
|
||
# Usage | ||
|
||
Please refer to the [project's `README.md`](https://github.com/paritytech/parachains-integration-tests#how-to-use) for an extensive description of how to write YAML test files and how to execute tests. | ||
|
||
For example, to use zombienet and perform a reserve transfer that tests the functionality of `asset-registry` pallet: | ||
``` | ||
$ parachains-integration-tests -m zombienet-test -c xcm-playground.toml -t integration-tests/asset-registry/0_reserve_transfer.yml | ||
``` |
249 changes: 249 additions & 0 deletions
249
integration-tests/asset-registry/0_reserve_transfer.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,249 @@ | ||
--- | ||
settings: | ||
chains: | ||
relay_chain: &relay_chain | ||
wsPort: 9900 | ||
reserve_parachain: &reserve_parachain | ||
wsPort: 9910 | ||
paraId: &rp_id 1000 | ||
trappist_parachain: &trappist_parachain | ||
wsPort: 9920 | ||
paraId: &tp_id 2000 | ||
variables: | ||
common: | ||
amount_to_mint: &amount_to_mint 100000000000000 | ||
amount_to_send: &amount_to_send 10000000000000 | ||
require_weight_at_most: &weight_at_most 1000000000 | ||
chains: | ||
relay_chain: | ||
signer: &rc_signer //Alice | ||
trappist_parachain_dest_routed: &tp_dest_routed { v1: { parents: 1, interior: { x1: { parachain: *tp_id } }}} | ||
reserve_parachain: | ||
signer: &rp_signer //Alice | ||
wallet: &rp_wallet HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F | ||
bob_signer: &rp_bob_signer //Bob | ||
bob_wallet: &rp_bob_wallet FoQJpPyadYccjavVdTWxpxU7rUEaYhfLCPwXgkfD6Zat9QP | ||
asset_id: &reserve_asset_id 1 | ||
asset_pallet_id: &reserve_asset_pallet_id 50 | ||
asset_min_balance: &reserve_assets_min_balance 1 | ||
asset_multi_location: &reserve_asset_multi_location { | ||
parents: 1, | ||
interior: { | ||
X3: [ | ||
{ | ||
Parachain: *rp_id | ||
}, | ||
{ | ||
PalletInstance: *reserve_asset_pallet_id | ||
}, | ||
{ | ||
GeneralIndex: *reserve_asset_id | ||
} | ||
] | ||
} | ||
} | ||
trappist_parachain: | ||
signer: &tp_signer //Alice | ||
wallet: &tp_wallet 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY | ||
bob_wallet: &tp_bob_wallet 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty | ||
asset_id: &trappist_asset_id 100 # different from reserve_asset_id, so we can test pallet-assets-registry | ||
asset_min_balance: &trappist_assets_min_balance 1 | ||
sovereign_account: &tp_sovereign_sibl FBeL7EAeUroLWXW1yfKboiqTqVfbRBcsUKd6QqVf4kGBySS | ||
bob_account: &tp_bob_acc '0x8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48' | ||
decodedCalls: | ||
force_create_asset: | ||
chain: *reserve_parachain | ||
pallet: assets | ||
call: forceCreate | ||
args: [ | ||
*reserve_asset_id, | ||
{ id: *rp_wallet }, # owner | ||
true, # isSufficient | ||
*reserve_assets_min_balance # minBalance | ||
] | ||
|
||
tests: | ||
- name: HRMP | ||
describes: | ||
- name: polkadotXcm.limitedReserveTransferAssets (Asset) | Reserve Parachain -> Trappist Parachain | ||
before: | ||
- name: DEPENDENCY | Create a sufficient Asset on Reserve Parachain | ||
actions: | ||
- extrinsics: | ||
- chain: *relay_chain | ||
signer: *rc_signer | ||
sudo: true | ||
pallet: parasSudoWrapper | ||
call: sudoQueueDownwardXcm | ||
args: [ | ||
*rp_id, # id | ||
{ | ||
v2: [ # message | ||
{ | ||
Transact: { | ||
originType: Superuser, | ||
requireWeightAtMost: *weight_at_most, | ||
call: $force_create_asset | ||
} | ||
} | ||
] | ||
} | ||
] | ||
events: | ||
- name: sudo.Sudid | ||
attributes: | ||
- type: Result<Null, SpRuntimeDispatchError> | ||
value: Ok | ||
- queries: | ||
forced_created_asset: | ||
chain: *reserve_parachain | ||
pallet: assets | ||
call: asset | ||
args: [ *reserve_asset_id ] | ||
- asserts: | ||
isSome: | ||
args: [ $forced_created_asset ] | ||
|
||
- name: DEPENDENCY | Mint assets on Reserve Parachain | ||
actions: | ||
- extrinsics: | ||
- chain: *reserve_parachain | ||
signer: *rp_signer | ||
pallet: assets | ||
call: mint | ||
args: [ | ||
*reserve_asset_id, | ||
*rp_bob_wallet, | ||
*amount_to_mint | ||
] | ||
events: | ||
- name: assets.Issued | ||
|
||
- name: DEPENDENCY | Create asset on Trappist Parachain | ||
actions: | ||
- extrinsics: | ||
- chain: *trappist_parachain | ||
signer: *tp_signer | ||
pallet: assets | ||
call: forceCreate | ||
sudo: true | ||
args: [ | ||
*trappist_asset_id, | ||
{ id: *tp_wallet }, # owner | ||
false, # isSufficient | ||
*trappist_assets_min_balance #minBalance | ||
] | ||
events: | ||
- name: sudo.Sudid | ||
attributes: | ||
- type: Result<Null, SpRuntimeDispatchError> | ||
value: Ok | ||
- name: assets.ForceCreated | ||
- queries: | ||
forced_created_asset: | ||
chain: *trappist_parachain | ||
pallet: assets | ||
call: asset | ||
args: [ *trappist_asset_id ] | ||
- asserts: | ||
isSome: | ||
args: [ $forced_created_asset ] | ||
|
||
its: | ||
- name: Trappist Parachain has AssetId registered to Reserve Asset | ||
actions: | ||
- extrinsics: | ||
- chain: *trappist_parachain | ||
signer: *tp_signer | ||
sudo: true | ||
pallet: assetRegistry | ||
call: registerReserveAsset | ||
args: [ | ||
*trappist_asset_id, | ||
*reserve_asset_multi_location | ||
] | ||
events: | ||
- name: sudo.Sudid | ||
attributes: | ||
- type: Result<Null, SpRuntimeDispatchError> | ||
value: Ok | ||
- name: assetRegistry.ReserveAssetRegistered | ||
attributes: | ||
- type: u32 | ||
value: *trappist_asset_id | ||
|
||
- name: Assets Parachain should be able to reserve transfer an asset to Trappist Parachain | ||
actions: | ||
- extrinsics: | ||
- chain: *reserve_parachain | ||
signer: *rp_bob_signer | ||
pallet: polkadotXcm | ||
call: limitedReserveTransferAssets | ||
args: [ | ||
*tp_dest_routed, # destination | ||
{ # beneficiary | ||
v1: { | ||
parents: 0, | ||
interior: { | ||
x1: { | ||
AccountId32: { | ||
network: null, | ||
id: *tp_bob_acc | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
{ # assets | ||
v1: [ | ||
{ | ||
id: { | ||
Concrete: { | ||
parents: 0, | ||
interior: { | ||
x2: [ | ||
{ | ||
PalletInstance: *reserve_asset_pallet_id | ||
}, | ||
{ | ||
GeneralIndex: *reserve_asset_id | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
fun: { | ||
Fungible: *amount_to_send | ||
} | ||
} | ||
] | ||
}, | ||
0, # feeAssetItem | ||
Unlimited # weightLimit | ||
] | ||
events: | ||
- name: polkadotXcm.Attempted | ||
attributes: | ||
- type: XcmV2TraitsOutcome | ||
xcmOutcome: Complete | ||
value: 1,000,000,000 | ||
- name: assets.Transferred | ||
attributes: | ||
- type: AccountId32 | ||
value: *tp_sovereign_sibl | ||
- type: u128 | ||
value: *amount_to_send | ||
- name: assets.Issued | ||
chain: *trappist_parachain | ||
- queries: | ||
bob_received_asset: | ||
chain: *trappist_parachain | ||
pallet: assets | ||
call: account | ||
args: [ | ||
*trappist_asset_id, | ||
*tp_bob_wallet | ||
] | ||
- asserts: | ||
isSome: | ||
args: [ $bob_received_asset ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.