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

[Feature] XCM-Emulator #2447

Merged
merged 23 commits into from
May 19, 2023
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ members = [
"test/relay-validation-worker-provider",
"test/runtime",
"test/service",
"xcm/xcm-emulator",
"xcm/xcm-emulator/example",
"xcm/xcm-emulator/test-runtime",
]

[profile.release]
Expand Down
30 changes: 30 additions & 0 deletions xcm/xcm-emulator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[package]
name = "xcm-emulator"
description = "Test kit to emulate XCM program execution."
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"

[dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0" }
paste = "1.0.5"
quote = "1.0.23"

frame-support = { git = "https://github.com/paritytech/substrate", branch = "master" }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "master" }

cumulus-primitives-core = { path = "../../primitives/core"}
cumulus-pallet-xcmp-queue = { path = "../../pallets/xcmp-queue" }
cumulus-pallet-dmp-queue = { path = "../../pallets/dmp-queue" }
cumulus-pallet-parachain-system = { path = "../../pallets/parachain-system" }
parachain-info = { path = "../../parachains/pallets/parachain-info" }
cumulus-primitives-parachain-inherent = { path = "../../primitives/parachain-inherent" }
cumulus-test-relay-sproof-builder = { path = "../../test/relay-sproof-builder" }

xcm = { git = "https://github.com/paritytech/polkadot", branch = "master" }
xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "master" }
23 changes: 23 additions & 0 deletions xcm/xcm-emulator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# xcm-emulator

XCM-Emulator is a tool to emulate XCM program execution using
pre-configured runtimes, including those used to run on live
networks, such as Kusama, Polkadot, Statemine et cetera.
This allows for testing cross-chain message passing, verifying
outcomes, weights and side-effects. It is faster than spinning up
gilescope marked this conversation as resolved.
Show resolved Hide resolved
a zombienet and as all the chains are in one process debugging using Clion is easy.

## Limitations

As the channels are mocked, using xcm-emulator tests to test
channel setup would not be appropriate.
NachoPal marked this conversation as resolved.
Show resolved Hide resolved

## Alternatives

If you just wish to test execution of various XCM instructions
against the XCM VM then the `xcm-simulator` (in the polkadot
repo) is the perfect tool for this.

## How to use

Please refer to [example crate source-code](example/src/lib.rs) for usage examples.
37 changes: 37 additions & 0 deletions xcm/xcm-emulator/example/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[package]
name = "xcm-emulator-example"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"

[dependencies]
serde = { version = "1.0.137", optional = true }
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false }
proc-macro2 = "1.0.40"

frame-system = { git = "https://github.com/paritytech/substrate", branch = "master" }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master" }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master" }

cumulus-primitives-core = { path = "../../../primitives/core" }
cumulus-pallet-xcmp-queue = { path = "../../../pallets/xcmp-queue" }
parachain-info = { path = "../../../parachains/pallets/parachain-info" }

xcm = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "master" }
kusama-runtime = { git = "https://github.com/paritytech/polkadot", branch = "master" }
pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "master" }


xcm-emulator = { path = ".." }
test-runtime = { path = "../test-runtime" }

[features]
runtime-benchmarks = [
"kusama-runtime/runtime-benchmarks",
"test-runtime/runtime-benchmarks",
]
Loading