diff --git a/Cargo.lock b/Cargo.lock index c35c291cdc..b8f13ac65c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -156,6 +156,12 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" +[[package]] +name = "arrayvec" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a2f58b0bb10c380af2b26e57212856b8c9a59e0925b4c20f4a174a49734eaf7" + [[package]] name = "asn1_der" version = "0.6.3" @@ -195,6 +201,16 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" +[[package]] +name = "async-attributes" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3203e79f4dd9bdda415ed03cf14dae5a2bf775c683a00f94e9cd1faf0f596e5" +dependencies = [ + "quote 1.0.9", + "syn 1.0.68", +] + [[package]] name = "async-channel" version = "1.5.1" @@ -284,6 +300,7 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f9f84f1280a2b436a2c77c2582602732b6c2f4321d5494d6e799e6c367859a8" dependencies = [ + "async-attributes", "async-channel", "async-global-executor", "async-io", @@ -412,7 +429,7 @@ dependencies = [ "cfg-if 1.0.0", "libc", "miniz_oxide", - "object", + "object 0.22.0", "rustc-demangle", ] @@ -443,10 +460,10 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" [[package]] name = "beefy-gadget" version = "0.1.0" -source = "git+https://github.com/paritytech/grandpa-bridge-gadget?branch=master#036215fa1eb18d531cfdb202bcbe57617a6100f9" +source = "git+https://github.com/paritytech/grandpa-bridge-gadget?branch=master#470bc3635a03579d48404f9d3f754608ee20ba1c" dependencies = [ "beefy-primitives", - "futures 0.3.13", + "futures 0.3.14", "hex", "log", "parity-scale-codec", @@ -470,11 +487,11 @@ dependencies = [ [[package]] name = "beefy-gadget-rpc" version = "0.1.0" -source = "git+https://github.com/paritytech/grandpa-bridge-gadget?branch=master#036215fa1eb18d531cfdb202bcbe57617a6100f9" +source = "git+https://github.com/paritytech/grandpa-bridge-gadget?branch=master#470bc3635a03579d48404f9d3f754608ee20ba1c" dependencies = [ "beefy-gadget", "beefy-primitives", - "futures 0.3.13", + "futures 0.3.14", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", @@ -491,7 +508,7 @@ dependencies = [ [[package]] name = "beefy-primitives" version = "0.1.0" -source = "git+https://github.com/paritytech/grandpa-bridge-gadget?branch=master#036215fa1eb18d531cfdb202bcbe57617a6100f9" +source = "git+https://github.com/paritytech/grandpa-bridge-gadget?branch=master#470bc3635a03579d48404f9d3f754608ee20ba1c" dependencies = [ "parity-scale-codec", "sp-api", @@ -957,18 +974,18 @@ checksum = "dcb25d077389e53838a8158c8e99174c5a9d902dee4904320db714f3c653ffba" [[package]] name = "cranelift-bforest" -version = "0.69.0" +version = "0.71.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4066fd63b502d73eb8c5fa6bcab9c7962b05cd580f6b149ee83a8e730d8ce7fb" +checksum = "bcee7a5107071484772b89fdf37f0f460b7db75f476e43ea7a684fd942470bcf" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.69.0" +version = "0.71.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a54e4beb833a3c873a18a8fe735d73d732044004c7539a072c8faa35ccb0c60" +checksum = "654ab96f0f1cab71c0d323618a58360a492da2c341eb2c1f977fc195c664001b" dependencies = [ "byteorder", "cranelift-bforest", @@ -986,9 +1003,9 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.69.0" +version = "0.71.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c54cac7cacb443658d8f0ff36a3545822613fa202c946c0891897843bc933810" +checksum = "65994cfc5be9d5fd10c5fc30bcdddfa50c04bb79c91329287bff846434ff8f14" dependencies = [ "cranelift-codegen-shared", "cranelift-entity", @@ -996,24 +1013,27 @@ dependencies = [ [[package]] name = "cranelift-codegen-shared" -version = "0.69.0" +version = "0.71.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a109760aff76788b2cdaeefad6875a73c2b450be13906524f6c2a81e05b8d83c" +checksum = "889d720b688b8b7df5e4903f9b788c3c59396050f5548e516e58ccb7312463ab" +dependencies = [ + "serde", +] [[package]] name = "cranelift-entity" -version = "0.69.0" +version = "0.71.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b044234aa32531f89a08b487630ddc6744696ec04c8123a1ad388de837f5de3" +checksum = "1a2e6884a363e42a9ba980193ea8603a4272f8a92bd8bbaf9f57a94dbea0ff96" dependencies = [ "serde", ] [[package]] name = "cranelift-frontend" -version = "0.69.0" +version = "0.71.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5452b3e4e97538ee5ef2cc071301c69a86c7adf2770916b9d04e9727096abd93" +checksum = "e6f41e2f9b57d2c030e249d0958f1cdc2c3cd46accf8c0438b3d1944e9153444" dependencies = [ "cranelift-codegen", "log", @@ -1023,25 +1043,24 @@ dependencies = [ [[package]] name = "cranelift-native" -version = "0.69.0" +version = "0.71.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f68035c10b2e80f26cc29c32fa824380877f38483504c2a47b54e7da311caaf3" +checksum = "aab70ba7575665375d31cbdea2462916ce58be887834e1b83c860b43b51af637" dependencies = [ "cranelift-codegen", - "raw-cpuid", "target-lexicon", ] [[package]] name = "cranelift-wasm" -version = "0.69.0" +version = "0.71.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a530eb9d1c95b3309deb24c3d179d8b0ba5837ed98914a429787c395f614949d" +checksum = "f2fc3d2e70da6439adf97648dcdf81834363154f2907405345b6fbe7ca38918c" dependencies = [ "cranelift-codegen", "cranelift-entity", "cranelift-frontend", - "itertools 0.9.0", + "itertools 0.10.0", "log", "serde", "smallvec 1.6.1", @@ -1228,7 +1247,7 @@ dependencies = [ "cumulus-test-client", "cumulus-test-runtime", "env_logger 0.7.1", - "futures 0.3.13", + "futures 0.3.14", "parity-scale-codec", "parking_lot 0.9.0", "polkadot-node-primitives", @@ -1256,7 +1275,7 @@ dependencies = [ "cumulus-test-client", "cumulus-test-runtime", "dyn-clone", - "futures 0.3.13", + "futures 0.3.14", "futures-timer 3.0.2", "parity-scale-codec", "polkadot-primitives", @@ -1284,7 +1303,7 @@ dependencies = [ "cumulus-client-consensus-common", "cumulus-primitives-core", "cumulus-primitives-parachain-inherent", - "futures 0.3.13", + "futures 0.3.14", "parity-scale-codec", "parking_lot 0.9.0", "polkadot-service", @@ -1307,7 +1326,7 @@ dependencies = [ "cumulus-primitives-core", "cumulus-test-service", "derive_more 0.99.11", - "futures 0.3.13", + "futures 0.3.14", "futures-timer 3.0.2", "parity-scale-codec", "parking_lot 0.10.2", @@ -1317,7 +1336,6 @@ dependencies = [ "polkadot-service", "polkadot-statement-table", "polkadot-test-client", - "polkadot-test-service", "sc-cli", "sc-client-api", "sc-service", @@ -1340,7 +1358,7 @@ dependencies = [ "cumulus-client-collator", "cumulus-client-consensus-common", "cumulus-primitives-core", - "futures 0.3.13", + "futures 0.3.14", "parity-scale-codec", "polkadot-primitives", "polkadot-service", @@ -1394,10 +1412,25 @@ dependencies = [ "sp-version", "substrate-test-runtime-client", "trie-db", + "xcm", ] [[package]] -name = "cumulus-pallet-xcm-handler" +name = "cumulus-pallet-xcm" +version = "0.1.0" +dependencies = [ + "cumulus-primitives-core", + "frame-support", + "frame-system", + "parity-scale-codec", + "serde", + "sp-runtime", + "sp-std", + "xcm", +] + +[[package]] +name = "cumulus-pallet-xcmp-queue" version = "0.1.0" dependencies = [ "cumulus-primitives-core", @@ -1405,15 +1438,34 @@ dependencies = [ "frame-system", "log", "parity-scale-codec", + "rand 0.8.3", + "rand_chacha 0.3.0", + "sp-runtime", "sp-std", "xcm", "xcm-executor", ] +[[package]] +name = "cumulus-ping" +version = "0.1.0" +dependencies = [ + "cumulus-pallet-xcm", + "cumulus-primitives-core", + "frame-support", + "frame-system", + "parity-scale-codec", + "serde", + "sp-runtime", + "sp-std", + "xcm", +] + [[package]] name = "cumulus-primitives-core" version = "0.1.0" dependencies = [ + "frame-support", "impl-trait-for-tuples", "parity-scale-codec", "polkadot-core-primitives", @@ -1422,6 +1474,7 @@ dependencies = [ "sp-runtime", "sp-std", "sp-trie", + "xcm", ] [[package]] @@ -1441,6 +1494,64 @@ dependencies = [ "tracing", ] +[[package]] +name = "cumulus-primitives-utility" +version = "0.1.0" +dependencies = [ + "cumulus-primitives-core", + "frame-support", + "impl-trait-for-tuples", + "parity-scale-codec", + "polkadot-core-primitives", + "polkadot-parachain", + "polkadot-primitives", + "sp-runtime", + "sp-std", + "sp-trie", + "xcm", +] + +[[package]] +name = "cumulus-shell-runtime" +version = "0.1.0" +dependencies = [ + "cumulus-pallet-parachain-system", + "cumulus-pallet-xcm", + "cumulus-pallet-xcmp-queue", + "cumulus-primitives-core", + "cumulus-primitives-utility", + "frame-executive", + "frame-support", + "frame-system", + "hex", + "log", + "pallet-balances", + "pallet-randomness-collective-flip", + "pallet-timestamp", + "pallet-transaction-payment", + "pallet-xcm", + "parachain-info", + "parity-scale-codec", + "polkadot-parachain", + "rococo-parachain-primitives", + "serde", + "sp-api", + "sp-block-builder", + "sp-core", + "sp-inherents", + "sp-io", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-std", + "sp-transaction-pool", + "sp-version", + "substrate-wasm-builder 3.0.0", + "xcm", + "xcm-builder", + "xcm-executor", +] + [[package]] name = "cumulus-test-client" version = "0.1.0" @@ -1475,16 +1586,21 @@ name = "cumulus-test-parachain-runtime" version = "0.1.0" dependencies = [ "cumulus-pallet-parachain-system", - "cumulus-pallet-xcm-handler", + "cumulus-pallet-xcm", + "cumulus-pallet-xcmp-queue", + "cumulus-ping", "cumulus-primitives-core", + "cumulus-primitives-utility", "frame-executive", "frame-support", "frame-system", + "log", "pallet-balances", "pallet-randomness-collective-flip", "pallet-sudo", "pallet-timestamp", "pallet-transaction-payment", + "pallet-xcm", "parachain-info", "parity-scale-codec", "polkadot-parachain", @@ -1519,6 +1635,13 @@ dependencies = [ "sp-std", ] +[[package]] +name = "cumulus-test-relay-validation-worker-provider" +version = "0.1.0" +dependencies = [ + "polkadot-node-core-pvf", +] + [[package]] name = "cumulus-test-runtime" version = "0.1.0" @@ -1558,8 +1681,9 @@ dependencies = [ "cumulus-client-network", "cumulus-client-service", "cumulus-primitives-core", + "cumulus-test-relay-validation-worker-provider", "cumulus-test-runtime", - "futures 0.3.13", + "futures 0.3.14", "jsonrpc-core", "parity-scale-codec", "polkadot-overseer", @@ -1650,6 +1774,17 @@ dependencies = [ "syn 1.0.68", ] +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2 1.0.26", + "quote 1.0.9", + "syn 1.0.68", +] + [[package]] name = "derive_more" version = "0.15.0" @@ -1844,6 +1979,17 @@ dependencies = [ "syn 1.0.68", ] +[[package]] +name = "enumn" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e58b112d5099aa0857c5d05f0eacab86406dd8c0f85fe5d320a13256d29ecf4" +dependencies = [ + "proc-macro2 1.0.26", + "quote 1.0.9", + "syn 1.0.68", +] + [[package]] name = "env_logger" version = "0.7.1" @@ -1967,7 +2113,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e43f2f1833d64e33f15592464d6fdd70f349dda7b1a53088eb83cd94014008c5" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", ] [[package]] @@ -2039,7 +2185,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6447e2f8178843749e8c8003206def83ec124a7859475395777a28b5338647c" dependencies = [ "either", - "futures 0.3.13", + "futures 0.3.14", "futures-timer 3.0.2", "log", "num-traits", @@ -2087,7 +2233,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "parity-scale-codec", ] @@ -2105,7 +2251,7 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "3.1.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-support", "frame-system", @@ -2124,7 +2270,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "Inflector", "chrono", @@ -2147,7 +2293,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-support", "frame-system", @@ -2160,7 +2306,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-support", "frame-system", @@ -2176,7 +2322,7 @@ dependencies = [ [[package]] name = "frame-metadata" version = "13.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "parity-scale-codec", "serde", @@ -2187,7 +2333,7 @@ dependencies = [ [[package]] name = "frame-support" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "bitflags", "frame-metadata", @@ -2213,7 +2359,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "Inflector", "frame-support-procedural-tools", @@ -2225,7 +2371,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate 1.0.0", @@ -2237,7 +2383,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "proc-macro2 1.0.26", "quote 1.0.9", @@ -2247,7 +2393,7 @@ dependencies = [ [[package]] name = "frame-system" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-support", "impl-trait-for-tuples", @@ -2264,7 +2410,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "parity-scale-codec", "sp-api", @@ -2273,7 +2419,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-support", "parity-scale-codec", @@ -2346,9 +2492,9 @@ checksum = "4c7e4c2612746b0df8fed4ce0c69156021b704c9aefa360311c04e6e9e002eed" [[package]] name = "futures" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f55667319111d593ba876406af7c409c0ebb44dc4be6132a783ccf163ea14c1" +checksum = "a9d5813545e459ad3ca1bff9915e9ad7f1a47dc6a91b627ce321d5863b7dd253" dependencies = [ "futures-channel", "futures-core", @@ -2361,9 +2507,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c2dd2df839b57db9ab69c2c9d8f3e8c81984781937fe2807dc6dcf3b2ad2939" +checksum = "ce79c6a52a299137a6013061e0cf0e688fce5d7f1bc60125f520912fdb29ec25" dependencies = [ "futures-core", "futures-sink", @@ -2371,9 +2517,9 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15496a72fabf0e62bdc3df11a59a3787429221dd0710ba8ef163d6f7a9112c94" +checksum = "098cd1c6dda6ca01650f1a37a794245eb73181d0d4d4e955e2f3c37db7af1815" [[package]] name = "futures-cpupool" @@ -2392,7 +2538,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdcef58a173af8148b182684c9f2d5250875adbcaff7b5794073894f9d8634a9" dependencies = [ "futures 0.1.30", - "futures 0.3.13", + "futures 0.3.14", "lazy_static", "log", "parking_lot 0.9.0", @@ -2403,9 +2549,9 @@ dependencies = [ [[package]] name = "futures-executor" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891a4b7b96d84d5940084b2a37632dd65deeae662c114ceaa2c879629c9c0ad1" +checksum = "10f6cb7042eda00f0049b1d2080aa4b93442997ee507eb3828e8bd7577f94c9d" dependencies = [ "futures-core", "futures-task", @@ -2415,9 +2561,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71c2c65c57704c32f5241c1223167c2c3294fd34ac020c807ddbe6db287ba59" +checksum = "365a1a1fb30ea1c03a830fdb2158f5236833ac81fa0ad12fe35b29cddc35cb04" [[package]] name = "futures-lite" @@ -2436,9 +2582,9 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea405816a5139fb39af82c2beb921d52143f556038378d6db21183a5c37fbfb7" +checksum = "668c6733a182cd7deb4f1de7ba3bf2120823835b3bcfbeacf7d2c4a773c1bb8b" dependencies = [ "proc-macro-hack", "proc-macro2 1.0.26", @@ -2459,15 +2605,15 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85754d98985841b7d4f5e8e6fbfa4a4ac847916893ec511a2917ccd8525b8bb3" +checksum = "5c5629433c555de3d82861a7a4e3794a4c40040390907cfbfd7143a92a426c23" [[package]] name = "futures-task" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa189ef211c15ee602667a6fcfe1c1fd9e07d42250d2156382820fba33c9df80" +checksum = "ba7aa51095076f3ba6d9a1f702f74bd05ec65f555d70d2033d55ba8d69f581bc" [[package]] name = "futures-timer" @@ -2483,9 +2629,9 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" [[package]] name = "futures-util" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1812c7ab8aedf8d6f2701a43e1243acdbcc2b36ab26e2ad421eb99ac963d96d1" +checksum = "3c144ad54d60f23927f0a6b6d816e4271278b64f005ad65e4e35291d2de9c025" dependencies = [ "futures 0.1.30", "futures-channel", @@ -2720,9 +2866,9 @@ dependencies = [ [[package]] name = "hex" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hex-literal" @@ -2990,7 +3136,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a6d52908d4ea4ab2bc22474ba149bf1011c8e2c3ebc1ff593ae28ac44f494b6" dependencies = [ "async-io", - "futures 0.3.13", + "futures 0.3.14", "futures-lite", "if-addrs", "ipnet", @@ -3078,7 +3224,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64fa110ec7b8f493f416eed552740d10e7030ad5f63b2308f82c9608ec2df275" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "futures-timer 2.0.2", ] @@ -3281,13 +3427,14 @@ dependencies = [ [[package]] name = "jsonrpsee-http-client" -version = "0.2.0-alpha" +version = "0.2.0-alpha.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "124797a4ea7430d0675db78e065e53316e3f1a3cbf0ee4d6dbdd42db7b08e193" +checksum = "9b15fc3a0ef2e02d770aa1a221d3412443dcaedc43e27d80c957dd5bbd65321b" dependencies = [ "async-trait", - "futures 0.3.13", + "futures 0.3.14", "hyper 0.13.9", + "hyper-rustls", "jsonrpsee-types", "jsonrpsee-utils", "log", @@ -3300,9 +3447,9 @@ dependencies = [ [[package]] name = "jsonrpsee-proc-macros" -version = "0.2.0-alpha.2" +version = "0.2.0-alpha.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cb3f732ccbeafd15cefb59c7c7b5ac6c553c2653613b63e5e7feb7f06a219e9" +checksum = "6bb4afbda476e2ee11cc6245055c498c116fc8002d2d60fe8338b6ee15d84c3a" dependencies = [ "Inflector", "proc-macro2 1.0.26", @@ -3312,12 +3459,12 @@ dependencies = [ [[package]] name = "jsonrpsee-types" -version = "0.2.0-alpha.2" +version = "0.2.0-alpha.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a8cd20c190e75dc56f7543b9d5713c3186351b301b5507ea6b85d8c403aac78" +checksum = "c42a82588b5f7830e94341bb7e79d15f46070ab6f64dde1e3b3719721b61c5bf" dependencies = [ "async-trait", - "futures 0.3.13", + "futures 0.3.14", "log", "serde", "serde_json", @@ -3327,11 +3474,11 @@ dependencies = [ [[package]] name = "jsonrpsee-utils" -version = "0.2.0-alpha" +version = "0.2.0-alpha.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0e45394ec3175a767c3c5bac584560e6ad9b56ebd73216c85ec8bab49619244" +checksum = "e65c77838fce96bc554b4a3a159d0b9a2497319ae9305c66ee853998c7ed2fd3" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "globset", "hyper 0.13.9", "jsonrpsee-types", @@ -3359,7 +3506,7 @@ dependencies = [ [[package]] name = "kusama-runtime" version = "0.8.30" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "beefy-primitives", "bitvec", @@ -3524,7 +3671,7 @@ checksum = "fe5759b526f75102829c15e4d8566603b4bf502ed19b5f35920d98113873470d" dependencies = [ "atomic", "bytes 1.0.1", - "futures 0.3.13", + "futures 0.3.14", "lazy_static", "libp2p-core", "libp2p-deflate", @@ -3566,7 +3713,7 @@ dependencies = [ "ed25519-dalek", "either", "fnv", - "futures 0.3.13", + "futures 0.3.14", "futures-timer 3.0.2", "lazy_static", "libsecp256k1", @@ -3596,7 +3743,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2181a641cd15f9b6ba71b1335800f309012a0a97a29ffaabbbf40e9d3d58f08" dependencies = [ "flate2", - "futures 0.3.13", + "futures 0.3.14", "libp2p-core", ] @@ -3607,7 +3754,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62e63dab8b5ff35e0c101a3e51e843ba782c07bbb1682f5fd827622e0d02b98b" dependencies = [ "async-std-resolver", - "futures 0.3.13", + "futures 0.3.14", "libp2p-core", "log", "smallvec 1.6.1", @@ -3622,7 +3769,7 @@ checksum = "897645f99e9b396df256a6aa8ba8c4bc019ac6b7c62556f624b5feea9acc82bb" dependencies = [ "cuckoofilter", "fnv", - "futures 0.3.13", + "futures 0.3.14", "libp2p-core", "libp2p-swarm", "log", @@ -3643,7 +3790,7 @@ dependencies = [ "byteorder", "bytes 1.0.1", "fnv", - "futures 0.3.13", + "futures 0.3.14", "hex_fmt", "libp2p-core", "libp2p-swarm", @@ -3664,7 +3811,7 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f88ebc841d744979176ab4b8b294a3e655a7ba4ef26a905d073a52b49ed4dff5" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "libp2p-core", "libp2p-swarm", "log", @@ -3685,7 +3832,7 @@ dependencies = [ "bytes 1.0.1", "either", "fnv", - "futures 0.3.13", + "futures 0.3.14", "libp2p-core", "libp2p-swarm", "log", @@ -3709,7 +3856,7 @@ dependencies = [ "async-io", "data-encoding", "dns-parser", - "futures 0.3.13", + "futures 0.3.14", "if-watch", "lazy_static", "libp2p-core", @@ -3729,7 +3876,7 @@ checksum = "85e9b544335d1ed30af71daa96edbefadef6f19c7a55f078b9fc92c87163105d" dependencies = [ "asynchronous-codec 0.6.0", "bytes 1.0.1", - "futures 0.3.13", + "futures 0.3.14", "libp2p-core", "log", "nohash-hasher", @@ -3747,7 +3894,7 @@ checksum = "36db0f0db3b0433f5b9463f1c0cd9eadc0a3734a9170439ce501ff99733a88bd" dependencies = [ "bytes 1.0.1", "curve25519-dalek 3.0.0", - "futures 0.3.13", + "futures 0.3.14", "lazy_static", "libp2p-core", "log", @@ -3767,7 +3914,7 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dea10fc5209260915ea65b78f612d7ff78a29ab288e7aa3250796866af861c45" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "libp2p-core", "libp2p-swarm", "log", @@ -3784,7 +3931,7 @@ checksum = "0c8c37b4d2a075b4be8442760a5f8c037180f0c8dd5b5734b9978ab868b3aa11" dependencies = [ "asynchronous-codec 0.6.0", "bytes 1.0.1", - "futures 0.3.13", + "futures 0.3.14", "libp2p-core", "log", "prost", @@ -3799,7 +3946,7 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ce3374f3b28162db9d3442c9347c4f14cb01e8290052615c7d341d40eae0599" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "log", "pin-project 1.0.4", "rand 0.7.3", @@ -3815,7 +3962,7 @@ checksum = "3ff268be6a9d6f3c6cca3b81bbab597b15217f9ad8787c6c40fc548c1af7cd24" dependencies = [ "asynchronous-codec 0.6.0", "bytes 1.0.1", - "futures 0.3.13", + "futures 0.3.14", "futures-timer 3.0.2", "libp2p-core", "libp2p-swarm", @@ -3838,7 +3985,7 @@ checksum = "725367dd2318c54c5ab1a6418592e5b01c63b0dedfbbfb8389220b2bcf691899" dependencies = [ "async-trait", "bytes 1.0.1", - "futures 0.3.13", + "futures 0.3.14", "libp2p-core", "libp2p-swarm", "log", @@ -3857,7 +4004,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75c26980cadd7c25d89071cb23e1f7f5df4863128cc91d83c6ddc72338cecafa" dependencies = [ "either", - "futures 0.3.13", + "futures 0.3.14", "libp2p-core", "log", "rand 0.7.3", @@ -3883,7 +4030,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b1a27d21c477951799e99d5c105d78868258502ce092988040a808d5a19bbd9" dependencies = [ "async-io", - "futures 0.3.13", + "futures 0.3.14", "futures-timer 3.0.2", "if-watch", "ipnet", @@ -3900,7 +4047,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffd6564bb3b7ff203661ccbb69003c2b551e34cef974f2d6c6a28306a12170b5" dependencies = [ "async-std", - "futures 0.3.13", + "futures 0.3.14", "libp2p-core", "log", ] @@ -3911,7 +4058,7 @@ version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cef45d61e43c313531b5e903e4e8415212ff6338e0c54c47da5b9b412b5760de" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "js-sys", "libp2p-core", "parity-send-wrapper", @@ -3926,7 +4073,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cace60995ef6f637e4752cccbb2590f6bc358e8741a0d066307636c69a4b3a74" dependencies = [ "either", - "futures 0.3.13", + "futures 0.3.14", "futures-rustls", "libp2p-core", "log", @@ -3943,7 +4090,7 @@ version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d6144cc94143fb0a8dd1e7c2fbcc32a2808168bcd1d69920635424d5993b7b" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "libp2p-core", "parking_lot 0.11.1", "thiserror", @@ -4208,10 +4355,10 @@ dependencies = [ [[package]] name = "metered-channel" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "derive_more 0.99.11", - "futures 0.3.13", + "futures 0.3.14", "futures-timer 3.0.2", ] @@ -4221,7 +4368,7 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c023c3f16109e7f33aa451f773fd61070e265b4977d0b6e344a51049296dd7df" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "rand 0.7.3", "thrift", ] @@ -4393,7 +4540,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "10ddc0eb0117736f19d556355464fc87efc8ad98b29e3fd84f02531eb6e90840" dependencies = [ "bytes 1.0.1", - "futures 0.3.13", + "futures 0.3.14", "log", "pin-project 1.0.4", "smallvec 1.6.1", @@ -4551,6 +4698,12 @@ name = "object" version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d3b63360ec3cb337817c2dbd47ab4a0f170d285d8e5a2064600f3def1402397" + +[[package]] +name = "object" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9a7ab5d64814df0fe4a4b5ead45ed6c5f181ee3ff04ba344313a6c80446c5d4" dependencies = [ "crc32fast", "indexmap", @@ -4604,7 +4757,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-support", "frame-system", @@ -4620,7 +4773,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-support", "frame-system", @@ -4635,7 +4788,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-benchmarking", "frame-support", @@ -4659,7 +4812,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-benchmarking", "frame-support", @@ -4674,7 +4827,7 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "0.1.0" -source = "git+https://github.com/paritytech/grandpa-bridge-gadget?branch=master#036215fa1eb18d531cfdb202bcbe57617a6100f9" +source = "git+https://github.com/paritytech/grandpa-bridge-gadget?branch=master#470bc3635a03579d48404f9d3f754608ee20ba1c" dependencies = [ "beefy-primitives", "frame-support", @@ -4689,7 +4842,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-support", "frame-system", @@ -4703,7 +4856,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-support", "frame-system", @@ -4719,7 +4872,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-benchmarking", "frame-support", @@ -4734,7 +4887,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-election-provider-support", "frame-support", @@ -4753,7 +4906,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-support", "frame-system", @@ -4768,7 +4921,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-benchmarking", "frame-support", @@ -4790,7 +4943,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "enumflags2", "frame-benchmarking", @@ -4806,7 +4959,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-support", "frame-system", @@ -4825,7 +4978,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-support", "frame-system", @@ -4841,7 +4994,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-support", "frame-system", @@ -4855,7 +5008,7 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "ckb-merkle-mountain-range", "frame-benchmarking", @@ -4873,7 +5026,7 @@ dependencies = [ [[package]] name = "pallet-mmr-primitives" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-support", "frame-system", @@ -4889,7 +5042,7 @@ dependencies = [ [[package]] name = "pallet-mmr-rpc" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -4907,7 +5060,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-support", "frame-system", @@ -4922,7 +5075,7 @@ dependencies = [ [[package]] name = "pallet-nicks" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-support", "frame-system", @@ -4936,7 +5089,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-support", "frame-system", @@ -4952,7 +5105,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-support", "frame-system", @@ -4967,7 +5120,7 @@ dependencies = [ [[package]] name = "pallet-randomness-collective-flip" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-support", "frame-system", @@ -4980,7 +5133,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "enumflags2", "frame-support", @@ -4995,7 +5148,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-benchmarking", "frame-support", @@ -5011,7 +5164,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-support", "frame-system", @@ -5031,7 +5184,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-support", "frame-system", @@ -5045,7 +5198,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-election-provider-support", "frame-support", @@ -5067,7 +5220,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "proc-macro-crate 1.0.0", "proc-macro2 1.0.26", @@ -5078,7 +5231,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-support", "frame-system", @@ -5092,7 +5245,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-benchmarking", "frame-support", @@ -5110,7 +5263,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-support", "frame-system", @@ -5124,7 +5277,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-support", "frame-system", @@ -5140,7 +5293,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -5157,7 +5310,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -5168,7 +5321,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-support", "frame-system", @@ -5183,7 +5336,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-support", "frame-system", @@ -5198,7 +5351,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "enumflags2", "frame-support", @@ -5209,6 +5362,20 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-xcm" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" +dependencies = [ + "frame-support", + "frame-system", + "parity-scale-codec", + "serde", + "sp-runtime", + "sp-std", + "xcm", +] + [[package]] name = "parachain-info" version = "0.1.0" @@ -5257,11 +5424,11 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75c823fdae1bb5ff5708ee61a62697e6296175dc671710876871c853f48592b3" +checksum = "731f4d179ed52b1c7eeb29baf29c604ea9301b889b23ce93660220a5465d5c6f" dependencies = [ - "arrayvec 0.5.2", + "arrayvec 0.7.0", "bitvec", "byte-slice-cast", "parity-scale-codec-derive", @@ -5270,9 +5437,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9029e65297c7fd6d7013f0579e193ec2b34ae78eabca854c9417504ad8a2d214" +checksum = "f44c5f94427bd0b5076e8f7e15ca3f60a4d8ac0077e4793884e6fdfd8915344e" dependencies = [ "proc-macro-crate 0.1.5", "proc-macro2 1.0.26", @@ -5665,9 +5832,9 @@ checksum = "989d43012e2ca1c4a02507c67282691a0a3207f9dc67cec596b43fe925b3d325" [[package]] name = "polkadot-approval-distribution" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "polkadot-node-network-protocol", "polkadot-node-primitives", "polkadot-node-subsystem", @@ -5679,9 +5846,9 @@ dependencies = [ [[package]] name = "polkadot-availability-bitfield-distribution" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "parity-scale-codec", "polkadot-node-network-protocol", "polkadot-node-subsystem", @@ -5693,9 +5860,9 @@ dependencies = [ [[package]] name = "polkadot-availability-distribution" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "lru", "parity-scale-codec", "polkadot-erasure-coding", @@ -5716,9 +5883,9 @@ dependencies = [ [[package]] name = "polkadot-availability-recovery" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "lru", "parity-scale-codec", "polkadot-erasure-coding", @@ -5735,12 +5902,12 @@ dependencies = [ [[package]] name = "polkadot-cli" version = "0.8.30" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "frame-benchmarking-cli", - "futures 0.3.13", + "futures 0.3.14", "log", - "polkadot-parachain", + "polkadot-node-core-pvf", "polkadot-service", "sc-cli", "sc-service", @@ -5755,10 +5922,10 @@ dependencies = [ [[package]] name = "polkadot-collator-protocol" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "always-assert", - "futures 0.3.13", + "futures 0.3.14", "futures-timer 3.0.2", "polkadot-node-network-protocol", "polkadot-node-primitives", @@ -5766,6 +5933,7 @@ dependencies = [ "polkadot-node-subsystem-util", "polkadot-primitives", "sp-core", + "sp-keystore", "sp-runtime", "thiserror", "tracing", @@ -5774,7 +5942,7 @@ dependencies = [ [[package]] name = "polkadot-core-primitives" version = "0.8.30" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "parity-scale-codec", "parity-util-mem", @@ -5786,7 +5954,7 @@ dependencies = [ [[package]] name = "polkadot-erasure-coding" version = "0.8.30" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "parity-scale-codec", "polkadot-node-primitives", @@ -5800,9 +5968,9 @@ dependencies = [ [[package]] name = "polkadot-gossip-support" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "polkadot-node-network-protocol", "polkadot-node-subsystem", "polkadot-node-subsystem-util", @@ -5815,14 +5983,15 @@ dependencies = [ [[package]] name = "polkadot-network-bridge" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "async-trait", - "futures 0.3.13", + "futures 0.3.14", "parity-scale-codec", "parking_lot 0.11.1", "polkadot-node-network-protocol", "polkadot-node-subsystem", + "polkadot-node-subsystem-util", "polkadot-primitives", "sc-authority-discovery", "sc-network", @@ -5834,15 +6003,17 @@ dependencies = [ [[package]] name = "polkadot-node-collation-generation" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", + "parity-scale-codec", "polkadot-erasure-coding", "polkadot-node-primitives", "polkadot-node-subsystem", "polkadot-node-subsystem-util", "polkadot-primitives", "sp-core", + "sp-maybe-compressed-blob", "thiserror", "tracing", ] @@ -5850,11 +6021,11 @@ dependencies = [ [[package]] name = "polkadot-node-core-approval-voting" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "bitvec", "derive_more 0.99.11", - "futures 0.3.13", + "futures 0.3.14", "futures-timer 3.0.2", "kvdb", "merlin", @@ -5879,10 +6050,10 @@ dependencies = [ [[package]] name = "polkadot-node-core-av-store" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "bitvec", - "futures 0.3.13", + "futures 0.3.14", "futures-timer 3.0.2", "kvdb", "parity-scale-codec", @@ -5899,10 +6070,10 @@ dependencies = [ [[package]] name = "polkadot-node-core-backing" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "bitvec", - "futures 0.3.13", + "futures 0.3.14", "polkadot-erasure-coding", "polkadot-node-primitives", "polkadot-node-subsystem", @@ -5917,9 +6088,9 @@ dependencies = [ [[package]] name = "polkadot-node-core-bitfield-signing" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "polkadot-node-subsystem", "polkadot-node-subsystem-util", "polkadot-primitives", @@ -5932,9 +6103,9 @@ dependencies = [ [[package]] name = "polkadot-node-core-candidate-selection" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "polkadot-node-primitives", "polkadot-node-subsystem", "polkadot-node-subsystem-util", @@ -5947,25 +6118,27 @@ dependencies = [ [[package]] name = "polkadot-node-core-candidate-validation" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ - "futures 0.3.13", + "async-trait", + "futures 0.3.14", "parity-scale-codec", + "polkadot-node-core-pvf", "polkadot-node-primitives", "polkadot-node-subsystem", "polkadot-node-subsystem-util", "polkadot-parachain", "polkadot-primitives", - "sp-core", + "sp-maybe-compressed-blob", "tracing", ] [[package]] name = "polkadot-node-core-chain-api" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "polkadot-node-subsystem", "polkadot-node-subsystem-util", "polkadot-primitives", @@ -5976,9 +6149,9 @@ dependencies = [ [[package]] name = "polkadot-node-core-proposer" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "futures-timer 3.0.2", "polkadot-node-subsystem", "polkadot-overseer", @@ -6001,10 +6174,10 @@ dependencies = [ [[package]] name = "polkadot-node-core-provisioner" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "bitvec", - "futures 0.3.13", + "futures 0.3.14", "futures-timer 3.0.2", "polkadot-node-subsystem", "polkadot-node-subsystem-util", @@ -6013,12 +6186,40 @@ dependencies = [ "tracing", ] +[[package]] +name = "polkadot-node-core-pvf" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" +dependencies = [ + "always-assert", + "assert_matches", + "async-process", + "async-std", + "futures 0.3.14", + "futures-timer 3.0.2", + "libc", + "parity-scale-codec", + "pin-project 1.0.4", + "polkadot-core-primitives", + "polkadot-parachain", + "rand 0.8.3", + "sc-executor", + "sc-executor-common", + "sc-executor-wasmtime", + "slotmap", + "sp-core", + "sp-externalities", + "sp-io", + "sp-wasm-interface", + "tracing", +] + [[package]] name = "polkadot-node-core-runtime-api" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "memory-lru", "parity-util-mem", "polkadot-node-subsystem", @@ -6034,7 +6235,7 @@ dependencies = [ [[package]] name = "polkadot-node-jaeger" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "async-std", "lazy_static", @@ -6052,9 +6253,9 @@ dependencies = [ [[package]] name = "polkadot-node-network-protocol" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "parity-scale-codec", "polkadot-node-jaeger", "polkadot-node-primitives", @@ -6067,9 +6268,9 @@ dependencies = [ [[package]] name = "polkadot-node-primitives" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "parity-scale-codec", "polkadot-parachain", "polkadot-primitives", @@ -6080,6 +6281,7 @@ dependencies = [ "sp-consensus-babe", "sp-consensus-vrf", "sp-core", + "sp-maybe-compressed-blob", "sp-runtime", "thiserror", "zstd", @@ -6088,12 +6290,12 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "async-std", "async-trait", "derive_more 0.99.11", - "futures 0.3.13", + "futures 0.3.14", "futures-timer 3.0.2", "lazy_static", "log", @@ -6118,10 +6320,10 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-test-helpers" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "async-trait", - "futures 0.3.13", + "futures 0.3.14", "futures-timer 3.0.2", "parity-scale-codec", "parking_lot 0.11.1", @@ -6140,10 +6342,10 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-util" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "async-trait", - "futures 0.3.13", + "futures 0.3.14", "futures-timer 3.0.2", "metered-channel", "parity-scale-codec", @@ -6167,50 +6369,39 @@ dependencies = [ [[package]] name = "polkadot-overseer" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "async-trait", - "futures 0.3.13", + "futures 0.3.14", "futures-timer 3.0.2", "polkadot-node-primitives", "polkadot-node-subsystem", "polkadot-node-subsystem-util", "polkadot-primitives", "sc-client-api", + "sp-api", "tracing", ] [[package]] name = "polkadot-parachain" version = "0.8.30" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "derive_more 0.99.11", - "futures 0.3.13", - "libc", - "log", "parity-scale-codec", "parity-util-mem", - "parking_lot 0.11.1", "polkadot-core-primitives", - "raw_sync", - "sc-executor", "serde", - "shared_memory", "sp-core", - "sp-externalities", - "sp-io", "sp-runtime", "sp-std", - "sp-wasm-interface", - "static_assertions", - "thiserror", ] [[package]] name = "polkadot-primitives" version = "0.8.30" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "bitvec", "frame-system", @@ -6239,7 +6430,7 @@ dependencies = [ [[package]] name = "polkadot-procmacro-subsystem-dispatch-gen" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "assert_matches", "proc-macro2 1.0.26", @@ -6250,7 +6441,7 @@ dependencies = [ [[package]] name = "polkadot-rpc" version = "0.8.30" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "beefy-gadget", "beefy-gadget-rpc", @@ -6283,7 +6474,7 @@ dependencies = [ [[package]] name = "polkadot-runtime" version = "0.8.30" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "beefy-primitives", "bitvec", @@ -6353,7 +6544,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-common" version = "0.8.30" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "beefy-primitives", "bitvec", @@ -6379,6 +6570,7 @@ dependencies = [ "rustc-hex", "serde", "serde_derive", + "slot-range-helper", "sp-api", "sp-core", "sp-inherents", @@ -6394,7 +6586,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-parachains" version = "0.8.30" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "bitvec", "derive_more 0.99.11", @@ -6431,13 +6623,13 @@ dependencies = [ [[package]] name = "polkadot-service" version = "0.8.30" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "beefy-gadget", "beefy-primitives", "frame-benchmarking", "frame-system-rpc-runtime-api", - "futures 0.3.13", + "futures 0.3.14", "hex-literal 0.3.1", "kusama-runtime", "kvdb", @@ -6520,16 +6712,18 @@ dependencies = [ [[package]] name = "polkadot-statement-distribution" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "arrayvec 0.5.2", - "futures 0.3.13", + "futures 0.3.14", "indexmap", + "parity-scale-codec", "polkadot-node-network-protocol", "polkadot-node-primitives", "polkadot-node-subsystem", "polkadot-node-subsystem-util", "polkadot-primitives", + "sc-network", "sp-staking", "tracing", ] @@ -6537,7 +6731,7 @@ dependencies = [ [[package]] name = "polkadot-statement-table" version = "0.8.30" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "parity-scale-codec", "polkadot-primitives", @@ -6547,7 +6741,7 @@ dependencies = [ [[package]] name = "polkadot-test-client" version = "0.8.30" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "parity-scale-codec", "polkadot-node-subsystem", @@ -6572,7 +6766,7 @@ dependencies = [ [[package]] name = "polkadot-test-runtime" version = "0.8.30" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "beefy-primitives", "bitvec", @@ -6629,12 +6823,12 @@ dependencies = [ [[package]] name = "polkadot-test-service" version = "0.8.30" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "frame-benchmarking", "frame-system", "futures 0.1.30", - "futures 0.3.13", + "futures 0.3.14", "hex", "pallet-balances", "pallet-staking", @@ -7191,30 +7385,6 @@ dependencies = [ "rand_core 0.3.1", ] -[[package]] -name = "raw-cpuid" -version = "8.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fdf7d9dbd43f3d81d94a49c1c3df73cc2b3827995147e6cf7f89d4ec5483e73" -dependencies = [ - "bitflags", - "cc", - "rustc_version", -] - -[[package]] -name = "raw_sync" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a34bde3561f980a51c70495164200569a11662644fe5af017f0b5d7015688cc" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "nix", - "rand 0.8.3", - "winapi 0.3.9", -] - [[package]] name = "rawpointer" version = "0.2.1" @@ -7332,6 +7502,7 @@ checksum = "571f7f397d61c4755285cd37853fe8e03271c243424a907415909379659381c5" dependencies = [ "log", "rustc-hash", + "serde", "smallvec 1.6.1", ] @@ -7378,7 +7549,7 @@ dependencies = [ [[package]] name = "remote-externalities" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "env_logger 0.8.3", "hex-literal 0.3.1", @@ -7463,10 +7634,11 @@ dependencies = [ "cumulus-client-network", "cumulus-client-service", "cumulus-primitives-core", + "cumulus-shell-runtime", "cumulus-test-parachain-runtime", "derive_more 0.15.0", "exit-future 0.1.4", - "futures 0.3.13", + "futures 0.3.14", "hex-literal 0.2.1", "jsonrpc-core", "log", @@ -7530,7 +7702,7 @@ dependencies = [ [[package]] name = "rococo-runtime" version = "0.8.30" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "beefy-primitives", "frame-executive", @@ -7544,9 +7716,11 @@ dependencies = [ "pallet-babe", "pallet-balances", "pallet-beefy", + "pallet-collective", "pallet-grandpa", "pallet-im-online", "pallet-indices", + "pallet-membership", "pallet-mmr", "pallet-mmr-primitives", "pallet-offences", @@ -7559,6 +7733,7 @@ dependencies = [ "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", "pallet-utility", + "pallet-xcm", "parity-scale-codec", "polkadot-parachain", "polkadot-primitives", @@ -7674,13 +7849,23 @@ dependencies = [ "security-framework", ] +[[package]] +name = "ruzstd" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d425143485a37727c7a46e689bbe3b883a00f42b4a52c4ac0f44855c1009b00" +dependencies = [ + "byteorder", + "twox-hash", +] + [[package]] name = "rw-stream-sink" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4da5fcb054c46f5a5dff833b129285a93d3f0179531735e6c866e8cc307d2020" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "pin-project 0.4.27", "static_assertions", ] @@ -7721,12 +7906,12 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "async-trait", "derive_more 0.99.11", "either", - "futures 0.3.13", + "futures 0.3.14", "futures-timer 3.0.2", "libp2p", "log", @@ -7749,9 +7934,9 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "futures-timer 3.0.2", "log", "parity-scale-codec", @@ -7772,7 +7957,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -7788,7 +7973,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -7809,7 +7994,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "proc-macro-crate 1.0.0", "proc-macro2 1.0.26", @@ -7820,11 +8005,11 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "chrono", "fdlimit", - "futures 0.3.13", + "futures 0.3.14", "hex", "libp2p", "log", @@ -7858,11 +8043,11 @@ dependencies = [ [[package]] name = "sc-client-api" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "derive_more 0.99.11", "fnv", - "futures 0.3.13", + "futures 0.3.14", "hash-db", "kvdb", "lazy_static", @@ -7892,7 +8077,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "blake2-rfc", "hash-db", @@ -7922,7 +8107,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "parking_lot 0.11.1", "sc-client-api", @@ -7934,12 +8119,12 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "async-trait", "derive_more 0.99.11", "fork-tree", - "futures 0.3.13", + "futures 0.3.14", "futures-timer 3.0.2", "log", "merlin", @@ -7981,10 +8166,10 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "derive_more 0.99.11", - "futures 0.3.13", + "futures 0.3.14", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", @@ -8005,7 +8190,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "fork-tree", "parity-scale-codec", @@ -8018,10 +8203,10 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "async-trait", - "futures 0.3.13", + "futures 0.3.14", "futures-timer 3.0.2", "log", "parity-scale-codec", @@ -8045,7 +8230,7 @@ dependencies = [ [[package]] name = "sc-consensus-uncles" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "log", "sc-client-api", @@ -8059,7 +8244,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "derive_more 0.99.11", "lazy_static", @@ -8075,6 +8260,7 @@ dependencies = [ "sp-core", "sp-externalities", "sp-io", + "sp-maybe-compressed-blob", "sp-panic-handler", "sp-runtime-interface", "sp-serializer", @@ -8088,11 +8274,12 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "derive_more 0.99.11", "parity-scale-codec", "parity-wasm 0.41.0", + "pwasm-utils", "sp-allocator", "sp-core", "sp-serializer", @@ -8104,7 +8291,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "log", "parity-scale-codec", @@ -8119,7 +8306,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "log", "parity-scale-codec", @@ -8137,14 +8324,14 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "async-trait", "derive_more 0.99.11", "dyn-clone", "finality-grandpa", "fork-tree", - "futures 0.3.13", + "futures 0.3.14", "futures-timer 3.0.2", "linked-hash-map", "log", @@ -8177,11 +8364,11 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "derive_more 0.99.11", "finality-grandpa", - "futures 0.3.13", + "futures 0.3.14", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", @@ -8201,10 +8388,10 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-warp-sync" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "derive_more 0.99.11", - "futures 0.3.13", + "futures 0.3.14", "log", "num-traits", "parity-scale-codec", @@ -8222,10 +8409,10 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "ansi_term 0.12.1", - "futures 0.3.13", + "futures 0.3.14", "log", "parity-util-mem", "sc-client-api", @@ -8240,11 +8427,11 @@ dependencies = [ [[package]] name = "sc-keystore" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "async-trait", "derive_more 0.99.11", - "futures 0.3.13", + "futures 0.3.14", "futures-util", "hex", "merlin", @@ -8260,7 +8447,7 @@ dependencies = [ [[package]] name = "sc-light" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "hash-db", "lazy_static", @@ -8279,7 +8466,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "async-std", "async-trait", @@ -8293,7 +8480,7 @@ dependencies = [ "erased-serde", "fnv", "fork-tree", - "futures 0.3.13", + "futures 0.3.14", "futures-timer 3.0.2", "hex", "ip_network", @@ -8332,9 +8519,9 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "futures-timer 3.0.2", "libp2p", "log", @@ -8349,11 +8536,11 @@ dependencies = [ [[package]] name = "sc-offchain" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "bytes 0.5.6", "fnv", - "futures 0.3.13", + "futures 0.3.14", "futures-timer 3.0.2", "hex", "hyper 0.13.9", @@ -8377,9 +8564,9 @@ dependencies = [ [[package]] name = "sc-peerset" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "libp2p", "log", "serde_json", @@ -8390,7 +8577,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -8399,9 +8586,9 @@ dependencies = [ [[package]] name = "sc-rpc" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "hash-db", "jsonrpc-core", "jsonrpc-pubsub", @@ -8433,10 +8620,10 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "derive_more 0.99.11", - "futures 0.3.13", + "futures 0.3.14", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", @@ -8457,7 +8644,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "futures 0.1.30", "jsonrpc-core", @@ -8475,13 +8662,13 @@ dependencies = [ [[package]] name = "sc-service" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "async-trait", "directories", "exit-future 0.2.0", "futures 0.1.30", - "futures 0.3.13", + "futures 0.3.14", "futures-timer 3.0.2", "hash-db", "jsonrpc-core", @@ -8539,7 +8726,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "log", "parity-scale-codec", @@ -8554,7 +8741,7 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -8574,10 +8761,10 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "chrono", - "futures 0.3.13", + "futures 0.3.14", "libp2p", "log", "parking_lot 0.11.1", @@ -8594,7 +8781,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "ansi_term 0.12.1", "atty", @@ -8621,7 +8808,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "proc-macro-crate 1.0.0", "proc-macro2 1.0.26", @@ -8632,10 +8819,10 @@ dependencies = [ [[package]] name = "sc-transaction-graph" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "derive_more 0.99.11", - "futures 0.3.13", + "futures 0.3.14", "linked-hash-map", "log", "parity-util-mem", @@ -8654,9 +8841,9 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "futures-diagnose", "intervalier", "log", @@ -8933,20 +9120,6 @@ dependencies = [ "loom", ] -[[package]] -name = "shared_memory" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b854a362375dfe8ab12ea8a98228040d37293c988f85fbac9fa0f83336387966" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "nix", - "quick-error 2.0.0", - "rand 0.8.3", - "winapi 0.3.9", -] - [[package]] name = "shlex" version = "0.1.1" @@ -8996,6 +9169,27 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" +[[package]] +name = "slot-range-helper" +version = "0.8.30" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" +dependencies = [ + "enumn", + "parity-scale-codec", + "paste 1.0.4", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "slotmap" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "585cd5dffe4e9e06f6dfdf66708b70aca3f781bed561f4f667b2d9c0d4559e36" +dependencies = [ + "version_check", +] + [[package]] name = "smallvec" version = "0.6.13" @@ -9059,7 +9253,7 @@ dependencies = [ "base64 0.12.3", "bytes 0.5.6", "flate2", - "futures 0.3.13", + "futures 0.3.14", "httparse", "log", "rand 0.7.3", @@ -9069,7 +9263,7 @@ dependencies = [ [[package]] name = "sp-allocator" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "log", "sp-core", @@ -9081,7 +9275,7 @@ dependencies = [ [[package]] name = "sp-api" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "hash-db", "log", @@ -9098,7 +9292,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "blake2-rfc", "proc-macro-crate 1.0.0", @@ -9110,7 +9304,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "parity-scale-codec", "serde", @@ -9122,7 +9316,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "integer-sqrt", "num-traits", @@ -9130,12 +9324,13 @@ dependencies = [ "serde", "sp-debug-derive", "sp-std", + "static_assertions", ] [[package]] name = "sp-authority-discovery" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "parity-scale-codec", "sp-api", @@ -9147,7 +9342,7 @@ dependencies = [ [[package]] name = "sp-authorship" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -9158,7 +9353,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "parity-scale-codec", "sp-api", @@ -9170,9 +9365,9 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "log", "lru", "parity-scale-codec", @@ -9188,7 +9383,7 @@ dependencies = [ [[package]] name = "sp-chain-spec" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "serde", "serde_json", @@ -9197,10 +9392,10 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "async-trait", - "futures 0.3.13", + "futures 0.3.14", "futures-timer 3.0.2", "libp2p", "log", @@ -9224,7 +9419,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "parity-scale-codec", "sp-api", @@ -9240,7 +9435,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "merlin", "parity-scale-codec", @@ -9261,7 +9456,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "parity-scale-codec", "sp-arithmetic", @@ -9271,7 +9466,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "parity-scale-codec", "schnorrkel", @@ -9283,14 +9478,14 @@ dependencies = [ [[package]] name = "sp-core" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "base58", "blake2-rfc", "byteorder", "dyn-clonable", "ed25519-dalek", - "futures 0.3.13", + "futures 0.3.14", "hash-db", "hash256-std-hasher", "hex", @@ -9327,7 +9522,7 @@ dependencies = [ [[package]] name = "sp-database" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "kvdb", "parking_lot 0.11.1", @@ -9336,7 +9531,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "proc-macro2 1.0.26", "quote 1.0.9", @@ -9346,7 +9541,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "environmental", "parity-scale-codec", @@ -9357,7 +9552,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "finality-grandpa", "log", @@ -9374,7 +9569,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "parity-scale-codec", "parking_lot 0.11.1", @@ -9386,9 +9581,9 @@ dependencies = [ [[package]] name = "sp-io" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "hash-db", "libsecp256k1", "log", @@ -9410,7 +9605,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "lazy_static", "sp-core", @@ -9421,11 +9616,11 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "async-trait", "derive_more 0.99.11", - "futures 0.3.13", + "futures 0.3.14", "merlin", "parity-scale-codec", "parking_lot 0.11.1", @@ -9435,10 +9630,19 @@ dependencies = [ "sp-externalities", ] +[[package]] +name = "sp-maybe-compressed-blob" +version = "3.0.0" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" +dependencies = [ + "ruzstd", + "zstd", +] + [[package]] name = "sp-npos-elections" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "parity-scale-codec", "serde", @@ -9451,7 +9655,7 @@ dependencies = [ [[package]] name = "sp-npos-elections-compact" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "proc-macro-crate 1.0.0", "proc-macro2 1.0.26", @@ -9462,7 +9666,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "sp-api", "sp-core", @@ -9472,7 +9676,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "backtrace", ] @@ -9480,7 +9684,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "serde", "sp-core", @@ -9489,7 +9693,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "either", "hash256-std-hasher", @@ -9510,7 +9714,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -9527,7 +9731,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "Inflector", "proc-macro-crate 1.0.0", @@ -9539,7 +9743,7 @@ dependencies = [ [[package]] name = "sp-serializer" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "serde", "serde_json", @@ -9548,7 +9752,7 @@ dependencies = [ [[package]] name = "sp-session" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "parity-scale-codec", "sp-api", @@ -9561,7 +9765,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -9571,7 +9775,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "hash-db", "log", @@ -9593,12 +9797,12 @@ dependencies = [ [[package]] name = "sp-std" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" [[package]] name = "sp-storage" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "impl-serde", "parity-scale-codec", @@ -9611,7 +9815,7 @@ dependencies = [ [[package]] name = "sp-tasks" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "log", "sp-core", @@ -9624,7 +9828,7 @@ dependencies = [ [[package]] name = "sp-test-primitives" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "parity-scale-codec", "parity-util-mem", @@ -9637,7 +9841,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "parity-scale-codec", "sp-api", @@ -9650,7 +9854,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "log", "parity-scale-codec", @@ -9663,10 +9867,10 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "derive_more 0.99.11", - "futures 0.3.13", + "futures 0.3.14", "log", "parity-scale-codec", "serde", @@ -9679,7 +9883,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "hash-db", "memory-db", @@ -9693,9 +9897,9 @@ dependencies = [ [[package]] name = "sp-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "futures-core", "futures-timer 3.0.2", "lazy_static", @@ -9705,7 +9909,7 @@ dependencies = [ [[package]] name = "sp-version" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "impl-serde", "parity-scale-codec", @@ -9717,7 +9921,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -9875,7 +10079,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "platforms", ] @@ -9883,10 +10087,10 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-system-rpc-runtime-api", - "futures 0.3.13", + "futures 0.3.14", "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", @@ -9906,7 +10110,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "async-std", "derive_more 0.99.11", @@ -9920,11 +10124,11 @@ dependencies = [ [[package]] name = "substrate-test-client" version = "2.0.1" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "async-trait", "futures 0.1.30", - "futures 0.3.13", + "futures 0.3.14", "hash-db", "hex", "parity-scale-codec", @@ -9949,7 +10153,7 @@ dependencies = [ [[package]] name = "substrate-test-runtime" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "cfg-if 1.0.0", "frame-support", @@ -9990,9 +10194,9 @@ dependencies = [ [[package]] name = "substrate-test-runtime-client" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "parity-scale-codec", "sc-block-builder", "sc-client-api", @@ -10011,9 +10215,9 @@ dependencies = [ [[package]] name = "substrate-test-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "substrate-test-utils-derive", "tokio 0.2.24", ] @@ -10021,7 +10225,7 @@ dependencies = [ [[package]] name = "substrate-test-utils-derive" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "proc-macro-crate 1.0.0", "quote 1.0.9", @@ -10047,12 +10251,13 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "ansi_term 0.12.1", "atty", "build-helper", "cargo_metadata", + "sp-maybe-compressed-blob", "tempfile", "toml", "walkdir", @@ -10724,7 +10929,7 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "try-runtime-cli" version = "0.9.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3dc169d526c12687944ffcd3d3c3b0adf4332db3" +source = "git+https://github.com/paritytech/substrate?branch=master#565078a965698c425cd909db55abb3b381e27701" dependencies = [ "frame-try-runtime", "log", @@ -11079,7 +11284,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "js-sys", "parking_lot 0.11.1", "pin-utils", @@ -11113,15 +11318,15 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.71.0" +version = "0.76.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89a30c99437829ede826802bfcf28500cf58df00e66cb9114df98813bc145ff1" +checksum = "755a9a4afe3f6cccbbe6d7e965eef44cf260b001f93e547eba84255c1d0187d8" [[package]] name = "wasmtime" -version = "0.22.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7426055cb92bd9a1e9469b48154d8d6119cd8c498c8b70284e420342c05dc45d" +checksum = "718cb52a9fdb7ab12471e9b9d051c9adfa6b5c504e0a1fea045e5eabc81eedd9" dependencies = [ "anyhow", "backtrace", @@ -11131,6 +11336,7 @@ dependencies = [ "indexmap", "libc", "log", + "paste 1.0.4", "region", "rustc-demangle", "serde", @@ -11139,6 +11345,7 @@ dependencies = [ "wasmparser", "wasmtime-cache", "wasmtime-environ", + "wasmtime-fiber", "wasmtime-jit", "wasmtime-profiling", "wasmtime-runtime", @@ -11148,9 +11355,9 @@ dependencies = [ [[package]] name = "wasmtime-cache" -version = "0.22.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c01d9287e36921e46f5887a47007824ae5dbb9b7517a2d565660ab4471478709" +checksum = "1f984df56c4adeba91540f9052db9f7a8b3b00cfaac1a023bee50a972f588b0c" dependencies = [ "anyhow", "base64 0.13.0", @@ -11169,27 +11376,28 @@ dependencies = [ [[package]] name = "wasmtime-cranelift" -version = "0.22.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4134ed3a4316cd0de0e546c6004850afe472b0fa3fcdc2f2c15f8d449562d962" +checksum = "2a05abbf94e03c2c8ee02254b1949320c4d45093de5d9d6ed4d9351d536075c9" dependencies = [ "cranelift-codegen", "cranelift-entity", "cranelift-frontend", "cranelift-wasm", + "wasmparser", "wasmtime-environ", ] [[package]] name = "wasmtime-debug" -version = "0.22.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91fa931df6dd8af2b02606307674d3bad23f55473d5f4c809dddf7e4c4dc411" +checksum = "382eecd6281c6c1d1f3c904c3c143e671fc1a9573820cbfa777fba45ce2eda9c" dependencies = [ "anyhow", "gimli", "more-asserts", - "object", + "object 0.23.0", "target-lexicon", "thiserror", "wasmparser", @@ -11198,9 +11406,9 @@ dependencies = [ [[package]] name = "wasmtime-environ" -version = "0.22.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1098871dc3120aaf8190d79153e470658bb79f63ee9ca31716711e123c28220" +checksum = "81011b2b833663d7e0ce34639459a0e301e000fc7331e0298b3a27c78d0cec60" dependencies = [ "anyhow", "cfg-if 1.0.0", @@ -11217,10 +11425,21 @@ dependencies = [ ] [[package]] -name = "wasmtime-jit" -version = "0.22.0" +name = "wasmtime-fiber" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "738bfcd1561ede8bb174215776fd7d9a95d5f0a47ca3deabe0282c55f9a89f68" +checksum = "d92da32e31af2e3d828f485f5f24651ed4d3b7f03a46ea6555eae6940d1402cd" +dependencies = [ + "cc", + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "wasmtime-jit" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b5f649623859a12d361fe4cc4793de44f7c3ff34c322c5714289787e89650bb" dependencies = [ "addr2line", "anyhow", @@ -11233,7 +11452,7 @@ dependencies = [ "gimli", "log", "more-asserts", - "object", + "object 0.23.0", "rayon", "region", "serde", @@ -11251,13 +11470,13 @@ dependencies = [ [[package]] name = "wasmtime-obj" -version = "0.22.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e96d77f1801131c5e86d93e42a3cf8a35402107332c202c245c83f34888a906" +checksum = "ef2e99cd9858f57fd062e9351e07881cedfc8597928385e02a48d9333b9e15a1" dependencies = [ "anyhow", "more-asserts", - "object", + "object 0.23.0", "target-lexicon", "wasmtime-debug", "wasmtime-environ", @@ -11265,16 +11484,16 @@ dependencies = [ [[package]] name = "wasmtime-profiling" -version = "0.22.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60bb672c9d894776d7b9250dd9b4fe890f8760201ee4f53e5f2da772b6c4debb" +checksum = "e46c0a590e49278ba7f79ef217af9db4ecc671b50042c185093e22d73524abb2" dependencies = [ "anyhow", "cfg-if 1.0.0", "gimli", "lazy_static", "libc", - "object", + "object 0.23.0", "scroll", "serde", "target-lexicon", @@ -11284,9 +11503,9 @@ dependencies = [ [[package]] name = "wasmtime-runtime" -version = "0.22.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a978086740949eeedfefcee667b57a9e98d9a7fc0de382fcfa0da30369e3530d" +checksum = "1438a09185fc7ca067caf1a80d7e5b398eefd4fb7630d94841448ade60feb3d0" dependencies = [ "backtrace", "cc", @@ -11306,18 +11525,18 @@ dependencies = [ [[package]] name = "wast" -version = "30.0.0" +version = "35.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b79907b22f740634810e882d8d1d9d0f9563095a8ab94e786e370242bff5cd2" +checksum = "2ef140f1b49946586078353a453a1d28ba90adfc54dde75710bc1931de204d68" dependencies = [ "leb128", ] [[package]] name = "wat" -version = "1.0.31" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8279a02835bf12e61ed2b3c3cbc6ecf9918762fd97e036917c11a09ec20ca44" +checksum = "8ec280a739b69173e0ffd12c1658507996836ba4e992ed9bc1e5385a0bd72a02" dependencies = [ "wast", ] @@ -11363,7 +11582,7 @@ dependencies = [ [[package]] name = "westend-runtime" version = "0.8.30" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "beefy-primitives", "bitvec", @@ -11542,17 +11761,20 @@ dependencies = [ [[package]] name = "xcm" version = "0.8.30" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ + "derivative", + "impl-trait-for-tuples", "parity-scale-codec", ] [[package]] name = "xcm-builder" version = "0.8.30" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "frame-support", + "frame-system", "impl-trait-for-tuples", "parity-scale-codec", "polkadot-parachain", @@ -11567,7 +11789,7 @@ dependencies = [ [[package]] name = "xcm-executor" version = "0.8.30" -source = "git+https://github.com/paritytech/polkadot?branch=master#96dc1f7ab613944f733fb8658dc8b0da18e2b8ea" +source = "git+https://github.com/paritytech/polkadot?branch=master#a208449d69b37a042151a1f44c8155769feba979" dependencies = [ "frame-support", "impl-trait-for-tuples", @@ -11587,7 +11809,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1cc7bd8c983209ed5d527f44b01c41b7dc146fd960c61cf9e1d25399841dc271" dependencies = [ - "futures 0.3.13", + "futures 0.3.14", "log", "nohash-hasher", "parking_lot 0.11.1", @@ -11618,18 +11840,18 @@ dependencies = [ [[package]] name = "zstd" -version = "0.5.4+zstd.1.4.7" +version = "0.6.1+zstd.1.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69996ebdb1ba8b1517f61387a883857818a66c8a295f487b1ffd8fd9d2c82910" +checksum = "5de55e77f798f205d8561b8fe2ef57abfb6e0ff2abe7fd3c089e119cdb5631a3" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "2.0.6+zstd.1.4.7" +version = "3.0.1+zstd.1.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98aa931fb69ecee256d44589d19754e61851ae4769bf963b385119b1cc37a49e" +checksum = "1387cabcd938127b30ce78c4bf00b30387dddf704e3f0881dbc4ff62b5566f8c" dependencies = [ "libc", "zstd-sys", @@ -11637,12 +11859,10 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "1.4.18+zstd.1.4.7" +version = "1.4.20+zstd.1.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1e6e8778706838f43f771d80d37787cb2fe06dafe89dd3aebaf6721b9eaec81" +checksum = "ebd5b733d7cf2d9447e2c3e76a5589b4f5e5ae065c22a2bc0b023cbc331b6c8e" dependencies = [ "cc", - "glob", - "itertools 0.9.0", "libc", ] diff --git a/Cargo.toml b/Cargo.toml index 76ea5518b4..1966e36265 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,17 +6,22 @@ members = [ "client/network", "client/service", "pallets/parachain-system", - "pallets/xcm-handler", + "pallets/xcm", + "pallets/xcmp-queue", "primitives/core", "primitives/parachain-inherent", + "primitives/utility", "rococo-parachains/", "rococo-parachains/pallets/parachain-info", + "rococo-parachains/pallets/ping", "rococo-parachains/primitives", "rococo-parachains/runtime", + "rococo-parachains/shell-runtime", "test/runtime", "test/client", "test/service", "test/relay-sproof-builder", + "test/relay-validation-worker-provider", ] [profile.release] diff --git a/README.md b/README.md index c494f7e6ab..2f3d094751 100644 --- a/README.md +++ b/README.md @@ -82,16 +82,16 @@ chain, and from the relay chain to its destination parachain. git clone https://github.com/paritytech/polkadot git fetch git checkout rococo-v1 -cargo build --release --features=real-overseer +cargo build --release # Generate a raw chain spec -./target/release/polkadot build-spec --chain rococo-local --disable-default-bootnode --raw > rococo-local-cfde-real-overseer.json +./target/release/polkadot build-spec --chain rococo-local --disable-default-bootnode --raw > rococo-local-cfde.json # Alice -./target/release/polkadot --chain rococo-local-cfde-real-overseer.json --alice --tmp +./target/release/polkadot --chain rococo-local-cfde.json --alice --tmp # Bob (In a separate terminal) -./target/release/polkadot --chain rococo-local-cfde-real-overseer.json --bob --tmp --port 30334 +./target/release/polkadot --chain rococo-local-cfde.json --bob --tmp --port 30334 ``` ### Launch the Parachain @@ -111,13 +111,13 @@ cargo build --release ./target/release/rococo-collator export-genesis-wasm > genesis-wasm # Collator1 -./target/release/rococo-collator --collator --tmp --parachain-id --port 40335 --ws-port 9946 -- --execution wasm --chain ../polkadot/rococo-local-cfde-real-overseer.json --port 30335 +./target/release/rococo-collator --collator --tmp --parachain-id --port 40335 --ws-port 9946 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30335 # Collator2 -./target/release/rococo-collator --collator --tmp --parachain-id --port 40336 --ws-port 9947 -- --execution wasm --chain ../polkadot/rococo-local-cfde-real-overseer.json --port 30336 +./target/release/rococo-collator --collator --tmp --parachain-id --port 40336 --ws-port 9947 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30336 # Parachain Full Node 1 -./target/release/rococo-collator --tmp --parachain-id --port 40337 --ws-port 9948 -- --execution wasm --chain ../polkadot/rococo-local-cfde-real-overseer.json --port 30337 +./target/release/rococo-collator --tmp --parachain-id --port 40337 --ws-port 9948 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30337 ``` ### Register the parachain ![image](https://user-images.githubusercontent.com/2915325/99548884-1be13580-2987-11eb-9a8b-20be658d34f9.png) diff --git a/client/collator/src/lib.rs b/client/collator/src/lib.rs index c146e246f3..04d6a0e9f5 100644 --- a/client/collator/src/lib.rs +++ b/client/collator/src/lib.rs @@ -400,10 +400,15 @@ mod tests { use cumulus_test_runtime::{Block, Header}; use futures::{channel::mpsc, executor::block_on, StreamExt}; use polkadot_node_subsystem_test_helpers::ForwardSubsystem; - use polkadot_overseer::{AllSubsystems, Overseer}; + use polkadot_overseer::{AllSubsystems, Overseer, HeadSupportsParachains}; use sp_consensus::BlockOrigin; use sp_core::{testing::TaskExecutor, Pair}; + struct AlwaysSupportsParachains; + impl HeadSupportsParachains for AlwaysSupportsParachains { + fn head_supports_parachains(&self, _head: &PHash) -> bool { true } + } + #[derive(Clone)] struct DummyParachainConsensus { client: Arc, @@ -454,8 +459,13 @@ mod tests { let all_subsystems = AllSubsystems::<()>::dummy().replace_collation_generation(ForwardSubsystem(sub_tx)); - let (overseer, handler) = Overseer::new(Vec::new(), all_subsystems, None, spawner.clone()) - .expect("Creates overseer"); + let (overseer, handler) = Overseer::new( + Vec::new(), + all_subsystems, + None, + AlwaysSupportsParachains, + spawner.clone(), + ).expect("Creates overseer"); spawner.spawn("overseer", overseer.run().then(|_| async { () }).boxed()); diff --git a/client/consensus/relay-chain/Cargo.toml b/client/consensus/relay-chain/Cargo.toml index b02eef9496..ce70fafcbf 100644 --- a/client/consensus/relay-chain/Cargo.toml +++ b/client/consensus/relay-chain/Cargo.toml @@ -18,7 +18,7 @@ sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "mas substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "master" } # Polkadot dependencies -polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "master", features = [ "real-overseer" ] } +polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "master" } # Cumulus dependencies cumulus-client-consensus-common = { path = "../common" } diff --git a/client/network/Cargo.toml b/client/network/Cargo.toml index 987c295c03..f7a9d5a4cd 100644 --- a/client/network/Cargo.toml +++ b/client/network/Cargo.toml @@ -38,7 +38,6 @@ cumulus-primitives-core = { path = "../../primitives/core" } # Polkadot deps polkadot-test-client = { git = "https://github.com/paritytech/polkadot", branch = "master" } -polkadot-test-service = { git = "https://github.com/paritytech/polkadot", branch = "master" } # substrate deps sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/client/network/tests/sync.rs b/client/network/tests/sync.rs index 2f2ff412a0..c102da96f8 100644 --- a/client/network/tests/sync.rs +++ b/client/network/tests/sync.rs @@ -15,7 +15,7 @@ // along with Substrate. If not, see . use cumulus_primitives_core::ParaId; -use cumulus_test_service::{initial_head_data, Keyring::*}; +use cumulus_test_service::{initial_head_data, run_relay_chain_validator_node, Keyring::*}; use futures::join; use sc_service::TaskExecutor; @@ -28,16 +28,11 @@ async fn sync_blocks_from_tip_without_being_connected_to_a_collator(task_executo let para_id = ParaId::from(100); // start alice - let alice = - polkadot_test_service::run_validator_node(task_executor.clone(), Alice, || {}, vec![]); + let alice = run_relay_chain_validator_node(task_executor.clone(), Alice, || {}, vec![]); // start bob - let bob = polkadot_test_service::run_validator_node( - task_executor.clone(), - Bob, - || {}, - vec![alice.addr.clone()], - ); + let bob = + run_relay_chain_validator_node(task_executor.clone(), Bob, || {}, vec![alice.addr.clone()]); // register parachain alice diff --git a/pallets/parachain-system/Cargo.toml b/pallets/parachain-system/Cargo.toml index 2d7896917d..8e3df6f404 100644 --- a/pallets/parachain-system/Cargo.toml +++ b/pallets/parachain-system/Cargo.toml @@ -12,6 +12,7 @@ cumulus-primitives-parachain-inherent = { path = "../../primitives/parachain-inh # Polkadot dependencies polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, features = [ "wasm-api" ], branch = "master" } +xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } # Substrate dependencies frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } @@ -72,4 +73,5 @@ std = [ "cumulus-primitives-core/std", "cumulus-primitives-parachain-inherent/std", "environmental/std", + "xcm/std" ] diff --git a/pallets/parachain-system/src/lib.rs b/pallets/parachain-system/src/lib.rs index 1741acf587..3c52fa4b40 100644 --- a/pallets/parachain-system/src/lib.rs +++ b/pallets/parachain-system/src/lib.rs @@ -27,27 +27,28 @@ //! //! Users must ensure that they register this pallet as an inherent provider. -use cumulus_primitives_core::{ - relay_chain, - well_known_keys::{self, NEW_VALIDATION_CODE}, - AbridgedHostConfiguration, DownwardMessageHandler, HrmpMessageHandler, HrmpMessageSender, - InboundDownwardMessage, InboundHrmpMessage, OnValidationData, OutboundHrmpMessage, ParaId, - PersistedValidationData, UpwardMessage, UpwardMessageSender, -}; -use cumulus_primitives_parachain_inherent::ParachainInherentData; +use sp_std::{prelude::*, cmp, collections::btree_map::BTreeMap}; +use sp_runtime::traits::{BlakeTwo256, Hash}; +use sp_inherents::{InherentData, InherentIdentifier, ProvideInherent}; use frame_support::{ decl_error, decl_event, decl_module, decl_storage, - dispatch::DispatchResult, + dispatch::{DispatchResult, DispatchError, DispatchResultWithPostInfo}, ensure, storage, traits::Get, - weights::{DispatchClass, Weight}, + weights::{DispatchClass, Weight, PostDispatchInfo, Pays}, }; use frame_system::{ensure_none, ensure_root}; use polkadot_parachain::primitives::RelayChainBlockNumber; +use cumulus_primitives_core::{ + relay_chain, + well_known_keys::{self, NEW_VALIDATION_CODE}, + AbridgedHostConfiguration, DownwardMessageHandler, XcmpMessageHandler, + InboundDownwardMessage, InboundHrmpMessage, OnValidationData, OutboundHrmpMessage, ParaId, + PersistedValidationData, UpwardMessage, UpwardMessageSender, MessageSendError, + XcmpMessageSource, ChannelStatus, GetChannelInfo, +}; +use cumulus_primitives_parachain_inherent::ParachainInherentData; use relay_state_snapshot::MessagingStateSnapshot; -use sp_inherents::{InherentData, InherentIdentifier, ProvideInherent}; -use sp_runtime::traits::{BlakeTwo256, Hash}; -use sp_std::{cmp, collections::btree_map::BTreeMap, vec::Vec}; mod relay_state_snapshot; #[macro_use] @@ -56,7 +57,7 @@ pub mod validate_block; /// The pallet's configuration trait. pub trait Config: frame_system::Config> { /// The overarching event type. - type Event: From + Into<::Event>; + type Event: From> + Into<::Event>; /// Something which can be notified when the validation data is set. type OnValidationData: OnValidationData; @@ -67,11 +68,18 @@ pub trait Config: frame_system::Config> { /// The downward message handlers that will be informed when a message is received. type DownwardMessageHandlers: DownwardMessageHandler; + /// The place where outbound XCMP messages come from. This is queried in `finalize_block`. + type OutboundXcmpMessageSource: XcmpMessageSource; + /// The HRMP message handlers that will be informed when a message is received. /// /// The messages are dispatched in the order they were relayed by the relay chain. If multiple - /// messages were relayed at one block, these will be dispatched in ascending order of the sender's para ID. - type HrmpMessageHandlers: HrmpMessageHandler; + /// messages were relayed at one block, these will be dispatched in ascending order of the + /// sender's para ID. + type XcmpMessageHandler: XcmpMessageHandler; + + /// The weight we reserve at the beginning of the block for processing XCMP messages. + type ReservedXcmpWeight: Get; } // This pallet's storage items. @@ -126,14 +134,16 @@ decl_storage! { PendingUpwardMessages: Vec; - /// Essentially `OutboundHrmpMessage`s grouped by the recipients. - OutboundHrmpMessages: map hasher(twox_64_concat) ParaId => Vec>; - /// HRMP channels with the given recipients are awaiting to be processed. If a `ParaId` is - /// present in this vector then `OutboundHrmpMessages` for it should be not empty. - NonEmptyHrmpChannels: Vec; /// The number of HRMP messages we observed in `on_initialize` and thus used that number for - /// announcing the weight of `on_initialize` and `on_finialize`. + /// announcing the weight of `on_initialize` and `on_finalize`. AnnouncedHrmpMessagesPerCandidate: u32; + + /// The weight we reserve at the beginning of the block for processing XCMP messages. This + /// overrides the amount set in the Config trait. + ReservedXcmpWeightOverride: Option; + + /// The next authorized upgrade, if there is one. + AuthorizedUpgrade: Option; } } @@ -171,7 +181,8 @@ decl_module! { /// As a side effect, this function upgrades the current validation function /// if the appropriate time has come. #[weight = (0, DispatchClass::Mandatory)] - pub fn set_validation_data(origin, data: ParachainInherentData) -> DispatchResult { + // TODO: This weight should be corrected. + pub fn set_validation_data(origin, data: ParachainInherentData) -> DispatchResultWithPostInfo { ensure_none(origin)?; assert!( !ValidationData::exists(), @@ -196,7 +207,7 @@ decl_module! { let validation_function = PendingValidationFunction::take(); LastUpgrade::put(&apply_block); Self::put_parachain_code(&validation_function); - Self::deposit_event(Event::ValidationFunctionApplied(vfp.relay_parent_number)); + Self::deposit_event(RawEvent::ValidationFunctionApplied(vfp.relay_parent_number)); } } @@ -217,16 +228,18 @@ decl_module! { ::on_validation_data(&vfp); - Self::process_inbound_downward_messages( + // TODO: This is more than zero, but will need benchmarking to figure out what. + let mut total_weight = 0; + total_weight += Self::process_inbound_downward_messages( relevant_messaging_state.dmq_mqc_head, downward_messages, )?; - Self::process_inbound_horizontal_messages( + total_weight += Self::process_inbound_horizontal_messages( &relevant_messaging_state.ingress_channels, horizontal_messages, )?; - Ok(()) + Ok(PostDispatchInfo { actual_weight: Some(total_weight), pays_fee: Pays::No }) } #[weight = (1_000, DispatchClass::Operational)] @@ -235,19 +248,43 @@ decl_module! { let _ = Self::send_upward_message(message); } - #[weight = (1_000, DispatchClass::Operational)] - fn sudo_send_hrmp_message(origin, message: OutboundHrmpMessage) { + #[weight = (1_000_000, DispatchClass::Operational)] + fn authorize_upgrade(origin, code_hash: T::Hash) { ensure_root(origin)?; - let _ = Self::send_hrmp_message(message); + + AuthorizedUpgrade::::put(&code_hash); + + Self::deposit_event(RawEvent::UpgradeAuthorized(code_hash)); + } + + #[weight = 1_000_000] + fn enact_authorized_upgrade(origin, code: Vec) { + // No ensure origin on purpose. We validate by checking the code vs hash in storage. + let required_hash = AuthorizedUpgrade::::get() + .ok_or(Error::::NothingAuthorized)?; + let actual_hash = T::Hashing::hash(&code[..]); + ensure!(actual_hash == required_hash, Error::::Unauthorized); + Self::set_code_impl(code)?; + AuthorizedUpgrade::::kill(); } fn on_finalize() { - DidSetValidationCode::take(); + DidSetValidationCode::kill(); - let host_config = Self::host_configuration() - .expect("host configuration is promised to set until `on_finalize`; qed"); - let relevant_messaging_state = Self::relevant_messaging_state() - .expect("relevant messaging state is promised to be set until `on_finalize`; qed"); + let host_config = match Self::host_configuration() { + Some(ok) => ok, + None => { + debug_assert!(false, "host configuration is promised to set until `on_finalize`; qed"); + return + } + }; + let relevant_messaging_state = match Self::relevant_messaging_state() { + Some(ok) => ok, + None => { + debug_assert!(false, "relevant messaging state is promised to be set until `on_finalize`; qed"); + return + } + }; ::PendingUpwardMessages::mutate(|up| { let (count, size) = relevant_messaging_state.relay_dispatch_queue_size; @@ -292,109 +329,19 @@ decl_module! { // - the capacity and total size of the channel is limited, // - the maximum size of a message is limited (and can potentially be changed), - let mut non_empty_hrmp_channels = NonEmptyHrmpChannels::get(); - // The number of messages we can send is limited by all of: - // - the number of non empty channels - // - the maximum number of messages per candidate according to the fresh config - // - the maximum number of messages per candidate according to the stale config - let outbound_hrmp_num = - non_empty_hrmp_channels.len() - .min(host_config.hrmp_max_message_num_per_candidate as usize) - .min(AnnouncedHrmpMessagesPerCandidate::take() as usize); + let maximum_channels = host_config.hrmp_max_message_num_per_candidate + .min(AnnouncedHrmpMessagesPerCandidate::take()) as usize; - let mut outbound_hrmp_messages = Vec::with_capacity(outbound_hrmp_num); - let mut prune_empty = Vec::with_capacity(outbound_hrmp_num); - - for &recipient in non_empty_hrmp_channels.iter() { - if outbound_hrmp_messages.len() == outbound_hrmp_num { - // We have picked the required number of messages for the batch, no reason to - // iterate further. - // - // We check this condition in the beginning of the loop so that we don't include - // a message where the limit is 0. - break; - } - - let idx = match relevant_messaging_state - .egress_channels - .binary_search_by_key(&recipient, |(recipient, _)| *recipient) - { - Ok(m) => m, - Err(_) => { - // TODO: #274 This means that there is no such channel anymore. Means that we should - // return back the messages from this channel. - // - // Until then pretend it became empty - prune_empty.push(recipient); - continue; - } - }; - - let channel_meta = &relevant_messaging_state.egress_channels[idx].1; - if channel_meta.msg_count + 1 > channel_meta.max_capacity { - // The channel is at its capacity. Skip it for now. - continue; - } - - let mut pending = ::OutboundHrmpMessages::get(&recipient); - - // This panics if `v` is empty. However, we are iterating only once over non-empty - // channels, therefore it cannot panic. - let message_payload = pending.remove(0); - let became_empty = pending.is_empty(); - - if channel_meta.total_size + message_payload.len() as u32 > channel_meta.max_total_size { - // Sending this message will make the channel total size overflow. Skip it for now. - continue; - } - - // If we reached here, then the channel has capacity to receive this message. However, - // it doesn't mean that we are sending it just yet. - if became_empty { - OutboundHrmpMessages::remove(&recipient); - prune_empty.push(recipient); - } else { - OutboundHrmpMessages::insert(&recipient, pending); - } - - if message_payload.len() as u32 > channel_meta.max_message_size { - // Apparently, the max message size was decreased since the message while the - // message was buffered. While it's possible to make another iteration to fetch - // the next message, we just keep going here to not complicate the logic too much. - // - // TODO: #274 Return back this message to sender. - continue; - } - - outbound_hrmp_messages.push(OutboundHrmpMessage { - recipient, - data: message_payload, - }); - } - - // Sort the outbound messages by asceding recipient para id to satisfy the acceptance - // criteria requirement. - outbound_hrmp_messages.sort_by_key(|m| m.recipient); - - // Prune hrmp channels that became empty. Additionally, because it may so happen that we - // only gave attention to some channels in `non_empty_hrmp_channels` it's important to - // change the order. Otherwise, the next `on_finalize` we will again give attention - // only to those channels that happen to be in the beginning, until they are emptied. - // This leads to "starvation" of the channels near to the end. - // - // To mitigate this we shift all processed elements towards the end of the vector using - // `rotate_left`. To get intution how it works see the examples in its rustdoc. - non_empty_hrmp_channels.retain(|x| !prune_empty.contains(x)); - // `prune_empty.len()` is greater or equal to `outbound_hrmp_num` because the loop above - // can only do `outbound_hrmp_num` iterations and `prune_empty` is appended to only inside - // the loop body. - non_empty_hrmp_channels.rotate_left(outbound_hrmp_num - prune_empty.len()); - - ::NonEmptyHrmpChannels::put(non_empty_hrmp_channels); - storage::unhashed::put( - well_known_keys::HRMP_OUTBOUND_MESSAGES, - &outbound_hrmp_messages, + let outbound_messages = T::OutboundXcmpMessageSource::take_outbound_messages( + maximum_channels, ); + + // Note conversion to the OutboundHrmpMessage isn't needed since the data that + // `take_outbound_messages` returns encodes equivalently. + // If the following code breaks, then we'll need to revisit that assumption. + let _ = OutboundHrmpMessage { recipient: ParaId::from(0), data: vec![] }; + + storage::unhashed::put(well_known_keys::HRMP_OUTBOUND_MESSAGES, &outbound_messages); } fn on_initialize(n: T::BlockNumber) -> Weight { @@ -449,6 +396,55 @@ decl_module! { } } +impl GetChannelInfo for Module { + fn get_channel_status(id: ParaId) -> ChannelStatus { + // Note, that we are using `relevant_messaging_state` which may be from the previous + // block, in case this is called from `on_initialize`, i.e. before the inherent with fresh + // data is submitted. + // + // That shouldn't be a problem though because this is anticipated and already can happen. + // This is because sending implies that a message is buffered until there is space to send + // a message in the candidate. After a while waiting in a buffer, it may be discovered that + // the channel to which a message were addressed is now closed. Another possibility, is that + // the maximum message size was decreased so that a message in the buffer doesn't fit. Should + // any of that happen the sender should be notified about the message was discarded. + // + // Here it a similar case, with the difference that the realization that the channel is closed + // came the same block. + let channels = match Self::relevant_messaging_state() { + None => { + log::warn!("calling `get_channel_status` with no RelevantMessagingState?!"); + return ChannelStatus::Closed + }, + Some(d) => d.egress_channels, + }; + // ^^^ NOTE: This storage field should carry over from the previous block. So if it's None + // then it must be that this is an edge-case where a message is attempted to be + // sent at the first block. It should be safe to assume that there are no channels + // opened at all so early. At least, relying on this assumption seems to be a better + // tradeoff, compared to introducing an error variant that the clients should be + // prepared to handle. + let index = match channels.binary_search_by_key(&id, |item| item.0) { + Err(_) => return ChannelStatus::Closed, + Ok(i) => i, + }; + let meta = &channels[index].1; + if meta.msg_count + 1 > meta.max_capacity { + // The channel is at its capacity. Skip it for now. + return ChannelStatus::Full; + } + let max_size_now = meta.max_total_size - meta.total_size; + let max_size_ever = meta.max_message_size; + ChannelStatus::Ready(max_size_now as usize, max_size_ever as usize) + } + + fn get_channel_max(id: ParaId) -> Option { + let channels = Self::relevant_messaging_state()?.egress_channels; + let index = channels.binary_search_by_key(&id, |item| item.0).ok()?; + Some(channels[index].1.max_message_size as usize) + } +} + impl Module { /// Validate the given [`PersistedValidationData`] against the /// [`ValidationParams`](polkadot_parachain::primitives::ValidationParams). @@ -481,13 +477,17 @@ impl Module { fn process_inbound_downward_messages( expected_dmq_mqc_head: relay_chain::Hash, downward_messages: Vec, - ) -> DispatchResult { + ) -> Result { let dm_count = downward_messages.len() as u32; + let mut weight_used = 0; + + // Reference fu to avoid the `move` capture. + let weight_used_mut_ref = &mut weight_used; let result_mqc_head = LastDmqMqcHead::mutate(move |mqc| { for downward_message in downward_messages { mqc.extend_downward(&downward_message); - T::DownwardMessageHandlers::handle_downward_message(downward_message); + *weight_used_mut_ref += T::DownwardMessageHandlers::handle_downward_message(downward_message); } mqc.0 }); @@ -503,7 +503,7 @@ impl Module { // PVF's `validate_block` wrapper and collation pipeline. storage::unhashed::put(well_known_keys::PROCESSED_DOWNWARD_MESSAGES, &dm_count); - Ok(()) + Ok(weight_used) } /// Process all inbound horizontal messages relayed by the collator. @@ -513,7 +513,7 @@ impl Module { fn process_inbound_horizontal_messages( ingress_channels: &[(ParaId, cumulus_primitives_core::AbridgedHrmpChannel)], horizontal_messages: BTreeMap>, - ) -> DispatchResult { + ) -> Result { // First, check that all submitted messages are sent from channels that exist. The channel // exists if its MQC head is present in `vfp.hrmp_mqc_heads`. for sender in horizontal_messages.keys() { @@ -552,21 +552,26 @@ impl Module { let mut running_mqc_heads = BTreeMap::new(); let mut hrmp_watermark = None; - for (sender, horizontal_message) in horizontal_messages { - if hrmp_watermark - .map(|w| w < horizontal_message.sent_at) - .unwrap_or(true) - { - hrmp_watermark = Some(horizontal_message.sent_at); + { + for (sender, ref horizontal_message) in &horizontal_messages { + if hrmp_watermark + .map(|w| w < horizontal_message.sent_at) + .unwrap_or(true) + { + hrmp_watermark = Some(horizontal_message.sent_at); + } + + running_mqc_heads + .entry(sender) + .or_insert_with(|| last_mqc_heads.get(&sender).cloned().unwrap_or_default()) + .extend_hrmp(horizontal_message); } - - running_mqc_heads - .entry(sender) - .or_insert_with(|| last_mqc_heads.get(&sender).cloned().unwrap_or_default()) - .extend_hrmp(&horizontal_message); - - T::HrmpMessageHandlers::handle_hrmp_message(sender, horizontal_message); } + let message_iter = horizontal_messages.iter() + .map(|&(sender, ref message)| (sender, message.sent_at, &message.data[..])); + + let max_weight = ReservedXcmpWeightOverride::get().unwrap_or_else(T::ReservedXcmpWeight::get); + let weight_used = T::XcmpMessageHandler::handle_xcmp_messages(message_iter, max_weight); // Check that the MQC heads for each channel provided by the relay chain match the MQC heads // we have after processing all incoming messages. @@ -577,7 +582,7 @@ impl Module { // would corrupt the message queue chain. for &(ref sender, ref channel) in ingress_channels { let cur_head = running_mqc_heads - .entry(*sender) + .entry(sender) .or_insert_with(|| last_mqc_heads.get(&sender).cloned().unwrap_or_default()) .head(); let target_head = channel.mqc_head.unwrap_or_default(); @@ -592,7 +597,7 @@ impl Module { storage::unhashed::put(well_known_keys::HRMP_WATERMARK, &hrmp_watermark); } - Ok(()) + Ok(weight_used) } /// Put a new validation function into a particular location where polkadot @@ -663,7 +668,7 @@ impl Module { Self::notify_polkadot_of_pending_upgrade(&validation_function); PendingRelayChainBlockNumber::put(apply_block); PendingValidationFunction::put(validation_function); - Self::deposit_event(Event::ValidationFunctionStored(apply_block)); + Self::deposit_event(RawEvent::ValidationFunctionStored(apply_block)); Ok(()) } @@ -714,24 +719,8 @@ impl MessageQueueChain { } } -/// An error that can be raised upon sending an upward message. -#[derive(Debug, PartialEq)] -pub enum SendUpErr { - /// The message sent is too big. - TooBig, -} - -/// An error that can be raised upon sending a horizontal message. -#[derive(Debug, PartialEq)] -pub enum SendHorizontalErr { - /// The message sent is too big. - TooBig, - /// There is no channel to the specified destination. - NoChannel, -} - impl Module { - pub fn send_upward_message(message: UpwardMessage) -> Result<(), SendUpErr> { + pub fn send_upward_message(message: UpwardMessage) -> Result { // Check if the message fits into the relay-chain constraints. // // Note, that we are using `host_configuration` here which may be from the previous @@ -747,7 +736,7 @@ impl Module { match Self::host_configuration() { Some(cfg) => { if message.len() > cfg.max_upward_message_size as usize { - return Err(SendUpErr::TooBig); + return Err(MessageSendError::TooBig); } } None => { @@ -763,71 +752,13 @@ impl Module { } }; ::PendingUpwardMessages::append(message); - Ok(()) - } - - pub fn send_hrmp_message(message: OutboundHrmpMessage) -> Result<(), SendHorizontalErr> { - let OutboundHrmpMessage { recipient, data } = message; - - // First, check if the message is addressed into an opened channel. - // - // Note, that we are using `relevant_messaging_state` which may be from the previous - // block, in case this is called from `on_initialize`, i.e. before the inherent with fresh - // data is submitted. - // - // That shouldn't be a problem though because this is anticipated and already can happen. - // This is because sending implies that a message is buffered until there is space to send - // a message in the candidate. After a while waiting in a buffer, it may be discovered that - // the channel to which a message were addressed is now closed. Another possibility, is that - // the maximum message size was decreased so that a message in the bufer doesn't fit. Should - // any of that happen the sender should be notified about the message was discarded. - // - // Here it a similar case, with the difference that the realization that the channel is closed - // came the same block. - let relevant_messaging_state = match Self::relevant_messaging_state() { - Some(s) => s, - None => { - // This storage field should carry over from the previous block. So if it's None - // then it must be that this is an edge-case where a message is attempted to be - // sent at the first block. It should be safe to assume that there are no channels - // opened at all so early. At least, relying on this assumption seems to be a better - // tradeoff, compared to introducing an error variant that the clients should be - // prepared to handle. - return Err(SendHorizontalErr::NoChannel); - } - }; - let channel_meta = match relevant_messaging_state - .egress_channels - .binary_search_by_key(&recipient, |(recipient, _)| *recipient) - { - Ok(idx) => &relevant_messaging_state.egress_channels[idx].1, - Err(_) => return Err(SendHorizontalErr::NoChannel), - }; - if data.len() as u32 > channel_meta.max_message_size { - return Err(SendHorizontalErr::TooBig); - } - - // And then at last update the storage. - ::OutboundHrmpMessages::append(&recipient, data); - ::NonEmptyHrmpChannels::mutate(|v| { - if !v.contains(&recipient) { - v.push(recipient); - } - }); - - Ok(()) + Ok(0) } } impl UpwardMessageSender for Module { - fn send_upward_message(message: UpwardMessage) -> Result<(), ()> { - Self::send_upward_message(message).map_err(|_| ()) - } -} - -impl HrmpMessageSender for Module { - fn send_hrmp_message(message: OutboundHrmpMessage) -> Result<(), ()> { - Self::send_hrmp_message(message).map_err(|_| ()) + fn send_upward_message(message: UpwardMessage) -> Result { + Self::send_upward_message(message) } } @@ -846,14 +777,20 @@ impl ProvideInherent for Module { Some(Call::set_validation_data(data)) } + + fn is_inherent(call: &Self::Call) -> bool { + matches!(call, Call::set_validation_data(_)) + } } decl_event! { - pub enum Event { + pub enum Event where Hash = ::Hash { // The validation function has been scheduled to apply as of the contained relay chain block number. ValidationFunctionStored(RelayChainBlockNumber), // The validation function was applied as of the contained relay chain block number. ValidationFunctionApplied(RelayChainBlockNumber), + // An upgrade has been authorized. + UpgradeAuthorized(Hash), } } @@ -888,6 +825,10 @@ decl_error! { HrmpMqcMismatch, /// No validation function upgrade is currently scheduled. NotScheduled, + /// No code upgrade has been authorized. + NothingAuthorized, + /// The given code upgrade has not been authorized. + Unauthorized, } } @@ -899,6 +840,7 @@ mod tests { use codec::Encode; use cumulus_primitives_core::{ AbridgedHrmpChannel, InboundDownwardMessage, InboundHrmpMessage, PersistedValidationData, + relay_chain::BlockNumber as RelayBlockNumber, }; use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder; use frame_support::{ @@ -927,7 +869,7 @@ mod tests { UncheckedExtrinsic = UncheckedExtrinsic, { System: frame_system::{Pallet, Call, Config, Storage, Event}, - ParachainSystem: parachain_system::{Pallet, Call, Storage, Event}, + ParachainSystem: parachain_system::{Pallet, Call, Storage, Event}, } ); @@ -943,6 +885,7 @@ mod tests { transaction_version: 1, }; pub const ParachainId: ParaId = ParaId::new(200); + pub const ReservedXcmpWeight: Weight = 0; } impl frame_system::Config for Test { type Origin = Origin; @@ -974,28 +917,69 @@ mod tests { type OnValidationData = (); type SelfParaId = ParachainId; type DownwardMessageHandlers = SaveIntoThreadLocal; - type HrmpMessageHandlers = SaveIntoThreadLocal; + type XcmpMessageHandler = SaveIntoThreadLocal; + type OutboundXcmpMessageSource = FromThreadLocal; + type ReservedXcmpWeight = ReservedXcmpWeight; } + pub struct FromThreadLocal; pub struct SaveIntoThreadLocal; std::thread_local! { static HANDLED_DOWNWARD_MESSAGES: RefCell> = RefCell::new(Vec::new()); - static HANDLED_HRMP_MESSAGES: RefCell> = RefCell::new(Vec::new()); + static HANDLED_XCMP_MESSAGES: RefCell)>> = RefCell::new(Vec::new()); + static SENT_MESSAGES: RefCell)>> = RefCell::new(Vec::new()); } - impl DownwardMessageHandler for SaveIntoThreadLocal { - fn handle_downward_message(msg: InboundDownwardMessage) { - HANDLED_DOWNWARD_MESSAGES.with(|m| { - m.borrow_mut().push(msg); - }); + fn send_message( + dest: ParaId, + message: Vec, + ) { + SENT_MESSAGES.with(|m| m.borrow_mut().push((dest, message))); + } + + impl XcmpMessageSource for FromThreadLocal { + fn take_outbound_messages(maximum_channels: usize) -> Vec<(ParaId, Vec)> { + let mut ids = std::collections::BTreeSet::::new(); + let mut taken = 0; + let mut result = Vec::new(); + SENT_MESSAGES.with(|ms| ms.borrow_mut() + .retain(|m| { + let status = as GetChannelInfo>::get_channel_status(m.0); + let ready = matches!(status, ChannelStatus::Ready(..)); + if ready && !ids.contains(&m.0) && taken < maximum_channels { + ids.insert(m.0); + taken += 1; + result.push(m.clone()); + false + } else { + true + } + }) + ); + result } } - impl HrmpMessageHandler for SaveIntoThreadLocal { - fn handle_hrmp_message(sender: ParaId, msg: InboundHrmpMessage) { - HANDLED_HRMP_MESSAGES.with(|m| { - m.borrow_mut().push((sender, msg)); + impl DownwardMessageHandler for SaveIntoThreadLocal { + fn handle_downward_message(msg: InboundDownwardMessage) -> Weight { + HANDLED_DOWNWARD_MESSAGES.with(|m| { + m.borrow_mut().push(msg); + }); + 0 + } + } + + impl XcmpMessageHandler for SaveIntoThreadLocal { + fn handle_xcmp_messages<'a, I: Iterator>( + iter: I, + _max_weight: Weight, + ) -> Weight { + HANDLED_XCMP_MESSAGES.with(|m| { + for (sender, sent_at, message) in iter { + m.borrow_mut().push((sender, sent_at, message.to_vec())); + } + 0 }) } } @@ -1004,7 +988,7 @@ mod tests { // our desired mockup. fn new_test_ext() -> sp_io::TestExternalities { HANDLED_DOWNWARD_MESSAGES.with(|m| m.borrow_mut().clear()); - HANDLED_HRMP_MESSAGES.with(|m| m.borrow_mut().clear()); + HANDLED_XCMP_MESSAGES.with(|m| m.borrow_mut().clear()); frame_system::GenesisConfig::default() .build_storage::() @@ -1253,7 +1237,7 @@ mod tests { let events = System::events(); assert_eq!( events[0].event, - Event::parachain_system(crate::Event::ValidationFunctionStored(1123)) + Event::parachain_system(crate::RawEvent::ValidationFunctionStored(1123).into()) ); }, ) @@ -1264,7 +1248,7 @@ mod tests { let events = System::events(); assert_eq!( events[0].event, - Event::parachain_system(crate::Event::ValidationFunctionApplied(1234)) + Event::parachain_system(crate::RawEvent::ValidationFunctionApplied(1234).into()) ); }, ); @@ -1399,80 +1383,6 @@ mod tests { ); } - #[test] - fn send_hrmp_preliminary_no_channel() { - BlockTests::new() - .with_relay_sproof_builder(|_, _, sproof| { - sproof.para_id = ParaId::from(200); - - // no channels established - sproof.hrmp_egress_channel_index = Some(vec![]); - }) - .add(1, || {}) - .add(2, || { - assert!(ParachainSystem::send_hrmp_message(OutboundHrmpMessage { - recipient: ParaId::from(300), - data: b"derp".to_vec(), - }) - .is_err()); - }); - } - - #[test] - fn send_hrmp_message_simple() { - BlockTests::new() - .with_relay_sproof_builder(|_, _, sproof| { - sproof.para_id = ParaId::from(200); - sproof.hrmp_egress_channel_index = Some(vec![ParaId::from(300)]); - sproof.hrmp_channels.insert( - HrmpChannelId { - sender: ParaId::from(200), - recipient: ParaId::from(300), - }, - AbridgedHrmpChannel { - max_capacity: 1, - max_total_size: 1024, - max_message_size: 8, - msg_count: 0, - total_size: 0, - mqc_head: Default::default(), - }, - ); - }) - .add_with_post_test( - 1, - || { - ParachainSystem::send_hrmp_message(OutboundHrmpMessage { - recipient: ParaId::from(300), - data: b"derp".to_vec(), - }) - .unwrap() - }, - || { - // there are no outbound messages since the special logic for handling the - // first block kicks in. - let v: Option> = - storage::unhashed::get(well_known_keys::HRMP_OUTBOUND_MESSAGES); - assert_eq!(v, Some(vec![])); - }, - ) - .add_with_post_test( - 2, - || {}, - || { - let v: Option> = - storage::unhashed::get(well_known_keys::HRMP_OUTBOUND_MESSAGES); - assert_eq!( - v, - Some(vec![OutboundHrmpMessage { - recipient: ParaId::from(300), - data: b"derp".to_vec(), - }]) - ); - }, - ); - } - #[test] fn send_hrmp_message_buffer_channel_close() { BlockTests::new() @@ -1512,7 +1422,7 @@ mod tests { ); // - // Adjustement according to block + // Adjustment according to block // match relay_block_num { 1 => {} @@ -1545,16 +1455,14 @@ mod tests { .add_with_post_test( 1, || { - ParachainSystem::send_hrmp_message(OutboundHrmpMessage { - recipient: ParaId::from(300), - data: b"1".to_vec(), - }) - .unwrap(); - ParachainSystem::send_hrmp_message(OutboundHrmpMessage { - recipient: ParaId::from(400), - data: b"2".to_vec(), - }) - .unwrap() + send_message( + ParaId::from(300), + b"1".to_vec(), + ); + send_message( + ParaId::from(400), + b"2".to_vec(), + ); }, || {}, ) @@ -1659,22 +1567,22 @@ mod tests { lazy_static::lazy_static! { static ref MSG_1: InboundHrmpMessage = InboundHrmpMessage { sent_at: 1, - data: b"aquadisco".to_vec(), + data: b"1".to_vec(), }; static ref MSG_2: InboundHrmpMessage = InboundHrmpMessage { sent_at: 1, - data: b"mudroom".to_vec(), + data: b"2".to_vec(), }; static ref MSG_3: InboundHrmpMessage = InboundHrmpMessage { sent_at: 2, - data: b"eggpeeling".to_vec(), + data: b"3".to_vec(), }; static ref MSG_4: InboundHrmpMessage = InboundHrmpMessage { sent_at: 2, - data: b"casino".to_vec(), + data: b"4".to_vec(), }; } @@ -1730,21 +1638,21 @@ mod tests { _ => unreachable!(), }) .add(1, || { - HANDLED_HRMP_MESSAGES.with(|m| { + HANDLED_XCMP_MESSAGES.with(|m| { let mut m = m.borrow_mut(); - assert_eq!(&*m, &[(ParaId::from(300), MSG_1.clone())]); + assert_eq!(&*m, &[(ParaId::from(300), 1, b"1".to_vec())]); m.clear(); }); }) .add(2, || { - HANDLED_HRMP_MESSAGES.with(|m| { + HANDLED_XCMP_MESSAGES.with(|m| { let mut m = m.borrow_mut(); assert_eq!( &*m, &[ - (ParaId::from(300), MSG_2.clone()), - (ParaId::from(200), MSG_4.clone()), - (ParaId::from(300), MSG_3.clone()), + (ParaId::from(300), 1, b"2".to_vec()), + (ParaId::from(200), 2, b"4".to_vec()), + (ParaId::from(300), 2, b"3".to_vec()), ] ); m.clear(); @@ -1822,17 +1730,17 @@ mod tests { _ => unreachable!(), }) .add(1, || { - HANDLED_HRMP_MESSAGES.with(|m| { + HANDLED_XCMP_MESSAGES.with(|m| { let mut m = m.borrow_mut(); - assert_eq!(&*m, &[(ALICE, MSG_1.clone())]); + assert_eq!(&*m, &[(ALICE, 1, b"mikhailinvanovich".to_vec())]); m.clear(); }); }) .add(2, || {}) .add(3, || { - HANDLED_HRMP_MESSAGES.with(|m| { + HANDLED_XCMP_MESSAGES.with(|m| { let mut m = m.borrow_mut(); - assert_eq!(&*m, &[(ALICE, MSG_2.clone())]); + assert_eq!(&*m, &[(ALICE, 3, b"1000000000".to_vec())]); m.clear(); }); }); diff --git a/pallets/xcm-handler/src/lib.rs b/pallets/xcm-handler/src/lib.rs deleted file mode 100644 index ed9b2a3d52..0000000000 --- a/pallets/xcm-handler/src/lib.rs +++ /dev/null @@ -1,232 +0,0 @@ -// Copyright 2020-2021 Parity Technologies (UK) Ltd. -// This file is part of Cumulus. - -// Substrate is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Substrate is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Cumulus. If not, see . - -//! A pallet which implements the message handling APIs for handling incoming XCM: -//! * `DownwardMessageHandler` -//! * `HrmpMessageHandler` -//! -//! Also provides an implementation of `SendXcm` to handle outgoing XCM. - -#![cfg_attr(not(feature = "std"), no_std)] - -use codec::{Decode, Encode}; -use cumulus_primitives_core::{ - DownwardMessageHandler, HrmpMessageHandler, HrmpMessageSender, InboundDownwardMessage, - InboundHrmpMessage, OutboundHrmpMessage, ParaId, UpwardMessageSender, -}; -use frame_support::{decl_error, decl_event, decl_module, dispatch::DispatchResult, sp_runtime::traits::Hash, traits::EnsureOrigin}; -use sp_std::convert::{TryFrom, TryInto}; -use xcm::{ - v0::{Error as XcmError, ExecuteXcm, Junction, MultiLocation, SendXcm, Xcm}, - VersionedXcm, -}; -use xcm_executor::traits::LocationConversion; - -pub trait Config: frame_system::Config { - type Event: From> + Into<::Event>; - /// Something to execute an XCM message. - type XcmExecutor: ExecuteXcm; - /// Something to send an upward message. - type UpwardMessageSender: UpwardMessageSender; - /// Something to send an HRMP message. - type HrmpMessageSender: HrmpMessageSender; - /// Required origin for sending XCM messages. Typically Root or parachain - /// council majority. - type SendXcmOrigin: EnsureOrigin; - /// Utility for converting from the signed origin (of type `Self::AccountId`) into a sensible - /// `MultiLocation` ready for passing to the XCM interpreter. - type AccountIdConverter: LocationConversion; -} - -decl_event! { - pub enum Event where Hash = ::Hash { - /// Some XCM was executed ok. - Success(Hash), - /// Some XCM failed. - Fail(Hash, XcmError), - /// Bad XCM version used. - BadVersion(Hash), - /// Bad XCM format used. - BadFormat(Hash), - /// An upward message was sent to the relay chain. - UpwardMessageSent(Hash), - /// An HRMP message was sent to a sibling parachain. - HrmpMessageSent(Hash), - } -} - -decl_error! { - pub enum Error for Module { - /// Failed to send XCM message. - FailedToSend, - /// Bad XCM origin. - BadXcmOrigin, - } -} - -decl_module! { - pub struct Module for enum Call where origin: T::Origin { - type Error = Error; - - fn deposit_event() = default; - - #[weight = 1_000] - fn send_xcm(origin, dest: MultiLocation, message: Xcm) { - T::SendXcmOrigin::ensure_origin(origin)?; - ::send_xcm(dest, message).map_err(|_| Error::::FailedToSend)?; - } - - #[weight = 1_000] - fn send_upward_xcm(origin, message: VersionedXcm) { - T::SendXcmOrigin::ensure_origin(origin)?; - let data = message.encode(); - T::UpwardMessageSender::send_upward_message(data).map_err(|_| Error::::FailedToSend)?; - } - - #[weight = 1_000] - fn send_hrmp_xcm(origin, recipient: ParaId, message: VersionedXcm) { - T::SendXcmOrigin::ensure_origin(origin)?; - let data = message.encode(); - let outbound_message = OutboundHrmpMessage { - recipient, - data, - }; - T::HrmpMessageSender::send_hrmp_message(outbound_message).map_err(|_| Error::::FailedToSend)?; - } - } -} - -impl Module { - /// Execute an XCM message locally. Returns `DispatchError` if failed. - pub fn execute_xcm(origin: T::AccountId, xcm: Xcm) -> DispatchResult { - let xcm_origin = T::AccountIdConverter::try_into_location(origin) - .map_err(|_| Error::::BadXcmOrigin)?; - let hash = T::Hashing::hash(&xcm.encode()); - let event = match T::XcmExecutor::execute_xcm(xcm_origin, xcm) { - Ok(_) => Event::::Success(hash), - Err(e) => Event::::Fail(hash, e), - }; - Self::deposit_event(event); - Ok(()) - } -} - -impl DownwardMessageHandler for Module { - fn handle_downward_message(msg: InboundDownwardMessage) { - let hash = msg.using_encoded(T::Hashing::hash); - log::debug!("Processing Downward XCM: {:?}", &hash); - let event = match VersionedXcm::decode(&mut &msg.msg[..]).map(Xcm::try_from) { - Ok(Ok(xcm)) => { - match T::XcmExecutor::execute_xcm(Junction::Parent.into(), xcm) { - Ok(..) => RawEvent::Success(hash), - Err(e) => RawEvent::Fail(hash, e), - } - } - Ok(Err(..)) => RawEvent::BadVersion(hash), - Err(..) => RawEvent::BadFormat(hash), - }; - Self::deposit_event(event); - } -} - -impl HrmpMessageHandler for Module { - fn handle_hrmp_message(sender: ParaId, msg: InboundHrmpMessage) { - let hash = msg.using_encoded(T::Hashing::hash); - log::debug!("Processing HRMP XCM: {:?}", &hash); - let event = match VersionedXcm::decode(&mut &msg.data[..]).map(Xcm::try_from) { - Ok(Ok(xcm)) => { - let location = ( - Junction::Parent, - Junction::Parachain { id: sender.into() }, - ); - match T::XcmExecutor::execute_xcm(location.into(), xcm) { - Ok(..) => RawEvent::Success(hash), - Err(e) => RawEvent::Fail(hash, e), - } - } - Ok(Err(..)) => RawEvent::BadVersion(hash), - Err(..) => RawEvent::BadFormat(hash), - }; - Self::deposit_event(event); - } -} - -impl SendXcm for Module { - fn send_xcm(dest: MultiLocation, msg: Xcm) -> Result<(), XcmError> { - let msg: VersionedXcm = msg.into(); - match dest.first() { - // A message for us. Execute directly. - None => { - let msg = msg.try_into().map_err(|_| XcmError::UnhandledXcmVersion)?; - let res = T::XcmExecutor::execute_xcm(MultiLocation::Null, msg); - res - } - // An upward message for the relay chain. - Some(Junction::Parent) if dest.len() == 1 => { - let data = msg.encode(); - let hash = T::Hashing::hash(&data); - - T::UpwardMessageSender::send_upward_message(data) - .map_err(|_| XcmError::CannotReachDestination)?; - Self::deposit_event(RawEvent::UpwardMessageSent(hash)); - - Ok(()) - } - // An HRMP message for a sibling parachain. - Some(Junction::Parent) if dest.len() == 2 => { - if let Some(Junction::Parachain { id }) = dest.at(1) { - let data = msg.encode(); - let hash = T::Hashing::hash(&data); - let message = OutboundHrmpMessage { - recipient: (*id).into(), - data, - }; - T::HrmpMessageSender::send_hrmp_message(message) - .map_err(|_| XcmError::CannotReachDestination)?; - Self::deposit_event(RawEvent::HrmpMessageSent(hash)); - Ok(()) - } else { - Err(XcmError::UnhandledXcmMessage) - } - } - _ => { - /* TODO: Handle other cases, like downward message */ - Err(XcmError::UnhandledXcmMessage) - } - } - } -} - -/// Origin for the parachains module. -#[derive(PartialEq, Eq, Clone, Encode, Decode)] -#[cfg_attr(feature = "std", derive(Debug))] -pub enum Origin { - /// It comes from the (parent) relay chain. - Relay, - /// It comes from a (sibling) parachain. - SiblingParachain(ParaId), -} - -impl From for Origin { - fn from(id: ParaId) -> Origin { - Origin::SiblingParachain(id) - } -} -impl From for Origin { - fn from(id: u32) -> Origin { - Origin::SiblingParachain(id.into()) - } -} diff --git a/pallets/xcm/Cargo.toml b/pallets/xcm/Cargo.toml new file mode 100644 index 0000000000..7f89b98cfb --- /dev/null +++ b/pallets/xcm/Cargo.toml @@ -0,0 +1,30 @@ +[package] +authors = ["Parity Technologies "] +edition = "2018" +name = "cumulus-pallet-xcm" +version = "0.1.0" + +[dependencies] +codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } +serde = { version = "1.0.101", optional = true, features = ["derive"] } + +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } + +xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } + +cumulus-primitives-core = { path = "../../primitives/core", default-features = false } + +[features] +default = ["std"] +std = [ + "codec/std", + "serde", + "cumulus-primitives-core/std", + "sp-std/std", + "sp-runtime/std", + "frame-support/std", + "frame-system/std", +] diff --git a/pallets/xcm/src/lib.rs b/pallets/xcm/src/lib.rs new file mode 100644 index 0000000000..5ca05794ef --- /dev/null +++ b/pallets/xcm/src/lib.rs @@ -0,0 +1,92 @@ +// Copyright 2020-2021 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Cumulus is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Cumulus. If not, see . + +//! Pallet for stuff specific to parachains' usage of XCM. Right now that's just the origin +//! used by parachains when receiving `Transact` messages from other parachains or the Relay chain +//! which must be natively represented. + +#![cfg_attr(not(feature = "std"), no_std)] + +use cumulus_primitives_core::ParaId; +use codec::{Encode, Decode}; +use sp_runtime::traits::BadOrigin; +pub use pallet::*; + +#[frame_support::pallet] +pub mod pallet { + use frame_support::pallet_prelude::*; + use frame_system::pallet_prelude::*; + + #[pallet::pallet] + #[pallet::generate_store(pub(super) trait Store)] + pub struct Pallet(_); + + /// The module configuration trait. + #[pallet::config] + pub trait Config: frame_system::Config {} + + #[pallet::error] + pub enum Error {} + + #[pallet::hooks] + impl Hooks> for Pallet {} + + #[pallet::call] + impl Pallet {} +} + +/// Origin for the parachains module. +#[derive(PartialEq, Eq, Clone, Encode, Decode)] +#[cfg_attr(feature = "std", derive(Debug))] +pub enum Origin { + /// It comes from the (parent) relay chain. + Relay, + /// It comes from a (sibling) parachain. + SiblingParachain(ParaId), +} + +impl From for Origin { + fn from(id: ParaId) -> Origin { + Origin::SiblingParachain(id) + } +} +impl From for Origin { + fn from(id: u32) -> Origin { + Origin::SiblingParachain(id.into()) + } +} + +/// Ensure that the origin `o` represents a sibling parachain. +/// Returns `Ok` with the parachain ID of the sibling or an `Err` otherwise. +pub fn ensure_sibling_para(o: OuterOrigin) -> Result + where OuterOrigin: Into> +{ + match o.into() { + Ok(Origin::SiblingParachain(id)) => Ok(id), + _ => Err(BadOrigin), + } +} + +/// Ensure that the origin `o` represents is the relay chain. +/// Returns `Ok` if it does or an `Err` otherwise. +pub fn ensure_relay(o: OuterOrigin) -> Result<(), BadOrigin> + where OuterOrigin: Into> +{ + match o.into() { + Ok(Origin::Relay) => Ok(()), + _ => Err(BadOrigin), + } +} diff --git a/pallets/xcm-handler/Cargo.toml b/pallets/xcmp-queue/Cargo.toml similarity index 81% rename from pallets/xcm-handler/Cargo.toml rename to pallets/xcmp-queue/Cargo.toml index c5d57a2b32..e9515ed5ea 100644 --- a/pallets/xcm-handler/Cargo.toml +++ b/pallets/xcmp-queue/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "cumulus-pallet-xcm-handler" +name = "cumulus-pallet-xcmp-queue" version = "0.1.0" authors = ["Parity Technologies "] edition = "2018" @@ -8,9 +8,12 @@ edition = "2018" # Other dependencies codec = { package = "parity-scale-codec", version = "2.0.0", features = [ "derive" ], default-features = false } log = { version = "0.4.14", default-features = false } +rand = { version = "0.8.3", default-features = false } +rand_chacha = { version = "0.3.0", default-features = false } # Substrate Dependencies sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } @@ -27,6 +30,7 @@ std = [ "codec/std", "log/std", "sp-std/std", + "sp-runtime/std", "frame-support/std", "frame-system/std", "cumulus-primitives-core/std", diff --git a/pallets/xcmp-queue/src/lib.rs b/pallets/xcmp-queue/src/lib.rs new file mode 100644 index 0000000000..23c73647bf --- /dev/null +++ b/pallets/xcmp-queue/src/lib.rs @@ -0,0 +1,706 @@ +// Copyright 2020-2021 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Substrate is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Substrate is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Cumulus. If not, see . + +//! A pallet which uses the XCMP transport layer to handle both incoming and outgoing XCM message +//! sending and dispatch, queuing, signalling and backpressure. To do so, it implements: +//! * `XcmpMessageHandler` +//! * `XcmpMessageSource` +//! +//! Also provides an implementation of `SendXcm` which can be placed in a router tuple for relaying +//! XCM over XCMP if the destination is `Parent/Parachain`. It requires an implementation of +//! `XcmExecutor` for dispatching incoming XCM messages. + +#![cfg_attr(not(feature = "std"), no_std)] + +use sp_std::{prelude::*, convert::TryFrom}; +use rand_chacha::{rand_core::{RngCore, SeedableRng}, ChaChaRng}; +use codec::{Decode, Encode}; +use sp_runtime::{RuntimeDebug, traits::Hash}; +use frame_support::{decl_error, decl_event, decl_module, decl_storage, dispatch::Weight}; +use xcm::{ + VersionedXcm, v0::{ + Error as XcmError, ExecuteXcm, Junction, MultiLocation, SendXcm, Outcome, Xcm, + }, +}; +use cumulus_primitives_core::{ + XcmpMessageHandler, ParaId, XcmpMessageSource, ChannelStatus, MessageSendError, GetChannelInfo, + relay_chain::BlockNumber as RelayBlockNumber, +}; + +pub trait Config: frame_system::Config { + type Event: From> + Into<::Event>; + + /// Something to execute an XCM message. We need this to service the XCMoXCMP queue. + type XcmExecutor: ExecuteXcm; + + /// Information on the avaialble XCMP channels. + type ChannelInfo: GetChannelInfo; +} + +#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, RuntimeDebug)] +pub enum InboundStatus { + Ok, + Suspended, +} + +#[derive(Copy, Clone, Eq, PartialEq, Encode, Decode, RuntimeDebug)] +pub enum OutboundStatus { + Ok, + Suspended, +} + +#[derive(Copy, Clone, Eq, PartialEq, Encode, Decode, RuntimeDebug)] +pub struct QueueConfigData { + /// The number of pages of messages which must be in the queue for the other side to be told to + /// suspend their sending. + suspend_threshold: u32, + /// The number of pages of messages which must be in the queue after which we drop any further + /// messages from the channel. + drop_threshold: u32, + /// The number of pages of messages which the queue must be reduced to before it signals that + /// message sending may recommence after it has been suspended. + resume_threshold: u32, + // The amount of remaining weight under which we stop processing messages. + threshold_weight: Weight, + /// The speed to which the available weight approaches the maximum weight. A lower number + /// results in a faster progression. A value of 1 makes the entire weight available initially. + weight_restrict_decay: Weight, +} + +impl Default for QueueConfigData { + fn default() -> Self { + Self { + suspend_threshold: 2, + drop_threshold: 5, + resume_threshold: 1, + threshold_weight: 100_000, + weight_restrict_decay: 2, + } + } +} + +decl_storage! { + trait Store for Module as XcmHandler { + /// Status of the inbound XCMP channels. + InboundXcmpStatus: Vec<(ParaId, InboundStatus, Vec<(RelayBlockNumber, XcmpMessageFormat)>)>; + + /// Inbound aggregate XCMP messages. It can only be one per ParaId/block. + InboundXcmpMessages: double_map hasher(blake2_128_concat) ParaId, + hasher(twox_64_concat) RelayBlockNumber + => Vec; + + /// The non-empty XCMP channels in order of becoming non-empty, and the index of the first + /// and last outbound message. If the two indices are equal, then it indicates an empty + /// queue and there must be a non-`Ok` `OutboundStatus`. We assume queues grow no greater + /// than 65535 items. Queue indices for normal messages begin at one; zero is reserved in + /// case of the need to send a high-priority signal message this block. + /// The bool is true if there is a signal message waiting to be sent. + OutboundXcmpStatus: Vec<(ParaId, OutboundStatus, bool, u16, u16)>; + + // The new way of doing it: + /// The messages outbound in a given XCMP channel. + OutboundXcmpMessages: double_map hasher(blake2_128_concat) ParaId, + hasher(twox_64_concat) u16 => Vec; + + /// Any signal messages waiting to be sent. + SignalMessages: map hasher(blake2_128_concat) ParaId => Vec; + + /// The configuration which controls the dynamics of the outbound queue. + QueueConfig: QueueConfigData; + } +} + +decl_event! { + pub enum Event where Hash = ::Hash { + /// Some XCM was executed ok. + Success(Option), + /// Some XCM failed. + Fail(Option, XcmError), + /// Bad XCM version used. + BadVersion(Option), + /// Bad XCM format used. + BadFormat(Option), + /// An upward message was sent to the relay chain. + UpwardMessageSent(Option), + /// An HRMP message was sent to a sibling parachain. + XcmpMessageSent(Option), + } +} + +decl_error! { + pub enum Error for Module { + /// Failed to send XCM message. + FailedToSend, + /// Bad XCM origin. + BadXcmOrigin, + /// Bad XCM data. + BadXcm, + } +} + +decl_module! { + pub struct Module for enum Call where origin: T::Origin { + type Error = Error; + + fn deposit_event() = default; + + fn on_idle(_now: T::BlockNumber, max_weight: Weight) -> Weight { + // on_idle processes additional messages with any remaining block weight. + Self::service_xcmp_queue(max_weight) + } + } +} + +#[derive(PartialEq, Eq, Copy, Clone, Encode, Decode)] +pub enum ChannelSignal { + Suspend, + Resume, +} + +/// The aggregate XCMP message format. +#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode)] +pub enum XcmpMessageFormat { + /// Encoded `VersionedXcm` messages, all concatenated. + ConcatenatedVersionedXcm, + /// Encoded `Vec` messages, all concatenated. + ConcatenatedEncodedBlob, + /// One or more channel control signals; these should be interpreted immediately upon receipt + /// from the relay-chain. + Signals, +} + +impl Module { + /// Place a message `fragment` on the outgoing XCMP queue for `recipient`. + /// + /// Format is the type of aggregate message that the `fragment` may be safely encoded and + /// appended onto. Whether earlier unused space is used for the fragment at the risk of sending + /// it out of order is determined with `qos`. NOTE: For any two messages to be guaranteed to be + /// dispatched in order, then both must be sent with `ServiceQuality::Ordered`. + /// + /// ## Background + /// + /// For our purposes, one HRMP "message" is actually an aggregated block of XCM "messages". + /// + /// For the sake of clarity, we distinguish between them as message AGGREGATEs versus + /// message FRAGMENTs. + /// + /// So each AGGREGATE is comprised of one or more concatenated SCALE-encoded `Vec` + /// FRAGMENTs. Though each fragment is already probably a SCALE-encoded Xcm, we can't be + /// certain, so we SCALE encode each `Vec` fragment in order to ensure we have the + /// length prefixed and can thus decode each fragment from the aggregate stream. With this, + /// we can concatenate them into a single aggregate blob without needing to be concerned + /// about encoding fragment boundaries. + fn send_fragment( + recipient: ParaId, + format: XcmpMessageFormat, + fragment: Fragment, + ) -> Result { + let data = fragment.encode(); + + // Optimization note: `max_message_size` could potentially be stored in + // `OutboundXcmpMessages` once known; that way it's only accessed when a new page is needed. + + let max_message_size = T::ChannelInfo::get_channel_max(recipient) + .ok_or(MessageSendError::NoChannel)?; + if data.len() > max_message_size { + return Err(MessageSendError::TooBig); + } + + let mut s = OutboundXcmpStatus::get(); + let index = s.iter().position(|item| item.0 == recipient) + .unwrap_or_else(|| { + s.push((recipient, OutboundStatus::Ok, false, 0, 0)); + s.len() - 1 + }); + let have_active = s[index].4 > s[index].3; + let appended = have_active && OutboundXcmpMessages::mutate(recipient, s[index].4 - 1, |s| { + if XcmpMessageFormat::decode(&mut &s[..]) != Ok(format) { return false } + if s.len() + data.len() > max_message_size { return false } + s.extend_from_slice(&data[..]); + return true + }); + if appended { + Ok((s[index].4 - s[index].3 - 1) as u32) + } else { + // Need to add a new page. + let page_index = s[index].4; + s[index].4 += 1; + let mut new_page = format.encode(); + new_page.extend_from_slice(&data[..]); + OutboundXcmpMessages::insert(recipient, page_index, new_page); + let r = (s[index].4 - s[index].3 - 1) as u32; + OutboundXcmpStatus::put(s); + Ok(r) + } + } + + /// Sends a signal to the `dest` chain over XCMP. This is guaranteed to be dispatched on this + /// block. + fn send_signal(dest: ParaId, signal: ChannelSignal) -> Result<(), ()> { + let mut s = OutboundXcmpStatus::get(); + if let Some(index) = s.iter().position(|item| item.0 == dest) { + s[index].2 = true; + } else { + s.push((dest, OutboundStatus::Ok, true, 0, 0)); + } + SignalMessages::mutate(dest, |page| if page.is_empty() { + *page = (XcmpMessageFormat::Signals, signal).encode(); + } else { + signal.using_encoded(|s| page.extend_from_slice(s)); + }); + OutboundXcmpStatus::put(s); + + Ok(()) + } + + pub fn send_blob_message( + recipient: ParaId, + blob: Vec, + ) -> Result { + Self::send_fragment(recipient, XcmpMessageFormat::ConcatenatedEncodedBlob, blob) + } + + pub fn send_xcm_message( + recipient: ParaId, + xcm: VersionedXcm<()>, + ) -> Result { + Self::send_fragment(recipient, XcmpMessageFormat::ConcatenatedVersionedXcm, xcm) + } + + fn create_shuffle(len: usize) -> Vec { + // Create a shuffled order for use to iterate through. + // Not a great random seed, but good enough for our purposes. + let seed = frame_system::Pallet::::parent_hash(); + let seed = <[u8; 32]>::decode(&mut sp_runtime::traits::TrailingZeroInput::new(seed.as_ref())) + .expect("input is padded with zeroes; qed"); + let mut rng = ChaChaRng::from_seed(seed); + let mut shuffled = (0..len).collect::>(); + for i in 0..len { + let j = (rng.next_u32() as usize) % len; + let a = shuffled[i]; + shuffled[i] = shuffled[j]; + shuffled[j] = a; + } + shuffled + } + + fn handle_blob_message(_sender: ParaId, _sent_at: RelayBlockNumber, _blob: Vec, _weight_limit: Weight) -> Result { + debug_assert!(false, "Blob messages not handled."); + Err(false) + } + + fn handle_xcm_message( + sender: ParaId, + _sent_at: RelayBlockNumber, + xcm: VersionedXcm, + max_weight: Weight, + ) -> Result { + let hash = Encode::using_encoded(&xcm, T::Hashing::hash); + log::debug!("Processing XCMP-XCM: {:?}", &hash); + let (result, event) = match Xcm::::try_from(xcm) { + Ok(xcm) => { + let location = ( + Junction::Parent, + Junction::Parachain { id: sender.into() }, + ); + match T::XcmExecutor::execute_xcm( + location.into(), + xcm, + max_weight, + ) { + Outcome::Error(e) => (Err(e.clone()), RawEvent::Fail(Some(hash), e)), + Outcome::Complete(w) => (Ok(w), RawEvent::Success(Some(hash))), + // As far as the caller is concerned, this was dispatched without error, so + // we just report the weight used. + Outcome::Incomplete(w, e) => (Ok(w), RawEvent::Fail(Some(hash), e)), + } + } + Err(()) => (Err(XcmError::UnhandledXcmVersion), RawEvent::BadVersion(Some(hash))), + }; + Self::deposit_event(event); + result + } + + fn process_xcmp_message( + sender: ParaId, + (sent_at, format): (RelayBlockNumber, XcmpMessageFormat), + max_weight: Weight, + ) -> (Weight, bool) { + let data = InboundXcmpMessages::get(sender, sent_at); + let mut last_remaining_fragments; + let mut remaining_fragments = &data[..]; + let mut weight_used = 0; + match format { + XcmpMessageFormat::ConcatenatedVersionedXcm => { + while !remaining_fragments.is_empty() { + last_remaining_fragments = remaining_fragments; + if let Ok(xcm) = VersionedXcm::::decode(&mut remaining_fragments) { + let weight = max_weight - weight_used; + match Self::handle_xcm_message(sender, sent_at, xcm, weight) { + Ok(used) => weight_used = weight_used.saturating_add(used), + Err(XcmError::TooMuchWeightRequired) => { + // That message didn't get processed this time because of being + // too heavy. We leave it around for next time and bail. + remaining_fragments = last_remaining_fragments; + break; + } + Err(_) => { + // Message looks invalid; don't attempt to retry + } + } + } else { + debug_assert!(false, "Invalid incoming XCMP message data"); + remaining_fragments = &b""[..]; + } + } + } + XcmpMessageFormat::ConcatenatedEncodedBlob => { + while !remaining_fragments.is_empty() { + last_remaining_fragments = remaining_fragments; + if let Ok(blob) = >::decode(&mut remaining_fragments) { + let weight = max_weight - weight_used; + match Self::handle_blob_message(sender, sent_at, blob, weight) { + Ok(used) => weight_used = weight_used.saturating_add(used), + Err(true) => { + // That message didn't get processed this time because of being + // too heavy. We leave it around for next time and bail. + remaining_fragments = last_remaining_fragments; + break; + } + Err(false) => { + // Message invalid; don't attempt to retry + } + } + } else { + debug_assert!(false, "Invalid incoming blob message data"); + remaining_fragments = &b""[..]; + } + } + } + XcmpMessageFormat::Signals => { + debug_assert!(false, "All signals are handled immediately; qed"); + remaining_fragments = &b""[..]; + } + } + let is_empty = remaining_fragments.is_empty(); + if is_empty { + InboundXcmpMessages::remove(sender, sent_at); + } else { + InboundXcmpMessages::insert(sender, sent_at, remaining_fragments); + } + (weight_used, is_empty) + } + + /// Service the incoming XCMP message queue attempting to execute up to `max_weight` execution + /// weight of messages. + fn service_xcmp_queue(max_weight: Weight) -> Weight { + let mut status = InboundXcmpStatus::get(); // <- sorted. + if status.len() == 0 { + return 0 + } + + let QueueConfigData { + resume_threshold, + threshold_weight, + weight_restrict_decay, + .. + } = QueueConfig::get(); + + let mut shuffled = Self::create_shuffle(status.len()); + let mut weight_used = 0; + let mut weight_available = 0; + + // We don't want the possibility of a chain sending a series of really heavy messages and + // tying up the block's execution time from other chains. Therefore we execute any remaining + // messages in a random order. + // Order within a single channel will always be preserved, however this does mean that + // relative order between channels may not. The result is that chains which tend to send + // fewer, lighter messages will generally have a lower latency than chains which tend to + // send more, heavier messages. + + let mut shuffle_index = 0; + while shuffle_index < shuffled.len() && max_weight.saturating_sub(weight_used) < threshold_weight { + let index = shuffled[shuffle_index]; + let sender = status[index].0; + + if weight_available != max_weight { + // Get incrementally closer to freeing up max_weight for message execution over the + // first round. For the second round we unlock all weight. If we come close enough + // on the first round to unlocking everything, then we do so. + if shuffle_index < status.len() { + weight_available += (max_weight - weight_available) / weight_restrict_decay; + if weight_available + threshold_weight > max_weight { + weight_available = max_weight; + } + } else { + weight_available = max_weight; + } + } + + let weight_processed = if status[index].2.is_empty() { + debug_assert!(false, "channel exists in status; there must be messages; qed"); + 0 + } else { + // Process up to one block's worth for now. + let weight_remaining = weight_available.saturating_sub(weight_used); + let (weight_processed, is_empty) = Self::process_xcmp_message( + sender, + status[index].2[0], + weight_remaining, + ); + if is_empty { + status[index].2.remove(0); + } + weight_processed + }; + weight_used += weight_processed; + + if status[index].2.len() as u32 <= resume_threshold && status[index].1 == InboundStatus::Suspended { + // Resume + let r = Self::send_signal(sender, ChannelSignal::Resume); + debug_assert!(r.is_ok(), "WARNING: Failed sending resume into suspended channel"); + status[index].1 = InboundStatus::Ok; + } + + // If there are more and we're making progress, we process them after we've given the + // other channels a look in. If we've still not unlocked all weight, then we set them + // up for processing a second time anyway. + if !status[index].2.is_empty() && weight_processed > 0 || weight_available != max_weight { + if shuffle_index + 1 == shuffled.len() { + // Only this queue left. Just run around this loop once more. + continue + } + shuffled.push(index); + } + shuffle_index += 1; + } + + // Only retain the senders that have non-empty queues. + status.retain(|item| !item.2.is_empty()); + + InboundXcmpStatus::put(status); + weight_used + } + + fn suspend_channel(target: ParaId) { + OutboundXcmpStatus::mutate(|s| { + if let Some(index) = s.iter().position(|item| item.0 == target) { + let ok = s[index].1 == OutboundStatus::Ok; + debug_assert!(ok, "WARNING: Attempt to suspend channel that was not Ok."); + s[index].1 = OutboundStatus::Suspended; + } else { + s.push((target, OutboundStatus::Suspended, false, 0, 0)); + } + }); + } + + fn resume_channel(target: ParaId) { + OutboundXcmpStatus::mutate(|s| { + if let Some(index) = s.iter().position(|item| item.0 == target) { + let suspended = s[index].1 == OutboundStatus::Suspended; + debug_assert!(suspended, "WARNING: Attempt to resume channel that was not suspended."); + if s[index].3 == s[index].4 { + s.remove(index); + } else { + s[index].1 = OutboundStatus::Ok; + } + } else { + debug_assert!(false, "WARNING: Attempt to resume channel that was not suspended."); + } + }); + } +} + +impl XcmpMessageHandler for Module { + fn handle_xcmp_messages<'a, I: Iterator>( + iter: I, + max_weight: Weight, + ) -> Weight { + let mut status = InboundXcmpStatus::get(); + + let QueueConfigData { suspend_threshold, drop_threshold, .. } = QueueConfig::get(); + + for (sender, sent_at, data) in iter { + + // Figure out the message format. + let mut data_ref = data; + let format = match XcmpMessageFormat::decode(&mut data_ref) { + Ok(f) => f, + Err(_) => { + debug_assert!(false, "Unknown XCMP message format. Silently dropping message"); + continue + }, + }; + if format == XcmpMessageFormat::Signals { + while !data_ref.is_empty() { + use ChannelSignal::*; + match ChannelSignal::decode(&mut data_ref) { + Ok(Suspend) => Self::suspend_channel(sender), + Ok(Resume) => Self::resume_channel(sender), + Err(_) => break, + } + } + } else { + // Record the fact we received it. + match status.binary_search_by_key(&sender, |item| item.0) { + Ok(i) => { + let count = status[i].2.len(); + if count as u32 >= suspend_threshold && status[i].1 == InboundStatus::Ok { + status[i].1 = InboundStatus::Suspended; + let r = Self::send_signal(sender, ChannelSignal::Suspend); + if r.is_err() { + log::warn!("Attempt to suspend channel failed. Messages may be dropped."); + } + } + if (count as u32) < drop_threshold { + status[i].2.push((sent_at, format)); + } else { + debug_assert!(false, "XCMP channel queue full. Silently dropping message"); + } + }, + Err(_) => status.push((sender, InboundStatus::Ok, vec![(sent_at, format)])), + } + // Queue the payload for later execution. + InboundXcmpMessages::insert(sender, sent_at, data_ref); + } + + // Optimization note; it would make sense to execute messages immediately if + // `status.is_empty()` here. + } + status.sort(); + InboundXcmpStatus::put(status); + + Self::service_xcmp_queue(max_weight) + } +} + +impl XcmpMessageSource for Module { + fn take_outbound_messages(maximum_channels: usize) -> Vec<(ParaId, Vec)> { + let mut statuses = OutboundXcmpStatus::get(); + let old_statuses_len = statuses.len(); + let max_message_count = statuses.len().min(maximum_channels); + let mut result = Vec::with_capacity(max_message_count); + + for status in statuses.iter_mut() { + let (para_id, outbound_status, mut signalling, mut begin, mut end) = *status; + + if result.len() == max_message_count { + // We check this condition in the beginning of the loop so that we don't include + // a message where the limit is 0. + break; + } + if outbound_status == OutboundStatus::Suspended { + continue + } + let (max_size_now, max_size_ever) = match T::ChannelInfo::get_channel_status(para_id) { + ChannelStatus::Closed => { + // This means that there is no such channel anymore. Nothing to be done but + // swallow the messages and discard the status. + for i in begin..end { + OutboundXcmpMessages::remove(para_id, i); + } + if signalling { + SignalMessages::remove(para_id); + } + *status = (para_id, OutboundStatus::Ok, false, 0, 0); + continue + } + ChannelStatus::Full => continue, + ChannelStatus::Ready(n, e) => (n, e), + }; + + let page = if signalling { + let page = SignalMessages::get(para_id); + if page.len() < max_size_now { + SignalMessages::remove(para_id); + signalling = false; + page + } else { + continue + } + } else if end > begin { + let page = OutboundXcmpMessages::get(para_id, begin); + if page.len() < max_size_now { + OutboundXcmpMessages::remove(para_id, begin); + begin += 1; + page + } else { + continue + } + } else { + continue; + }; + if begin == end { + begin = 0; + end = 0; + } + + if page.len() > max_size_ever { + // TODO: #274 This means that the channel's max message size has changed since + // the message was sent. We should parse it and split into smaller mesasges but + // since it's so unlikely then for now we just drop it. + log::warn!("WARNING: oversize message in queue. silently dropping."); + } else { + result.push((para_id, page)); + } + + *status = (para_id, outbound_status, signalling, begin, end); + } + + // Sort the outbound messages by ascending recipient para id to satisfy the acceptance + // criteria requirement. + result.sort_by_key(|m| m.0); + + // Prune hrmp channels that became empty. Additionally, because it may so happen that we + // only gave attention to some channels in `non_empty_hrmp_channels` it's important to + // change the order. Otherwise, the next `on_finalize` we will again give attention + // only to those channels that happen to be in the beginning, until they are emptied. + // This leads to "starvation" of the channels near to the end. + // + // To mitigate this we shift all processed elements towards the end of the vector using + // `rotate_left`. To get intuition how it works see the examples in its rustdoc. + statuses.retain(|x| x.1 == OutboundStatus::Suspended || x.2 || x.3 < x.4); + + // old_status_len must be >= status.len() since we never add anything to status. + let pruned = old_statuses_len - statuses.len(); + // removing an item from status implies a message being sent, so the result messages must + // be no less than the pruned channels. + statuses.rotate_left(result.len() - pruned); + + OutboundXcmpStatus::put(statuses); + + result + } +} + +/// Xcm sender for sending to a sibling parachain. +impl SendXcm for Module { + fn send_xcm(dest: MultiLocation, msg: Xcm<()>) -> Result<(), XcmError> { + match &dest { + // An HRMP message for a sibling parachain. + MultiLocation::X2(Junction::Parent, Junction::Parachain { id }) => { + let msg = VersionedXcm::<()>::from(msg); + let hash = T::Hashing::hash_of(&msg); + Self::send_fragment((*id).into(), XcmpMessageFormat::ConcatenatedVersionedXcm, msg) + .map_err(|e| XcmError::SendFailed(<&'static str>::from(e)))?; + Self::deposit_event(RawEvent::XcmpMessageSent(Some(hash))); + Ok(()) + } + // Anything else is unhandled. This includes a message this is meant for us. + _ => Err(XcmError::CannotReachDestination(dest, msg)), + } + } +} diff --git a/primitives/core/Cargo.toml b/primitives/core/Cargo.toml index 35806626e8..518fc8c2e9 100644 --- a/primitives/core/Cargo.toml +++ b/primitives/core/Cargo.toml @@ -9,16 +9,19 @@ edition = "2018" sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } sp-trie = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } # Polkadot dependencies polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } polkadot-primitives = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } +xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } # Other dependencies impl-trait-for-tuples = "0.2.1" codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = [ "derive" ] } + [features] default = [ "std" ] std = [ @@ -29,4 +32,5 @@ std = [ "polkadot-core-primitives/std", "sp-runtime/std", "sp-trie/std", + "frame-support/std", ] diff --git a/primitives/core/src/lib.rs b/primitives/core/src/lib.rs index 7751fdcec4..dc39338d36 100644 --- a/primitives/core/src/lib.rs +++ b/primitives/core/src/lib.rs @@ -18,7 +18,10 @@ #![cfg_attr(not(feature = "std"), no_std)] -use sp_runtime::traits::Block as BlockT; +use sp_std::prelude::*; +use codec::{Encode, Decode}; +use sp_runtime::{RuntimeDebug, traits::Block as BlockT}; +use frame_support::weights::Weight; pub use polkadot_core_primitives::InboundDownwardMessage; pub use polkadot_parachain::primitives::{Id as ParaId, UpwardMessage, ValidationParams}; @@ -32,6 +35,7 @@ pub mod relay_chain { pub use polkadot_primitives::v1; pub use polkadot_primitives::v1::well_known_keys; } +use relay_chain::BlockNumber as RelayBlockNumber; /// An inbound HRMP message. pub type InboundHrmpMessage = polkadot_primitives::v1::InboundHrmpMessage; @@ -39,6 +43,52 @@ pub type InboundHrmpMessage = polkadot_primitives::v1::InboundHrmpMessage; +/// Error description of a message send failure. +#[derive(Eq, PartialEq, Copy, Clone, RuntimeDebug, Encode, Decode)] +pub enum MessageSendError { + /// The dispatch queue is full. + QueueFull, + /// There does not exist a channel for sending the message. + NoChannel, + /// The message is too big to ever fit in a channel. + TooBig, + /// Some other error. + Other, +} + +impl From for &'static str { + fn from(e: MessageSendError) -> Self { + use MessageSendError::*; + match e { + QueueFull => "QueueFull", + NoChannel => "NoChannel", + TooBig => "TooBig", + Other => "Other", + } + } +} + +/// Information about an XCMP channel. +pub struct ChannelInfo { + /// The maximum number of messages that can be pending in the channel at once. + pub max_capacity: u32, + /// The maximum total size of the messages that can be pending in the channel at once. + pub max_total_size: u32, + /// The maximum message size that could be put into the channel. + pub max_message_size: u32, + /// The current number of messages pending in the channel. + /// Invariant: should be less or equal to `max_capacity`.s`. + pub msg_count: u32, + /// The total size in bytes of all message payloads in the channel. + /// Invariant: should be less or equal to `max_total_size`. + pub total_size: u32, +} + +pub trait GetChannelInfo { + fn get_channel_status(id: ParaId) -> ChannelStatus; + fn get_channel_max(id: ParaId) -> Option; +} + /// Well known keys for values in the storage. pub mod well_known_keys { /// The storage key for the upward messages. @@ -68,29 +118,81 @@ pub mod well_known_keys { } /// Something that should be called when a downward message is received. -#[impl_trait_for_tuples::impl_for_tuples(30)] pub trait DownwardMessageHandler { /// Handle the given downward message. - fn handle_downward_message(msg: InboundDownwardMessage); + fn handle_downward_message(msg: InboundDownwardMessage) -> Weight; +} +impl DownwardMessageHandler for () { + fn handle_downward_message(_msg: InboundDownwardMessage) -> Weight { 0 } } -/// Something that should be called when an HRMP message is received. -#[impl_trait_for_tuples::impl_for_tuples(30)] -pub trait HrmpMessageHandler { - /// Handle the given HRMP message. - fn handle_hrmp_message(sender: ParaId, msg: InboundHrmpMessage); +/// Something that should be called for each batch of messages received over XCMP. +pub trait XcmpMessageHandler { + /// Handle some incoming XCMP messages (note these are the big one-per-block aggregate + /// messages). + /// + /// Also, process messages up to some `max_weight`. + fn handle_xcmp_messages<'a, I: Iterator>( + iter: I, + max_weight: Weight, + ) -> Weight; +} +impl XcmpMessageHandler for () { + fn handle_xcmp_messages<'a, I: Iterator>( + iter: I, + _max_weight: Weight, + ) -> Weight { for _ in iter {} 0 } } /// Something that should be called when sending an upward message. pub trait UpwardMessageSender { - /// Send the given upward message. - fn send_upward_message(msg: UpwardMessage) -> Result<(), ()>; + /// Send the given UMP message; return the expected number of blocks before the message will + /// be dispatched or an error if the message cannot be sent. + fn send_upward_message(msg: UpwardMessage) -> Result; +} +impl UpwardMessageSender for () { + fn send_upward_message(_msg: UpwardMessage) -> Result { + Err(MessageSendError::NoChannel) + } } -/// Something that should be called when sending an HRMP message. -pub trait HrmpMessageSender { - /// Send the given HRMP message. - fn send_hrmp_message(msg: OutboundHrmpMessage) -> Result<(), ()>; +/// The status of a channel. +pub enum ChannelStatus { + /// Channel doesn't exist/has been closed. + Closed, + /// Channel is completely full right now. + Full, + /// Channel is ready for sending; the two parameters are the maximum size a valid message may + /// have right now, and the maximum size a message may ever have (this will generally have been + /// available during message construction, but it's possible the channel parameters changed in + /// the meantime). + Ready(usize, usize), +} + +/// A means of figuring out what outbound XCMP messages should be being sent. +pub trait XcmpMessageSource { + /// Take a single XCMP message from the queue for the given `dest`, if one exists. + fn take_outbound_messages( + maximum_channels: usize, + ) -> Vec<(ParaId, Vec)>; +} + +impl XcmpMessageSource for () { + fn take_outbound_messages( + _maximum_channels: usize, + ) -> Vec<(ParaId, Vec)> { vec![] } +} + +/// The "quality of service" considerations for message sending. +#[derive(Eq, PartialEq, Clone, Copy, Encode, Decode, RuntimeDebug)] +pub enum ServiceQuality { + /// Ensure that this message is dispatched in the same relative order as any other messages that + /// were also sent with `Ordered`. This only guarantees message ordering on the dispatch side, + /// and not necessarily on the execution side. + Ordered, + /// Ensure that the message is dispatched as soon as possible, which could result in it being + /// dispatched before other messages which are larger and/or rely on relative ordering. + Fast, } /// A trait which is called when the validation data is set. diff --git a/primitives/utility/Cargo.toml b/primitives/utility/Cargo.toml new file mode 100644 index 0000000000..d069f7394f --- /dev/null +++ b/primitives/utility/Cargo.toml @@ -0,0 +1,39 @@ +[package] +name = "cumulus-primitives-utility" +version = "0.1.0" +authors = ["Parity Technologies "] +edition = "2018" + +[dependencies] +# Substrate dependencies +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-trie = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } + +# Polkadot dependencies +polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } +polkadot-primitives = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } +polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } +xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } + +cumulus-primitives-core = { path = "../core", default-features = false } + +# Other dependencies +impl-trait-for-tuples = "0.2.1" +codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = [ "derive" ] } + + +[features] +default = [ "std" ] +std = [ + "codec/std", + "sp-std/std", + "polkadot-primitives/std", + "polkadot-parachain/std", + "polkadot-core-primitives/std", + "sp-runtime/std", + "sp-trie/std", + "frame-support/std", + "cumulus-primitives-core/std", +] diff --git a/primitives/utility/src/lib.rs b/primitives/utility/src/lib.rs new file mode 100644 index 0000000000..bbfb0c5299 --- /dev/null +++ b/primitives/utility/src/lib.rs @@ -0,0 +1,77 @@ +// Copyright 2020-2021 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Substrate is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Substrate is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Cumulus. If not, see . + +//! Helper datatypes for cumulus. This includes the [`ParentAsUmp`] routing type which will route +//! messages into an [`UpwardMessageSender`] if the destination is `Parent`. + +#![cfg_attr(not(feature = "std"), no_std)] + +use sp_std::{marker::PhantomData, convert::TryFrom}; +use codec::{Encode, Decode}; +use cumulus_primitives_core::{UpwardMessageSender, DownwardMessageHandler, InboundDownwardMessage}; +use xcm::{VersionedXcm, v0::{Xcm, MultiLocation, Junction, SendXcm, Error as XcmError, ExecuteXcm}}; +use frame_support::{traits::Get, dispatch::Weight}; + +/// Xcm router which recognises the `Parent` destination and handles it by sending the message into +/// the given UMP `UpwardMessageSender` implementation. Thus this essentially adapts an +/// `UpwardMessageSender` trait impl into a `SendXcm` trait impl. +/// +/// NOTE: This is a pretty dumb "just send it" router; we will probably want to introduce queuing +/// to UMP eventually and when we do, the pallet which implements the queuing will be responsible +/// for the `SendXcm` implementation. +pub struct ParentAsUmp(PhantomData); +impl SendXcm for ParentAsUmp { + fn send_xcm(dest: MultiLocation, msg: Xcm<()>) -> Result<(), XcmError> { + match &dest { + // An upward message for the relay chain. + MultiLocation::X1(Junction::Parent) => { + let data = VersionedXcm::<()>::from(msg).encode(); + + T::send_upward_message(data) + .map_err(|e| XcmError::SendFailed(e.into()))?; + + Ok(()) + } + // Anything else is unhandled. This includes a message this is meant for us. + _ => Err(XcmError::CannotReachDestination(dest, msg)), + } + } +} + +/// For an incoming downward message, this just adapts an XCM executor and executes DMP messages +/// immediately up until some `MaxWeight` at which point it errors. Their origin is asserted to be +/// the Parent location. +pub struct UnqueuedDmpAsParent( + PhantomData<(MaxWeight, XcmExecutor, Call)> +); +impl< + MaxWeight: Get, + XcmExecutor: ExecuteXcm, + Call, +> DownwardMessageHandler for UnqueuedDmpAsParent { + fn handle_downward_message(msg: InboundDownwardMessage) -> Weight { + let msg = VersionedXcm::::decode(&mut &msg.msg[..]) + .map(Xcm::::try_from); + match msg { + Ok(Ok(x)) => { + let weight_limit = MaxWeight::get(); + XcmExecutor::execute_xcm(Junction::Parent.into(), x, weight_limit).weight_used() + } + Ok(Err(..)) => 0, + Err(..) => 0, + } + } +} diff --git a/rococo-parachains/Cargo.toml b/rococo-parachains/Cargo.toml index 18f34b8cb1..af61ddd243 100644 --- a/rococo-parachains/Cargo.toml +++ b/rococo-parachains/Cargo.toml @@ -23,6 +23,7 @@ hex-literal = "0.2.1" # Parachain dependencies parachain-runtime = { package = "cumulus-test-parachain-runtime", path = "runtime" } +shell-runtime = { package = "cumulus-shell-runtime", path = "shell-runtime" } rococo-parachain-primitives = { path = "primitives" } # Substrate dependencies @@ -67,7 +68,6 @@ cumulus-primitives-core = { path = "../primitives/core" } polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master" } -polkadot-test-service = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "master" } [build-dependencies] diff --git a/rococo-parachains/contracts-runtime/src/lib.rs b/rococo-parachains/contracts-runtime/src/lib.rs deleted file mode 100644 index 432163e293..0000000000 --- a/rococo-parachains/contracts-runtime/src/lib.rs +++ /dev/null @@ -1,412 +0,0 @@ -// Copyright 2019-2021 Parity Technologies (UK) Ltd. -// This file is part of Cumulus. - -// Cumulus is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Cumulus is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Cumulus. If not, see . - -#![cfg_attr(not(feature = "std"), no_std)] -// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. -#![recursion_limit = "256"] - -// Make the WASM binary available. -#[cfg(feature = "std")] -include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); - -use cumulus_pallet_contracts_rpc_runtime_api::ContractExecResult; -use rococo_parachain_primitives::*; -use sp_api::impl_runtime_apis; -use sp_core::OpaqueMetadata; -use sp_runtime::{ - create_runtime_str, generic, impl_opaque_keys, - traits::{BlakeTwo256, Block as BlockT, IdentityLookup, Saturating}, - transaction_validity::{TransactionSource, TransactionValidity}, - ApplyExtrinsicResult, -}; -use sp_std::prelude::*; -#[cfg(feature = "std")] -use sp_version::NativeVersion; -use sp_version::RuntimeVersion; - -// A few exports that help ease life for downstream crates. -pub use frame_support::{ - construct_runtime, parameter_types, - traits::Randomness, - weights::{constants::WEIGHT_PER_SECOND, IdentityFee, Weight}, - StorageValue, -}; -pub use pallet_balances::Call as BalancesCall; -pub use pallet_timestamp::Call as TimestampCall; -#[cfg(any(feature = "std", test))] -pub use sp_runtime::BuildStorage; -pub use sp_runtime::{Perbill, Permill}; - -pub type SessionHandlers = (); - -impl_opaque_keys! { - pub struct SessionKeys {} -} - -/// This runtime version. -pub const VERSION: RuntimeVersion = RuntimeVersion { - spec_name: create_runtime_str!("cumulus-contracts-parachain"), - impl_name: create_runtime_str!("cumulus-contracts-parachain"), - authoring_version: 1, - spec_version: 4, - impl_version: 1, - apis: RUNTIME_API_VERSIONS, - transaction_version: 1, -}; - -pub const MILLISECS_PER_BLOCK: u64 = 6000; - -pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK; - -pub const EPOCH_DURATION_IN_BLOCKS: u32 = 10 * MINUTES; - -// These time units are defined in number of blocks. -pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber); -pub const HOURS: BlockNumber = MINUTES * 60; -pub const DAYS: BlockNumber = HOURS * 24; - -// 1 in 4 blocks (on average, not counting collisions) will be primary babe blocks. -pub const PRIMARY_PROBABILITY: (u64, u64) = (1, 4); - -#[derive(codec::Encode, codec::Decode)] -pub enum XCMPMessage { - /// Transfer tokens to the given account from the Parachain account. - TransferToken(XAccountId, XBalance), -} - -/// The version information used to identify this runtime when compiled natively. -#[cfg(feature = "std")] -pub fn native_version() -> NativeVersion { - NativeVersion { - runtime_version: VERSION, - can_author_with: Default::default(), - } -} - -parameter_types! { - pub const BlockHashCount: BlockNumber = 250; - pub const MaximumBlockWeight: Weight = 2 * WEIGHT_PER_SECOND; - /// Assume 10% of weight for average on_initialize calls. - pub MaximumExtrinsicWeight: Weight = AvailableBlockRatio::get() - .saturating_sub(Perbill::from_percent(10)) * MaximumBlockWeight::get(); - pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75); - pub const MaximumBlockLength: u32 = 5 * 1024 * 1024; - pub const Version: RuntimeVersion = VERSION; - pub const ExtrinsicBaseWeight: Weight = 10_000_000; - pub const SS58Prefix: u8 = 42; -} - -impl frame_system::Config for Runtime { - /// The identifier used to distinguish between accounts. - type AccountId = AccountId; - /// The aggregated dispatch type that is available for extrinsics. - type Call = Call; - /// The lookup mechanism to get account ID from whatever is passed in dispatchers. - type Lookup = IdentityLookup; - /// The index type for storing how many extrinsics an account has signed. - type Index = Index; - /// The index type for blocks. - type BlockNumber = BlockNumber; - /// The type for hashing blocks and tries. - type Hash = Hash; - /// The hashing algorithm used. - type Hashing = BlakeTwo256; - /// The header type. - type Header = generic::Header; - /// The ubiquitous event type. - type Event = Event; - /// The ubiquitous origin type. - type Origin = Origin; - /// Maximum number of block number to block hash mappings to keep (oldest pruned first). - type BlockHashCount = BlockHashCount; - /// Maximum weight of each block. With a default weight system of 1byte == 1weight, 4mb is ok. - type MaximumBlockWeight = MaximumBlockWeight; - /// Maximum size of all encoded transactions (in bytes) that are allowed in one block. - type MaximumBlockLength = MaximumBlockLength; - /// Portion of the block weight that is available to all normal transactions. - type AvailableBlockRatio = AvailableBlockRatio; - /// Runtime version. - type Version = Version; - type PalletInfo = PalletInfo; - type AccountData = pallet_balances::AccountData; - type OnNewAccount = (); - type OnKilledAccount = (); - type DbWeight = (); - type ExtrinsicBaseWeight = ExtrinsicBaseWeight; - type BlockExecutionWeight = (); - type MaximumExtrinsicWeight = MaximumExtrinsicWeight; - type BaseCallFilter = (); - type SystemWeightInfo = (); - type SS58Prefix = SS58Prefix; -} - -parameter_types! { - pub const MinimumPeriod: u64 = SLOT_DURATION / 2; -} - -impl pallet_timestamp::Config for Runtime { - /// A timestamp: milliseconds since the unix epoch. - type Moment = u64; - type OnTimestampSet = (); - type MinimumPeriod = MinimumPeriod; - type WeightInfo = (); -} - -parameter_types! { - pub const ExistentialDeposit: u128 = 500; - pub const TransferFee: u128 = 0; - pub const CreationFee: u128 = 0; - pub const TransactionByteFee: u128 = 1; -} - -impl pallet_balances::Config for Runtime { - /// The type for recording an account's balance. - type Balance = Balance; - /// The ubiquitous event type. - type Event = Event; - type DustRemoval = (); - type ExistentialDeposit = ExistentialDeposit; - type AccountStore = System; - type WeightInfo = (); -} - -impl pallet_transaction_payment::Config for Runtime { - type Currency = Balances; - type OnTransactionPayment = (); - type TransactionByteFee = TransactionByteFee; - type WeightToFee = IdentityFee; - type FeeMultiplierUpdate = (); -} - -impl pallet_sudo::Config for Runtime { - type Call = Call; - type Event = Event; -} - -impl cumulus_parachain_system::Config for Runtime { - type Event = Event; - type OnValidationFunctionParams = (); -} - -impl cumulus_message_broker::Config for Runtime { - type Event = Event; - type DownwardMessageHandlers = TokenDealer; - type UpwardMessage = cumulus_upward_message::RococoUpwardMessage; - type ParachainId = ParachainInfo; - type XCMPMessage = cumulus_token_dealer::XCMPMessage; - type XCMPMessageHandlers = TokenDealer; -} - -impl cumulus_token_dealer::Config for Runtime { - type Event = Event; - type UpwardMessageSender = MessageBroker; - type UpwardMessage = cumulus_upward_message::RococoUpwardMessage; - type Currency = Balances; - type XCMPMessageSender = MessageBroker; -} - -impl parachain_info::Config for Runtime {} - -// We disable the rent system for easier testing. -parameter_types! { - pub const TombstoneDeposit: Balance = 0; - pub const RentByteFee: Balance = 0; - pub const RentDepositOffset: Balance = 0; - pub const SurchargeReward: Balance = 0; -} - -impl cumulus_pallet_contracts::Config for Runtime { - type Time = Timestamp; - type Randomness = RandomnessCollectiveFlip; - type Currency = Balances; - type Call = Call; - type Event = Event; - type DetermineContractAddress = cumulus_pallet_contracts::SimpleAddressDeterminer; - type TrieIdGenerator = cumulus_pallet_contracts::TrieIdFromParentCounter; - type RentPayment = (); - type SignedClaimHandicap = cumulus_pallet_contracts::DefaultSignedClaimHandicap; - type TombstoneDeposit = TombstoneDeposit; - type StorageSizeOffset = cumulus_pallet_contracts::DefaultStorageSizeOffset; - type RentByteFee = RentByteFee; - type RentDepositOffset = RentDepositOffset; - type SurchargeReward = SurchargeReward; - type MaxDepth = cumulus_pallet_contracts::DefaultMaxDepth; - type MaxValueSize = cumulus_pallet_contracts::DefaultMaxValueSize; - type WeightPrice = pallet_transaction_payment::Module; -} - -construct_runtime! { - pub enum Runtime where - Block = Block, - NodeBlock = rococo_parachain_primitives::Block, - UncheckedExtrinsic = UncheckedExtrinsic - { - System: frame_system::{Module, Call, Storage, Config, Event}, - Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent}, - Balances: pallet_balances::{Module, Call, Storage, Config, Event}, - Contracts: cumulus_pallet_contracts::{Module, Call, Config, Storage, Event}, - Sudo: pallet_sudo::{Module, Call, Storage, Config, Event}, - RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage}, - ParachainUpgrade: cumulus_parachain_system::{Module, Call, Storage, Inherent, Event}, - MessageBroker: cumulus_message_broker::{Module, Call, Inherent, Event}, - TokenDealer: cumulus_token_dealer::{Module, Call, Event}, - TransactionPayment: pallet_transaction_payment::{Module, Storage}, - ParachainInfo: parachain_info::{Module, Storage, Config}, - } -} - -/// The address format for describing accounts. -pub type Address = AccountId; -/// Block header type as expected by this runtime. -pub type Header = generic::Header; -/// Block type as expected by this runtime. -pub type Block = generic::Block; -/// A Block signed with a Justification -pub type SignedBlock = generic::SignedBlock; -/// BlockId type as expected by this runtime. -pub type BlockId = generic::BlockId; -/// The SignedExtension to the basic transaction logic. -pub type SignedExtra = ( - frame_system::CheckSpecVersion, - frame_system::CheckGenesis, - frame_system::CheckEra, - frame_system::CheckNonce, - frame_system::CheckWeight, - pallet_transaction_payment::ChargeTransactionPayment, -); -/// Unchecked extrinsic type as expected by this runtime. -pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; -/// Extrinsic type that has already been checked. -pub type CheckedExtrinsic = generic::CheckedExtrinsic; -/// Executive: handles dispatch to the various modules. -pub type Executive = frame_executive::Executive< - Runtime, - Block, - frame_system::ChainContext, - Runtime, - AllModules, ->; - -impl_runtime_apis! { - impl sp_api::Core for Runtime { - fn version() -> RuntimeVersion { - VERSION - } - - fn execute_block(block: Block) { - Executive::execute_block(block) - } - - fn initialize_block(header: &::Header) { - Executive::initialize_block(header) - } - } - - impl sp_api::Metadata for Runtime { - fn metadata() -> OpaqueMetadata { - Runtime::metadata().into() - } - } - - impl sp_block_builder::BlockBuilder for Runtime { - fn apply_extrinsic( - extrinsic: ::Extrinsic, - ) -> ApplyExtrinsicResult { - Executive::apply_extrinsic(extrinsic) - } - - fn finalize_block() -> ::Header { - Executive::finalize_block() - } - - fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<::Extrinsic> { - data.create_extrinsics() - } - - fn check_inherents(block: Block, data: sp_inherents::InherentData) -> sp_inherents::CheckInherentsResult { - data.check_extrinsics(&block) - } - - fn random_seed() -> ::Hash { - RandomnessCollectiveFlip::random_seed() - } - } - - impl sp_transaction_pool::runtime_api::TaggedTransactionQueue for Runtime { - fn validate_transaction( - source: TransactionSource, - tx: ::Extrinsic, - ) -> TransactionValidity { - Executive::validate_transaction(source, tx) - } - } - - impl sp_offchain::OffchainWorkerApi for Runtime { - fn offchain_worker(header: &::Header) { - Executive::offchain_worker(header) - } - } - - impl sp_session::SessionKeys for Runtime { - fn decode_session_keys( - encoded: Vec, - ) -> Option, sp_core::crypto::KeyTypeId)>> { - SessionKeys::decode_into_raw_public_keys(&encoded) - } - - fn generate_session_keys(seed: Option>) -> Vec { - SessionKeys::generate(seed) - } - } - - impl cumulus_pallet_contracts_rpc_runtime_api::ContractsApi - for Runtime - { - fn call( - origin: AccountId, - dest: AccountId, - value: Balance, - gas_limit: u64, - input_data: Vec, - ) -> ContractExecResult { - let (exec_result, gas_consumed) = - Contracts::bare_call(origin, dest.into(), value, gas_limit, input_data); - match exec_result { - Ok(v) => ContractExecResult::Success { - flags: v.status.into(), - data: v.data, - gas_consumed: gas_consumed, - }, - Err(_) => ContractExecResult::Error, - } - } - - fn get_storage( - address: AccountId, - key: [u8; 32], - ) -> cumulus_pallet_contracts_primitives::GetStorageResult { - Contracts::get_storage(address, key) - } - - fn rent_projection( - address: AccountId, - ) -> cumulus_pallet_contracts_primitives::RentProjectionResult { - Contracts::rent_projection(address) - } - } -} - -cumulus_pallet_parachain_system::register_validate_block!(Block, Executive); diff --git a/rococo-parachains/pallets/ping/Cargo.toml b/rococo-parachains/pallets/ping/Cargo.toml new file mode 100644 index 0000000000..3c3d3a7241 --- /dev/null +++ b/rococo-parachains/pallets/ping/Cargo.toml @@ -0,0 +1,31 @@ +[package] +authors = ["Parity Technologies "] +edition = "2018" +name = "cumulus-ping" +version = "0.1.0" + +[dependencies] +codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } +serde = { version = "1.0.101", optional = true, features = ["derive"] } + +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } + +xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } + +cumulus-primitives-core = { path = "../../../primitives/core", default-features = false } +cumulus-pallet-xcm = { path = "../../../pallets/xcm", default-features = false } + +[features] +default = ["std"] +std = [ + "codec/std", + "serde", + "cumulus-primitives-core/std", + "sp-std/std", + "sp-runtime/std", + "frame-support/std", + "frame-system/std", +] diff --git a/rococo-parachains/pallets/ping/src/lib.rs b/rococo-parachains/pallets/ping/src/lib.rs new file mode 100644 index 0000000000..56d7dc2ea5 --- /dev/null +++ b/rococo-parachains/pallets/ping/src/lib.rs @@ -0,0 +1,193 @@ +// Copyright 2020-2021 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Cumulus is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Cumulus. If not, see . + +//! Pallet to spam the XCM/UMP. + +#![cfg_attr(not(feature = "std"), no_std)] + +use sp_std::prelude::*; +use sp_runtime::traits::Saturating; +use frame_system::Config as SystemConfig; +use cumulus_primitives_core::ParaId; +use cumulus_pallet_xcm::{Origin as CumulusOrigin, ensure_sibling_para}; +use xcm::v0::{Xcm, Error as XcmError, SendXcm, OriginKind, MultiLocation, Junction}; + +pub use pallet::*; + +#[frame_support::pallet] +pub mod pallet { + use frame_support::pallet_prelude::*; + use frame_system::pallet_prelude::*; + use super::*; + + #[pallet::pallet] + #[pallet::generate_store(pub(super) trait Store)] + pub struct Pallet(_); + + /// The module configuration trait. + #[pallet::config] + pub trait Config: frame_system::Config { + /// The overarching event type. + type Event: From> + IsType<::Event>; + + type Origin: From<::Origin> + Into::Origin>>; + + /// The overarching call type; we assume sibling chains use the same type. + type Call: From> + Encode; + + type XcmSender: SendXcm; + } + + /// The target parachains to ping. + #[pallet::storage] + pub(super) type Targets = StorageValue< + _, + Vec<(ParaId, Vec)>, + ValueQuery, + >; + + /// The total number of pings sent. + #[pallet::storage] + pub(super) type PingCount = StorageValue< + _, + u32, + ValueQuery, + >; + + /// The sent pings. + #[pallet::storage] + pub(super) type Pings = StorageMap< + _, + Blake2_128Concat, + u32, + T::BlockNumber, + OptionQuery, + >; + + #[pallet::event] + #[pallet::generate_deposit(pub(super) fn deposit_event)] + #[pallet::metadata(T::BlockNumber = "BlockNumber")] + pub enum Event { + PingSent(ParaId, u32, Vec), + Pinged(ParaId, u32, Vec), + PongSent(ParaId, u32, Vec), + Ponged(ParaId, u32, Vec, T::BlockNumber), + ErrorSendingPing(XcmError, ParaId, u32, Vec), + ErrorSendingPong(XcmError, ParaId, u32, Vec), + UnknownPong(ParaId, u32, Vec), + } + + #[pallet::error] + pub enum Error {} + + #[pallet::hooks] + impl Hooks> for Pallet { + fn on_finalize( + n: T::BlockNumber, + ) { + for (para, payload) in Targets::::get().into_iter() { + let seq = PingCount::::mutate(|seq| { *seq += 1; *seq }); + match T::XcmSender::send_xcm( + MultiLocation::X2(Junction::Parent, Junction::Parachain { id: para.into() }), + Xcm::Transact { + origin_type: OriginKind::Native, + require_weight_at_most: 1_000, + call: ::Call::from(Call::::ping(seq, payload.clone())).encode().into(), + }, + ) { + Ok(()) => { + Pings::::insert(seq, n); + Self::deposit_event(Event::PingSent(para, seq, payload)); + }, + Err(e) => { + Self::deposit_event(Event::ErrorSendingPing(e, para, seq, payload)); + } + } + } + } + } + + #[pallet::call] + impl Pallet { + #[pallet::weight(0)] + fn start(origin: OriginFor, para: ParaId, payload: Vec) -> DispatchResult { + ensure_root(origin)?; + Targets::::mutate(|t| t.push((para, payload))); + Ok(()) + } + + #[pallet::weight(0)] + fn start_many(origin: OriginFor, para: ParaId, count: u32, payload: Vec) -> DispatchResult { + ensure_root(origin)?; + for _ in 0..count { + Targets::::mutate(|t| t.push((para, payload.clone()))); + } + Ok(()) + } + + #[pallet::weight(0)] + fn stop(origin: OriginFor, para: ParaId) -> DispatchResult { + ensure_root(origin)?; + Targets::::mutate(|t| if let Some(p) = t.iter().position(|(p, _)| p == ¶) { t.swap_remove(p); }); + Ok(()) + } + + #[pallet::weight(0)] + fn stop_all(origin: OriginFor, maybe_para: Option) -> DispatchResult { + ensure_root(origin)?; + if let Some(para) = maybe_para { + Targets::::mutate(|t| t.retain(|&(x, _)| x != para)); + } else { + Targets::::kill(); + } + Ok(()) + } + + #[pallet::weight(0)] + fn ping(origin: OriginFor, seq: u32, payload: Vec) -> DispatchResult { + // Only accept pings from other chains. + let para = ensure_sibling_para(::Origin::from(origin))?; + + Self::deposit_event(Event::Pinged(para, seq, payload.clone())); + match T::XcmSender::send_xcm( + MultiLocation::X2(Junction::Parent, Junction::Parachain { id: para.into() }), + Xcm::Transact { + origin_type: OriginKind::Native, + require_weight_at_most: 1_000, + call: ::Call::from(Call::::pong(seq, payload.clone())).encode().into(), + }, + ) { + Ok(()) => Self::deposit_event(Event::PongSent(para, seq, payload)), + Err(e) => Self::deposit_event(Event::ErrorSendingPong(e, para, seq, payload)), + } + Ok(()) + } + + #[pallet::weight(0)] + fn pong(origin: OriginFor, seq: u32, payload: Vec) -> DispatchResult { + // Only accept pings from other chains. + let para = ensure_sibling_para(::Origin::from(origin))?; + + if let Some(sent_at) = Pings::::take(seq) { + Self::deposit_event(Event::Ponged(para, seq, payload, frame_system::Pallet::::block_number().saturating_sub(sent_at))); + } else { + // Pong received for a ping we apparently didn't send?! + Self::deposit_event(Event::UnknownPong(para, seq, payload)); + } + Ok(()) + } + } +} diff --git a/rococo-parachains/runtime/Cargo.toml b/rococo-parachains/runtime/Cargo.toml index e7c114ab6b..1c6064cba4 100644 --- a/rococo-parachains/runtime/Cargo.toml +++ b/rococo-parachains/runtime/Cargo.toml @@ -7,7 +7,7 @@ edition = '2018' [dependencies] serde = { version = "1.0.101", optional = true, features = ["derive"] } codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } - +log = { version = "0.4.14", default-features = false } parachain-info = { path = "../pallets/parachain-info", default-features = false } rococo-parachain-primitives = { path = "../primitives", default-features = false } @@ -36,13 +36,17 @@ pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", # Cumulus dependencies cumulus-pallet-parachain-system = { path = "../../pallets/parachain-system", default-features = false } cumulus-primitives-core = { path = "../../primitives/core", default-features = false } -cumulus-pallet-xcm-handler = { path = "../../pallets/xcm-handler", default-features = false } +cumulus-primitives-utility = { path = "../../primitives/utility", default-features = false } +cumulus-pallet-xcmp-queue = { path = "../../pallets/xcmp-queue", default-features = false } +cumulus-pallet-xcm = { path = "../../pallets/xcm", default-features = false } +cumulus-ping = { path = "../../rococo-parachains/pallets/ping", default-features = false } # Polkadot dependencies polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } +pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } [build-dependencies] substrate-wasm-builder = "3.0.0" @@ -52,6 +56,7 @@ default = [ "std" ] std = [ "codec/std", "serde", + "log/std", "sp-api/std", "sp-std/std", "sp-io/std", @@ -74,8 +79,11 @@ std = [ "parachain-info/std", "rococo-parachain-primitives/std", "cumulus-pallet-parachain-system/std", - "cumulus-pallet-xcm-handler/std", + "cumulus-pallet-xcmp-queue/std", + "cumulus-pallet-xcm/std", "cumulus-primitives-core/std", + "cumulus-primitives-utility/std", + "cumulus-ping/std", "xcm/std", "xcm-builder/std", "xcm-executor/std", diff --git a/rococo-parachains/runtime/src/lib.rs b/rococo-parachains/runtime/src/lib.rs index 3dfa17fc55..d662f5d66d 100644 --- a/rococo-parachains/runtime/src/lib.rs +++ b/rococo-parachains/runtime/src/lib.rs @@ -39,14 +39,14 @@ use sp_version::RuntimeVersion; // A few exports that help ease life for downstream crates. pub use frame_support::{ construct_runtime, parameter_types, - traits::Randomness, + traits::{Randomness, IsInVec, All}, weights::{ constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND}, DispatchClass, IdentityFee, Weight, }, StorageValue, }; -use frame_system::{EnsureRoot, limits::{BlockLength, BlockWeights}}; +use frame_system::limits::{BlockLength, BlockWeights}; pub use pallet_balances::Call as BalancesCall; pub use pallet_timestamp::Call as TimestampCall; #[cfg(any(feature = "std", test))] @@ -59,12 +59,11 @@ use xcm::v0::{Junction, MultiLocation, NetworkId}; use xcm_builder::{ AccountId32Aliases, CurrencyAdapter, LocationInverter, ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, - SovereignSignedViaLocation, -}; -use xcm_executor::{ - traits::{IsConcrete, NativeAsset}, - Config, XcmExecutor, + SovereignSignedViaLocation, FixedRateOfConcreteFungible, EnsureXcmOrigin, + AllowTopLevelPaidExecutionFrom, TakeWeightCredit, FixedWeightBounds, IsConcrete, NativeAsset, + AllowUnpaidExecutionFrom, ParentAsSuperuser, }; +use xcm_executor::{Config, XcmExecutor}; pub type SessionHandlers = (); @@ -77,8 +76,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("cumulus-test-parachain"), impl_name: create_runtime_str!("cumulus-test-parachain"), authoring_version: 1, - spec_version: 3, - impl_version: 1, + spec_version: 18, + impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, }; @@ -230,12 +229,22 @@ impl pallet_sudo::Config for Runtime { type Event = Event; } +parameter_types! { + pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4; +} + impl cumulus_pallet_parachain_system::Config for Runtime { type Event = Event; type OnValidationData = (); type SelfParaId = parachain_info::Module; - type DownwardMessageHandlers = XcmHandler; - type HrmpMessageHandlers = XcmHandler; + type DownwardMessageHandlers = cumulus_primitives_utility::UnqueuedDmpAsParent< + MaxDownwardMessageWeight, + XcmExecutor, + Call, + >; + type OutboundXcmpMessageSource = XcmpQueue; + type XcmpMessageHandler = XcmpQueue; + type ReservedXcmpWeight = ReservedXcmpWeight; } impl parachain_info::Config for Runtime {} @@ -243,55 +252,128 @@ impl parachain_info::Config for Runtime {} parameter_types! { pub const RococoLocation: MultiLocation = MultiLocation::X1(Junction::Parent); pub const RococoNetwork: NetworkId = NetworkId::Polkadot; - pub RelayChainOrigin: Origin = cumulus_pallet_xcm_handler::Origin::Relay.into(); + pub RelayChainOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into(); pub Ancestry: MultiLocation = Junction::Parachain { id: ParachainInfo::parachain_id().into() }.into(); } -type LocationConverter = ( +/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used +/// when determining ownership of accounts for asset transacting and when attempting to use XCM +/// `Transact` in order to determine the dispatch Origin. +pub type LocationToAccountId = ( + // The parent (Relay-chain) origin converts to the default `AccountId`. ParentIsDefault, + // Sibling parachain origins convert to AccountId via the `ParaId::into`. SiblingParachainConvertsVia, + // Straight up local `AccountId32` origins just alias directly to `AccountId`. AccountId32Aliases, ); -type LocalAssetTransactor = CurrencyAdapter< +/// Means for transacting assets on this chain. +pub type LocalAssetTransactor = CurrencyAdapter< // Use this currency: Balances, // Use this currency when it is a fungible asset matching the given location or name: IsConcrete, // Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID: - LocationConverter, + LocationToAccountId, // Our chain's account ID type (we can't get away without mentioning it explicitly): AccountId, >; -type LocalOriginConverter = ( - SovereignSignedViaLocation, +/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance, +/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can +/// biases the kind of local `Origin` it will become. +pub type XcmOriginToTransactDispatchOrigin = ( + // Sovereign account converter; this attempts to derive an `AccountId` from the origin location + // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for + // foreign chains who want to have a local sovereign account on this chain which they control. + SovereignSignedViaLocation, + // Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when + // recognised. RelayChainAsNative, - SiblingParachainAsNative, + // Native converter for sibling Parachains; will convert to a `SiblingPara` origin when + // recognised. + SiblingParachainAsNative, + // Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a + // transaction from the Root origin. + ParentAsSuperuser, + // Native signed account converter; this just converts an `AccountId32` origin into a normal + // `Origin::Signed` origin of the same 32-byte value. SignedAccountId32AsNative, ); +parameter_types! { + pub UnitWeightCost: Weight = 1_000; +} + +parameter_types! { + // 1_000_000_000_000 => 1 unit of asset for 1 unit of Weight. + // TODO: Should take the actual weight price. This is just 1_000 ROC per second of weight. + pub const WeightPrice: (MultiLocation, u128) = (MultiLocation::X1(Junction::Parent), 1_000); + pub AllowUnpaidFrom: Vec = vec![ MultiLocation::X1(Junction::Parent) ]; +} + +pub type Barrier = ( + TakeWeightCredit, + AllowTopLevelPaidExecutionFrom>, + AllowUnpaidExecutionFrom>, // <- Parent gets free execution +); + pub struct XcmConfig; impl Config for XcmConfig { type Call = Call; - type XcmSender = XcmHandler; + type XcmSender = XcmRouter; // How to withdraw and deposit an asset. type AssetTransactor = LocalAssetTransactor; - type OriginConverter = LocalOriginConverter; + type OriginConverter = XcmOriginToTransactDispatchOrigin; type IsReserve = NativeAsset; - type IsTeleporter = (); + type IsTeleporter = NativeAsset; // <- should be enough to allow teleportation of ROC type LocationInverter = LocationInverter; + type Barrier = Barrier; + type Weigher = FixedWeightBounds; + type Trader = FixedRateOfConcreteFungible; + type ResponseHandler = (); // Don't handle responses for now. } -impl cumulus_pallet_xcm_handler::Config for Runtime { +parameter_types! { + pub const MaxDownwardMessageWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 10; +} + +/// No local origins on this chain are allowed to dispatch XCM sends/executions. +pub type LocalOriginToLocation = (); + +/// The means for routing XCM messages which are not for local execution into the right message +/// queues. +pub type XcmRouter = ( + // Two routers - use UMP to communicate with the relay chain: + cumulus_primitives_utility::ParentAsUmp, + // ..and XCMP to communicate with the sibling chains. + XcmpQueue, +); + +impl pallet_xcm::Config for Runtime { + type Event = Event; + type SendXcmOrigin = EnsureXcmOrigin; + type XcmRouter = XcmRouter; + type ExecuteXcmOrigin = EnsureXcmOrigin; + type XcmExecutor = XcmExecutor; +} + +impl cumulus_pallet_xcm::Config for Runtime {} + +impl cumulus_pallet_xcmp_queue::Config for Runtime { type Event = Event; type XcmExecutor = XcmExecutor; - type UpwardMessageSender = ParachainSystem; - type HrmpMessageSender = ParachainSystem; - type SendXcmOrigin = EnsureRoot; - type AccountIdConverter = LocationConverter; + type ChannelInfo = ParachainSystem; +} + +impl cumulus_ping::Config for Runtime { + type Event = Event; + type Origin = Origin; + type Call = Call; + type XcmSender = XcmRouter; } construct_runtime! { @@ -305,10 +387,16 @@ construct_runtime! { Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, Sudo: pallet_sudo::{Pallet, Call, Storage, Config, Event}, RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Call, Storage}, - ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Storage, Inherent, Event}, + ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Storage, Inherent, Event}, TransactionPayment: pallet_transaction_payment::{Pallet, Storage}, ParachainInfo: parachain_info::{Pallet, Storage, Config}, - XcmHandler: cumulus_pallet_xcm_handler::{Pallet, Call, Event, Origin}, + + // XCM helpers. + XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event}, + PolkadotXcm: pallet_xcm::{Pallet, Call, Event, Origin}, + CumulusXcm: cumulus_pallet_xcm::{Pallet, Origin}, + + Spambot: cumulus_ping::{Pallet, Call, Storage, Event} = 99, } } diff --git a/rococo-parachains/shell-runtime/Cargo.toml b/rococo-parachains/shell-runtime/Cargo.toml new file mode 100644 index 0000000000..ab55950e2d --- /dev/null +++ b/rococo-parachains/shell-runtime/Cargo.toml @@ -0,0 +1,89 @@ +[package] +name = 'cumulus-shell-runtime' +version = '0.1.0' +authors = ["Parity Technologies "] +edition = '2018' + +[dependencies] +serde = { version = "1.0.101", optional = true, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] } +log = { version = "0.4.14", default-features = false } +parachain-info = { path = "../pallets/parachain-info", default-features = false } +rococo-parachain-primitives = { path = "../primitives", default-features = false } + +# Substrate dependencies +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-offchain = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-block-builder = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-transaction-pool = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-inherents = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } + +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } + +# Cumulus dependencies +cumulus-pallet-parachain-system = { path = "../../pallets/parachain-system", default-features = false } +cumulus-primitives-core = { path = "../../primitives/core", default-features = false } +cumulus-primitives-utility = { path = "../../primitives/utility", default-features = false } +cumulus-pallet-xcmp-queue = { path = "../../pallets/xcmp-queue", default-features = false } +cumulus-pallet-xcm = { path = "../../pallets/xcm", default-features = false } + +# Polkadot dependencies +polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } +xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } +xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } +xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } +pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } + +[dev-dependencies] +hex = "0.4.3" + +[build-dependencies] +substrate-wasm-builder = "3.0.0" + +[features] +default = [ "std" ] +std = [ + "codec/std", + "serde", + "log/std", + "sp-api/std", + "sp-std/std", + "sp-io/std", + "sp-core/std", + "sp-runtime/std", + "sp-version/std", + "sp-offchain/std", + "sp-session/std", + "sp-block-builder/std", + "sp-transaction-pool/std", + "sp-inherents/std", + "frame-support/std", + "frame-executive/std", + "frame-system/std", + "pallet-balances/std", + "pallet-randomness-collective-flip/std", + "pallet-timestamp/std", + "pallet-transaction-payment/std", + "parachain-info/std", + "rococo-parachain-primitives/std", + "cumulus-pallet-parachain-system/std", + "cumulus-pallet-xcmp-queue/std", + "cumulus-pallet-xcm/std", + "cumulus-primitives-core/std", + "cumulus-primitives-utility/std", + "xcm/std", + "xcm-builder/std", + "xcm-executor/std", +] diff --git a/rococo-parachains/shell-runtime/build.rs b/rococo-parachains/shell-runtime/build.rs new file mode 100644 index 0000000000..fe1a2ea911 --- /dev/null +++ b/rococo-parachains/shell-runtime/build.rs @@ -0,0 +1,25 @@ +// Copyright 2019-2021 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Substrate is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Substrate is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Cumulus. If not, see . + +use substrate_wasm_builder::WasmBuilder; + +fn main() { + WasmBuilder::new() + .with_current_project() + .export_heap_base() + .import_memory() + .build() +} diff --git a/rococo-parachains/shell-runtime/src/lib.rs b/rococo-parachains/shell-runtime/src/lib.rs new file mode 100644 index 0000000000..8277c6b896 --- /dev/null +++ b/rococo-parachains/shell-runtime/src/lib.rs @@ -0,0 +1,493 @@ +// Copyright 2019-2021 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Cumulus is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Cumulus. If not, see . + +#![cfg_attr(not(feature = "std"), no_std)] +// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. +#![recursion_limit = "256"] + +// Make the WASM binary available. +#[cfg(feature = "std")] +include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); + +use rococo_parachain_primitives::*; +use sp_api::impl_runtime_apis; +use sp_core::OpaqueMetadata; +use sp_runtime::{ + create_runtime_str, generic, impl_opaque_keys, + traits::{BlakeTwo256, Block as BlockT, IdentityLookup}, + transaction_validity::{TransactionSource, TransactionValidity}, + ApplyExtrinsicResult, +}; +use sp_std::prelude::*; +#[cfg(feature = "std")] +use sp_version::NativeVersion; +use sp_version::RuntimeVersion; + +// A few exports that help ease life for downstream crates. +pub use frame_support::{ + construct_runtime, parameter_types, + traits::{Randomness, All, IsInVec}, + weights::{ + constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND}, + DispatchClass, IdentityFee, Weight, + }, + StorageValue, +}; +use frame_system::limits::{BlockLength, BlockWeights}; +pub use pallet_balances::Call as BalancesCall; +pub use pallet_timestamp::Call as TimestampCall; +#[cfg(any(feature = "std", test))] +pub use sp_runtime::BuildStorage; +pub use sp_runtime::{Perbill, Permill}; + +// XCM imports +use polkadot_parachain::primitives::Sibling; +use xcm::v0::{Junction, MultiLocation, NetworkId}; +use xcm_builder::{ + AccountId32Aliases, CurrencyAdapter, LocationInverter, ParentIsDefault, RelayChainAsNative, + SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, + SovereignSignedViaLocation, FixedRateOfConcreteFungible, EnsureXcmOrigin, + AllowTopLevelPaidExecutionFrom, TakeWeightCredit, FixedWeightBounds, IsConcrete, NativeAsset, + AllowUnpaidExecutionFrom, ParentAsSuperuser, +}; +use xcm_executor::{Config, XcmExecutor}; + +pub type SessionHandlers = (); + +impl_opaque_keys! { + pub struct SessionKeys {} +} + +/// This runtime version. +pub const VERSION: RuntimeVersion = RuntimeVersion { + spec_name: create_runtime_str!("cumulus-test-parachain"), + impl_name: create_runtime_str!("cumulus-test-parachain"), + authoring_version: 1, + spec_version: 18, + impl_version: 0, + apis: RUNTIME_API_VERSIONS, + transaction_version: 1, +}; + +pub const MILLISECS_PER_BLOCK: u64 = 6000; + +pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK; + +pub const EPOCH_DURATION_IN_BLOCKS: u32 = 10 * MINUTES; + +// These time units are defined in number of blocks. +pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber); +pub const HOURS: BlockNumber = MINUTES * 60; +pub const DAYS: BlockNumber = HOURS * 24; + +// 1 in 4 blocks (on average, not counting collisions) will be primary babe blocks. +pub const PRIMARY_PROBABILITY: (u64, u64) = (1, 4); + +#[derive(codec::Encode, codec::Decode)] +pub enum XCMPMessage { + /// Transfer tokens to the given account from the Parachain account. + TransferToken(XAccountId, XBalance), +} + +/// The version information used to identify this runtime when compiled natively. +#[cfg(feature = "std")] +pub fn native_version() -> NativeVersion { + NativeVersion { + runtime_version: VERSION, + can_author_with: Default::default(), + } +} + +/// We assume that ~10% of the block weight is consumed by `on_initalize` handlers. +/// This is used to limit the maximal weight of a single extrinsic. +const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10); +/// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used +/// by Operational extrinsics. +const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); +/// We allow for 2 seconds of compute with a 6 second average block time. +const MAXIMUM_BLOCK_WEIGHT: Weight = 2 * WEIGHT_PER_SECOND; + +parameter_types! { + pub const BlockHashCount: BlockNumber = 250; + pub const Version: RuntimeVersion = VERSION; + pub RuntimeBlockLength: BlockLength = + BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO); + pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder() + .base_block(BlockExecutionWeight::get()) + .for_class(DispatchClass::all(), |weights| { + weights.base_extrinsic = ExtrinsicBaseWeight::get(); + }) + .for_class(DispatchClass::Normal, |weights| { + weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT); + }) + .for_class(DispatchClass::Operational, |weights| { + weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT); + // Operational transactions have some extra reserved space, so that they + // are included even if block reached `MAXIMUM_BLOCK_WEIGHT`. + weights.reserved = Some( + MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT + ); + }) + .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO) + .build_or_panic(); + pub const SS58Prefix: u8 = 42; +} + +impl frame_system::Config for Runtime { + /// The identifier used to distinguish between accounts. + type AccountId = AccountId; + /// The aggregated dispatch type that is available for extrinsics. + type Call = Call; + /// The lookup mechanism to get account ID from whatever is passed in dispatchers. + type Lookup = IdentityLookup; + /// The index type for storing how many extrinsics an account has signed. + type Index = Index; + /// The index type for blocks. + type BlockNumber = BlockNumber; + /// The type for hashing blocks and tries. + type Hash = Hash; + /// The hashing algorithm used. + type Hashing = BlakeTwo256; + /// The header type. + type Header = generic::Header; + /// The ubiquitous event type. + type Event = Event; + /// The ubiquitous origin type. + type Origin = Origin; + /// Maximum number of block number to block hash mappings to keep (oldest pruned first). + type BlockHashCount = BlockHashCount; + /// Runtime version. + type Version = Version; + /// Converts a module to an index of this module in the runtime. + type PalletInfo = PalletInfo; + type AccountData = pallet_balances::AccountData; + type OnNewAccount = (); + type OnKilledAccount = (); + type DbWeight = (); + type BaseCallFilter = (); + type SystemWeightInfo = (); + type BlockWeights = RuntimeBlockWeights; + type BlockLength = RuntimeBlockLength; + type SS58Prefix = SS58Prefix; + type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; +} + +parameter_types! { + pub const MinimumPeriod: u64 = SLOT_DURATION / 2; +} + +impl pallet_timestamp::Config for Runtime { + /// A timestamp: milliseconds since the unix epoch. + type Moment = u64; + type OnTimestampSet = (); + type MinimumPeriod = MinimumPeriod; + type WeightInfo = (); +} + +parameter_types! { + pub const ExistentialDeposit: u128 = 500; + pub const TransferFee: u128 = 0; + pub const CreationFee: u128 = 0; + pub const TransactionByteFee: u128 = 1; + pub const MaxLocks: u32 = 50; +} + +impl pallet_balances::Config for Runtime { + /// The type for recording an account's balance. + type Balance = Balance; + /// The ubiquitous event type. + type Event = Event; + type DustRemoval = (); + type ExistentialDeposit = ExistentialDeposit; + type AccountStore = System; + type WeightInfo = (); + type MaxLocks = MaxLocks; +} + +impl pallet_transaction_payment::Config for Runtime { + type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter; + type TransactionByteFee = TransactionByteFee; + type WeightToFee = IdentityFee; + type FeeMultiplierUpdate = (); +} + +parameter_types! { + pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4; +} + +impl cumulus_pallet_parachain_system::Config for Runtime { + type Event = Event; + type OnValidationData = (); + type SelfParaId = parachain_info::Module; + type DownwardMessageHandlers = cumulus_primitives_utility::UnqueuedDmpAsParent< + MaxDownwardMessageWeight, + XcmExecutor, + Call, + >; + type OutboundXcmpMessageSource = XcmpQueue; + type XcmpMessageHandler = XcmpQueue; + type ReservedXcmpWeight = ReservedXcmpWeight; +} + +impl parachain_info::Config for Runtime {} + +parameter_types! { + pub const RococoLocation: MultiLocation = MultiLocation::X1(Junction::Parent); + pub const RococoNetwork: NetworkId = NetworkId::Polkadot; + pub RelayChainOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into(); + pub Ancestry: MultiLocation = Junction::Parachain { + id: ParachainInfo::parachain_id().into() + }.into(); +} + +/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used +/// when determining ownership of accounts for asset transacting and when attempting to use XCM +/// `Transact` in order to determine the dispatch Origin. +pub type LocationToAccountId = ( + // The parent (Relay-chain) origin converts to the default `AccountId`. + ParentIsDefault, + // Sibling parachain origins convert to AccountId via the `ParaId::into`. + SiblingParachainConvertsVia, + // Straight up local `AccountId32` origins just alias directly to `AccountId`. + AccountId32Aliases, +); + +/// Means for transacting assets on this chain. +pub type LocalAssetTransactor = CurrencyAdapter< + // Use this currency: + Balances, + // Use this currency when it is a fungible asset matching the given location or name: + IsConcrete, + // Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID: + LocationToAccountId, + // Our chain's account ID type (we can't get away without mentioning it explicitly): + AccountId, +>; + +/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance, +/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can +/// biases the kind of local `Origin` it will become. +pub type XcmOriginToTransactDispatchOrigin = ( + // Sovereign account converter; this attempts to derive an `AccountId` from the origin location + // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for + // foreign chains who want to have a local sovereign account on this chain which they control. + SovereignSignedViaLocation, + // Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when + // recognised. + RelayChainAsNative, + // Native converter for sibling Parachains; will convert to a `SiblingPara` origin when + // recognised. + SiblingParachainAsNative, + // Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a + // transaction from the Root origin. + ParentAsSuperuser, + // Native signed account converter; this just converts an `AccountId32` origin into a normal + // `Origin::Signed` origin of the same 32-byte value. + SignedAccountId32AsNative, +); + +parameter_types! { + pub UnitWeightCost: Weight = 1_000; +} + +parameter_types! { + // 1_000_000_000_000 => 1 unit of asset for 1 unit of Weight. + // TODO: Should take the actual weight price. This is just 1_000 ROC per second of weight. + pub const WeightPrice: (MultiLocation, u128) = (MultiLocation::X1(Junction::Parent), 1_000); + pub AllowUnpaidFrom: Vec = vec![ MultiLocation::X1(Junction::Parent) ]; +} + +pub type Barrier = ( + TakeWeightCredit, + AllowTopLevelPaidExecutionFrom>, + AllowUnpaidExecutionFrom>, // <- Parent gets free execution +); + +pub struct XcmConfig; +impl Config for XcmConfig { + type Call = Call; + type XcmSender = XcmRouter; + // How to withdraw and deposit an asset. + type AssetTransactor = LocalAssetTransactor; + type OriginConverter = XcmOriginToTransactDispatchOrigin; + type IsReserve = NativeAsset; + type IsTeleporter = NativeAsset; // <- should be enough to allow teleportation of ROC + type LocationInverter = LocationInverter; + type Barrier = Barrier; + type Weigher = FixedWeightBounds; + type Trader = FixedRateOfConcreteFungible; + type ResponseHandler = (); // Don't handle responses for now. +} + +parameter_types! { + pub const MaxDownwardMessageWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 10; +} + +/// No local origins on this chain are allowed to dispatch XCM sends/executions. +pub type LocalOriginToLocation = (); + +/// The means for routing XCM messages which are not for local execution into the right message +/// queues. +pub type XcmRouter = ( + // Two routers - use UMP to communicate with the relay chain: + cumulus_primitives_utility::ParentAsUmp, + // ..and XCMP to communicate with the sibling chains. + XcmpQueue, +); + +impl pallet_xcm::Config for Runtime { + type Event = Event; + type SendXcmOrigin = EnsureXcmOrigin; + type XcmRouter = XcmRouter; + type ExecuteXcmOrigin = EnsureXcmOrigin; + type XcmExecutor = XcmExecutor; +} + +impl cumulus_pallet_xcm::Config for Runtime {} + +impl cumulus_pallet_xcmp_queue::Config for Runtime { + type Event = Event; + type XcmExecutor = XcmExecutor; + type ChannelInfo = ParachainSystem; +} + +construct_runtime! { + pub enum Runtime where + Block = Block, + NodeBlock = rococo_parachain_primitives::Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + System: frame_system::{Pallet, Call, Storage, Config, Event}, + Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, + Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, + RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Call, Storage}, + ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Storage, Inherent, Event}, + TransactionPayment: pallet_transaction_payment::{Pallet, Storage}, + ParachainInfo: parachain_info::{Pallet, Storage, Config}, + + // XCM helpers. + XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event}, + PolkadotXcm: pallet_xcm::{Pallet, Call, Event, Origin}, + CumulusXcm: cumulus_pallet_xcm::{Pallet, Origin}, + } +} + +/// The address format for describing accounts. +pub type Address = AccountId; +/// Block header type as expected by this runtime. +pub type Header = generic::Header; +/// Block type as expected by this runtime. +pub type Block = generic::Block; +/// A Block signed with a Justification +pub type SignedBlock = generic::SignedBlock; +/// BlockId type as expected by this runtime. +pub type BlockId = generic::BlockId; +/// The SignedExtension to the basic transaction logic. +pub type SignedExtra = ( + frame_system::CheckSpecVersion, + frame_system::CheckGenesis, + frame_system::CheckEra, + frame_system::CheckNonce, + frame_system::CheckWeight, + pallet_transaction_payment::ChargeTransactionPayment, +); +/// Unchecked extrinsic type as expected by this runtime. +pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; +/// Extrinsic type that has already been checked. +pub type CheckedExtrinsic = generic::CheckedExtrinsic; +/// Executive: handles dispatch to the various modules. +pub type Executive = frame_executive::Executive< + Runtime, + Block, + frame_system::ChainContext, + Runtime, + AllPallets, +>; + +impl_runtime_apis! { + impl sp_api::Core for Runtime { + fn version() -> RuntimeVersion { + VERSION + } + + fn execute_block(block: Block) { + Executive::execute_block(block) + } + + fn initialize_block(header: &::Header) { + Executive::initialize_block(header) + } + } + + impl sp_api::Metadata for Runtime { + fn metadata() -> OpaqueMetadata { + Runtime::metadata().into() + } + } + + impl sp_block_builder::BlockBuilder for Runtime { + fn apply_extrinsic( + extrinsic: ::Extrinsic, + ) -> ApplyExtrinsicResult { + Executive::apply_extrinsic(extrinsic) + } + + fn finalize_block() -> ::Header { + Executive::finalize_block() + } + + fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<::Extrinsic> { + data.create_extrinsics() + } + + fn check_inherents(block: Block, data: sp_inherents::InherentData) -> sp_inherents::CheckInherentsResult { + data.check_extrinsics(&block) + } + + fn random_seed() -> ::Hash { + RandomnessCollectiveFlip::random_seed().0 + } + } + + impl sp_transaction_pool::runtime_api::TaggedTransactionQueue for Runtime { + fn validate_transaction( + source: TransactionSource, + tx: ::Extrinsic, + ) -> TransactionValidity { + Executive::validate_transaction(source, tx) + } + } + + impl sp_offchain::OffchainWorkerApi for Runtime { + fn offchain_worker(header: &::Header) { + Executive::offchain_worker(header) + } + } + + impl sp_session::SessionKeys for Runtime { + fn decode_session_keys( + encoded: Vec, + ) -> Option, sp_core::crypto::KeyTypeId)>> { + SessionKeys::decode_into_raw_public_keys(&encoded) + } + + fn generate_session_keys(seed: Option>) -> Vec { + SessionKeys::generate(seed) + } + } +} + +cumulus_pallet_parachain_system::register_validate_block!(Runtime, Executive); diff --git a/test/relay-validation-worker-provider/Cargo.toml b/test/relay-validation-worker-provider/Cargo.toml new file mode 100644 index 0000000000..9946a29b70 --- /dev/null +++ b/test/relay-validation-worker-provider/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "cumulus-test-relay-validation-worker-provider" +version = "0.1.0" +authors = ["Parity Technologies "] +edition = "2018" +build = "build.rs" + +[dependencies] +polkadot-node-core-pvf = { git = "https://github.com/paritytech/polkadot", branch = "master" } diff --git a/test/relay-validation-worker-provider/build.rs b/test/relay-validation-worker-provider/build.rs new file mode 100644 index 0000000000..05eb38c9d5 --- /dev/null +++ b/test/relay-validation-worker-provider/build.rs @@ -0,0 +1,113 @@ +// Copyright 2021 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Cumulus is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Cumulus. If not, see . + +use std::{ + env, fs, + path::{Path, PathBuf}, + process::{self, Command}, +}; + +/// The name of the project we will building. +const PROJECT_NAME: &str = "validation-worker"; +/// The env variable that instructs us to skip the build. +const SKIP_ENV: &str = "SKIP_BUILD"; + +fn main() { + if env::var(SKIP_ENV).is_ok() { return + } + + let out_dir = PathBuf::from(env::var("OUT_DIR").expect("`OUT_DIR` is set by cargo")); + + let project = create_project(&out_dir); + build_project(&project.join("Cargo.toml")); + + fs::copy( + project.join("target/release").join(PROJECT_NAME), + out_dir.join(PROJECT_NAME), + ) + .expect("Copies validation worker"); +} + +fn find_cargo_lock() -> PathBuf { + let mut path = PathBuf::from(env::var("CARGO_MANIFEST_DIR").expect("`CARGO_MANIFEST_DIR` is set by cargo")); + + loop { + if path.join("Cargo.lock").exists() { + return path.join("Cargo.lock") + } + + if !path.pop() { + panic!("Could not find `Cargo.lock`") + } + } +} + +fn create_project(out_dir: &Path) -> PathBuf { + let project_dir = out_dir.join(format!("{}-project", PROJECT_NAME)); + fs::create_dir_all(project_dir.join("src")).expect("Creates project dir and project src dir"); + + let cargo_toml = format!( + r#" + [package] + name = "{project_name}" + version = "0.1.0" + authors = ["Parity Technologies "] + edition = "2018" + + [dependencies] + cumulus-test-relay-validation-worker-provider = {{ path = "{provider_path}" }} + + [workspace] + "#, + project_name = PROJECT_NAME, + provider_path = + env::var("CARGO_MANIFEST_DIR").expect("`CARGO_MANIFEST_DIR` is set by cargo"), + ); + + fs::write(project_dir.join("Cargo.toml"), cargo_toml).expect("Writes project `Cargo.toml`"); + + fs::write( + project_dir.join("src").join("main.rs"), + r#" + cumulus_test_relay_validation_worker_provider::polkadot_node_core_pvf::decl_puppet_worker_main!(); + "#, + ) + .expect("Writes `main.rs`"); + + fs::copy(find_cargo_lock(), project_dir.join("Cargo.lock")).expect("Copies `Cargo.lock`"); + + project_dir +} + +fn build_project(cargo_toml: &Path) { + let cargo = env::var("CARGO").expect("`CARGO` env variable is always set by cargo"); + + let status = Command::new(cargo) + .arg("build") + .arg("--release") + .arg(format!("--manifest-path={}", cargo_toml.display())) + // Unset the `CARGO_TARGET_DIR` to prevent a cargo deadlock (cargo locks a target dir exclusive). + .env_remove("CARGO_TARGET_DIR") + // Do not call us recursively. + .env(SKIP_ENV, "1") + .status(); + + match status.map(|s| s.success()) { + Ok(true) => {} + // Use `process.exit(1)` to have a clean error output. + _ => process::exit(1), + } +} diff --git a/test/relay-validation-worker-provider/src/lib.rs b/test/relay-validation-worker-provider/src/lib.rs new file mode 100644 index 0000000000..840214eb3c --- /dev/null +++ b/test/relay-validation-worker-provider/src/lib.rs @@ -0,0 +1,27 @@ +// Copyright 2021 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Cumulus is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Cumulus. If not, see . + +//! Provides the [`VALIDATION_WORKER`] for integration tests in Cumulus. +//! +//! The validation worker is used by the relay chain to validate parachains. This worker is placed +//! in an extra process to provide better security and to ensure that a worker can be killed etc. +//! +//! !!This should only be used for tests!! + +pub use polkadot_node_core_pvf; + +/// The path to the validation worker. +pub const VALIDATION_WORKER: &str = concat!(env!("OUT_DIR"), "/validation-worker"); diff --git a/test/runtime/src/lib.rs b/test/runtime/src/lib.rs index cedd4ce56c..ecb758fd20 100644 --- a/test/runtime/src/lib.rs +++ b/test/runtime/src/lib.rs @@ -213,7 +213,9 @@ impl cumulus_pallet_parachain_system::Config for Runtime { type Event = Event; type OnValidationData = (); type DownwardMessageHandlers = (); - type HrmpMessageHandlers = (); + type OutboundXcmpMessageSource = (); + type XcmpMessageHandler = (); + type ReservedXcmpWeight = (); } parameter_types! { @@ -231,7 +233,7 @@ construct_runtime! { Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, Sudo: pallet_sudo::{Pallet, Call, Storage, Config, Event}, RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Call, Storage}, - ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Storage, Inherent, Event}, + ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Storage, Inherent, Event}, TransactionPayment: pallet_transaction_payment::{Pallet, Storage}, } } diff --git a/test/service/Cargo.toml b/test/service/Cargo.toml index 81eb6be907..47553cb45f 100644 --- a/test/service/Cargo.toml +++ b/test/service/Cargo.toml @@ -48,6 +48,7 @@ cumulus-client-network = { path = "../../client/network" } cumulus-client-service = { path = "../../client/service" } cumulus-primitives-core = { path = "../../primitives/core" } cumulus-test-runtime = { path = "../runtime" } +cumulus-test-relay-validation-worker-provider = { path = "../relay-validation-worker-provider" } # RPC related dependencies jsonrpc-core = "15.1.0" diff --git a/test/service/src/lib.rs b/test/service/src/lib.rs index ad9d222be9..4028d26c73 100644 --- a/test/service/src/lib.rs +++ b/test/service/src/lib.rs @@ -162,6 +162,7 @@ where } else { polkadot_service::IsCollator::No }, + None, ) .map_err(|e| match e { polkadot_service::Error::Sub(x) => x, @@ -546,3 +547,22 @@ impl TestNode { self.client.wait_for_blocks(count) } } + +/// Run a relay-chain validator node. +/// +/// This is essentially a wrapper around +/// [`run_validator_node`](polkadot_test_service::run_validator_node). +pub fn run_relay_chain_validator_node( + task_executor: TaskExecutor, + key: Sr25519Keyring, + storage_update_func: impl Fn(), + boot_nodes: Vec, +) -> polkadot_test_service::PolkadotTestNode { + polkadot_test_service::run_validator_node( + task_executor, + key, + storage_update_func, + boot_nodes, + Some(cumulus_test_relay_validation_worker_provider::VALIDATION_WORKER.into()), + ) +} diff --git a/test/service/tests/integration.rs b/test/service/tests/integration.rs index 0f720830c1..5fbe7c89a8 100644 --- a/test/service/tests/integration.rs +++ b/test/service/tests/integration.rs @@ -15,7 +15,7 @@ // along with Substrate. If not, see . use cumulus_primitives_core::ParaId; -use cumulus_test_service::{initial_head_data, Keyring::*}; +use cumulus_test_service::{initial_head_data, run_relay_chain_validator_node, Keyring::*}; use futures::join; use sc_service::TaskExecutor; @@ -28,16 +28,11 @@ async fn test_collating_and_non_collator_mode_catching_up(task_executor: TaskExe let para_id = ParaId::from(100); // start alice - let alice = - polkadot_test_service::run_validator_node(task_executor.clone(), Alice, || {}, vec![]); + let alice = run_relay_chain_validator_node(task_executor.clone(), Alice, || {}, vec![]); // start bob - let bob = polkadot_test_service::run_validator_node( - task_executor.clone(), - Bob, - || {}, - vec![alice.addr.clone()], - ); + let bob = + run_relay_chain_validator_node(task_executor.clone(), Bob, || {}, vec![alice.addr.clone()]); // register parachain alice