diff --git a/Cargo.lock b/Cargo.lock index aad7702a..c26b96f0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -604,6 +604,219 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" +[[package]] +name = "asset-hub-kusama-runtime" +version = "0.9.420" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "assets-common", + "cumulus-pallet-aura-ext", + "cumulus-pallet-dmp-queue", + "cumulus-pallet-parachain-system", + "cumulus-pallet-session-benchmarking", + "cumulus-pallet-xcm", + "cumulus-pallet-xcmp-queue", + "cumulus-primitives-core", + "cumulus-primitives-utility", + "frame-benchmarking", + "frame-executive", + "frame-support", + "frame-system", + "frame-system-benchmarking", + "frame-system-rpc-runtime-api", + "frame-try-runtime", + "hex-literal", + "kusama-runtime-constants", + "log", + "pallet-asset-conversion", + "pallet-asset-conversion-tx-payment", + "pallet-assets", + "pallet-aura", + "pallet-authorship", + "pallet-balances", + "pallet-collator-selection", + "pallet-multisig", + "pallet-nft-fractionalization", + "pallet-nfts", + "pallet-nfts-runtime-api", + "pallet-proxy", + "pallet-session", + "pallet-state-trie-migration", + "pallet-timestamp", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", + "pallet-uniques", + "pallet-utility", + "pallet-xcm", + "pallet-xcm-benchmarks", + "parachain-info", + "parachains-common", + "parity-scale-codec", + "polkadot-core-primitives", + "polkadot-parachain-primitives", + "polkadot-runtime-common", + "primitive-types", + "scale-info", + "smallvec", + "sp-api", + "sp-block-builder", + "sp-consensus-aura", + "sp-core", + "sp-inherents", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-std", + "sp-storage", + "sp-transaction-pool", + "sp-version", + "sp-weights", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", + "substrate-wasm-builder", +] + +[[package]] +name = "asset-hub-polkadot-runtime" +version = "0.9.420" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "assets-common", + "cumulus-pallet-aura-ext", + "cumulus-pallet-dmp-queue", + "cumulus-pallet-parachain-system", + "cumulus-pallet-session-benchmarking", + "cumulus-pallet-xcm", + "cumulus-pallet-xcmp-queue", + "cumulus-primitives-core", + "cumulus-primitives-utility", + "frame-benchmarking", + "frame-executive", + "frame-support", + "frame-system", + "frame-system-benchmarking", + "frame-system-rpc-runtime-api", + "frame-try-runtime", + "hex-literal", + "log", + "pallet-asset-tx-payment", + "pallet-assets", + "pallet-aura", + "pallet-authorship", + "pallet-balances", + "pallet-collator-selection", + "pallet-multisig", + "pallet-nfts", + "pallet-nfts-runtime-api", + "pallet-proxy", + "pallet-session", + "pallet-timestamp", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", + "pallet-uniques", + "pallet-utility", + "pallet-xcm", + "pallet-xcm-benchmarks", + "parachain-info", + "parachains-common", + "parity-scale-codec", + "polkadot-core-primitives", + "polkadot-parachain-primitives", + "polkadot-runtime-common", + "polkadot-runtime-constants", + "scale-info", + "smallvec", + "sp-api", + "sp-block-builder", + "sp-consensus-aura", + "sp-core", + "sp-inherents", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-std", + "sp-storage", + "sp-transaction-pool", + "sp-version", + "sp-weights", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", + "substrate-wasm-builder", +] + +[[package]] +name = "asset-hub-westend-runtime" +version = "0.9.420" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "assets-common", + "cumulus-pallet-aura-ext", + "cumulus-pallet-dmp-queue", + "cumulus-pallet-parachain-system", + "cumulus-pallet-session-benchmarking", + "cumulus-pallet-xcm", + "cumulus-pallet-xcmp-queue", + "cumulus-primitives-core", + "cumulus-primitives-utility", + "frame-benchmarking", + "frame-executive", + "frame-support", + "frame-system", + "frame-system-benchmarking", + "frame-system-rpc-runtime-api", + "frame-try-runtime", + "hex-literal", + "log", + "pallet-asset-conversion", + "pallet-asset-conversion-tx-payment", + "pallet-assets", + "pallet-aura", + "pallet-authorship", + "pallet-balances", + "pallet-collator-selection", + "pallet-multisig", + "pallet-nft-fractionalization", + "pallet-nfts", + "pallet-nfts-runtime-api", + "pallet-proxy", + "pallet-session", + "pallet-timestamp", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", + "pallet-uniques", + "pallet-utility", + "pallet-xcm", + "pallet-xcm-benchmarks", + "parachain-info", + "parachains-common", + "parity-scale-codec", + "polkadot-core-primitives", + "polkadot-parachain-primitives", + "polkadot-runtime-common", + "primitive-types", + "scale-info", + "smallvec", + "sp-api", + "sp-block-builder", + "sp-consensus-aura", + "sp-core", + "sp-inherents", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-std", + "sp-storage", + "sp-transaction-pool", + "sp-version", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", + "substrate-wasm-builder", + "westend-runtime-constants", +] + [[package]] name = "assets-common" version = "0.1.0" @@ -1058,46 +1271,489 @@ dependencies = [ ] [[package]] -name = "block-padding" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" - -[[package]] -name = "blocking" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94c4ef1f913d78636d78d538eec1f18de81e481f44b1be0a81060090530846e1" +name = "block-padding" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" + +[[package]] +name = "blocking" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94c4ef1f913d78636d78d538eec1f18de81e481f44b1be0a81060090530846e1" +dependencies = [ + "async-channel", + "async-lock", + "async-task", + "fastrand 2.0.0", + "futures-io", + "futures-lite", + "piper", + "tracing", +] + +[[package]] +name = "bounded-collections" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb5b05133427c07c4776906f673ccf36c21b102c9829c641a5b56bd151d44fd6" +dependencies = [ + "log", + "parity-scale-codec", + "scale-info", + "serde", +] + +[[package]] +name = "bounded-vec" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68534a48cbf63a4b1323c433cf21238c9ec23711e0df13b08c33e5c2082663ce" +dependencies = [ + "thiserror", +] + +[[package]] +name = "bp-bridge-hub-cumulus" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "bp-messages", + "bp-polkadot-core", + "bp-runtime", + "frame-support", + "frame-system", + "polkadot-primitives", + "sp-api", + "sp-std", +] + +[[package]] +name = "bp-bridge-hub-rococo" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "bp-bridge-hub-cumulus", + "bp-messages", + "bp-runtime", + "frame-support", + "sp-api", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "bp-bridge-hub-wococo" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "bp-bridge-hub-cumulus", + "bp-messages", + "bp-runtime", + "frame-support", + "sp-api", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "bp-header-chain" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "bp-runtime", + "finality-grandpa", + "frame-support", + "parity-scale-codec", + "scale-info", + "serde", + "sp-consensus-grandpa", + "sp-core", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "bp-messages" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "bp-header-chain", + "bp-runtime", + "frame-support", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-std", +] + +[[package]] +name = "bp-parachains" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "bp-header-chain", + "bp-polkadot-core", + "bp-runtime", + "frame-support", + "impl-trait-for-tuples", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "bp-polkadot-core" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "bp-messages", + "bp-runtime", + "frame-support", + "frame-system", + "parity-scale-codec", + "parity-util-mem", + "scale-info", + "serde", + "sp-core", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "bp-relayers" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "bp-messages", + "bp-runtime", + "frame-support", + "parity-scale-codec", + "scale-info", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "bp-rococo" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "bp-header-chain", + "bp-polkadot-core", + "bp-runtime", + "frame-support", + "sp-api", + "sp-std", +] + +[[package]] +name = "bp-runtime" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "frame-support", + "frame-system", + "hash-db", + "impl-trait-for-tuples", + "log", + "num-traits", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-state-machine", + "sp-std", + "sp-trie", + "trie-db", +] + +[[package]] +name = "bp-test-utils" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "bp-header-chain", + "bp-parachains", + "bp-polkadot-core", + "bp-runtime", + "ed25519-dalek 1.0.1", + "finality-grandpa", + "parity-scale-codec", + "sp-application-crypto", + "sp-consensus-grandpa", + "sp-core", + "sp-runtime", + "sp-std", + "sp-trie", +] + +[[package]] +name = "bp-wococo" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "bp-header-chain", + "bp-polkadot-core", + "bp-rococo", + "bp-runtime", + "frame-support", + "sp-api", + "sp-std", +] + +[[package]] +name = "bp-xcm-bridge-hub-router" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-runtime", +] + +[[package]] +name = "bridge-hub-kusama-runtime" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "cumulus-pallet-aura-ext", + "cumulus-pallet-dmp-queue", + "cumulus-pallet-parachain-system", + "cumulus-pallet-session-benchmarking", + "cumulus-pallet-xcm", + "cumulus-pallet-xcmp-queue", + "cumulus-primitives-core", + "cumulus-primitives-utility", + "frame-benchmarking", + "frame-executive", + "frame-support", + "frame-system", + "frame-system-benchmarking", + "frame-system-rpc-runtime-api", + "frame-try-runtime", + "hex-literal", + "kusama-runtime-constants", + "log", + "pallet-aura", + "pallet-authorship", + "pallet-balances", + "pallet-collator-selection", + "pallet-multisig", + "pallet-session", + "pallet-timestamp", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", + "pallet-utility", + "pallet-xcm", + "pallet-xcm-benchmarks", + "parachain-info", + "parachains-common", + "parity-scale-codec", + "polkadot-core-primitives", + "polkadot-parachain-primitives", + "polkadot-runtime-common", + "scale-info", + "serde", + "smallvec", + "sp-api", + "sp-block-builder", + "sp-consensus-aura", + "sp-core", + "sp-inherents", + "sp-io", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-std", + "sp-storage", + "sp-transaction-pool", + "sp-version", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", + "substrate-wasm-builder", +] + +[[package]] +name = "bridge-hub-polkadot-runtime" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" dependencies = [ - "async-channel", - "async-lock", - "async-task", - "fastrand 2.0.0", - "futures-io", - "futures-lite", - "piper", - "tracing", + "cumulus-pallet-aura-ext", + "cumulus-pallet-dmp-queue", + "cumulus-pallet-parachain-system", + "cumulus-pallet-session-benchmarking", + "cumulus-pallet-xcm", + "cumulus-pallet-xcmp-queue", + "cumulus-primitives-core", + "cumulus-primitives-utility", + "frame-benchmarking", + "frame-executive", + "frame-support", + "frame-system", + "frame-system-benchmarking", + "frame-system-rpc-runtime-api", + "frame-try-runtime", + "hex-literal", + "log", + "pallet-aura", + "pallet-authorship", + "pallet-balances", + "pallet-collator-selection", + "pallet-multisig", + "pallet-session", + "pallet-timestamp", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", + "pallet-utility", + "pallet-xcm", + "pallet-xcm-benchmarks", + "parachain-info", + "parachains-common", + "parity-scale-codec", + "polkadot-core-primitives", + "polkadot-parachain-primitives", + "polkadot-runtime-common", + "polkadot-runtime-constants", + "scale-info", + "serde", + "smallvec", + "sp-api", + "sp-block-builder", + "sp-consensus-aura", + "sp-core", + "sp-inherents", + "sp-io", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-std", + "sp-storage", + "sp-transaction-pool", + "sp-version", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", + "substrate-wasm-builder", ] [[package]] -name = "bounded-collections" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb5b05133427c07c4776906f673ccf36c21b102c9829c641a5b56bd151d44fd6" +name = "bridge-hub-rococo-runtime" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" dependencies = [ + "bp-bridge-hub-rococo", + "bp-bridge-hub-wococo", + "bp-header-chain", + "bp-messages", + "bp-parachains", + "bp-polkadot-core", + "bp-relayers", + "bp-rococo", + "bp-runtime", + "bp-wococo", + "bridge-runtime-common", + "cumulus-pallet-aura-ext", + "cumulus-pallet-dmp-queue", + "cumulus-pallet-parachain-system", + "cumulus-pallet-session-benchmarking", + "cumulus-pallet-xcm", + "cumulus-pallet-xcmp-queue", + "cumulus-primitives-core", + "cumulus-primitives-utility", + "frame-benchmarking", + "frame-executive", + "frame-support", + "frame-system", + "frame-system-benchmarking", + "frame-system-rpc-runtime-api", + "frame-try-runtime", + "hex-literal", "log", + "pallet-aura", + "pallet-authorship", + "pallet-balances", + "pallet-bridge-grandpa", + "pallet-bridge-messages", + "pallet-bridge-parachains", + "pallet-bridge-relayers", + "pallet-collator-selection", + "pallet-multisig", + "pallet-session", + "pallet-timestamp", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", + "pallet-utility", + "pallet-xcm", + "pallet-xcm-benchmarks", + "parachain-info", + "parachains-common", "parity-scale-codec", + "polkadot-core-primitives", + "polkadot-parachain-primitives", + "polkadot-runtime-common", + "rococo-runtime-constants", "scale-info", "serde", + "smallvec", + "sp-api", + "sp-block-builder", + "sp-consensus-aura", + "sp-core", + "sp-inherents", + "sp-io", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-std", + "sp-storage", + "sp-transaction-pool", + "sp-version", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", + "substrate-wasm-builder", ] [[package]] -name = "bounded-vec" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68534a48cbf63a4b1323c433cf21238c9ec23711e0df13b08c33e5c2082663ce" +name = "bridge-runtime-common" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" dependencies = [ - "thiserror", + "bp-header-chain", + "bp-messages", + "bp-parachains", + "bp-polkadot-core", + "bp-relayers", + "bp-runtime", + "bp-xcm-bridge-hub-router", + "frame-support", + "frame-system", + "hash-db", + "log", + "pallet-bridge-grandpa", + "pallet-bridge-messages", + "pallet-bridge-parachains", + "pallet-bridge-relayers", + "pallet-transaction-payment", + "pallet-utility", + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", + "sp-trie", + "staging-xcm", + "staging-xcm-builder", ] [[package]] @@ -1438,6 +2094,76 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "collectives-polkadot-runtime" +version = "1.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "cumulus-pallet-aura-ext", + "cumulus-pallet-dmp-queue", + "cumulus-pallet-parachain-system", + "cumulus-pallet-session-benchmarking", + "cumulus-pallet-xcm", + "cumulus-pallet-xcmp-queue", + "cumulus-primitives-core", + "cumulus-primitives-utility", + "frame-benchmarking", + "frame-executive", + "frame-support", + "frame-system", + "frame-system-benchmarking", + "frame-system-rpc-runtime-api", + "frame-try-runtime", + "hex-literal", + "log", + "pallet-alliance", + "pallet-aura", + "pallet-authorship", + "pallet-balances", + "pallet-collator-selection", + "pallet-collective", + "pallet-core-fellowship", + "pallet-multisig", + "pallet-preimage", + "pallet-proxy", + "pallet-ranked-collective", + "pallet-referenda", + "pallet-salary", + "pallet-scheduler", + "pallet-session", + "pallet-timestamp", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", + "pallet-utility", + "pallet-xcm", + "parachain-info", + "parachains-common", + "parity-scale-codec", + "polkadot-core-primitives", + "polkadot-parachain-primitives", + "polkadot-runtime-common", + "polkadot-runtime-constants", + "scale-info", + "smallvec", + "sp-api", + "sp-arithmetic", + "sp-block-builder", + "sp-consensus-aura", + "sp-core", + "sp-inherents", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-std", + "sp-storage", + "sp-transaction-pool", + "sp-version", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", + "substrate-wasm-builder", +] + [[package]] name = "colorchoice" version = "1.0.0" @@ -2945,6 +3671,15 @@ dependencies = [ "spki 0.7.2", ] +[[package]] +name = "ed25519" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" +dependencies = [ + "signature 1.6.4", +] + [[package]] name = "ed25519" version = "2.2.2" @@ -2955,6 +3690,20 @@ dependencies = [ "signature 2.1.0", ] +[[package]] +name = "ed25519-dalek" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +dependencies = [ + "curve25519-dalek 3.2.0", + "ed25519 1.5.3", + "rand 0.7.3", + "serde", + "sha2 0.9.9", + "zeroize", +] + [[package]] name = "ed25519-dalek" version = "2.0.0" @@ -2962,7 +3711,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7277392b266383ef8396db7fdeb1e77b6c52fed775f5df15bb24f35b72156980" dependencies = [ "curve25519-dalek 4.0.0", - "ed25519", + "ed25519 2.2.2", "rand_core 0.6.4", "serde", "sha2 0.10.7", @@ -2990,7 +3739,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d9ce6874da5d4415896cd45ffbc4d1cfc0c4f9c079427bd870742c30f2f65a9" dependencies = [ "curve25519-dalek 4.0.0", - "ed25519", + "ed25519 2.2.2", "hashbrown 0.14.0", "hex", "rand_core 0.6.4", @@ -3153,6 +3902,33 @@ dependencies = [ "libc", ] +[[package]] +name = "ethbloom" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" +dependencies = [ + "crunchy", + "fixed-hash", + "impl-rlp", + "impl-serde", + "tiny-keccak", +] + +[[package]] +name = "ethereum-types" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" +dependencies = [ + "ethbloom", + "fixed-hash", + "impl-rlp", + "impl-serde", + "primitive-types", + "uint", +] + [[package]] name = "event-listener" version = "2.5.3" @@ -4345,6 +5121,26 @@ dependencies = [ "parity-scale-codec", ] +[[package]] +name = "impl-num-traits" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "951641f13f873bff03d4bf19ae8bec531935ac0ac2cc775f84d7edfdcfed3f17" +dependencies = [ + "integer-sqrt", + "num-traits", + "uint", +] + +[[package]] +name = "impl-rlp" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" +dependencies = [ + "rlp", +] + [[package]] name = "impl-serde" version = "0.4.0" @@ -4457,6 +5253,88 @@ dependencies = [ "num-traits", ] +[[package]] +name = "integration-tests" +version = "0.1.0" +dependencies = [ + "asset-hub-kusama-runtime", + "asset-hub-polkadot-runtime", + "frame-support", + "frame-system", + "integration-tests-common", + "pallet-asset-registry", + "pallet-assets", + "pallet-xcm", + "parachains-common", + "parity-scale-codec", + "polkadot-parachain-primitives", + "polkadot-runtime-common", + "rococo-runtime", + "sp-core", + "sp-runtime", + "staging-xcm", + "staging-xcm-executor", + "stout-runtime", + "thousands", + "tracing", + "tracing-subscriber 0.3.17", + "trappist-runtime", + "xcm-emulator", + "xcm-primitives", +] + +[[package]] +name = "integration-tests-common" +version = "1.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "asset-hub-kusama-runtime", + "asset-hub-polkadot-runtime", + "asset-hub-westend-runtime", + "bp-messages", + "bridge-hub-kusama-runtime", + "bridge-hub-polkadot-runtime", + "bridge-hub-rococo-runtime", + "bridge-runtime-common", + "collectives-polkadot-runtime", + "cumulus-pallet-dmp-queue", + "cumulus-pallet-parachain-system", + "cumulus-pallet-xcmp-queue", + "cumulus-primitives-core", + "frame-support", + "kusama-runtime-constants", + "pallet-assets", + "pallet-bridge-messages", + "pallet-im-online", + "pallet-message-queue", + "pallet-staking", + "pallet-xcm", + "parachains-common", + "parity-scale-codec", + "paste", + "penpal-runtime", + "polkadot-core-primitives", + "polkadot-parachain-primitives", + "polkadot-primitives", + "polkadot-runtime", + "polkadot-runtime-constants", + "polkadot-runtime-parachains", + "polkadot-service", + "rococo-runtime", + "rococo-runtime-constants", + "sc-consensus-grandpa", + "sp-authority-discovery", + "sp-consensus-babe", + "sp-consensus-beefy", + "sp-core", + "sp-runtime", + "staging-kusama-runtime", + "staging-xcm", + "westend-runtime", + "westend-runtime-constants", + "xcm-emulator", +] + [[package]] name = "interceptor" version = "0.8.2" @@ -4960,7 +5838,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "276bb57e7af15d8f100d3c11cbdd32c6752b7eef4ba7a18ecf464972c07abcce" dependencies = [ "bs58 0.4.0", - "ed25519-dalek", + "ed25519-dalek 2.0.0", "log", "multiaddr", "multihash", @@ -5397,6 +6275,15 @@ version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +[[package]] +name = "lru" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909" +dependencies = [ + "hashbrown 0.12.3", +] + [[package]] name = "lru" version = "0.10.1" @@ -5519,6 +6406,15 @@ dependencies = [ "regex-automata 0.1.10", ] +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + [[package]] name = "matches" version = "0.1.10" @@ -5985,6 +6881,16 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + [[package]] name = "num-bigint" version = "0.4.3" @@ -6166,6 +7072,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + [[package]] name = "p256" version = "0.11.1" @@ -6188,6 +7100,27 @@ dependencies = [ "sha2 0.10.7", ] +[[package]] +name = "pallet-alliance" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "array-bytes", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-collective", + "pallet-identity", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-core-hashing", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-asset-conversion" version = "4.0.0-dev" @@ -6206,6 +7139,21 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-asset-conversion-tx-payment" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "frame-support", + "frame-system", + "pallet-asset-conversion", + "pallet-transaction-payment", + "parity-scale-codec", + "scale-info", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-asset-registry" version = "0.0.1" @@ -6347,97 +7295,178 @@ name = "pallet-bags-list" version = "4.0.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" dependencies = [ - "aquamarine", - "docify", + "aquamarine", + "docify", + "frame-benchmarking", + "frame-election-provider-support", + "frame-support", + "frame-system", + "log", + "pallet-balances", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", + "sp-tracing", +] + +[[package]] +name = "pallet-balances" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-beefy" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "frame-support", + "frame-system", + "log", + "pallet-authorship", + "pallet-session", + "parity-scale-codec", + "scale-info", + "serde", + "sp-consensus-beefy", + "sp-runtime", + "sp-session", + "sp-staking", + "sp-std", +] + +[[package]] +name = "pallet-beefy-mmr" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "array-bytes", + "binary-merkle-tree", + "frame-support", + "frame-system", + "log", + "pallet-beefy", + "pallet-mmr", + "pallet-session", + "parity-scale-codec", + "scale-info", + "serde", + "sp-api", + "sp-consensus-beefy", + "sp-core", + "sp-io", + "sp-runtime", + "sp-state-machine", + "sp-std", +] + +[[package]] +name = "pallet-bounties" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ "frame-benchmarking", - "frame-election-provider-support", "frame-support", "frame-system", "log", - "pallet-balances", + "pallet-treasury", "parity-scale-codec", "scale-info", "sp-core", "sp-io", "sp-runtime", "sp-std", - "sp-tracing", ] [[package]] -name = "pallet-balances" -version = "4.0.0-dev" +name = "pallet-bridge-grandpa" +version = "0.1.0" source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" dependencies = [ + "bp-header-chain", + "bp-runtime", + "bp-test-utils", + "finality-grandpa", "frame-benchmarking", "frame-support", "frame-system", "log", "parity-scale-codec", "scale-info", + "sp-consensus-grandpa", "sp-runtime", "sp-std", + "sp-trie", ] [[package]] -name = "pallet-beefy" -version = "4.0.0-dev" +name = "pallet-bridge-messages" +version = "0.1.0" source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" dependencies = [ + "bp-messages", + "bp-runtime", + "frame-benchmarking", "frame-support", "frame-system", "log", - "pallet-authorship", - "pallet-session", + "num-traits", "parity-scale-codec", "scale-info", - "serde", - "sp-consensus-beefy", + "sp-core", "sp-runtime", - "sp-session", - "sp-staking", "sp-std", ] [[package]] -name = "pallet-beefy-mmr" -version = "4.0.0-dev" +name = "pallet-bridge-parachains" +version = "0.1.0" source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" dependencies = [ - "array-bytes", - "binary-merkle-tree", + "bp-header-chain", + "bp-parachains", + "bp-polkadot-core", + "bp-runtime", + "frame-benchmarking", "frame-support", "frame-system", "log", - "pallet-beefy", - "pallet-mmr", - "pallet-session", + "pallet-bridge-grandpa", "parity-scale-codec", "scale-info", - "serde", - "sp-api", - "sp-consensus-beefy", - "sp-core", - "sp-io", "sp-runtime", - "sp-state-machine", "sp-std", + "sp-trie", ] [[package]] -name = "pallet-bounties" -version = "4.0.0-dev" +name = "pallet-bridge-relayers" +version = "0.1.0" source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" dependencies = [ + "bp-messages", + "bp-relayers", + "bp-runtime", "frame-benchmarking", "frame-support", "frame-system", "log", - "pallet-treasury", + "pallet-bridge-messages", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", + "sp-arithmetic", "sp-runtime", "sp-std", ] @@ -6567,6 +7596,24 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-core-fellowship" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-democracy" version = "4.0.0-dev" @@ -6892,6 +7939,51 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-nft-fractionalization" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-assets", + "pallet-nfts", + "parity-scale-codec", + "scale-info", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-nfts" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "enumflags2", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-nfts-runtime-api" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "pallet-nfts", + "parity-scale-codec", + "sp-api", +] + [[package]] name = "pallet-nis" version = "4.0.0-dev" @@ -7098,6 +8190,24 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-salary" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-scheduler" version = "4.0.0-dev" @@ -7583,6 +8693,35 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa9777aa91b8ad9dd5aaa04a9b6bcb02c7f1deb952fca5a66034d5e63afc5c6f" +[[package]] +name = "parity-util-mem" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d32c34f4f5ca7f9196001c0aba5a1f9a5a12382c8944b8b0f90233282d1e8f8" +dependencies = [ + "cfg-if", + "ethereum-types", + "hashbrown 0.12.3", + "impl-trait-for-tuples", + "lru 0.8.1", + "parity-util-mem-derive", + "parking_lot 0.12.1", + "primitive-types", + "smallvec", + "winapi", +] + +[[package]] +name = "parity-util-mem-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f557c32c6d268a07c921471619c0295f5efad3a0e76d4f97a05c091a51d110b2" +dependencies = [ + "proc-macro2", + "syn 1.0.109", + "synstructure", +] + [[package]] name = "parity-wasm" version = "0.45.0" @@ -7706,6 +8845,66 @@ dependencies = [ "base64ct", ] +[[package]] +name = "penpal-runtime" +version = "0.9.27" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "cumulus-pallet-aura-ext", + "cumulus-pallet-dmp-queue", + "cumulus-pallet-parachain-system", + "cumulus-pallet-session-benchmarking", + "cumulus-pallet-xcm", + "cumulus-pallet-xcmp-queue", + "cumulus-primitives-core", + "cumulus-primitives-utility", + "frame-benchmarking", + "frame-executive", + "frame-support", + "frame-system", + "frame-system-benchmarking", + "frame-system-rpc-runtime-api", + "frame-try-runtime", + "hex-literal", + "log", + "pallet-asset-tx-payment", + "pallet-assets", + "pallet-aura", + "pallet-authorship", + "pallet-balances", + "pallet-collator-selection", + "pallet-session", + "pallet-sudo", + "pallet-timestamp", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", + "pallet-xcm", + "parachain-info", + "parachains-common", + "parity-scale-codec", + "polkadot-parachain-primitives", + "polkadot-primitives", + "polkadot-runtime-common", + "scale-info", + "smallvec", + "sp-api", + "sp-block-builder", + "sp-consensus-aura", + "sp-core", + "sp-inherents", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-std", + "sp-storage", + "sp-transaction-pool", + "sp-version", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", + "substrate-wasm-builder", +] + [[package]] name = "percent-encoding" version = "2.3.0" @@ -9180,6 +10379,8 @@ checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66" dependencies = [ "fixed-hash", "impl-codec", + "impl-num-traits", + "impl-rlp", "impl-serde", "scale-info", "uint", @@ -9745,6 +10946,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "rlp" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" +dependencies = [ + "bytes", + "rustc-hex", +] + [[package]] name = "rocksdb" version = "0.21.0" @@ -11151,7 +12362,7 @@ dependencies = [ "thiserror", "tracing", "tracing-log", - "tracing-subscriber", + "tracing-subscriber 0.2.25", ] [[package]] @@ -12184,7 +13395,7 @@ version = "23.0.0" source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" dependencies = [ "bytes", - "ed25519-dalek", + "ed25519-dalek 2.0.0", "libsecp256k1", "log", "parity-scale-codec", @@ -12416,7 +13627,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polk dependencies = [ "aes-gcm 0.10.2", "curve25519-dalek 4.0.0", - "ed25519-dalek", + "ed25519-dalek 2.0.0", "hkdf", "parity-scale-codec", "rand 0.8.5", @@ -12473,7 +13684,7 @@ dependencies = [ "sp-std", "tracing", "tracing-core", - "tracing-subscriber", + "tracing-subscriber 0.2.25", ] [[package]] @@ -13656,7 +14867,7 @@ dependencies = [ "ansi_term", "chrono", "lazy_static", - "matchers", + "matchers 0.0.1", "parking_lot 0.11.2", "regex", "serde", @@ -13670,6 +14881,24 @@ dependencies = [ "tracing-serde", ] +[[package]] +name = "tracing-subscriber" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" +dependencies = [ + "matchers 0.1.0", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + [[package]] name = "trappist" version = "1.0.0" @@ -15272,6 +16501,38 @@ dependencies = [ "time", ] +[[package]] +name = "xcm-emulator" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?branch=release-polkadot-v1.1.0#f60318f68687e601c47de5ad5ca88e2c3f8139a7" +dependencies = [ + "cumulus-pallet-parachain-system", + "cumulus-primitives-core", + "cumulus-primitives-parachain-inherent", + "cumulus-test-relay-sproof-builder", + "frame-support", + "frame-system", + "impl-trait-for-tuples", + "lazy_static", + "log", + "pallet-balances", + "pallet-message-queue", + "parachains-common", + "parity-scale-codec", + "paste", + "polkadot-parachain-primitives", + "polkadot-primitives", + "polkadot-runtime-parachains", + "sp-arithmetic", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", + "sp-tracing", + "staging-xcm", + "staging-xcm-executor", +] + [[package]] name = "xcm-primitives" version = "0.0.1" diff --git a/Cargo.toml b/Cargo.toml index be82302b..be69e2ef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,10 +4,9 @@ members = [ "runtime/stout", "runtime/trappist", "primitives/xcm", + "integration-tests/emulated", ] -exclude = [ - "xcm-simulator" -] +exclude = ["xcm-simulator"] resolver = "2" [profile.release] @@ -34,13 +33,17 @@ license = "Apache License v2" # common async-trait = "0.1" clap = { version = "4.3" } -parity-scale-codec = { version = "3.6", default-features = false, features = ["derive"] } +parity-scale-codec = { version = "3.6", default-features = false, features = [ + "derive", +] } futures = { version = "0.3" } hex-literal = { version = "0.4" } log = { version = "0.4" } serde = { version = "1.0.186" } serde_json = "1.0.104" -scale-info = { version = "2.9", default-features = false, features = ["derive"] } +scale-info = { version = "2.9", default-features = false, features = [ + "derive", +] } smallvec = "1.11" # Local dependencies @@ -159,7 +162,9 @@ cumulus-relay-chain-interface = { git = "https://github.com/paritytech/polkadot- assets-common = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } cumulus-pallet-aura-ext = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } -cumulus-pallet-parachain-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } +cumulus-pallet-parachain-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false, features = [ + "parameterized-consensus-hook", +] } cumulus-pallet-xcm = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } cumulus-ping = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } @@ -171,8 +176,17 @@ parachains-common = { git = "https://github.com/paritytech/polkadot-sdk", branch parachain-info = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } cumulus-pallet-session-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false, version = "3.0.0" } +# Cumulus Xcm Emulator +xcm-emulator = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } +integration-tests-common = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } +asset-hub-kusama-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } +asset-hub-polkadot-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } +rococo-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false } + # Polkadot -polkadot-cli = { git = "https://github.com/paritytech/polkadot-sdk", features = ["rococo-native"], branch = "release-polkadot-v1.1.0" } +polkadot-cli = { git = "https://github.com/paritytech/polkadot-sdk", features = [ + "rococo-native", +], branch = "release-polkadot-v1.1.0" } polkadot-primitives = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" } polkadot-service = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" } polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, branch = "release-polkadot-v1.1.0" } diff --git a/integration-tests/emulated/Cargo.toml b/integration-tests/emulated/Cargo.toml new file mode 100644 index 00000000..8053331b --- /dev/null +++ b/integration-tests/emulated/Cargo.toml @@ -0,0 +1,59 @@ +[package] +name = "integration-tests" +version = "0.1.0" +edition = "2021" + +[dependencies] +parity-scale-codec = { workspace = true } +thousands = "0.2.0" + +# Tracing +tracing = { version = "0.1.37" } +tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } + +# Substrate +frame-system = { workspace = true } +frame-support = { workspace = true } +sp-core = { workspace = true } +sp-runtime = { workspace = true } +pallet-assets = { workspace = true } + +# Cumulus +integration-tests-common = { workspace = true } +xcm-emulator = { workspace = true } + +# Polkadot +polkadot-parachain-primitives = { workspace = true } +xcm = { workspace = true } +xcm-executor = { workspace = true } +pallet-xcm = { workspace = true } +xcm-primitives = { workspace = true } + +# Runtimes +polkadot-runtime-common = { workspace = true } +parachains-common = { workspace = true } +rococo-runtime = { workspace = true } +asset-hub-kusama-runtime = { workspace = true } +asset-hub-polkadot-runtime = { workspace = true } +trappist-runtime = { path = "../../runtime/trappist" } +stout-runtime = { path = "../../runtime/stout" } + +# Local +pallet-asset-registry = { workspace = true } + +[features] +runtime-benchmarks = [ + "polkadot-runtime-common/runtime-benchmarks", + "rococo-runtime/runtime-benchmarks", + "asset-hub-kusama-runtime/runtime-benchmarks", + "asset-hub-polkadot-runtime/runtime-benchmarks", + "trappist-runtime/runtime-benchmarks", + "stout-runtime/runtime-benchmarks", + "polkadot-parachain-primitives/runtime-benchmarks", + "pallet-xcm/runtime-benchmarks", + "integration-tests-common/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "pallet-assets/runtime-benchmarks", +] diff --git a/integration-tests/emulated/src/lib.rs b/integration-tests/emulated/src/lib.rs new file mode 100644 index 00000000..cb82dd85 --- /dev/null +++ b/integration-tests/emulated/src/lib.rs @@ -0,0 +1,216 @@ +use parachains_common::Balance; +use sp_core::{sr25519, storage::Storage}; +use sp_runtime::BuildStorage; +use xcm_emulator::{ + decl_test_networks, decl_test_parachains, decl_test_relay_chains, + helpers::get_account_id_from_seed, DefaultMessageProcessor, Hooks, ParaId, +}; + +#[cfg(test)] +mod tests; + +decl_test_relay_chains! { + // Rococo + #[api_version(5)] + pub struct Rococo { + genesis = integration_tests_common::constants::rococo::genesis(), + on_init = (), + runtime = rococo_runtime, + core = { + MessageProcessor: DefaultMessageProcessor, + SovereignAccountOf: rococo_runtime::xcm_config::LocationConverter, + }, + pallets = { + XcmPallet: rococo_runtime::XcmPallet, + Sudo: rococo_runtime::Sudo, + Balances: rococo_runtime::Balances, + } + } +} + +// Declare Parachains +decl_test_parachains! { + // Parachain A + pub struct Trappist { + genesis = para_a_genesis(), + on_init = {trappist_runtime::AuraExt::on_initialize(1);} + , + runtime = trappist_runtime, + core = { + XcmpMessageHandler: trappist_runtime::XcmpQueue, + DmpMessageHandler: trappist_runtime::DmpQueue, + LocationToAccountId: trappist_runtime::xcm_config::LocationToAccountId, + ParachainInfo: trappist_runtime::ParachainInfo, + }, + pallets= { + XcmPallet: trappist_runtime::PolkadotXcm, + Assets: trappist_runtime::Assets, + Sudo: trappist_runtime::Sudo, + AssetRegistry: trappist_runtime::AssetRegistry, + Balances: trappist_runtime::Balances, + } + }, + // Parachain B + pub struct Stout { + genesis = para_b_genesis(), + on_init = {stout_runtime::AuraExt::on_initialize(1);}, + runtime = stout_runtime, + core = { + XcmpMessageHandler: stout_runtime::XcmpQueue, + DmpMessageHandler: stout_runtime::DmpQueue, + LocationToAccountId: stout_runtime::xcm_config::LocationToAccountId, + ParachainInfo: stout_runtime::ParachainInfo, + }, + pallets= { + XcmPallet: stout_runtime::PolkadotXcm, + Assets: stout_runtime::Assets, + Sudo: stout_runtime::Sudo, + AssetRegistry: stout_runtime::AssetRegistry, + Balances: stout_runtime::Balances, + } + }, + + // AssetHub + pub struct AssetHubRococo { + genesis = integration_tests_common::constants::asset_hub_kusama::genesis(), + on_init = { + asset_hub_polkadot_runtime::AuraExt::on_initialize(1); + }, + runtime = asset_hub_kusama_runtime, + core = { + XcmpMessageHandler: asset_hub_kusama_runtime::XcmpQueue, + DmpMessageHandler: asset_hub_kusama_runtime::DmpQueue, + LocationToAccountId: asset_hub_kusama_runtime::xcm_config::LocationToAccountId, + ParachainInfo: asset_hub_kusama_runtime::ParachainInfo, + }, + pallets = { + PolkadotXcm: asset_hub_kusama_runtime::PolkadotXcm, + Assets: asset_hub_kusama_runtime::Assets, + Balances: asset_hub_kusama_runtime::Balances, + } + }, +} + +//Define network(s) +decl_test_networks! { + // Rococo + pub struct RococoMockNet { + relay_chain = Rococo, + parachains = vec![Trappist, Stout, AssetHubRococo,], + bridge = () + } +} + +fn para_a_genesis() -> Storage { + const PARA_ID: ParaId = ParaId::new(1836); + const ED: Balance = trappist_runtime::constants::currency::EXISTENTIAL_DEPOSIT; + + let genesis_config = trappist_runtime::RuntimeGenesisConfig { + system: trappist_runtime::SystemConfig { + code: trappist_runtime::WASM_BINARY + .expect("WASM binary was not build, please build it!") + .to_vec(), + ..Default::default() + }, + balances: trappist_runtime::BalancesConfig { + balances: integration_tests_common::constants::accounts::init_balances() + .iter() + .cloned() + .map(|k| (k, ED * 1_000_000_000)) + .collect(), + }, + parachain_info: trappist_runtime::ParachainInfoConfig { + parachain_id: PARA_ID, + ..Default::default() + }, + collator_selection: trappist_runtime::CollatorSelectionConfig { + invulnerables: + integration_tests_common::constants::collators::invulnerables_asset_hub_polkadot() + .iter() + .cloned() + .map(|(acc, _)| acc) + .collect(), + candidacy_bond: ED * 16, + ..Default::default() + }, + session: trappist_runtime::SessionConfig { + keys: integration_tests_common::constants::collators::invulnerables() + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + trappist_runtime::SessionKeys { aura }, // session keys + ) + }) + .collect(), + }, + sudo: trappist_runtime::SudoConfig { + key: Some(get_account_id_from_seed::("Alice")), + }, + polkadot_xcm: trappist_runtime::PolkadotXcmConfig { + safe_xcm_version: Some(xcm::prelude::XCM_VERSION), + ..Default::default() + }, + ..Default::default() + }; + + genesis_config.build_storage().unwrap() +} + +fn para_b_genesis() -> Storage { + const PARA_ID: ParaId = ParaId::new(3000); + const ED: Balance = stout_runtime::constants::currency::EXISTENTIAL_DEPOSIT; + + let genesis_config = stout_runtime::RuntimeGenesisConfig { + system: stout_runtime::SystemConfig { + code: stout_runtime::WASM_BINARY + .expect("WASM binary was not build, please build it!") + .to_vec(), + ..Default::default() + }, + balances: stout_runtime::BalancesConfig { + balances: integration_tests_common::constants::accounts::init_balances() + .iter() + .cloned() + .map(|k| (k, ED * 1_000_000_000)) + .collect(), + }, + parachain_info: stout_runtime::ParachainInfoConfig { + parachain_id: PARA_ID, + ..Default::default() + }, + collator_selection: stout_runtime::CollatorSelectionConfig { + invulnerables: + integration_tests_common::constants::collators::invulnerables_asset_hub_polkadot() + .iter() + .cloned() + .map(|(acc, _)| acc) + .collect(), + candidacy_bond: ED * 16, + ..Default::default() + }, + session: stout_runtime::SessionConfig { + keys: integration_tests_common::constants::collators::invulnerables() + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + stout_runtime::SessionKeys { aura }, // session keys + ) + }) + .collect(), + }, + sudo: stout_runtime::SudoConfig { + key: Some(get_account_id_from_seed::("Alice")), + }, + polkadot_xcm: stout_runtime::PolkadotXcmConfig { + safe_xcm_version: Some(xcm::prelude::XCM_VERSION), + ..Default::default() + }, + ..Default::default() + }; + + genesis_config.build_storage().unwrap() +} diff --git a/integration-tests/emulated/src/tests/misc.rs b/integration-tests/emulated/src/tests/misc.rs new file mode 100644 index 00000000..bf804656 --- /dev/null +++ b/integration-tests/emulated/src/tests/misc.rs @@ -0,0 +1,30 @@ +use crate::tests::*; + +#[test] +fn event_collection_works() { + //init_tracing(); + + const AMOUNT: u128 = 1_000_000_000 * 10; + const MAX_WEIGHT: u128 = 1_000_000_000; + let alice_account: sp_runtime::AccountId32 = get_account_id_from_seed::(ALICE); + + Trappist::execute_with(|| { + assert_ok!(::XcmPallet::execute( + ::RuntimeOrigin::signed(alice_account.clone()), + Box::new(VersionedXcm::from(Xcm(vec![WithdrawAsset((Here, AMOUNT).into())]))), + (MAX_WEIGHT as u64).into() + )); + output_events::<::Runtime>(); + assert_eq!(3, ::System::events().len()); + }); + + Stout::execute_with(|| { + assert_ok!(::XcmPallet::execute( + ::RuntimeOrigin::signed(alice_account), + Box::new(VersionedXcm::from(Xcm(vec![WithdrawAsset((Here, AMOUNT).into())]))), + (MAX_WEIGHT as u64).into() + )); + output_events::<::Runtime>(); + assert_eq!(1, ::System::events().len()); + }); +} diff --git a/integration-tests/emulated/src/tests/mod.rs b/integration-tests/emulated/src/tests/mod.rs new file mode 100644 index 00000000..45f0f6d7 --- /dev/null +++ b/integration-tests/emulated/src/tests/mod.rs @@ -0,0 +1,68 @@ +use super::*; +use frame_support::{assert_ok, instances::Instance1, traits::PalletInfoAccess}; +use integration_tests_common::constants::{accounts::ALICE, XCM_V3}; +use parity_scale_codec::Encode; +use sp_runtime::traits::{BlakeTwo256, Hash}; +use thousands::Separable; +use xcm::{ + opaque::lts::{ + prelude::{ + BuyExecution, DepositAsset, DepositReserveAsset, InitiateReserveWithdraw, Transact, + UnpaidExecution, WithdrawAsset, Xcm, + }, + AssetId::Concrete, + Fungibility::Fungible, + Junction::{AccountId32, GeneralIndex, PalletInstance, Parachain}, + Junctions::{Here, X1, X2, X3}, + MultiAsset, + MultiAssetFilter::Wild, + OriginKind, + WeightLimit::Unlimited, + WildMultiAsset::AllCounted, + }, + VersionedMultiAssets, VersionedMultiLocation, VersionedXcm, +}; +use xcm_emulator::{ + assert_expected_events, bx, log, Chain, MultiAssets, MultiLocation, Network, + Parachain as EmulatorParachain, Parent, RelayChain, TestExt, Weight, WeightLimit, +}; +use xcm_executor::Assets; +use xcm_primitives::AssetMultiLocationGetter; + +mod misc; +mod reserve_asset_transfer; +mod set_xcm_version; +mod xcm_asset_trap; + +#[allow(non_upper_case_globals)] +const xUSD: u32 = 1984; +#[allow(non_upper_case_globals)] +const txUSD: u32 = 10; + +const ASSET_HUB_ID: u32 = 1_000; +const TRAPPIST_ID: u32 = 1_836; +const STOUT_ID: u32 = 3_000; + +static INIT: std::sync::Once = std::sync::Once::new(); +fn init_tracing() { + INIT.call_once(|| { + // Add test tracing (from sp_tracing::init_for_tests()) but filtering for xcm logs only + let _ = tracing_subscriber::fmt() + .with_max_level(tracing::Level::TRACE) + // Comment out this line to see all traces + .with_env_filter( + vec!["xcm=trace", "events=trace", "hrmp=trace", "dmp=trace", "ump=trace"].join(","), + ) + .with_test_writer() + .init(); + }); +} + +fn output_events() { + const TARGET: &str = "system::events"; + let events = frame_system::Pallet::::events(); + log::trace!(target: TARGET, "{} events", events.len()); + for event in events { + log::trace!(target: TARGET, "{:?}", event) + } +} diff --git a/integration-tests/emulated/src/tests/reserve_asset_transfer.rs b/integration-tests/emulated/src/tests/reserve_asset_transfer.rs new file mode 100644 index 00000000..a9dcb13c --- /dev/null +++ b/integration-tests/emulated/src/tests/reserve_asset_transfer.rs @@ -0,0 +1,480 @@ +use crate::tests::*; + +// Initiates a reserve-transfer of some asset on the asset reserve parachain to the trappist +// parachain (HRMP) +#[test] +fn reserve_transfer_asset_from_asset_reserve_parachain_to_trappist_parachain() { + init_tracing(); + + //Reboot test network to init + RococoMockNet::reset(); + + // Get account from const seed. Funded on genesis config. + let alice_account: sp_runtime::AccountId32 = get_account_id_from_seed::(ALICE); + + const ASSET_MIN_BALANCE: Balance = 1_000_000_000; + const MINT_AMOUNT: u128 = 1_000_000_000_000_000_000; + + // Create and mint fungible asset on Reserve Parachain + + AssetHubRococo::execute_with(|| { + // Create fungible asset on Asset Hub + assert_ok!(::Assets::create( + ::RuntimeOrigin::signed(alice_account.clone()), + xUSD.into(), + alice_account.clone().into(), + ASSET_MIN_BALANCE + )); + + // Mint fungible asset + assert_ok!(::Assets::mint( + ::RuntimeOrigin::signed(alice_account.clone()), + xUSD.into(), + alice_account.clone().into(), + MINT_AMOUNT + )); + + // Assert balance update + assert_eq!( + ::Assets::balance(xUSD, &alice_account), + MINT_AMOUNT + ); + }); + + // Make asset sufficient from Relay to Reserve Parachain + + // Pallet Asset called to be transacted from Relay to Reserve Parachain + let call = ::RuntimeCall::Assets(pallet_assets::Call::< + ::Runtime, + Instance1, + >::force_asset_status { + id: xUSD.into(), + owner: alice_account.clone().into(), + issuer: alice_account.clone().into(), + admin: alice_account.clone().into(), + freezer: alice_account.clone().into(), + min_balance: ASSET_MIN_BALANCE, + is_sufficient: true, + is_frozen: false, + }) + .encode() + .into(); + + // Send arguments to be sent from Relay to Reserve Parachain via pallet-xcm + let sudo_origin = ::RuntimeOrigin::root(); + let assets_para_destination: VersionedMultiLocation = + Rococo::child_location_of(AssetHubRococo::para_id()).into(); + + let weight_limit = WeightLimit::Unlimited; + let require_weight_at_most = Weight::from_parts(1000000000, 200000); + let origin_kind = OriginKind::Superuser; + let check_origin = None; + + // Reserve barrier requires explicit unpaid execution and accepts parent governance as source + let xcm = VersionedXcm::from(Xcm(vec![ + UnpaidExecution { weight_limit, check_origin }, + Transact { require_weight_at_most, origin_kind, call }, + ])); + + Rococo::execute_with(|| { + // Declare xUSD (on Reserve Parachain) as self-sufficient via Relay Chain + assert_ok!(::XcmPallet::send( + sudo_origin, + bx!(assets_para_destination), + bx!(xcm), + )); + }); + + // Create asset on Trappist and map to Asset Registry + + let mut beneficiary_balance = 0; + + // Call for asset regitry to be mapped to Trappist - Requires sudo + let asset_registry_call = + ::RuntimeCall::AssetRegistry(pallet_asset_registry::Call::< + ::Runtime, + >::register_reserve_asset { + asset_id: txUSD, + asset_multi_location: ( + Parent, + X3( + Parachain(ASSET_HUB_ID), + PalletInstance(::Assets::index() as u8), + GeneralIndex(xUSD as u128), + ), + ) + .into(), + }); + + Trappist::execute_with(|| { + // Create fungible asset on Asset Hub + assert_ok!(::Assets::create( + ::RuntimeOrigin::signed(alice_account.clone()), + txUSD.into(), + alice_account.clone().into(), + ASSET_MIN_BALANCE + )); + + // Map derivative asset (txUSD) to multi-location (xUSD within Assets pallet on Reserve + // Parachain) via Asset Registry + assert_ok!(::Sudo::sudo( + ::RuntimeOrigin::signed(alice_account.clone()), + Box::new(asset_registry_call), + ),); + assert!( + ::AssetRegistry::get_asset_multi_location(txUSD).is_some() + ); + + // // Check beneficiary balance + beneficiary_balance = + ::Assets::balance(txUSD, &alice_account.clone()); + }); + + // Reserve asset transfer from Asset Hub to Trappist + + const AMOUNT: u128 = 20_000_000_000; + + AssetHubRococo::execute_with(|| { + // Reserve parachain should be able to reserve-transfer an asset to Trappist Parachain + assert_ok!( + ::PolkadotXcm::limited_reserve_transfer_assets( + ::RuntimeOrigin::signed(alice_account.clone()), + Box::new((Parent, Parachain(TRAPPIST_ID)).into()), + Box::new( + X1(AccountId32 { network: None, id: alice_account.clone().into() }).into(), + ), + Box::new( + vec![( + X2( + PalletInstance( + ::Assets::index() as u8 + ), + GeneralIndex(xUSD as u128) + ), + AMOUNT + ) + .into()] + .into() + ), + 0, + WeightLimit::Unlimited, + ) + ); + + // Ensure send amount moved to sovereign account + let sovereign_account = AssetHubRococo::sovereign_account_id_of(MultiLocation { + parents: 1, + interior: Parachain(TRAPPIST_ID.into()).into(), + }); + assert_eq!( + ::Assets::balance(xUSD, &sovereign_account), + AMOUNT + ); + }); + + // Check that balance increased on Trappist + + Trappist::execute_with(|| { + // Ensure beneficiary account balance increased + let current_balance = ::Assets::balance(txUSD, alice_account); + assert!(current_balance > 0u128.into()); + println!( + "Reserve-transfer: initial balance {} transfer amount {} current balance {} actual fees {}", + beneficiary_balance, + AMOUNT, + current_balance, + (beneficiary_balance + AMOUNT - current_balance) + ); + }); +} + +// Initiates a send of a XCM message from trappist to the asset reserve parachain, instructing +// it to transfer some amount of a fungible asset to some tertiary (stout) parachain (HRMP) +#[test] +fn two_hop_reserve_transfer_from_trappist_parachain_to_tertiary_parachain() { + init_tracing(); + + RococoMockNet::reset(); + + let alice_account: sp_runtime::AccountId32 = get_account_id_from_seed::(ALICE); + let trappist_sovereign_account = AssetHubRococo::sovereign_account_id_of(MultiLocation { + parents: 1, + interior: Parachain(TRAPPIST_ID.into()).into(), + }); + let stout_sovereign_account = AssetHubRococo::sovereign_account_id_of(MultiLocation { + parents: 1, + interior: Parachain(STOUT_ID.into()).into(), + }); + + const ASSET_MIN_BALANCE: Balance = 1_000_000_000; + const MINT_AMOUNT: u128 = 100_000_000_000; + + AssetHubRococo::execute_with(|| { + // Create and mint fungible asset on Reserve Parachain + // Create fungible asset on Asset Hub + assert_ok!(::Assets::create( + ::RuntimeOrigin::signed(alice_account.clone()), + xUSD.into(), + alice_account.clone().into(), + ASSET_MIN_BALANCE + )); + + // Mint fungible asset + assert_ok!(::Assets::mint( + ::RuntimeOrigin::signed(alice_account.clone()), + xUSD.into(), + alice_account.clone().into(), + MINT_AMOUNT * 2 + )); + + assert_ok!(::Balances::transfer( + ::RuntimeOrigin::signed(alice_account.clone()), + trappist_sovereign_account.clone().into(), + ASSET_MIN_BALANCE + )); + + // Touch parachain account + assert_ok!(::Assets::transfer( + ::RuntimeOrigin::signed(alice_account.clone()), + xUSD.into(), + trappist_sovereign_account.into(), + MINT_AMOUNT + )); + }); + + let call = ::RuntimeCall::Assets(pallet_assets::Call::< + ::Runtime, + Instance1, + >::force_asset_status { + id: xUSD.into(), + owner: alice_account.clone().into(), + issuer: alice_account.clone().into(), + admin: alice_account.clone().into(), + freezer: alice_account.clone().into(), + min_balance: ASSET_MIN_BALANCE, + is_sufficient: true, + is_frozen: false, + }) + .encode() + .into(); + + // XcmPallet send arguments + let sudo_origin = ::RuntimeOrigin::root(); + let assets_para_destination: VersionedMultiLocation = + Rococo::child_location_of(AssetHubRococo::para_id()).into(); + + let weight_limit = WeightLimit::Unlimited; + let require_weight_at_most = Weight::from_parts(1000000000, 200000); + let origin_kind = OriginKind::Superuser; + let check_origin = None; + + let xcm = VersionedXcm::from(Xcm(vec![ + UnpaidExecution { weight_limit, check_origin }, + Transact { require_weight_at_most, origin_kind, call }, + ])); + + Rococo::execute_with(|| { + // Declare xUSD (on Reserve Parachain) as self-sufficient via Relay Chain + assert_ok!(::XcmPallet::send( + sudo_origin, + bx!(assets_para_destination), + bx!(xcm), + )); + }); + + let stout_asset_registry_call = + ::RuntimeCall::AssetRegistry(pallet_asset_registry::Call::< + ::Runtime, + >::register_reserve_asset { + asset_id: txUSD, + asset_multi_location: ( + Parent, + X3( + Parachain(ASSET_HUB_ID), + PalletInstance(::Assets::index() as u8), + GeneralIndex(xUSD as u128), + ), + ) + .into(), + }); + + let mut beneficiary_balance = 0; + + Stout::execute_with(|| { + // Create fungible asset on Asset Hub + assert_ok!(::Assets::create( + ::RuntimeOrigin::signed(alice_account.clone()), + txUSD.into(), + alice_account.clone().into(), + ASSET_MIN_BALANCE + )); + + // Map derivative asset (txUSD) to multi-location (xUSD within Assets pallet on Reserve + // Parachain) via Asset Registry + assert_ok!(::Sudo::sudo( + ::RuntimeOrigin::signed(alice_account.clone()), + Box::new(stout_asset_registry_call), + ),); + assert!(::AssetRegistry::get_asset_multi_location(txUSD).is_some()); + + // // Check beneficiary balance + beneficiary_balance = + ::Assets::balance(txUSD, &alice_account.clone()); + }); + + let trappist_asset_registry_call = + ::RuntimeCall::AssetRegistry(pallet_asset_registry::Call::< + ::Runtime, + >::register_reserve_asset { + asset_id: txUSD, + asset_multi_location: ( + Parent, + X3( + Parachain(ASSET_HUB_ID), + PalletInstance(::Assets::index() as u8), + GeneralIndex(xUSD as u128), + ), + ) + .into(), + }); + + const MAX_WEIGHT: u128 = 1_000_000_000 * 2; // 1,000,000,000 per instruction + const EXECUTION_COST: u128 = 65_000_000_000; + + Trappist::execute_with(|| { + // Create fungible asset on Asset Hub + assert_ok!(::Assets::create( + ::RuntimeOrigin::signed(alice_account.clone()), + txUSD.into(), + alice_account.clone().into(), + ASSET_MIN_BALANCE + )); + + // Mint fungible asset + assert_ok!(::Assets::mint( + ::RuntimeOrigin::signed(alice_account.clone()), + txUSD.into(), + alice_account.clone().into(), + MINT_AMOUNT + )); + + // Map derivative asset (txUSD) to multi-location (xUSD within Assets pallet on Reserve + // Parachain) via Asset Registry + assert_ok!(::Sudo::sudo( + ::RuntimeOrigin::signed(alice_account.clone()), + Box::new(trappist_asset_registry_call), + ),); + assert!( + ::AssetRegistry::get_asset_multi_location(txUSD).is_some() + ); + + // // Check beneficiary balance + beneficiary_balance = + ::Assets::balance(txUSD, &alice_account.clone()); + + // Trappist parachain should be able to reserve-transfer an asset to Tertiary Parachain + // Call must be hand constructed as pallet-xcm reserve-transfer call does not support third party reserve + assert_ok!(::XcmPallet::execute( + ::RuntimeOrigin::signed(alice_account.clone()), + Box::new(VersionedXcm::from(Xcm(vec![ + // Withdraw asset from Trappist Parachain + WithdrawAsset( + ( + ( + Parent, + X3( + Parachain(ASSET_HUB_ID), + PalletInstance( + ::Assets::index() as u8 + ), + GeneralIndex(xUSD as u128) + ) + ), + MINT_AMOUNT + ) + .into() + ), + // Initiate reserve-transfer of asset + InitiateReserveWithdraw { + assets: Wild(AllCounted(1)), + reserve: (Parent, Parachain(ASSET_HUB_ID)).into(), + // This part of the message is intended to be executed on Asset Hub + xcm: Xcm(vec![ + // Buy execution from Asset Hub + BuyExecution { + fees: ( + X2( + PalletInstance( + ::Assets::index() + as u8 + ), + GeneralIndex(xUSD as u128) + ), + EXECUTION_COST + ) + .into(), + weight_limit: Unlimited + }, + // At this point tokens are moved from one sovereign account to another + DepositReserveAsset { + assets: Wild(AllCounted(1)), + dest: (Parent, Parachain(STOUT_ID)).into(), + // This part of the message is intended to be executed by Stout + xcm: Xcm(vec![ + // Buy execution on Stout + BuyExecution { + fees: ( + (Parent, + X3( + Parachain(ASSET_HUB_ID), + PalletInstance(::Assets::index() as u8), + GeneralIndex(xUSD as u128), + )), + EXECUTION_COST + ) + .into(), + weight_limit: Unlimited + }, + // Deposit asset (derivative) to beneficiary account + DepositAsset { + assets: Wild(AllCounted(1)), + beneficiary: X1(AccountId32 { + network: None, + id: alice_account.clone().into() + }) + .into() + } + ]) + } + ]) + }, + ]))), + (MAX_WEIGHT as u64).into(), + )); + }); + + AssetHubRococo::execute_with(|| { + // Check send amount moved to sovereign account + assert_eq!( + ::Assets::balance( + xUSD, + &stout_sovereign_account + ), + 92813999939 //Mint amount minus fees + ); + }); + + Stout::execute_with(|| { + // Ensure beneficiary received amount, less fees + let current_balance = ::Assets::balance(txUSD, &alice_account); + assert!(current_balance > 0u128.into()); + println!( + "Two-hop Reserve-transfer: initial balance {} transfer amount {} current balance {} estimated fees {} actual fees {}", + beneficiary_balance.separate_with_commas(), + MINT_AMOUNT.separate_with_commas(), + current_balance.separate_with_commas(), + EXECUTION_COST.separate_with_commas(), + (beneficiary_balance + MINT_AMOUNT - current_balance).separate_with_commas() + ); + }); +} diff --git a/integration-tests/emulated/src/tests/set_xcm_version.rs b/integration-tests/emulated/src/tests/set_xcm_version.rs new file mode 100644 index 00000000..657ce696 --- /dev/null +++ b/integration-tests/emulated/src/tests/set_xcm_version.rs @@ -0,0 +1,30 @@ +use crate::tests::*; + +#[test] +fn trappist_sets_stout_para_xcm_supported_version() { + init_tracing(); + // Init tests variables + let sudo_origin = ::RuntimeOrigin::root(); + let stout_para_destination: MultiLocation = MultiLocation::new(1, X1(3000u64.into())); + + // Relay Chain sets supported version for Asset Parachain + Trappist::execute_with(|| { + type RuntimeEvent = ::RuntimeEvent; + + assert_ok!(::XcmPallet::force_xcm_version( + sudo_origin, + bx!(stout_para_destination), + XCM_V3 + )); + + assert_expected_events!( + Trappist, + vec![ + RuntimeEvent::PolkadotXcm(pallet_xcm::Event::SupportedVersionChanged { + location, + version: XCM_V3 + }) => { location: *location == stout_para_destination, }, + ] + ); + }); +} diff --git a/integration-tests/emulated/src/tests/xcm_asset_trap.rs b/integration-tests/emulated/src/tests/xcm_asset_trap.rs new file mode 100644 index 00000000..8b1fb095 --- /dev/null +++ b/integration-tests/emulated/src/tests/xcm_asset_trap.rs @@ -0,0 +1,692 @@ +use crate::tests::*; +/* +// make sure we can trap a native asset +#[test] +fn native_trap_works() { + init_tracing(); + + RococoMockNet::reset(); + + const AMOUNT: u128 = 33_333_333 * 10; + const MAX_WEIGHT: u128 = 1_000_000_000; + let alice_account: sp_runtime::AccountId32 = get_account_id_from_seed::(ALICE); + + Trappist::execute_with(|| { + assert_ok!(::XcmPallet::execute( + ::RuntimeOrigin::signed(alice_account.clone()), + Box::new(VersionedXcm::from(Xcm(vec![WithdrawAsset((Here, AMOUNT).into())]))), + (MAX_WEIGHT as u64).into() + )); + + assert!(::System::events().iter().any(|r| matches!( + r.event, + trappist_runtime::RuntimeEvent::PolkadotXcm(pallet_xcm::Event::AssetsTrapped { .. }) + ))); + + //PolkadotXcm(pallet_xcm::Event::AssetsTrapped { .. }) + let origin: MultiLocation = AccountId32 { network: None, id: alice_account.into() }.into(); + let native_asset: Assets = MultiAsset { + id: Concrete(MultiLocation { parents: 0, interior: Here }), + fun: Fungible((AMOUNT) as u128), + } + .into(); + let expected_versioned = + VersionedMultiAssets::from(MultiAssets::from(native_asset.clone())); + let expected_hash = BlakeTwo256::hash_of(&(&origin, &expected_versioned)); + + // we can read the asset trap storage + let read_asset_trap = ::XcmPallet::asset_trap(expected_hash); + assert_eq!(read_asset_trap, 1); + }); +} +*/ + +// make sure that native dust is not trapped +#[test] +fn native_dust_trap_doesnt_work() { + init_tracing(); + + RococoMockNet::reset(); + + const AMOUNT: u128 = 33_333_333 / 10; // dust + const MAX_WEIGHT: u128 = 1_000_000_000; + let alice_account: sp_runtime::AccountId32 = get_account_id_from_seed::(ALICE); + + Trappist::execute_with(|| { + assert_ok!(::XcmPallet::execute( + ::RuntimeOrigin::signed(alice_account.clone()), + Box::new(VersionedXcm::from(Xcm(vec![WithdrawAsset((Here, AMOUNT).into())]))), + (MAX_WEIGHT as u64).into() + )); + + assert!(!::System::events().iter().any(|r| matches!( + r.event, + trappist_runtime::RuntimeEvent::PolkadotXcm(pallet_xcm::Event::AssetsTrapped { .. }) + ))); + + let origin: MultiLocation = AccountId32 { network: None, id: alice_account.into() }.into(); + let native_asset: Assets = MultiAsset { + id: Concrete(MultiLocation { parents: 0, interior: Here }), + fun: Fungible((AMOUNT) as u128), + } + .into(); + let expected_versioned = + VersionedMultiAssets::from(MultiAssets::from(native_asset.clone())); + let expected_hash = BlakeTwo256::hash_of(&(&origin, &expected_versioned)); + + // nothing was written into asset trap storage + let read_asset_trap = ::XcmPallet::asset_trap(expected_hash); + assert_eq!(read_asset_trap, 0); + }); +} + +/* +// make sure we can trap known derivative fungibles +#[test] +fn fungible_trap_works() { + init_tracing(); + + //Reboot test network to init + RococoMockNet::reset(); + + // Get account from const seed. Funded on genesis config. + let alice_account: sp_runtime::AccountId32 = get_account_id_from_seed::(ALICE); + + const ASSET_MIN_BALANCE: Balance = 1_000_000_000; + const MINT_AMOUNT: u128 = 1_000_000_000_000_000_000; + + // Create and mint fungible asset on Reserve Parachain + + AssetHubRococo::execute_with(|| { + // Create fungible asset on Asset Hub + assert_ok!(::Assets::create( + ::RuntimeOrigin::signed(alice_account.clone()), + xUSD.into(), + alice_account.clone().into(), + ASSET_MIN_BALANCE + )); + + // Mint fungible asset + assert_ok!(::Assets::mint( + ::RuntimeOrigin::signed(alice_account.clone()), + xUSD.into(), + alice_account.clone().into(), + MINT_AMOUNT + )); + + // Assert balance update + assert_eq!( + ::Assets::balance(xUSD, &alice_account), + MINT_AMOUNT + ); + }); + + // Make asset sufficient from Relay to Reserve Parachain + + // Pallet Asset called to be transacted from Relay to Reserve Parachain + let call = ::RuntimeCall::Assets(pallet_assets::Call::< + ::Runtime, + Instance1, + >::force_asset_status { + id: xUSD.into(), + owner: alice_account.clone().into(), + issuer: alice_account.clone().into(), + admin: alice_account.clone().into(), + freezer: alice_account.clone().into(), + min_balance: ASSET_MIN_BALANCE, + is_sufficient: true, + is_frozen: false, + }) + .encode() + .into(); + + // Send arguments to be sent from Relay to Reserve Parachain via pallet-xcm + let sudo_origin = ::RuntimeOrigin::root(); + let assets_para_destination: VersionedMultiLocation = + Rococo::child_location_of(AssetHubRococo::para_id()).into(); + + let weight_limit = WeightLimit::Unlimited; + let require_weight_at_most = Weight::from_parts(1000000000, 200000); + let origin_kind = OriginKind::Superuser; + let check_origin = None; + + // Reserve barrier requires explicit unpaid execution and accepts parent governance as source + let xcm = VersionedXcm::from(Xcm(vec![ + UnpaidExecution { weight_limit, check_origin }, + Transact { require_weight_at_most, origin_kind, call }, + ])); + + Rococo::execute_with(|| { + // Declare xUSD (on Reserve Parachain) as self-sufficient via Relay Chain + assert_ok!(::XcmPallet::send( + sudo_origin, + bx!(assets_para_destination), + bx!(xcm), + )); + }); + + // Create asset on Trappist and map to Asset Registry + + let mut beneficiary_balance = 0; + + // Call for asset regitry to be mapped to Trappist - Requires sudo + let asset_registry_call = + ::RuntimeCall::AssetRegistry(pallet_asset_registry::Call::< + ::Runtime, + >::register_reserve_asset { + asset_id: txUSD, + asset_multi_location: ( + Parent, + X3( + Parachain(ASSET_HUB_ID), + PalletInstance(::Assets::index() as u8), + GeneralIndex(xUSD as u128), + ), + ) + .into(), + }); + + Trappist::execute_with(|| { + // Create fungible asset on Asset Hub + assert_ok!(::Assets::create( + ::RuntimeOrigin::signed(alice_account.clone()), + txUSD.into(), + alice_account.clone().into(), + ASSET_MIN_BALANCE + )); + + // Map derivative asset (txUSD) to multi-location (xUSD within Assets pallet on Reserve + // Parachain) via Asset Registry + assert_ok!(::Sudo::sudo( + ::RuntimeOrigin::signed(alice_account.clone()), + Box::new(asset_registry_call), + ),); + assert!( + ::AssetRegistry::get_asset_multi_location(txUSD).is_some() + ); + + // // Check beneficiary balance + beneficiary_balance = + ::Assets::balance(txUSD, &alice_account.clone()); + }); + + // Reserve asset transfer from Asset Hub to Trappist + + const AMOUNT: u128 = 20_000_000_000; + + AssetHubRococo::execute_with(|| { + // Reserve parachain should be able to reserve-transfer an asset to Trappist Parachain + assert_ok!( + ::PolkadotXcm::limited_reserve_transfer_assets( + ::RuntimeOrigin::signed(alice_account.clone()), + Box::new((Parent, Parachain(TRAPPIST_ID)).into()), + Box::new( + X1(AccountId32 { network: None, id: alice_account.clone().into() }).into(), + ), + Box::new( + vec![( + X2( + PalletInstance( + ::Assets::index() as u8 + ), + GeneralIndex(xUSD as u128) + ), + AMOUNT + ) + .into()] + .into() + ), + 0, + WeightLimit::Unlimited, + ) + ); + + // Ensure send amount moved to sovereign account + let sovereign_account = AssetHubRococo::sovereign_account_id_of(MultiLocation { + parents: 1, + interior: Parachain(TRAPPIST_ID.into()).into(), + }); + assert_eq!( + ::Assets::balance(xUSD, &sovereign_account), + AMOUNT + ); + }); + + // the actual test starts here + Trappist::execute_with(|| { + const TRAP_AMOUNT: u128 = ASSET_MIN_BALANCE * 10; + const MAX_WEIGHT: u128 = 1_000_000_000; + + let fungible_asset_multi_location = MultiLocation { + parents: 1, + interior: X3( + Parachain(ASSET_HUB_ID), + PalletInstance(::Assets::index() as u8), + GeneralIndex(xUSD as u128), + ), + }; + + assert_ok!(::XcmPallet::execute( + ::RuntimeOrigin::signed(alice_account.clone()), + Box::new(VersionedXcm::from(Xcm(vec![WithdrawAsset( + (fungible_asset_multi_location.clone(), TRAP_AMOUNT).into() + )]))), + (MAX_WEIGHT as u64).into() + )); + + assert!(::System::events().iter().any(|r| matches!( + r.event, + trappist_runtime::RuntimeEvent::PolkadotXcm(pallet_xcm::Event::AssetsTrapped { .. }) + ))); + + let origin: MultiLocation = AccountId32 { network: None, id: alice_account.into() }.into(); + let fungible_asset = + MultiAsset { id: Concrete(fungible_asset_multi_location), fun: Fungible(TRAP_AMOUNT) }; + let expected_versioned = + VersionedMultiAssets::from(MultiAssets::from(fungible_asset.clone())); + let expected_hash = BlakeTwo256::hash_of(&(&origin, &expected_versioned)); + + // we can read the asset trap storage + let read_asset_trap = ::XcmPallet::asset_trap(expected_hash); + assert_eq!(read_asset_trap, 1); + }); +} +*/ + +// make sure we can trap known derivative fungibles +#[test] +fn fungible_dust_trap_doesnt_work() { + init_tracing(); + + //Reboot test network to init + RococoMockNet::reset(); + + // Get account from const seed. Funded on genesis config. + let alice_account: sp_runtime::AccountId32 = get_account_id_from_seed::(ALICE); + + const ASSET_MIN_BALANCE: Balance = 1_000_000_000; + const MINT_AMOUNT: u128 = 1_000_000_000_000_000_000; + + // Create and mint fungible asset on Reserve Parachain + + AssetHubRococo::execute_with(|| { + // Create fungible asset on Asset Hub + assert_ok!(::Assets::create( + ::RuntimeOrigin::signed(alice_account.clone()), + xUSD.into(), + alice_account.clone().into(), + ASSET_MIN_BALANCE + )); + + // Mint fungible asset + assert_ok!(::Assets::mint( + ::RuntimeOrigin::signed(alice_account.clone()), + xUSD.into(), + alice_account.clone().into(), + MINT_AMOUNT + )); + + // Assert balance update + assert_eq!( + ::Assets::balance(xUSD, &alice_account), + MINT_AMOUNT + ); + }); + + // Make asset sufficient from Relay to Reserve Parachain + + // Pallet Asset called to be transacted from Relay to Reserve Parachain + let call = ::RuntimeCall::Assets(pallet_assets::Call::< + ::Runtime, + Instance1, + >::force_asset_status { + id: xUSD.into(), + owner: alice_account.clone().into(), + issuer: alice_account.clone().into(), + admin: alice_account.clone().into(), + freezer: alice_account.clone().into(), + min_balance: ASSET_MIN_BALANCE, + is_sufficient: true, + is_frozen: false, + }) + .encode() + .into(); + + // Send arguments to be sent from Relay to Reserve Parachain via pallet-xcm + let sudo_origin = ::RuntimeOrigin::root(); + let assets_para_destination: VersionedMultiLocation = + Rococo::child_location_of(AssetHubRococo::para_id()).into(); + + let weight_limit = WeightLimit::Unlimited; + let require_weight_at_most = Weight::from_parts(1000000000, 200000); + let origin_kind = OriginKind::Superuser; + let check_origin = None; + + // Reserve barrier requires explicit unpaid execution and accepts parent governance as source + let xcm = VersionedXcm::from(Xcm(vec![ + UnpaidExecution { weight_limit, check_origin }, + Transact { require_weight_at_most, origin_kind, call }, + ])); + + Rococo::execute_with(|| { + // Declare xUSD (on Reserve Parachain) as self-sufficient via Relay Chain + assert_ok!(::XcmPallet::send( + sudo_origin, + bx!(assets_para_destination), + bx!(xcm), + )); + }); + + // Create asset on Trappist and map to Asset Registry + + let mut beneficiary_balance = 0; + + // Call for asset regitry to be mapped to Trappist - Requires sudo + let asset_registry_call = + ::RuntimeCall::AssetRegistry(pallet_asset_registry::Call::< + ::Runtime, + >::register_reserve_asset { + asset_id: txUSD, + asset_multi_location: ( + Parent, + X3( + Parachain(ASSET_HUB_ID), + PalletInstance(::Assets::index() as u8), + GeneralIndex(xUSD as u128), + ), + ) + .into(), + }); + + Trappist::execute_with(|| { + // Create fungible asset on Asset Hub + assert_ok!(::Assets::create( + ::RuntimeOrigin::signed(alice_account.clone()), + txUSD.into(), + alice_account.clone().into(), + ASSET_MIN_BALANCE + )); + + // Map derivative asset (txUSD) to multi-location (xUSD within Assets pallet on Reserve + // Parachain) via Asset Registry + assert_ok!(::Sudo::sudo( + ::RuntimeOrigin::signed(alice_account.clone()), + Box::new(asset_registry_call), + ),); + assert!( + ::AssetRegistry::get_asset_multi_location(txUSD).is_some() + ); + + // // Check beneficiary balance + beneficiary_balance = + ::Assets::balance(txUSD, &alice_account.clone()); + }); + + // Reserve asset transfer from Asset Hub to Trappist + + const AMOUNT: u128 = 20_000_000_000; + + AssetHubRococo::execute_with(|| { + // Reserve parachain should be able to reserve-transfer an asset to Trappist Parachain + assert_ok!( + ::PolkadotXcm::limited_reserve_transfer_assets( + ::RuntimeOrigin::signed(alice_account.clone()), + Box::new((Parent, Parachain(TRAPPIST_ID)).into()), + Box::new( + X1(AccountId32 { network: None, id: alice_account.clone().into() }).into(), + ), + Box::new( + vec![( + X2( + PalletInstance( + ::Assets::index() as u8 + ), + GeneralIndex(xUSD as u128) + ), + AMOUNT + ) + .into()] + .into() + ), + 0, + WeightLimit::Unlimited, + ) + ); + + // Ensure send amount moved to sovereign account + let sovereign_account = AssetHubRococo::sovereign_account_id_of(MultiLocation { + parents: 1, + interior: Parachain(TRAPPIST_ID.into()).into(), + }); + assert_eq!( + ::Assets::balance(xUSD, &sovereign_account), + AMOUNT + ); + }); + + // the actual test starts here + Trappist::execute_with(|| { + const TRAP_AMOUNT: u128 = ASSET_MIN_BALANCE / 10; + const MAX_WEIGHT: u128 = 1_000_000_000; + + let fungible_asset_multi_location = MultiLocation { + parents: 1, + interior: X3( + Parachain(ASSET_HUB_ID), + PalletInstance(::Assets::index() as u8), + GeneralIndex(xUSD as u128), + ), + }; + + assert_ok!(::XcmPallet::execute( + ::RuntimeOrigin::signed(alice_account.clone()), + Box::new(VersionedXcm::from(Xcm(vec![WithdrawAsset( + (fungible_asset_multi_location.clone(), TRAP_AMOUNT).into() + )]))), + (MAX_WEIGHT as u64).into() + )); + + assert!(!::System::events().iter().any(|r| matches!( + r.event, + trappist_runtime::RuntimeEvent::PolkadotXcm(pallet_xcm::Event::AssetsTrapped { .. }) + ))); + + let origin: MultiLocation = AccountId32 { network: None, id: alice_account.into() }.into(); + let fungible_asset = + MultiAsset { id: Concrete(fungible_asset_multi_location), fun: Fungible(TRAP_AMOUNT) }; + let expected_versioned = + VersionedMultiAssets::from(MultiAssets::from(fungible_asset.clone())); + let expected_hash = BlakeTwo256::hash_of(&(&origin, &expected_versioned)); + + // we can read the asset trap storage + let read_asset_trap = ::XcmPallet::asset_trap(expected_hash); + assert_eq!(read_asset_trap, 0); + }); +} + +// make sure that unknown fungibles (not on AssetRegistry) do not get trapped +#[test] +fn fungible_non_registered_trap_doesnt_work() { + init_tracing(); + + //Reboot test network to init + RococoMockNet::reset(); + + // Get account from const seed. Funded on genesis config. + let alice_account: sp_runtime::AccountId32 = get_account_id_from_seed::(ALICE); + + const ASSET_MIN_BALANCE: Balance = 1_000_000_000; + const MINT_AMOUNT: u128 = 1_000_000_000_000_000_000; + + // Create and mint fungible asset on Reserve Parachain + + AssetHubRococo::execute_with(|| { + // Create fungible asset on Asset Hub + assert_ok!(::Assets::create( + ::RuntimeOrigin::signed(alice_account.clone()), + xUSD.into(), + alice_account.clone().into(), + ASSET_MIN_BALANCE + )); + + // Mint fungible asset + assert_ok!(::Assets::mint( + ::RuntimeOrigin::signed(alice_account.clone()), + xUSD.into(), + alice_account.clone().into(), + MINT_AMOUNT + )); + + // Assert balance update + assert_eq!( + ::Assets::balance(xUSD, &alice_account), + MINT_AMOUNT + ); + }); + + // Make asset sufficient from Relay to Reserve Parachain + + // Pallet Asset called to be transacted from Relay to Reserve Parachain + let call = ::RuntimeCall::Assets(pallet_assets::Call::< + ::Runtime, + Instance1, + >::force_asset_status { + id: xUSD.into(), + owner: alice_account.clone().into(), + issuer: alice_account.clone().into(), + admin: alice_account.clone().into(), + freezer: alice_account.clone().into(), + min_balance: ASSET_MIN_BALANCE, + is_sufficient: true, + is_frozen: false, + }) + .encode() + .into(); + + // Send arguments to be sent from Relay to Reserve Parachain via pallet-xcm + let sudo_origin = ::RuntimeOrigin::root(); + let assets_para_destination: VersionedMultiLocation = + Rococo::child_location_of(AssetHubRococo::para_id()).into(); + + let weight_limit = WeightLimit::Unlimited; + let require_weight_at_most = Weight::from_parts(1000000000, 200000); + let origin_kind = OriginKind::Superuser; + let check_origin = None; + + // Reserve barrier requires explicit unpaid execution and accepts parent governance as source + let xcm = VersionedXcm::from(Xcm(vec![ + UnpaidExecution { weight_limit, check_origin }, + Transact { require_weight_at_most, origin_kind, call }, + ])); + + Rococo::execute_with(|| { + // Declare xUSD (on Reserve Parachain) as self-sufficient via Relay Chain + assert_ok!(::XcmPallet::send( + sudo_origin, + bx!(assets_para_destination), + bx!(xcm), + )); + }); + + // Create asset on Trappist and map to Asset Registry + + let mut beneficiary_balance = 0; + + Trappist::execute_with(|| { + // Create fungible asset on Asset Hub + assert_ok!(::Assets::create( + ::RuntimeOrigin::signed(alice_account.clone()), + txUSD.into(), + alice_account.clone().into(), + ASSET_MIN_BALANCE + )); + + // Explicitly do not map derivative asset (txUSD) to multi-location (xUSD within Assets + // pallet on Reserve Parachain) via Asset Registry + + // // Check beneficiary balance + beneficiary_balance = + ::Assets::balance(txUSD, &alice_account.clone()); + }); + + // Reserve asset transfer from Asset Hub to Trappist + + const AMOUNT: u128 = 20_000_000_000; + + AssetHubRococo::execute_with(|| { + // Reserve parachain should be able to reserve-transfer an asset to Trappist Parachain + assert_ok!( + ::PolkadotXcm::limited_reserve_transfer_assets( + ::RuntimeOrigin::signed(alice_account.clone()), + Box::new((Parent, Parachain(TRAPPIST_ID)).into()), + Box::new( + X1(AccountId32 { network: None, id: alice_account.clone().into() }).into(), + ), + Box::new( + vec![( + X2( + PalletInstance( + ::Assets::index() as u8 + ), + GeneralIndex(xUSD as u128) + ), + AMOUNT + ) + .into()] + .into() + ), + 0, + WeightLimit::Unlimited, + ) + ); + + // Ensure send amount moved to sovereign account + let sovereign_account = AssetHubRococo::sovereign_account_id_of(MultiLocation { + parents: 1, + interior: Parachain(TRAPPIST_ID.into()).into(), + }); + assert_eq!( + ::Assets::balance(xUSD, &sovereign_account), + AMOUNT + ); + }); + + // the actual test starts here + Trappist::execute_with(|| { + const TRAP_AMOUNT: u128 = ASSET_MIN_BALANCE * 10; + const MAX_WEIGHT: u128 = 1_000_000_000; + + let fungible_asset_multi_location = MultiLocation { + parents: 1, + interior: X3( + Parachain(ASSET_HUB_ID), + PalletInstance(::Assets::index() as u8), + GeneralIndex(xUSD as u128), + ), + }; + + assert_ok!(::XcmPallet::execute( + ::RuntimeOrigin::signed(alice_account.clone()), + Box::new(VersionedXcm::from(Xcm(vec![WithdrawAsset( + (fungible_asset_multi_location.clone(), TRAP_AMOUNT).into() + )]))), + (MAX_WEIGHT as u64).into() + )); + + assert!(!::System::events().iter().any(|r| matches!( + r.event, + trappist_runtime::RuntimeEvent::PolkadotXcm(pallet_xcm::Event::AssetsTrapped { .. }) + ))); + + let origin: MultiLocation = AccountId32 { network: None, id: alice_account.into() }.into(); + let fungible_asset = + MultiAsset { id: Concrete(fungible_asset_multi_location), fun: Fungible(TRAP_AMOUNT) }; + let expected_versioned = + VersionedMultiAssets::from(MultiAssets::from(fungible_asset.clone())); + let expected_hash = BlakeTwo256::hash_of(&(&origin, &expected_versioned)); + + // we can read the asset trap storage + let read_asset_trap = ::XcmPallet::asset_trap(expected_hash); + assert_eq!(read_asset_trap, 0); + }); +} diff --git a/runtime/stout/src/constants.rs b/runtime/stout/src/constants.rs index a372c08c..7cb80623 100644 --- a/runtime/stout/src/constants.rs +++ b/runtime/stout/src/constants.rs @@ -15,6 +15,18 @@ // See the License for the specific language governing permissions and // limitations under the License. +/// Consensus-related. +pub mod consensus { + /// Maximum number of blocks simultaneously accepted by the Runtime, not yet included + /// into the relay chain. + pub const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1; + /// How many parachain blocks are processed by the relay chain per parent. Limits the + /// number of blocks authored per slot. + pub const BLOCK_PROCESSING_VELOCITY: u32 = 1; + /// Relay chain slot duration, in milliseconds. + pub const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000; +} + pub mod currency { use kusama_runtime_constants as constants; use polkadot_core_primitives::Balance; diff --git a/runtime/stout/src/lib.rs b/runtime/stout/src/lib.rs index 7dfa13d6..5bf75a78 100644 --- a/runtime/stout/src/lib.rs +++ b/runtime/stout/src/lib.rs @@ -37,7 +37,7 @@ use sp_runtime::{ ApplyExtrinsicResult, Perbill, }; -use constants::{currency::*, fee::WeightToFee}; +use constants::{consensus::*, currency::*, fee::WeightToFee}; use frame_support::{ construct_runtime, dispatch::DispatchClass, @@ -295,6 +295,12 @@ impl cumulus_pallet_parachain_system::Config for Runtime { type XcmpMessageHandler = XcmpQueue; type ReservedXcmpWeight = ReservedXcmpWeight; type CheckAssociatedRelayNumber = RelayNumberStrictlyIncreases; + type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook< + Runtime, + RELAY_CHAIN_SLOT_DURATION_MILLIS, + BLOCK_PROCESSING_VELOCITY, + UNINCLUDED_SEGMENT_CAPACITY, + >; } impl pallet_insecure_randomness_collective_flip::Config for Runtime {} diff --git a/runtime/trappist/src/constants.rs b/runtime/trappist/src/constants.rs index 8dc51e6e..dee64f68 100644 --- a/runtime/trappist/src/constants.rs +++ b/runtime/trappist/src/constants.rs @@ -15,6 +15,17 @@ // See the License for the specific language governing permissions and // limitations under the License. +/// Consensus-related. +pub mod consensus { + /// Maximum number of blocks simultaneously accepted by the Runtime, not yet included + /// into the relay chain. + pub const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1; + /// How many parachain blocks are processed by the relay chain per parent. Limits the + /// number of blocks authored per slot. + pub const BLOCK_PROCESSING_VELOCITY: u32 = 1; + /// Relay chain slot duration, in milliseconds. + pub const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000; +} pub mod currency { use kusama_runtime_constants as constants; use polkadot_core_primitives::Balance; diff --git a/runtime/trappist/src/lib.rs b/runtime/trappist/src/lib.rs index 026656c5..a3405d72 100644 --- a/runtime/trappist/src/lib.rs +++ b/runtime/trappist/src/lib.rs @@ -64,7 +64,7 @@ use sp_version::NativeVersion; use sp_version::RuntimeVersion; use xcm::latest::prelude::BodyId; -use constants::{currency::*, fee::WeightToFee}; +use constants::{consensus::*, currency::*, fee::WeightToFee}; use impls::{DealWithFees, LockdownDmpHandler, RuntimeBlackListedCalls, XcmExecutionManager}; use xcm_config::{ CollatorSelectionUpdateOrigin, RelayLocation, TrustBackedAssetsConvertedConcreteId, @@ -298,6 +298,12 @@ impl cumulus_pallet_parachain_system::Config for Runtime { type XcmpMessageHandler = XcmpQueue; type ReservedXcmpWeight = ReservedXcmpWeight; type CheckAssociatedRelayNumber = RelayNumberStrictlyIncreases; + type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook< + Runtime, + RELAY_CHAIN_SLOT_DURATION_MILLIS, + BLOCK_PROCESSING_VELOCITY, + UNINCLUDED_SEGMENT_CAPACITY, + >; } impl pallet_insecure_randomness_collective_flip::Config for Runtime {}