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

Commit

Permalink
[Feature] XCM-Emulator (#2447)
Browse files Browse the repository at this point in the history
* [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>
  • Loading branch information
5 people authored May 19, 2023
1 parent 95f2c0c commit b7082d1
Show file tree
Hide file tree
Showing 40 changed files with 3,848 additions and 1,859 deletions.
108 changes: 108 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,14 @@ members = [
"parachains/runtimes/contracts/contracts-rococo",
"parachains/runtimes/glutton/glutton-kusama",
"parachains/runtimes/testing/penpal",
"parachains/integration-tests/emulated/common",
"parachains/integration-tests/emulated/assets/statemint",
"test/client",
"test/relay-sproof-builder",
"test/relay-validation-worker-provider",
"test/runtime",
"test/service",
"xcm/xcm-emulator",
]

[profile.release]
Expand All @@ -67,4 +70,3 @@ opt-level = 3
inherits = "release"
lto = true
codegen-units = 1

Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ settings:
paraId: &pp_id 2000
variables:
common:
xcm_verison: &xcm_version '2'
require_weight_at_most: &weight_at_most 1000000000
xcm_version: &xcm_version '3'
require_weight_at_most: &weight_at_most {refTime: 1000000000, proofSize: 200000}
chains:
relay_chain:
signer: &rc_signer //Alice
assets_parachain_destination: &ap_dest { v1: { 0, interior: { x1: { parachain: *ap_id }}}}
assets_parachain_destination: &ap_dest { v3: { 0, interior: { x1: { parachain: *ap_id }}}}
penpal_parachain:
signer: &pp_signer //Alice
decodedCalls:
Expand All @@ -37,7 +37,7 @@ tests:
its:
- name: XCM supported versions between chains
actions:
- extrinsics: # Relay Chain sets supported version for Assset Parachain
- extrinsics: # Relay Chain sets supported version for Asset Parachain
- chain: *relay_chain
sudo: true
signer: *rc_signer
Expand All @@ -56,13 +56,13 @@ tests:
]
events:
- name: sudo.Sudid
attribute:
type: Result<Null, SpRuntimeDispatchError>
value: Ok
attributes:
- type: Result<Null, SpRuntimeDispatchError>
value: Ok
- name: xcmPallet.SupportedVersionChanged
attribute:
type: u32
value: *xcm_version
attributes:
- type: u32
value: *xcm_version
- extrinsics: # Relay Chain sets supported version for Penpal Parachain
- chain: *relay_chain
sudo: true
Expand All @@ -82,14 +82,14 @@ tests:
]
events:
- name: sudo.Sudid
attribute:
type: Result<Null, SpRuntimeDispatchError>
value: Ok
attributes:
- type: Result<Null, SpRuntimeDispatchError>
value: Ok
- name: xcmPallet.SupportedVersionChanged
attribute:
type: u32
value: *xcm_version
- extrinsics: # Assset Parachain sets supported version for Relay Chain through it
attributes:
- type: u32
value: *xcm_version
- extrinsics: # Asset Parachain sets supported version for Relay Chain through it
- chain: *relay_chain
signer: *rc_signer
sudo: true
Expand All @@ -98,10 +98,20 @@ tests:
args: [
*ap_dest, # destination
{
v2: [ #message
v3: [ #message
{
UnpaidExecution: {
weightLimit: {
limited: {
refTime: 2200000000,
proofSize: 200000
}
}
}
},
{
Transact: {
originType: Superuser,
originKind: Superuser,
requireWeightAtMost: *weight_at_most,
call: $ap_force_xcm_version
}
Expand All @@ -111,15 +121,15 @@ tests:
]
events:
- name: sudo.Sudid
attribute:
type: Result<Null, SpRuntimeDispatchError>
value: Ok
attributes:
- type: Result<Null, SpRuntimeDispatchError>
value: Ok
- name: xcmPallet.Sent
- name: polkadotXcm.SupportedVersionChanged
chain: *assets_parachain
attribute:
type: u32
value: *xcm_version
attributes:
- type: u32
value: *xcm_version
- extrinsics: # Penpal Parachain sets supported version for Relay Chain
- chain: *penpal_parachain
signer: *pp_signer
Expand All @@ -135,10 +145,10 @@ tests:
]
events:
- name: sudo.Sudid
attribute:
type: Result<Null, SpRuntimeDispatchError>
value: Ok
attributes:
- type: Result<Null, SpRuntimeDispatchError>
value: Ok
- name: polkadotXcm.SupportedVersionChanged
attribute:
type: u32
value: *xcm_version
attributes:
- type: u32
value: *xcm_version
Loading

0 comments on commit b7082d1

Please sign in to comment.