diff --git a/.github/ISSUE_TEMPLATE/release-runtime.md b/.github/ISSUE_TEMPLATE/release-runtime.md index a9430c6103b..0f3543759af 100644 --- a/.github/ISSUE_TEMPLATE/release-runtime.md +++ b/.github/ISSUE_TEMPLATE/release-runtime.md @@ -33,8 +33,9 @@ The following checks can be performed after we have forked off to the release-ca runtime state is correctly updated for any public (non-private/test) networks - [ ] Run [integration tests](https://github.com/paritytech/cumulus/blob/master/docs/release.md#integration-tests), and make sure they pass. -- [ ] Push runtime upgrade to Westmint and verify network stability +- [ ] Push runtime upgrade to Asset Hub Westend and verify network stability - [ ] Push runtime upgrade to Collectives and verify network stability +- [ ] Push runtime upgrade to Bridge-Hub-Kusama and verify network stability ### Github diff --git a/Cargo.lock b/Cargo.lock index 61e466125f6..2c4d4e97dbd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -422,6 +422,7 @@ dependencies = [ "pallet-balances", "pallet-collator-selection", "pallet-multisig", + "pallet-nft-fractionalization", "pallet-nfts", "pallet-nfts-runtime-api", "pallet-proxy", @@ -757,18 +758,18 @@ checksum = "0e97ce7de6cf12de5d7226c73f5ba9811622f4db3a5b91b55c53e987e5f91cba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] name = "async-trait" -version = "0.1.68" +version = "0.1.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" +checksum = "a564d521dd56509c4c47480d00b80ee55f7e385ae48db5744c67ad50c92d2ebf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] @@ -870,7 +871,7 @@ dependencies = [ [[package]] name = "binary-merkle-tree" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "hash-db", "log", @@ -903,7 +904,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] @@ -1357,6 +1358,34 @@ dependencies = [ "xcm-executor", ] +[[package]] +name = "bridge-hub-rococo-integration-tests" +version = "1.0.0" +dependencies = [ + "bp-messages", + "bridge-hub-rococo-runtime", + "cumulus-pallet-xcmp-queue", + "frame-support", + "frame-system", + "integration-tests-common", + "pallet-assets", + "pallet-balances", + "pallet-bridge-messages", + "pallet-xcm", + "parachains-common", + "parity-scale-codec", + "polkadot-core-primitives", + "polkadot-parachain", + "polkadot-runtime", + "polkadot-runtime-parachains", + "sp-core", + "sp-runtime", + "sp-weights", + "xcm", + "xcm-emulator", + "xcm-executor", +] + [[package]] name = "bridge-hub-rococo-runtime" version = "0.1.0" @@ -1821,9 +1850,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.6" +version = "4.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6320c6d1c98b6981da7bb2dcecbd0be9dc98d42165fa8326b21000f7dbfde6d0" +checksum = "1640e5cc7fb47dbb8338fd471b105e7ed6c3cb2aeb00c2e067127ffd3764a05d" dependencies = [ "clap_builder", "clap_derive", @@ -1832,13 +1861,12 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.3.5" +version = "4.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e53afce1efce6ed1f633cf0e57612fe51db54a1ee4fd8f8503d078fe02d69ae" +checksum = "98c59138d527eeaf9b53f35a77fcc1fad9d883116070c63d5de1c7dc7b00c72b" dependencies = [ "anstream", "anstyle 1.0.0", - "bitflags", "clap_lex", "strsim", ] @@ -1852,7 +1880,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] @@ -1884,7 +1912,7 @@ dependencies = [ ] [[package]] -name = "collectives-polkadot-it" +name = "collectives-polkadot-integration-tests" version = "0.1.0" dependencies = [ "asset-hub-polkadot-runtime", @@ -2436,9 +2464,9 @@ dependencies = [ [[package]] name = "crypto-bigint" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c2538c4e68e52548bacb3e83ac549f903d44f011ac9d5abb5e132e67d0808f7" +checksum = "cf4c2f4e1afd912bc40bfd6fed5d9dc1f288e0ba01bfcc835cc5bc3eb13efe15" dependencies = [ "generic-array 0.14.6", "rand_core 0.6.4", @@ -2512,6 +2540,7 @@ dependencies = [ "parity-scale-codec", "sc-chain-spec", "sc-cli", + "sc-client-api", "sc-service", "sp-core", "sp-runtime", @@ -2555,10 +2584,12 @@ dependencies = [ "cumulus-client-collator", "cumulus-client-consensus-common", "cumulus-client-consensus-proposer", + "cumulus-primitives-aura", "cumulus-primitives-core", "cumulus-primitives-parachain-inherent", "cumulus-relay-chain-interface", "futures", + "lru 0.10.0", "parity-scale-codec", "polkadot-node-primitives", "polkadot-overseer", @@ -2566,6 +2597,7 @@ dependencies = [ "sc-client-api", "sc-consensus", "sc-consensus-aura", + "sc-consensus-babe", "sc-consensus-slots", "sc-telemetry", "sp-api", @@ -2601,11 +2633,14 @@ dependencies = [ "polkadot-primitives", "sc-client-api", "sc-consensus", + "sc-consensus-babe", "schnellru", "sp-blockchain", "sp-consensus", + "sp-consensus-slots", "sp-core", "sp-runtime", + "sp-timestamp", "sp-tracing", "sp-trie", "substrate-prometheus-endpoint", @@ -2661,7 +2696,6 @@ dependencies = [ "futures-timer", "parity-scale-codec", "parking_lot 0.12.1", - "polkadot-client", "polkadot-node-primitives", "polkadot-parachain", "polkadot-primitives", @@ -2820,7 +2854,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] @@ -2905,6 +2939,19 @@ dependencies = [ "xcm", ] +[[package]] +name = "cumulus-primitives-aura" +version = "0.1.0" +dependencies = [ + "parity-scale-codec", + "polkadot-core-primitives", + "polkadot-primitives", + "sp-api", + "sp-consensus-aura", + "sp-runtime", + "sp-std", +] + [[package]] name = "cumulus-primitives-core" version = "0.1.0" @@ -2988,7 +3035,6 @@ dependencies = [ "futures", "futures-timer", "polkadot-cli", - "polkadot-client", "polkadot-primitives", "polkadot-service", "polkadot-test-client", @@ -3137,7 +3183,7 @@ name = "cumulus-test-relay-validation-worker-provider" version = "0.1.0" dependencies = [ "polkadot-node-core-pvf", - "toml 0.7.4", + "toml 0.7.6", ] [[package]] @@ -3408,9 +3454,9 @@ dependencies = [ [[package]] name = "der" -version = "0.7.1" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc906908ea6458456e5eaa160a9c08543ec3d1e6f71e2235cedd660cb65f9df0" +checksum = "0c7ed52955ce76b1554f509074bb357d3fb8ac9b51288a65a3fd480d1dfba946" dependencies = [ "const-oid", "zeroize", @@ -3541,6 +3587,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" dependencies = [ "block-buffer 0.10.0", + "const-oid", "crypto-common", "subtle", ] @@ -3625,7 +3672,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.18", + "syn 2.0.25", "termcolor", "walkdir", ] @@ -3689,14 +3736,16 @@ dependencies = [ [[package]] name = "ecdsa" -version = "0.16.1" +version = "0.16.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1b0a1222f8072619e8a6b667a854020a03d363738303203c09468b3424a420a" +checksum = "0997c976637b606099b9985693efa3581e84e41f5c11ba5255f88711058ad428" dependencies = [ - "der 0.7.1", - "elliptic-curve 0.13.2", + "der 0.7.7", + "digest 0.10.6", + "elliptic-curve 0.13.5", "rfc6979 0.4.0", - "signature 2.0.0", + "signature 2.1.0", + "spki 0.7.2", ] [[package]] @@ -3766,17 +3815,17 @@ dependencies = [ [[package]] name = "elliptic-curve" -version = "0.13.2" +version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea5a92946e8614bb585254898bb7dd1ddad241ace60c52149e3765e34cc039d" +checksum = "968405c8fdc9b3bf4df0a6638858cc0b52462836ab6b1c87377785dd09cf1c0b" dependencies = [ "base16ct 0.2.0", - "crypto-bigint 0.5.1", + "crypto-bigint 0.5.2", "digest 0.10.6", "ff 0.13.0", "generic-array 0.14.6", "group 0.13.0", - "pkcs8 0.10.1", + "pkcs8 0.10.2", "rand_core 0.6.4", "sec1 0.7.1", "subtle", @@ -3818,7 +3867,7 @@ checksum = "5e9a1f9f7d83e59740248a6e14ecf93929ade55027844dfcea78beafccc15745" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] @@ -3829,7 +3878,7 @@ checksum = "48016319042fb7c87b78d2993084a831793a897a5cd1a2a67cab9d1eeb4b7d76" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] @@ -3864,6 +3913,12 @@ version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e48c92028aaa870e83d51c64e5d4e0b6981b360c522198c23959f219a4e1b15b" +[[package]] +name = "equivalent" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88bffebc5d80432c9b140ee17875ff173a8ab62faad5b257da912bd2f6c1c0a1" + [[package]] name = "errno" version = "0.2.8" @@ -3972,7 +4027,7 @@ dependencies = [ "fs-err", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] @@ -4013,7 +4068,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f5aa1e3ae159e592ad222dc90c5acbad632b527779ba88486abe92782ab268bd" dependencies = [ "expander 0.0.4", - "indexmap", + "indexmap 1.9.1", "proc-macro-crate", "proc-macro2", "quote", @@ -4143,7 +4198,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "parity-scale-codec", ] @@ -4166,7 +4221,7 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-support", "frame-support-procedural", @@ -4191,7 +4246,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "Inflector", "array-bytes 4.2.0", @@ -4225,12 +4280,13 @@ dependencies = [ "sp-database", "sp-externalities", "sp-inherents", + "sp-io", "sp-keystore", "sp-runtime", "sp-state-machine", - "sp-std", "sp-storage", "sp-trie", + "sp-wasm-interface", "thiserror", "thousands", ] @@ -4238,18 +4294,18 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -4266,7 +4322,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-support", "frame-system", @@ -4282,9 +4338,9 @@ dependencies = [ [[package]] name = "frame-metadata" -version = "15.1.0" +version = "16.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "878babb0b136e731cc77ec2fd883ff02745ff21e6fb662729953d44923df009c" +checksum = "87cf1549fba25a6fcac22785b61698317d958e96cac72a59102ea45b9ae64692" dependencies = [ "cfg-if", "parity-scale-codec", @@ -4295,7 +4351,7 @@ dependencies = [ [[package]] name = "frame-remote-externalities" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "async-recursion", "futures", @@ -4316,7 +4372,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "bitflags", "environmental", @@ -4326,7 +4382,6 @@ dependencies = [ "k256", "log", "macro_magic", - "once_cell", "parity-scale-codec", "paste", "scale-info", @@ -4351,7 +4406,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "Inflector", "cfg-expr", @@ -4363,35 +4418,35 @@ dependencies = [ "proc-macro-warning", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "cfg-if", "frame-support", @@ -4410,7 +4465,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -4425,7 +4480,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "parity-scale-codec", "sp-api", @@ -4434,7 +4489,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-support", "parity-scale-codec", @@ -4554,7 +4609,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] @@ -4692,7 +4747,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dec7af912d60cdbd3677c1af9352ebae6fb8394d165568a2234df0fa00f87793" dependencies = [ "fallible-iterator", - "indexmap", + "indexmap 1.9.1", "stable_deref_trait", ] @@ -4785,7 +4840,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap", + "indexmap 1.9.1", "slab", "tokio", "tokio-util", @@ -4845,6 +4900,12 @@ dependencies = [ "ahash 0.8.2", ] +[[package]] +name = "hashbrown" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" + [[package]] name = "heck" version = "0.4.0" @@ -5189,6 +5250,16 @@ dependencies = [ "serde", ] +[[package]] +name = "indexmap" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +dependencies = [ + "equivalent", + "hashbrown 0.14.0", +] + [[package]] name = "indexmap-nostd" version = "0.4.0" @@ -5238,8 +5309,12 @@ dependencies = [ "asset-hub-kusama-runtime", "asset-hub-polkadot-runtime", "asset-hub-westend-runtime", + "bp-messages", + "bp-runtime", "bridge-hub-kusama-runtime", "bridge-hub-polkadot-runtime", + "bridge-hub-rococo-runtime", + "bridge-runtime-common", "collectives-polkadot-runtime", "cumulus-primitives-core", "frame-support", @@ -5248,6 +5323,7 @@ dependencies = [ "kusama-runtime-constants", "pallet-assets", "pallet-balances", + "pallet-bridge-messages", "pallet-im-online", "pallet-staking", "pallet-xcm", @@ -5262,9 +5338,12 @@ dependencies = [ "polkadot-runtime-constants", "polkadot-runtime-parachains", "polkadot-service", + "rococo-runtime", + "rococo-runtime-constants", "sc-consensus-grandpa", "sp-authority-discovery", "sp-consensus-babe", + "sp-consensus-beefy", "sp-core", "sp-runtime", "sp-weights", @@ -5294,6 +5373,12 @@ dependencies = [ "webrtc-util", ] +[[package]] +name = "intx" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f38a50a899dc47a6d0ed5508e7f601a2e34c3a85303514b5d137f3c10a0c75" + [[package]] name = "io-lifetimes" version = "0.7.5" @@ -5532,13 +5617,13 @@ dependencies = [ [[package]] name = "k256" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955890845095ccf31ef83ad41a05aabb4d8cc23dc3cac5a9f5c89cf26dd0da75" +checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" dependencies = [ "cfg-if", - "ecdsa 0.16.1", - "elliptic-curve 0.13.2", + "ecdsa 0.16.7", + "elliptic-curve 0.13.5", "once_cell", "sha2 0.10.2", ] @@ -5552,7 +5637,7 @@ checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" [[package]] name = "kusama-runtime" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "bitvec", "frame-benchmarking", @@ -5604,6 +5689,7 @@ dependencies = [ "pallet-society", "pallet-staking", "pallet-staking-runtime-api", + "pallet-state-trie-migration", "pallet-timestamp", "pallet-tips", "pallet-transaction-payment", @@ -5651,7 +5737,7 @@ dependencies = [ [[package]] name = "kusama-runtime-constants" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "frame-support", "polkadot-primitives", @@ -6374,7 +6460,7 @@ dependencies = [ "macro_magic_core", "macro_magic_macros", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] @@ -6387,7 +6473,7 @@ dependencies = [ "macro_magic_core_macros", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] @@ -6398,7 +6484,7 @@ checksum = "93d7d9e6e234c040dafc745c7592738d56a03ad04b1fa04ab60821deb597466a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] @@ -6409,7 +6495,7 @@ checksum = "ffd19f13cfd2bfbd83692adfef8c244fe5109b3eb822a1fb4e0a6253b406cd81" dependencies = [ "macro_magic_core", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] @@ -6567,20 +6653,19 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.4" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", - "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.36.1", + "windows-sys 0.48.0", ] [[package]] name = "mmr-gadget" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "futures", "log", @@ -6599,7 +6684,7 @@ dependencies = [ [[package]] name = "mmr-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "anyhow", "jsonrpsee", @@ -6975,7 +7060,7 @@ checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" dependencies = [ "crc32fast", "hashbrown 0.13.2", - "indexmap", + "indexmap 1.9.1", "memchr", ] @@ -7103,7 +7188,7 @@ dependencies = [ [[package]] name = "pallet-alliance" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "array-bytes 4.2.0", "frame-benchmarking", @@ -7124,7 +7209,7 @@ dependencies = [ [[package]] name = "pallet-asset-conversion" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -7142,7 +7227,7 @@ dependencies = [ [[package]] name = "pallet-asset-conversion-tx-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-support", "frame-system", @@ -7156,7 +7241,7 @@ dependencies = [ [[package]] name = "pallet-asset-tx-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -7174,7 +7259,7 @@ dependencies = [ [[package]] name = "pallet-assets" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -7189,7 +7274,7 @@ dependencies = [ [[package]] name = "pallet-aura" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-support", "frame-system", @@ -7205,7 +7290,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-support", "frame-system", @@ -7221,7 +7306,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-support", "frame-system", @@ -7235,7 +7320,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -7259,7 +7344,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7279,7 +7364,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -7294,7 +7379,7 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-support", "frame-system", @@ -7313,7 +7398,7 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "array-bytes 4.2.0", "binary-merkle-tree", @@ -7337,7 +7422,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -7443,7 +7528,7 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -7487,7 +7572,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -7504,7 +7589,7 @@ dependencies = [ [[package]] name = "pallet-contracts" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "bitflags", "environmental", @@ -7528,13 +7613,12 @@ dependencies = [ "sp-std", "wasm-instrument 0.4.0", "wasmi", - "wasmparser-nostd", ] [[package]] name = "pallet-contracts-primitives" version = "24.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "bitflags", "parity-scale-codec", @@ -7547,17 +7631,17 @@ dependencies = [ [[package]] name = "pallet-contracts-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] name = "pallet-conviction-voting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "assert_matches", "frame-benchmarking", @@ -7574,7 +7658,7 @@ dependencies = [ [[package]] name = "pallet-core-fellowship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -7592,7 +7676,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -7610,7 +7694,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7633,7 +7717,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7646,7 +7730,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -7664,7 +7748,7 @@ dependencies = [ [[package]] name = "pallet-fast-unstake" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "docify", "frame-benchmarking", @@ -7683,7 +7767,7 @@ dependencies = [ [[package]] name = "pallet-glutton" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "blake2", "frame-benchmarking", @@ -7701,7 +7785,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -7724,7 +7808,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "enumflags2", "frame-benchmarking", @@ -7740,7 +7824,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -7760,7 +7844,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -7777,7 +7861,7 @@ dependencies = [ [[package]] name = "pallet-insecure-randomness-collective-flip" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-support", "frame-system", @@ -7791,7 +7875,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -7808,7 +7892,7 @@ dependencies = [ [[package]] name = "pallet-message-queue" version = "7.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -7827,7 +7911,7 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -7844,7 +7928,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -7860,7 +7944,7 @@ dependencies = [ [[package]] name = "pallet-nft-fractionalization" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -7877,7 +7961,7 @@ dependencies = [ [[package]] name = "pallet-nfts" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "enumflags2", "frame-benchmarking", @@ -7895,7 +7979,7 @@ dependencies = [ [[package]] name = "pallet-nfts-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-support", "pallet-nfts", @@ -7906,7 +7990,7 @@ dependencies = [ [[package]] name = "pallet-nis" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -7922,7 +8006,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-support", "frame-system", @@ -7939,7 +8023,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-benchmarking" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7959,7 +8043,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-runtime-api" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "pallet-nomination-pools", "parity-scale-codec", @@ -7970,7 +8054,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-support", "frame-system", @@ -7987,7 +8071,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -8026,7 +8110,7 @@ dependencies = [ [[package]] name = "pallet-preimage" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -8043,7 +8127,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -8058,7 +8142,7 @@ dependencies = [ [[package]] name = "pallet-ranked-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -8076,7 +8160,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -8091,7 +8175,7 @@ dependencies = [ [[package]] name = "pallet-referenda" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "assert_matches", "frame-benchmarking", @@ -8110,7 +8194,7 @@ dependencies = [ [[package]] name = "pallet-salary" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -8128,7 +8212,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -8145,7 +8229,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-support", "frame-system", @@ -8166,7 +8250,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -8182,7 +8266,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -8201,7 +8285,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -8224,18 +8308,18 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] name = "pallet-staking-reward-fn" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "log", "sp-arithmetic", @@ -8244,7 +8328,7 @@ dependencies = [ [[package]] name = "pallet-staking-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "parity-scale-codec", "sp-api", @@ -8253,7 +8337,7 @@ dependencies = [ [[package]] name = "pallet-state-trie-migration" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -8270,7 +8354,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -8285,7 +8369,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -8303,7 +8387,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -8322,7 +8406,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-support", "frame-system", @@ -8338,7 +8422,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -8354,7 +8438,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -8366,7 +8450,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -8383,7 +8467,7 @@ dependencies = [ [[package]] name = "pallet-uniques" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -8398,7 +8482,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -8414,7 +8498,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -8429,7 +8513,7 @@ dependencies = [ [[package]] name = "pallet-whitelist" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-benchmarking", "frame-support", @@ -8444,7 +8528,7 @@ dependencies = [ [[package]] name = "pallet-xcm" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "bounded-collections", "frame-benchmarking", @@ -8465,7 +8549,7 @@ dependencies = [ [[package]] name = "pallet-xcm-benchmarks" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "frame-benchmarking", "frame-support", @@ -8490,6 +8574,8 @@ dependencies = [ "frame-system", "parity-scale-codec", "scale-info", + "sp-runtime", + "sp-std", ] [[package]] @@ -8507,6 +8593,7 @@ dependencies = [ "cumulus-relay-chain-interface", "frame-benchmarking", "frame-benchmarking-cli", + "futures", "jsonrpsee", "log", "pallet-transaction-payment-rpc", @@ -8522,6 +8609,7 @@ dependencies = [ "sc-executor", "sc-network", "sc-network-sync", + "sc-offchain", "sc-rpc", "sc-service", "sc-sysinfo", @@ -8685,9 +8773,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.6.1" +version = "3.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2287753623c76f953acd29d15d8100bcab84d29db78fb6f352adb3c53e83b967" +checksum = "756d439303e94fae44f288ba881ad29670c65b0c4b0e05674ca81061bb65f2c5" dependencies = [ "arrayvec 0.7.2", "bitvec", @@ -8700,9 +8788,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.6.1" +version = "3.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b6937b5e67bfba3351b87b040d48352a2fcb6ad72f81855412ce97b45c8f110" +checksum = "9d884d78fcf214d70b1e239fcd1c6e5e95aa3be1881918da2e488cc946c7a476" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -8813,9 +8901,9 @@ checksum = "7924d1d0ad836f665c9065e26d016c673ece3993f30d340068b16f282afc1156" [[package]] name = "paste" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" +checksum = "b4b27ab7be369122c218afc2079489cdcb4b517c0a3fc386ff11e1fedfcc2b35" [[package]] name = "pbkdf2" @@ -8974,7 +9062,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a13a2fa9d0b63e5f22328828741e523766fff0ee9e779316902290dff3f824f" dependencies = [ "fixedbitset", - "indexmap", + "indexmap 1.9.1", ] [[package]] @@ -9027,12 +9115,12 @@ dependencies = [ [[package]] name = "pkcs8" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d2820d87d2b008616e5c27212dd9e0e694fb4c6b522de06094106813328cb49" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" dependencies = [ - "der 0.7.1", - "spki 0.7.0", + "der 0.7.7", + "spki 0.7.2", ] [[package]] @@ -9078,7 +9166,7 @@ dependencies = [ [[package]] name = "polkadot-approval-distribution" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "futures", "futures-timer", @@ -9096,7 +9184,7 @@ dependencies = [ [[package]] name = "polkadot-availability-bitfield-distribution" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "futures", "futures-timer", @@ -9111,7 +9199,7 @@ dependencies = [ [[package]] name = "polkadot-availability-distribution" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "derive_more", "fatality", @@ -9134,7 +9222,7 @@ dependencies = [ [[package]] name = "polkadot-availability-recovery" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "fatality", "futures", @@ -9155,13 +9243,12 @@ dependencies = [ [[package]] name = "polkadot-cli" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "clap", "frame-benchmarking-cli", "futures", "log", - "polkadot-client", "polkadot-node-core-pvf-execute-worker", "polkadot-node-core-pvf-prepare-worker", "polkadot-node-metrics", @@ -9182,53 +9269,10 @@ dependencies = [ "try-runtime-cli", ] -[[package]] -name = "polkadot-client" -version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" -dependencies = [ - "async-trait", - "frame-benchmarking", - "frame-benchmarking-cli", - "frame-system", - "frame-system-rpc-runtime-api", - "futures", - "pallet-transaction-payment", - "pallet-transaction-payment-rpc-runtime-api", - "polkadot-core-primitives", - "polkadot-node-core-parachains-inherent", - "polkadot-primitives", - "polkadot-runtime", - "polkadot-runtime-common", - "rococo-runtime", - "sc-client-api", - "sc-consensus", - "sc-executor", - "sc-service", - "sp-api", - "sp-authority-discovery", - "sp-block-builder", - "sp-blockchain", - "sp-consensus", - "sp-consensus-babe", - "sp-consensus-beefy", - "sp-consensus-grandpa", - "sp-core", - "sp-inherents", - "sp-keyring", - "sp-mmr-primitives", - "sp-offchain", - "sp-runtime", - "sp-session", - "sp-storage", - "sp-timestamp", - "sp-transaction-pool", -] - [[package]] name = "polkadot-collator-protocol" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "always-assert", "bitvec", @@ -9250,7 +9294,7 @@ dependencies = [ [[package]] name = "polkadot-core-primitives" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "parity-scale-codec", "scale-info", @@ -9262,13 +9306,13 @@ dependencies = [ [[package]] name = "polkadot-dispute-distribution" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "derive_more", "fatality", "futures", "futures-timer", - "indexmap", + "indexmap 1.9.1", "lru 0.9.0", "parity-scale-codec", "polkadot-erasure-coding", @@ -9287,7 +9331,7 @@ dependencies = [ [[package]] name = "polkadot-erasure-coding" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "parity-scale-codec", "polkadot-node-primitives", @@ -9301,7 +9345,7 @@ dependencies = [ [[package]] name = "polkadot-gossip-support" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "futures", "futures-timer", @@ -9321,7 +9365,7 @@ dependencies = [ [[package]] name = "polkadot-network-bridge" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "always-assert", "async-trait", @@ -9344,7 +9388,7 @@ dependencies = [ [[package]] name = "polkadot-node-collation-generation" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "futures", "parity-scale-codec", @@ -9362,7 +9406,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-approval-voting" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "bitvec", "derive_more", @@ -9391,7 +9435,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-av-store" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "bitvec", "futures", @@ -9412,7 +9456,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-backing" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "bitvec", "fatality", @@ -9431,7 +9475,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-bitfield-signing" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "futures", "polkadot-node-subsystem", @@ -9446,7 +9490,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-candidate-validation" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "async-trait", "futures", @@ -9466,7 +9510,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-api" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "futures", "polkadot-node-metrics", @@ -9481,7 +9525,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-selection" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "futures", "futures-timer", @@ -9498,7 +9542,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-dispute-coordinator" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "fatality", "futures", @@ -9517,7 +9561,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-parachains-inherent" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "async-trait", "futures", @@ -9534,7 +9578,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-provisioner" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "bitvec", "fatality", @@ -9552,7 +9596,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "always-assert", "futures", @@ -9583,7 +9627,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf-checker" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "futures", "polkadot-node-primitives", @@ -9599,7 +9643,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf-common" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "cpu-time", "futures", @@ -9622,7 +9666,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf-execute-worker" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "cpu-time", "futures", @@ -9642,7 +9686,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf-prepare-worker" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "futures", "libc", @@ -9665,7 +9709,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-runtime-api" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "futures", "lru 0.9.0", @@ -9680,7 +9724,7 @@ dependencies = [ [[package]] name = "polkadot-node-jaeger" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "lazy_static", "log", @@ -9698,7 +9742,7 @@ dependencies = [ [[package]] name = "polkadot-node-metrics" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "bs58", "futures", @@ -9717,7 +9761,7 @@ dependencies = [ [[package]] name = "polkadot-node-network-protocol" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "async-channel", "async-trait", @@ -9740,7 +9784,7 @@ dependencies = [ [[package]] name = "polkadot-node-primitives" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "bounded-vec", "futures", @@ -9762,7 +9806,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "polkadot-node-jaeger", "polkadot-node-subsystem-types", @@ -9772,7 +9816,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-test-helpers" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "async-trait", "futures", @@ -9790,7 +9834,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-types" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "async-trait", "derive_more", @@ -9813,7 +9857,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-util" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "async-trait", "derive_more", @@ -9846,7 +9890,7 @@ dependencies = [ [[package]] name = "polkadot-overseer" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "async-trait", "futures", @@ -9869,7 +9913,7 @@ dependencies = [ [[package]] name = "polkadot-parachain" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "bounded-collections", "derive_more", @@ -9968,7 +10012,7 @@ dependencies = [ [[package]] name = "polkadot-performance-test" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "env_logger 0.9.0", "kusama-runtime", @@ -9986,7 +10030,7 @@ dependencies = [ [[package]] name = "polkadot-primitives" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "bitvec", "hex-literal 0.4.1", @@ -10012,7 +10056,7 @@ dependencies = [ [[package]] name = "polkadot-rpc" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "jsonrpsee", "mmr-rpc", @@ -10044,7 +10088,7 @@ dependencies = [ [[package]] name = "polkadot-runtime" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "bitvec", "frame-benchmarking", @@ -10139,7 +10183,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-common" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "bitvec", "frame-benchmarking", @@ -10185,7 +10229,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-constants" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "frame-support", "polkadot-primitives", @@ -10199,7 +10243,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-metrics" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "bs58", "parity-scale-codec", @@ -10211,7 +10255,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-parachains" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "bitflags", "bitvec", @@ -10256,11 +10300,13 @@ dependencies = [ [[package]] name = "polkadot-service" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "async-trait", + "frame-benchmarking", "frame-benchmarking-cli", "frame-support", + "frame-system", "frame-system-rpc-runtime-api", "futures", "hex-literal 0.4.1", @@ -10273,14 +10319,16 @@ dependencies = [ "pallet-babe", "pallet-im-online", "pallet-staking", + "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", "parity-db", + "parity-scale-codec", "polkadot-approval-distribution", "polkadot-availability-bitfield-distribution", "polkadot-availability-distribution", "polkadot-availability-recovery", - "polkadot-client", "polkadot-collator-protocol", + "polkadot-core-primitives", "polkadot-dispute-distribution", "polkadot-gossip-support", "polkadot-network-bridge", @@ -10307,7 +10355,7 @@ dependencies = [ "polkadot-primitives", "polkadot-rpc", "polkadot-runtime", - "polkadot-runtime-constants", + "polkadot-runtime-common", "polkadot-runtime-parachains", "polkadot-statement-distribution", "rococo-runtime", @@ -10347,6 +10395,7 @@ dependencies = [ "sp-core", "sp-inherents", "sp-io", + "sp-keyring", "sp-keystore", "sp-mmr-primitives", "sp-offchain", @@ -10357,6 +10406,8 @@ dependencies = [ "sp-timestamp", "sp-transaction-pool", "sp-trie", + "sp-version", + "sp-weights", "substrate-prometheus-endpoint", "thiserror", "tracing-gum", @@ -10366,13 +10417,13 @@ dependencies = [ [[package]] name = "polkadot-statement-distribution" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "arrayvec 0.5.2", "fatality", "futures", "futures-timer", - "indexmap", + "indexmap 1.9.1", "parity-scale-codec", "polkadot-node-network-protocol", "polkadot-node-primitives", @@ -10388,7 +10439,7 @@ dependencies = [ [[package]] name = "polkadot-statement-table" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "parity-scale-codec", "polkadot-primitives", @@ -10398,8 +10449,9 @@ dependencies = [ [[package]] name = "polkadot-test-client" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ + "frame-benchmarking", "parity-scale-codec", "polkadot-node-subsystem", "polkadot-primitives", @@ -10407,6 +10459,7 @@ dependencies = [ "polkadot-test-service", "sc-block-builder", "sc-consensus", + "sc-offchain", "sc-service", "sp-api", "sp-blockchain", @@ -10414,6 +10467,7 @@ dependencies = [ "sp-consensus-babe", "sp-core", "sp-inherents", + "sp-io", "sp-runtime", "sp-state-machine", "sp-timestamp", @@ -10423,7 +10477,7 @@ dependencies = [ [[package]] name = "polkadot-test-runtime" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "bitvec", "frame-election-provider-support", @@ -10484,9 +10538,8 @@ dependencies = [ [[package]] name = "polkadot-test-service" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ - "frame-benchmarking", "frame-system", "futures", "hex", @@ -10511,7 +10564,6 @@ dependencies = [ "sc-consensus", "sc-consensus-babe", "sc-consensus-grandpa", - "sc-executor", "sc-network", "sc-service", "sc-tracing", @@ -10651,7 +10703,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ceca8aaf45b5c46ec7ed39fff75f57290368c1846d33d24a122ca81416ab058" dependencies = [ "proc-macro2", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] @@ -10727,14 +10779,14 @@ checksum = "70550716265d1ec349c41f70dd4f964b4fd88394efe4405f0c1da679c4799a07" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] name = "proc-macro2" -version = "1.0.60" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" +checksum = "78803b62cbf1f46fde80d7c0e803111524b9877184cfe7c3033659490ac7a7da" dependencies = [ "unicode-ident", ] @@ -10903,9 +10955,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.28" +version = "1.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" dependencies = [ "proc-macro2", ] @@ -11265,7 +11317,7 @@ dependencies = [ [[package]] name = "rococo-runtime" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "binary-merkle-tree", "frame-benchmarking", @@ -11352,7 +11404,7 @@ dependencies = [ [[package]] name = "rococo-runtime-constants" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "frame-support", "polkadot-primitives", @@ -11621,7 +11673,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "log", "sp-core", @@ -11632,7 +11684,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "async-trait", "futures", @@ -11647,7 +11699,6 @@ dependencies = [ "rand 0.8.5", "sc-client-api", "sc-network", - "sc-network-common", "sp-api", "sp-authority-discovery", "sp-blockchain", @@ -11661,7 +11712,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "futures", "futures-timer", @@ -11684,7 +11735,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -11699,7 +11750,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "memmap2", "sc-chain-spec-derive", @@ -11718,18 +11769,18 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "array-bytes 4.2.0", "chrono", @@ -11747,7 +11798,6 @@ dependencies = [ "sc-client-db", "sc-keystore", "sc-network", - "sc-network-common", "sc-service", "sc-telemetry", "sc-tracing", @@ -11769,7 +11819,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "fnv", "futures", @@ -11796,7 +11846,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "hash-db", "kvdb", @@ -11822,7 +11872,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "async-trait", "futures", @@ -11847,7 +11897,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "async-trait", "futures", @@ -11876,7 +11926,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "async-trait", "fork-tree", @@ -11891,7 +11941,6 @@ dependencies = [ "sc-consensus", "sc-consensus-epochs", "sc-consensus-slots", - "sc-keystore", "sc-telemetry", "scale-info", "sp-api", @@ -11912,7 +11961,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "futures", "jsonrpsee", @@ -11934,7 +11983,7 @@ dependencies = [ [[package]] name = "sc-consensus-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "array-bytes 4.2.0", "async-channel", @@ -11946,9 +11995,7 @@ dependencies = [ "parking_lot 0.12.1", "sc-client-api", "sc-consensus", - "sc-keystore", "sc-network", - "sc-network-common", "sc-network-gossip", "sc-network-sync", "sc-utils", @@ -11970,7 +12017,7 @@ dependencies = [ [[package]] name = "sc-consensus-beefy-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "futures", "jsonrpsee", @@ -11989,7 +12036,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "fork-tree", "parity-scale-codec", @@ -12002,7 +12049,7 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "ahash 0.8.2", "array-bytes 4.2.0", @@ -12042,7 +12089,7 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "finality-grandpa", "futures", @@ -12062,7 +12109,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "async-trait", "futures", @@ -12085,7 +12132,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "lru 0.10.0", "parity-scale-codec", @@ -12107,7 +12154,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "sc-allocator", "sp-maybe-compressed-blob", @@ -12119,13 +12166,12 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "anyhow", "cfg-if", "libc", "log", - "once_cell", "rustix 0.36.7", "sc-allocator", "sc-executor-common", @@ -12137,7 +12183,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "ansi_term", "futures", @@ -12153,7 +12199,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "array-bytes 4.2.0", "parking_lot 0.12.1", @@ -12167,7 +12213,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "array-bytes 4.2.0", "async-channel", @@ -12182,25 +12228,20 @@ dependencies = [ "libp2p", "linked_hash_set", "log", - "lru 0.10.0", "mockall", "parity-scale-codec", "parking_lot 0.12.1", "partial_sort", "pin-project", "rand 0.8.5", - "sc-block-builder", "sc-client-api", - "sc-consensus", "sc-network-common", "sc-utils", "serde", "serde_json", "smallvec", - "snow", "sp-arithmetic", "sp-blockchain", - "sp-consensus", "sp-core", "sp-runtime", "substrate-prometheus-endpoint", @@ -12213,7 +12254,7 @@ dependencies = [ [[package]] name = "sc-network-bitswap" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "async-channel", "cid", @@ -12224,7 +12265,6 @@ dependencies = [ "prost-build", "sc-client-api", "sc-network", - "sc-network-common", "sp-blockchain", "sp-runtime", "thiserror", @@ -12234,34 +12274,24 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ - "array-bytes 4.2.0", "async-trait", "bitflags", - "bytes", "futures", - "futures-timer", "libp2p-identity", "parity-scale-codec", "prost-build", "sc-consensus", - "sc-utils", - "serde", - "smallvec", - "sp-blockchain", "sp-consensus", "sp-consensus-grandpa", "sp-runtime", - "substrate-prometheus-endpoint", - "thiserror", - "zeroize", ] [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "ahash 0.8.2", "futures", @@ -12279,7 +12309,7 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "array-bytes 4.2.0", "async-channel", @@ -12291,7 +12321,6 @@ dependencies = [ "prost-build", "sc-client-api", "sc-network", - "sc-network-common", "sp-blockchain", "sp-core", "sp-runtime", @@ -12301,7 +12330,7 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "array-bytes 4.2.0", "async-channel", @@ -12335,7 +12364,7 @@ dependencies = [ [[package]] name = "sc-network-transactions" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "array-bytes 4.2.0", "futures", @@ -12353,7 +12382,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "array-bytes 4.2.0", "bytes", @@ -12370,7 +12399,6 @@ dependencies = [ "rand 0.8.5", "sc-client-api", "sc-network", - "sc-network-common", "sc-utils", "sp-api", "sp-core", @@ -12383,7 +12411,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -12392,7 +12420,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "futures", "jsonrpsee", @@ -12423,7 +12451,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -12442,7 +12470,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "http", "jsonrpsee", @@ -12457,7 +12485,7 @@ dependencies = [ [[package]] name = "sc-rpc-spec-v2" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "array-bytes 4.2.0", "futures", @@ -12483,7 +12511,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "async-trait", "directories", @@ -12514,7 +12542,6 @@ dependencies = [ "sc-rpc", "sc-rpc-server", "sc-rpc-spec-v2", - "sc-storage-monitor", "sc-sysinfo", "sc-telemetry", "sc-tracing", @@ -12549,7 +12576,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "log", "parity-scale-codec", @@ -12560,14 +12587,12 @@ dependencies = [ [[package]] name = "sc-storage-monitor" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "clap", "fs4", - "futures", "log", "sc-client-db", - "sc-utils", "sp-core", "thiserror", "tokio", @@ -12576,7 +12601,7 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -12595,7 +12620,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "futures", "libc", @@ -12614,7 +12639,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "chrono", "futures", @@ -12633,7 +12658,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "ansi_term", "atty", @@ -12641,12 +12666,10 @@ dependencies = [ "lazy_static", "libc", "log", - "once_cell", "parking_lot 0.12.1", "regex", "rustc-hash", "sc-client-api", - "sc-rpc-server", "sc-tracing-proc-macro", "serde", "sp-api", @@ -12664,18 +12687,18 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "async-trait", "futures", @@ -12701,7 +12724,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "async-trait", "futures", @@ -12717,7 +12740,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "async-channel", "futures", @@ -12731,9 +12754,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad560913365790f17cbf12479491169f01b9d46d29cfc7422bf8c64bdc61b731" +checksum = "35c0a159d0c45c12b20c5a844feb1fe4bea86e28f17b92a5f0c42193634d3782" dependencies = [ "bitvec", "cfg-if", @@ -12745,9 +12768,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19df9bd9ace6cc2fe19387c96ce677e823e07d017ceed253e7bb3d1d1bd9c73b" +checksum = "912e55f6d20e0e80d63733872b40e1227c0bce1e1ab81ba67d696339bfd7fd29" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -12859,9 +12882,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48518a2b5775ba8ca5b46596aae011caa431e6ce7e4a67ead66d92f08884220e" dependencies = [ "base16ct 0.2.0", - "der 0.7.1", + "der 0.7.7", "generic-array 0.14.6", - "pkcs8 0.10.1", + "pkcs8 0.10.2", "subtle", "zeroize", ] @@ -12980,29 +13003,29 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.164" +version = "1.0.171" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" +checksum = "30e27d1e4fd7659406c492fd6cfaf2066ba8773de45ca75e855590f856dc34a9" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.164" +version = "1.0.171" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" +checksum = "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] name = "serde_json" -version = "1.0.97" +version = "1.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdf3bf93142acad5821c99197022e170842cdbc1c30482b98750c688c640842a" +checksum = "b5062a995d481b2308b6064e9af76011f2921c35f97b0468811ed9f6cd91dfed" dependencies = [ "itoa 1.0.4", "ryu", @@ -13011,9 +13034,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93107647184f6027e3b7dcb2e11034cf95ffa1e3a682c67951963ac69c1c007d" +checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" dependencies = [ "serde", ] @@ -13156,9 +13179,9 @@ dependencies = [ [[package]] name = "signature" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fe458c98333f9c8152221191a77e2a44e8325d0193484af2e9421a53019e57d" +checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" dependencies = [ "digest 0.10.6", "rand_core 0.6.4", @@ -13198,7 +13221,7 @@ checksum = "03b634d87b960ab1a38c4fe143b508576f075e7c978bfad18217645ebfdfa2ec" [[package]] name = "slot-range-helper" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "enumn", "parity-scale-codec", @@ -13218,9 +13241,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" [[package]] name = "snap" @@ -13275,7 +13298,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "hash-db", "log", @@ -13295,7 +13318,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "Inflector", "blake2", @@ -13303,13 +13326,13 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] name = "sp-application-crypto" version = "23.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "parity-scale-codec", "scale-info", @@ -13322,7 +13345,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "16.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "integer-sqrt", "num-traits", @@ -13336,7 +13359,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "parity-scale-codec", "scale-info", @@ -13349,9 +13372,8 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ - "parity-scale-codec", "sp-api", "sp-inherents", "sp-runtime", @@ -13361,7 +13383,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "futures", "log", @@ -13379,7 +13401,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "async-trait", "futures", @@ -13394,14 +13416,13 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "async-trait", "parity-scale-codec", "scale-info", "sp-api", "sp-application-crypto", - "sp-consensus", "sp-consensus-slots", "sp-inherents", "sp-runtime", @@ -13412,7 +13433,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "async-trait", "parity-scale-codec", @@ -13420,11 +13441,9 @@ dependencies = [ "serde", "sp-api", "sp-application-crypto", - "sp-consensus", "sp-consensus-slots", "sp-core", "sp-inherents", - "sp-keystore", "sp-runtime", "sp-std", "sp-timestamp", @@ -13433,7 +13452,7 @@ dependencies = [ [[package]] name = "sp-consensus-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "lazy_static", "parity-scale-codec", @@ -13452,7 +13471,7 @@ dependencies = [ [[package]] name = "sp-consensus-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "finality-grandpa", "log", @@ -13470,7 +13489,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "parity-scale-codec", "scale-info", @@ -13482,7 +13501,7 @@ dependencies = [ [[package]] name = "sp-core" version = "21.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "array-bytes 4.2.0", "bitflags", @@ -13526,32 +13545,30 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "9.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "blake2b_simd", "byteorder", "digest 0.10.6", "sha2 0.10.2", "sha3", - "sp-std", "twox-hash", ] [[package]] name = "sp-core-hashing-proc-macro" version = "9.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ - "proc-macro2", "quote", "sp-core-hashing", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -13560,17 +13577,17 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "8.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] name = "sp-externalities" version = "0.19.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "environmental", "parity-scale-codec", @@ -13581,13 +13598,12 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "async-trait", "impl-trait-for-tuples", "parity-scale-codec", "scale-info", - "sp-core", "sp-runtime", "sp-std", "thiserror", @@ -13596,12 +13612,11 @@ dependencies = [ [[package]] name = "sp-io" version = "23.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "bytes", "ed25519", "ed25519-dalek", - "futures", "libsecp256k1", "log", "parity-scale-codec", @@ -13622,7 +13637,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "24.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "lazy_static", "sp-core", @@ -13633,12 +13648,10 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.27.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ - "futures", "parity-scale-codec", "parking_lot 0.12.1", - "serde", "sp-core", "sp-externalities", "thiserror", @@ -13647,7 +13660,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "thiserror", "zstd 0.12.3+zstd.1.5.2", @@ -13656,7 +13669,7 @@ dependencies = [ [[package]] name = "sp-metadata-ir" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-metadata", "parity-scale-codec", @@ -13667,7 +13680,7 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "ckb-merkle-mountain-range", "log", @@ -13685,7 +13698,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "parity-scale-codec", "scale-info", @@ -13699,7 +13712,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "sp-api", "sp-core", @@ -13709,7 +13722,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "8.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "backtrace", "lazy_static", @@ -13719,7 +13732,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "rustc-hash", "serde", @@ -13729,7 +13742,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "24.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "either", "hash256-std-hasher", @@ -13751,7 +13764,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "17.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -13769,19 +13782,19 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "11.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "Inflector", "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "parity-scale-codec", "scale-info", @@ -13795,7 +13808,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "parity-scale-codec", "scale-info", @@ -13808,7 +13821,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.28.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "hash-db", "log", @@ -13823,14 +13836,14 @@ dependencies = [ "sp-trie", "thiserror", "tracing", + "trie-db", ] [[package]] name = "sp-statement-store" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ - "log", "parity-scale-codec", "scale-info", "sp-api", @@ -13846,12 +13859,12 @@ dependencies = [ [[package]] name = "sp-std" version = "8.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" [[package]] name = "sp-storage" version = "13.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "impl-serde", "parity-scale-codec", @@ -13864,11 +13877,9 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "async-trait", - "futures-timer", - "log", "parity-scale-codec", "sp-inherents", "sp-runtime", @@ -13879,7 +13890,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "10.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "parity-scale-codec", "sp-std", @@ -13891,7 +13902,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "sp-api", "sp-runtime", @@ -13900,10 +13911,9 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "async-trait", - "log", "parity-scale-codec", "scale-info", "sp-core", @@ -13916,7 +13926,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "22.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "ahash 0.8.2", "hash-db", @@ -13939,7 +13949,7 @@ dependencies = [ [[package]] name = "sp-version" version = "22.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "impl-serde", "parity-scale-codec", @@ -13956,18 +13966,18 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "8.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "parity-scale-codec", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] name = "sp-wasm-interface" version = "14.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "anyhow", "impl-trait-for-tuples", @@ -13980,7 +13990,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "20.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "parity-scale-codec", "scale-info", @@ -14027,12 +14037,12 @@ dependencies = [ [[package]] name = "spki" -version = "0.7.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0445c905640145c7ea8c1993555957f65e7c46d0535b91ba501bc9bfc85522f" +checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" dependencies = [ "base64ct", - "der 0.7.1", + "der 0.7.7", ] [[package]] @@ -14178,15 +14188,12 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" -dependencies = [ - "platforms", -] +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "frame-system-rpc-runtime-api", "futures", @@ -14205,7 +14212,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "hyper", "log", @@ -14217,7 +14224,7 @@ dependencies = [ [[package]] name = "substrate-rpc-client" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "async-trait", "jsonrpsee", @@ -14230,14 +14237,12 @@ dependencies = [ [[package]] name = "substrate-state-trie-migration-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "jsonrpsee", - "log", "parity-scale-codec", "sc-client-api", "sc-rpc-api", - "scale-info", "serde", "sp-core", "sp-runtime", @@ -14249,7 +14254,7 @@ dependencies = [ [[package]] name = "substrate-test-client" version = "2.0.1" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -14275,7 +14280,7 @@ dependencies = [ [[package]] name = "substrate-test-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "futures", "substrate-test-utils-derive", @@ -14285,18 +14290,18 @@ dependencies = [ [[package]] name = "substrate-test-utils-derive" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "ansi_term", "build-helper", @@ -14306,7 +14311,7 @@ dependencies = [ "sp-maybe-compressed-blob", "strum", "tempfile", - "toml 0.7.4", + "toml 0.7.6", "walkdir", "wasm-opt", ] @@ -14339,9 +14344,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.18" +version = "2.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" +checksum = "15e3fc8c0c74267e2df136e5e5fb656a464158aa57624053375eb9c8c6e25ae2" dependencies = [ "proc-macro2", "quote", @@ -14425,7 +14430,7 @@ checksum = "13a4ec180a2de59b57434704ccfad967f789b12737738798fa08798cd5824c16" [[package]] name = "test-runtime-constants" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "frame-support", "polkadot-primitives", @@ -14438,22 +14443,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.40" +version = "1.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" +checksum = "a35fc5b8971143ca348fa6df4f024d4d55264f3468c71ad1c2f365b0a4d58c42" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.40" +version = "1.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" +checksum = "463fe12d7993d3b327787537ce8dd4dfa058de32fc2b195ef3cde03dc4771e8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] @@ -14608,11 +14613,12 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.28.2" +version = "1.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2" +checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" dependencies = [ "autocfg", + "backtrace", "bytes", "libc", "mio", @@ -14633,7 +14639,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] @@ -14706,9 +14712,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6135d499e69981f9ff0ef2167955a5333c35e36f6937d382974566b3d5b94ec" +checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" dependencies = [ "serde", "serde_spanned", @@ -14718,20 +14724,20 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a76a9312f5ba4c2dec6b9161fdf25d87ad8a09256ccea5a556fef03c706a10f" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.19.9" +version = "0.19.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d964908cec0d030b812013af25a0e57fddfadb1e066ecc6681d86253129d4f" +checksum = "c500344a19072298cd05a7224b3c0c629348b78692bf48466c5238656e315a78" dependencies = [ - "indexmap", + "indexmap 2.0.0", "serde", "serde_spanned", "toml_datetime", @@ -14826,7 +14832,7 @@ dependencies = [ [[package]] name = "tracing-gum" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "polkadot-node-jaeger", "polkadot-primitives", @@ -14837,13 +14843,13 @@ dependencies = [ [[package]] name = "tracing-gum-proc-macro" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "expander 2.0.0", "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] @@ -14967,7 +14973,7 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "try-runtime-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#81d125fe2a938ba336716c8b1d5e0faff0487d50" +source = "git+https://github.com/paritytech/substrate?branch=master#29ef4775d673178d6674864299a5341abb78be75" dependencies = [ "async-trait", "clap", @@ -14978,7 +14984,6 @@ dependencies = [ "parity-scale-codec", "sc-cli", "sc-executor", - "sc-service", "serde", "serde_json", "sp-api", @@ -15377,10 +15382,12 @@ dependencies = [ [[package]] name = "wasmi" -version = "0.28.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e61a7006b0fdf24f6bbe8dcfdad5ca1b350de80061fb2827f31c82fbbb9565a" +checksum = "e51fb5c61993e71158abf5bb863df2674ca3ec39ed6471c64f07aeaf751d67b4" dependencies = [ + "intx", + "smallvec", "spin 0.9.4", "wasmi_arena", "wasmi_core", @@ -15411,7 +15418,7 @@ version = "0.102.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48134de3d7598219ab9eaf6b91b15d8e50d31da76b8519fe4ecfcec2cf35104b" dependencies = [ - "indexmap", + "indexmap 1.9.1", "url", ] @@ -15433,7 +15440,7 @@ dependencies = [ "anyhow", "bincode", "cfg-if", - "indexmap", + "indexmap 1.9.1", "libc", "log", "object", @@ -15527,7 +15534,7 @@ dependencies = [ "anyhow", "cranelift-entity", "gimli", - "indexmap", + "indexmap 1.9.1", "log", "object", "serde", @@ -15592,7 +15599,7 @@ dependencies = [ "anyhow", "cc", "cfg-if", - "indexmap", + "indexmap 1.9.1", "libc", "log", "mach", @@ -15882,7 +15889,7 @@ dependencies = [ [[package]] name = "westend-runtime" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "bitvec", "frame-benchmarking", @@ -15975,7 +15982,7 @@ dependencies = [ [[package]] name = "westend-runtime-constants" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "frame-support", "polkadot-primitives", @@ -16070,19 +16077,6 @@ dependencies = [ "windows_x86_64_msvc 0.32.0", ] -[[package]] -name = "windows-sys" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" -dependencies = [ - "windows_aarch64_msvc 0.36.1", - "windows_i686_gnu 0.36.1", - "windows_i686_msvc 0.36.1", - "windows_x86_64_gnu 0.36.1", - "windows_x86_64_msvc 0.36.1", -] - [[package]] name = "windows-sys" version = "0.42.0" @@ -16170,12 +16164,6 @@ version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17cffbe740121affb56fad0fc0e421804adf0ae00891205213b5cecd30db881d" -[[package]] -name = "windows_aarch64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" - [[package]] name = "windows_aarch64_msvc" version = "0.42.2" @@ -16200,12 +16188,6 @@ version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2564fde759adb79129d9b4f54be42b32c89970c18ebf93124ca8870a498688ed" -[[package]] -name = "windows_i686_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" - [[package]] name = "windows_i686_gnu" version = "0.42.2" @@ -16230,12 +16212,6 @@ version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9cd9d32ba70453522332c14d38814bceeb747d80b3958676007acadd7e166956" -[[package]] -name = "windows_i686_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" - [[package]] name = "windows_i686_msvc" version = "0.42.2" @@ -16260,12 +16236,6 @@ version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfce6deae227ee8d356d19effc141a509cc503dfd1f850622ec4b0f84428e1f4" -[[package]] -name = "windows_x86_64_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" - [[package]] name = "windows_x86_64_gnu" version = "0.42.2" @@ -16302,12 +16272,6 @@ version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d19538ccc21819d01deaf88d6a17eae6596a12e9aafdbb97916fb49896d89de9" -[[package]] -name = "windows_x86_64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" - [[package]] name = "windows_x86_64_msvc" version = "0.42.2" @@ -16409,7 +16373,7 @@ dependencies = [ [[package]] name = "xcm" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "bounded-collections", "derivative", @@ -16425,7 +16389,7 @@ dependencies = [ [[package]] name = "xcm-builder" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "frame-support", "frame-system", @@ -16474,13 +16438,12 @@ dependencies = [ "sp-std", "sp-trie", "xcm", - "xcm-executor", ] [[package]] name = "xcm-executor" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "environmental", "frame-benchmarking", @@ -16500,12 +16463,12 @@ dependencies = [ [[package]] name = "xcm-procedural" version = "0.9.43" -source = "git+https://github.com/paritytech/polkadot?branch=master#0db5f018c6a510c5eceb4f25be794cd0a7873bbf" +source = "git+https://github.com/paritytech/polkadot?branch=master#d124d9932302fd003668ce02feff75e1de7768d9" dependencies = [ "Inflector", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.25", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 77b32019681..149a4d345e0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,6 +30,7 @@ members = [ "pallets/xcmp-queue", "parachain-template/node", "parachain-template/runtime", + "primitives/aura", "primitives/core", "primitives/parachain-inherent", "primitives/timestamp", @@ -57,6 +58,7 @@ members = [ "parachains/integration-tests/emulated/assets/asset-hub-polkadot", "parachains/integration-tests/emulated/assets/asset-hub-westend", "parachains/integration-tests/emulated/collectives/collectives-polkadot", + "parachains/integration-tests/emulated/bridges/bridge-hub-rococo", "test/client", "test/relay-sproof-builder", "test/relay-validation-worker-provider", @@ -73,3 +75,4 @@ opt-level = 3 inherits = "release" lto = true codegen-units = 1 + diff --git a/README.md b/README.md index b9ebebfe3a7..72e3ad8d3dc 100644 --- a/README.md +++ b/README.md @@ -153,13 +153,13 @@ cargo build --release --bin polkadot-parachain ./target/release/polkadot-parachain export-genesis-wasm > genesis-wasm # Collator1 -./target/release/polkadot-parachain --collator --alice --force-authoring --tmp --port 40335 --ws-port 9946 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30335 +./target/release/polkadot-parachain --collator --alice --force-authoring --tmp --port 40335 --rpc-port 9946 -- --chain ../polkadot/rococo-local-cfde.json --port 30335 # Collator2 -./target/release/polkadot-parachain --collator --bob --force-authoring --tmp --port 40336 --ws-port 9947 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30336 +./target/release/polkadot-parachain --collator --bob --force-authoring --tmp --port 40336 --rpc-port 9947 -- --chain ../polkadot/rococo-local-cfde.json --port 30336 # Parachain Full Node 1 -./target/release/polkadot-parachain --tmp --port 40337 --ws-port 9948 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30337 +./target/release/polkadot-parachain --tmp --port 40337 --rpc-port 9948 -- --chain ../polkadot/rococo-local-cfde.json --port 30337 ``` #### Register the parachain @@ -267,5 +267,5 @@ docker build --tag $OWNER/$IMAGE_NAME --file ./docker/polkadot-parachain_builder You may then run your new container: ```bash -docker run --rm -it $OWNER/$IMAGE_NAME --collator --tmp --execution wasm --chain /specs/westmint.json +docker run --rm -it $OWNER/$IMAGE_NAME --collator --tmp --chain /specs/westmint.json ``` diff --git a/bridges/bin/runtime-common/Cargo.toml b/bridges/bin/runtime-common/Cargo.toml index 0ccca8cf618..98b3bc99250 100644 --- a/bridges/bin/runtime-common/Cargo.toml +++ b/bridges/bin/runtime-common/Cargo.toml @@ -10,7 +10,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } hash-db = { version = "0.16.0", default-features = false } log = { version = "0.4.19", default-features = false } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } static_assertions = { version = "1.1", optional = true } # Bridge dependencies diff --git a/bridges/bin/runtime-common/src/integrity.rs b/bridges/bin/runtime-common/src/integrity.rs index 83bc3288379..1292a4fbaa3 100644 --- a/bridges/bin/runtime-common/src/integrity.rs +++ b/bridges/bin/runtime-common/src/integrity.rs @@ -38,15 +38,15 @@ macro_rules! assert_chain_types( // if one of asserts fail, then either bridge isn't configured properly (or alternatively - non-standard // configuration is used), or something has broke existing configuration (meaning that all bridged chains // and relays will stop functioning) - use frame_system::Config as SystemConfig; + use frame_system::{Config as SystemConfig, pallet_prelude::*}; use static_assertions::assert_type_eq_all; assert_type_eq_all!(<$r as SystemConfig>::Nonce, bp_runtime::NonceOf<$this>); - assert_type_eq_all!(<$r as SystemConfig>::BlockNumber, bp_runtime::BlockNumberOf<$this>); + assert_type_eq_all!(BlockNumberFor<$r>, bp_runtime::BlockNumberOf<$this>); assert_type_eq_all!(<$r as SystemConfig>::Hash, bp_runtime::HashOf<$this>); assert_type_eq_all!(<$r as SystemConfig>::Hashing, bp_runtime::HasherOf<$this>); assert_type_eq_all!(<$r as SystemConfig>::AccountId, bp_runtime::AccountIdOf<$this>); - assert_type_eq_all!(<$r as SystemConfig>::Header, bp_runtime::HeaderOf<$this>); + assert_type_eq_all!(HeaderFor<$r>, bp_runtime::HeaderOf<$this>); } } ); diff --git a/bridges/bin/runtime-common/src/mock.rs b/bridges/bin/runtime-common/src/mock.rs index d886242493e..f7e5fc7daa3 100644 --- a/bridges/bin/runtime-common/src/mock.rs +++ b/bridges/bin/runtime-common/src/mock.rs @@ -63,12 +63,8 @@ pub type ThisChainHasher = BlakeTwo256; pub type ThisChainRuntimeCall = RuntimeCall; /// Runtime call origin at `ThisChain`. pub type ThisChainCallOrigin = RuntimeOrigin; -/// Header of `ThisChain`. -pub type ThisChainHeader = sp_runtime::generic::Header; -/// Block of `ThisChain`. -pub type ThisChainBlock = frame_system::mocking::MockBlock; -/// Unchecked extrinsic of `ThisChain`. -pub type ThisChainUncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; +// Block of `ThisChain`. +pub type ThisChainBlock = frame_system::mocking::MockBlockU32; /// Account identifier at the `BridgedChain`. pub type BridgedChainAccountId = u128; @@ -83,6 +79,8 @@ pub type BridgedChainHasher = BlakeTwo256; /// Header of the `BridgedChain`. pub type BridgedChainHeader = sp_runtime::generic::Header; +/// Block of the `BridgedChain`. +pub type BridgedChainBlock = frame_system::mocking::MockBlockU32; /// Rewards payment procedure. pub type TestPaymentProcedure = PayRewardFromAccount; @@ -108,12 +106,9 @@ pub const BRIDGED_CHAIN_MAX_EXTRINSIC_WEIGHT: usize = 2048; pub const BRIDGED_CHAIN_MAX_EXTRINSIC_SIZE: u32 = 1024; frame_support::construct_runtime! { - pub enum TestRuntime where - Block = ThisChainBlock, - NodeBlock = ThisChainBlock, - UncheckedExtrinsic = ThisChainUncheckedExtrinsic, + pub enum TestRuntime { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, Utility: pallet_utility, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event}, @@ -150,12 +145,11 @@ impl frame_system::Config for TestRuntime { type RuntimeOrigin = RuntimeOrigin; type Nonce = u64; type RuntimeCall = RuntimeCall; - type BlockNumber = ThisChainBlockNumber; type Hash = ThisChainHash; type Hashing = ThisChainHasher; type AccountId = ThisChainAccountId; type Lookup = IdentityLookup; - type Header = ThisChainHeader; + type Block = ThisChainBlock; type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU32<250>; type Version = (); @@ -318,10 +312,9 @@ impl From pub struct ThisUnderlyingChain; impl Chain for ThisUnderlyingChain { - type BlockNumber = ThisChainBlockNumber; + type Block = ThisChainBlock; type Hash = ThisChainHash; type Hasher = ThisChainHasher; - type Header = ThisChainHeader; type AccountId = ThisChainAccountId; type Balance = ThisChainBalance; type Nonce = u32; @@ -358,10 +351,9 @@ pub struct BridgedUnderlyingParachain; pub struct BridgedChainCall; impl Chain for BridgedUnderlyingChain { - type BlockNumber = BridgedChainBlockNumber; + type Block = BridgedChainBlock; type Hash = BridgedChainHash; type Hasher = BridgedChainHasher; - type Header = BridgedChainHeader; type AccountId = BridgedChainAccountId; type Balance = BridgedChainBalance; type Nonce = u32; @@ -384,10 +376,9 @@ impl ChainWithGrandpa for BridgedUnderlyingChain { } impl Chain for BridgedUnderlyingParachain { - type BlockNumber = BridgedChainBlockNumber; + type Block = BridgedChainBlock; type Hash = BridgedChainHash; type Hasher = BridgedChainHasher; - type Header = BridgedChainHeader; type AccountId = BridgedChainAccountId; type Balance = BridgedChainBalance; type Nonce = u32; diff --git a/bridges/bin/runtime-common/src/parachains_benchmarking.rs b/bridges/bin/runtime-common/src/parachains_benchmarking.rs index aad53673c3a..53095784cb1 100644 --- a/bridges/bin/runtime-common/src/parachains_benchmarking.rs +++ b/bridges/bin/runtime-common/src/parachains_benchmarking.rs @@ -46,7 +46,7 @@ where + pallet_bridge_grandpa::Config, PI: 'static, >::BridgedChain: - bp_runtime::Chain, + bp_runtime::Chain, { let parachain_head = ParaHead(vec![0u8; parachain_head_size as usize]); diff --git a/bridges/bin/runtime-common/src/refund_relayer_extension.rs b/bridges/bin/runtime-common/src/refund_relayer_extension.rs index c5419837316..1beacd981ee 100644 --- a/bridges/bin/runtime-common/src/refund_relayer_extension.rs +++ b/bridges/bin/runtime-common/src/refund_relayer_extension.rs @@ -24,7 +24,7 @@ use crate::messages_call_ext::{ }; use bp_messages::{LaneId, MessageNonce}; use bp_relayers::{RewardsAccountOwner, RewardsAccountParams}; -use bp_runtime::{Parachain, ParachainIdOf, RangeInclusiveExt, StaticStrProvider}; +use bp_runtime::{Chain, Parachain, ParachainIdOf, RangeInclusiveExt, StaticStrProvider}; use codec::{Decode, Encode}; use frame_support::{ dispatch::{CallableCallFor, DispatchInfo, Dispatchable, PostDispatchInfo}, @@ -47,7 +47,10 @@ use pallet_transaction_payment::{Config as TransactionPaymentConfig, OnChargeTra use pallet_utility::{Call as UtilityCall, Config as UtilityConfig, Pallet as UtilityPallet}; use scale_info::TypeInfo; use sp_runtime::{ - traits::{DispatchInfoOf, Get, PostDispatchInfoOf, SignedExtension, Zero}, + traits::{ + Block as BlockT, DispatchInfoOf, Get, Header as HeaderT, PostDispatchInfoOf, + SignedExtension, Zero, + }, transaction_validity::{ TransactionPriority, TransactionValidity, TransactionValidityError, ValidTransactionBuilder, }, @@ -278,6 +281,7 @@ where + GrandpaCallSubType + ParachainsCallSubType + MessagesCallSubType, + <<>::BridgedRelayChain as Chain>::Block as BlockT>::Header: HeaderT { fn expand_call<'a>(&self, call: &'a CallOf) -> Vec<&'a CallOf> { match call.is_sub_type() { @@ -525,6 +529,7 @@ where + GrandpaCallSubType + ParachainsCallSubType + MessagesCallSubType, + <<>::BridgedRelayChain as Chain>::Block as BlockT>::Header: HeaderT { const IDENTIFIER: &'static str = Id::STR; type AccountId = Runtime::AccountId; diff --git a/bridges/modules/grandpa/Cargo.toml b/bridges/modules/grandpa/Cargo.toml index 9986c85d034..d04c6072979 100644 --- a/bridges/modules/grandpa/Cargo.toml +++ b/bridges/modules/grandpa/Cargo.toml @@ -11,7 +11,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false } finality-grandpa = { version = "0.16.2", default-features = false } log = { version = "0.4.19", default-features = false } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } # Bridge Dependencies diff --git a/bridges/modules/grandpa/src/call_ext.rs b/bridges/modules/grandpa/src/call_ext.rs index b57aebb1ac1..868b6626955 100644 --- a/bridges/modules/grandpa/src/call_ext.rs +++ b/bridges/modules/grandpa/src/call_ext.rs @@ -19,6 +19,7 @@ use bp_header_chain::{justification::GrandpaJustification, ChainWithGrandpa}; use bp_runtime::BlockNumberOf; use codec::Encode; use frame_support::{dispatch::CallableCallFor, traits::IsSubType, weights::Weight, RuntimeDebug}; +use frame_system::pallet_prelude::HeaderFor; use sp_runtime::{ traits::{Header, Zero}, transaction_validity::{InvalidTransaction, TransactionValidity, ValidTransaction}, @@ -178,8 +179,9 @@ pub(crate) fn submit_finality_proof_info_from_args, I: 'static>( /// Returns maximal expected size of `submit_finality_proof` call arguments. fn max_expected_call_size, I: 'static>(required_precommits: u32) -> u32 { - let max_expected_justification_size = - GrandpaJustification::max_reasonable_size::(required_precommits); + let max_expected_justification_size = GrandpaJustification::>::max_reasonable_size::< + T::BridgedChain, + >(required_precommits); // call arguments are header and justification T::BridgedChain::MAX_HEADER_SIZE.saturating_add(max_expected_justification_size) diff --git a/bridges/modules/grandpa/src/lib.rs b/bridges/modules/grandpa/src/lib.rs index 10b60878302..8ff128ef20f 100644 --- a/bridges/modules/grandpa/src/lib.rs +++ b/bridges/modules/grandpa/src/lib.rs @@ -176,11 +176,12 @@ pub mod pallet { justification.votes_ancestries.len().saturated_into(), ))] pub fn submit_finality_proof( - _origin: OriginFor, + origin: OriginFor, finality_target: Box>, justification: GrandpaJustification>, ) -> DispatchResultWithPostInfo { Self::ensure_not_halted().map_err(Error::::BridgeModule)?; + ensure_signed(origin)?; let (hash, number) = (finality_target.hash(), *finality_target.number()); log::trace!( @@ -379,7 +380,7 @@ pub mod pallet { } #[pallet::genesis_build] - impl, I: 'static> GenesisBuild for GenesisConfig { + impl, I: 'static> BuildGenesisConfig for GenesisConfig { fn build(&self) { if let Some(ref owner) = self.owner { >::put(owner); @@ -1414,4 +1415,23 @@ mod tests { fn maybe_headers_to_keep_returns_correct_value() { assert_eq!(MaybeHeadersToKeep::::get(), Some(mock::HeadersToKeep::get())); } + + #[test] + fn submit_finality_proof_requires_signed_origin() { + run_test(|| { + initialize_substrate_bridge(); + + let header = test_header(1); + let justification = make_default_justification(&header); + + assert_noop!( + Pallet::::submit_finality_proof( + RuntimeOrigin::root(), + Box::new(header), + justification, + ), + DispatchError::BadOrigin, + ); + }) + } } diff --git a/bridges/modules/grandpa/src/mock.rs b/bridges/modules/grandpa/src/mock.rs index 68336befdf4..819875b870a 100644 --- a/bridges/modules/grandpa/src/mock.rs +++ b/bridges/modules/grandpa/src/mock.rs @@ -26,7 +26,7 @@ use frame_support::{ }; use sp_core::sr25519::Signature; use sp_runtime::{ - testing::{Header, H256}, + testing::H256, traits::{BlakeTwo256, IdentityLookup}, Perbill, }; @@ -36,19 +36,15 @@ pub type TestHeader = crate::BridgedHeader; pub type TestNumber = crate::BridgedBlockNumber; type Block = frame_system::mocking::MockBlock; -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; pub const MAX_BRIDGED_AUTHORITIES: u32 = 5; use crate as grandpa; construct_runtime! { - pub enum TestRuntime where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum TestRuntime { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, Grandpa: grandpa::{Pallet, Call, Event}, } } @@ -63,12 +59,11 @@ impl frame_system::Config for TestRuntime { type RuntimeOrigin = RuntimeOrigin; type Nonce = u64; type RuntimeCall = RuntimeCall; - type BlockNumber = u64; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = AccountId; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<250>; type Version = (); @@ -105,10 +100,9 @@ impl grandpa::Config for TestRuntime { pub struct TestBridgedChain; impl Chain for TestBridgedChain { - type BlockNumber = ::BlockNumber; + type Block = Block; type Hash = ::Hash; type Hasher = ::Hashing; - type Header = ::Header; type AccountId = AccountId; type Balance = u64; diff --git a/bridges/modules/messages/Cargo.toml b/bridges/modules/messages/Cargo.toml index c84065539f9..da69f66d538 100644 --- a/bridges/modules/messages/Cargo.toml +++ b/bridges/modules/messages/Cargo.toml @@ -10,7 +10,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false } log = { version = "0.4.19", default-features = false } num-traits = { version = "0.2", default-features = false } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } # Bridge dependencies diff --git a/bridges/modules/messages/src/lib.rs b/bridges/modules/messages/src/lib.rs index 51e6857d777..3bfd5bc7e98 100644 --- a/bridges/modules/messages/src/lib.rs +++ b/bridges/modules/messages/src/lib.rs @@ -188,9 +188,9 @@ pub mod pallet { #[pallet::hooks] impl, I: 'static> Hooks> for Pallet where - u32: TryFrom<::BlockNumber>, + u32: TryFrom>, { - fn on_idle(_block: T::BlockNumber, remaining_weight: Weight) -> Weight { + fn on_idle(_block: BlockNumberFor, remaining_weight: Weight) -> Weight { // we'll need at least to read outbound lane state, kill a message and update lane state let db_weight = T::DbWeight::get(); if !remaining_weight.all_gte(db_weight.reads_writes(1, 2)) { @@ -597,7 +597,7 @@ pub mod pallet { } #[pallet::genesis_build] - impl, I: 'static> GenesisBuild for GenesisConfig { + impl, I: 'static> BuildGenesisConfig for GenesisConfig { fn build(&self) { PalletOperatingMode::::put(self.operating_mode); if let Some(ref owner) = self.owner { diff --git a/bridges/modules/messages/src/mock.rs b/bridges/modules/messages/src/mock.rs index c17f5f22b3f..62bc76c5e01 100644 --- a/bridges/modules/messages/src/mock.rs +++ b/bridges/modules/messages/src/mock.rs @@ -39,9 +39,8 @@ use frame_support::{ use scale_info::TypeInfo; use sp_core::H256; use sp_runtime::{ - testing::Header as SubstrateHeader, traits::{BlakeTwo256, ConstU32, IdentityLookup}, - Perbill, + BuildStorage, Perbill, }; use std::{ collections::{BTreeMap, VecDeque}, @@ -71,17 +70,13 @@ pub type TestRelayer = u64; pub type TestDispatchLevelResult = (); type Block = frame_system::mocking::MockBlock; -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; use crate as pallet_bridge_messages; frame_support::construct_runtime! { - pub enum TestRuntime where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum TestRuntime { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, Balances: pallet_balances::{Pallet, Call, Event}, Messages: pallet_bridge_messages::{Pallet, Call, Event}, } @@ -100,12 +95,11 @@ impl frame_system::Config for TestRuntime { type RuntimeOrigin = RuntimeOrigin; type Nonce = u64; type RuntimeCall = RuntimeCall; - type BlockNumber = u64; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = AccountId; type Lookup = IdentityLookup; - type Header = SubstrateHeader; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<250>; type Version = (); @@ -487,7 +481,7 @@ pub fn inbound_unrewarded_relayers_state(lane: bp_messages::LaneId) -> Unrewarde /// Return test externalities to use in tests. pub fn new_test_ext() -> sp_io::TestExternalities { - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); pallet_balances::GenesisConfig:: { balances: vec![(ENDOWED_ACCOUNT, 1_000_000)] } .assimilate_storage(&mut t) .unwrap(); diff --git a/bridges/modules/parachains/Cargo.toml b/bridges/modules/parachains/Cargo.toml index 1c439c8a415..f7e2184a261 100644 --- a/bridges/modules/parachains/Cargo.toml +++ b/bridges/modules/parachains/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false } log = { version = "0.4.19", default-features = false } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } # Bridge Dependencies diff --git a/bridges/modules/parachains/src/benchmarking.rs b/bridges/modules/parachains/src/benchmarking.rs index 59c4642cde9..f89fbb0f361 100644 --- a/bridges/modules/parachains/src/benchmarking.rs +++ b/bridges/modules/parachains/src/benchmarking.rs @@ -47,7 +47,7 @@ benchmarks_instance_pallet! { where >::BridgedChain: bp_runtime::Chain< - BlockNumber = RelayBlockNumber, + Block = crate::RelayBlock, Hash = RelayBlockHash, Hasher = RelayBlockHasher, >, diff --git a/bridges/modules/parachains/src/lib.rs b/bridges/modules/parachains/src/lib.rs index b17b52163d8..6f28bfc1b08 100644 --- a/bridges/modules/parachains/src/lib.rs +++ b/bridges/modules/parachains/src/lib.rs @@ -63,6 +63,8 @@ pub type RelayBlockHash = bp_polkadot_core::Hash; pub type RelayBlockNumber = bp_polkadot_core::BlockNumber; /// Hasher of the bridged relay chain. pub type RelayBlockHasher = bp_polkadot_core::Hasher; +/// Block type of the bridged relay chain. +pub type RelayBlock = bp_polkadot_core::Block; /// Artifacts of the parachains head update. struct UpdateParachainHeadArtifacts { @@ -137,18 +139,15 @@ pub mod pallet { pub trait BoundedBridgeGrandpaConfig: pallet_bridge_grandpa::Config { - type BridgedRelayChain: Chain< - BlockNumber = RelayBlockNumber, - Hash = RelayBlockHash, - Hasher = RelayBlockHasher, - >; + type BridgedRelayChain: Chain; } impl BoundedBridgeGrandpaConfig for T where T: pallet_bridge_grandpa::Config, - T::BridgedChain: - Chain, + T::BridgedChain: Chain, + <::Block as sp_runtime::traits::Block>::Header: + sp_runtime::traits::Header, { type BridgedRelayChain = T::BridgedChain; } @@ -307,12 +306,13 @@ pub mod pallet { parachains.len() as _, ))] pub fn submit_parachain_heads( - _origin: OriginFor, + origin: OriginFor, at_relay_block: (RelayBlockNumber, RelayBlockHash), parachains: Vec<(ParaId, ParaHash)>, parachain_heads_proof: ParaHeadsProof, ) -> DispatchResultWithPostInfo { Self::ensure_not_halted().map_err(Error::::BridgeModule)?; + ensure_signed(origin)?; // we'll need relay chain header to verify that parachains heads are always increasing. let (relay_block_number, relay_block_hash) = at_relay_block; @@ -322,7 +322,7 @@ pub mod pallet { >::get(relay_block_hash) .ok_or(Error::::UnknownRelayChainBlock)?; ensure!( - relay_block.number == relay_block_number, + relay_block.number == relay_block_number.into(), Error::::InvalidRelayChainBlockNumber, ); @@ -417,7 +417,7 @@ pub mod pallet { }); // we're refunding weight if update has not happened and if pruning has not happened - let is_update_happened = matches!(update_result, Ok(_)); + let is_update_happened = update_result.is_ok(); if !is_update_happened { actual_weight = actual_weight.saturating_sub( WeightInfoOf::::parachain_head_storage_write_weight( @@ -622,7 +622,7 @@ pub mod pallet { } #[pallet::genesis_build] - impl, I: 'static> GenesisBuild for GenesisConfig { + impl, I: 'static> BuildGenesisConfig for GenesisConfig { fn build(&self) { PalletOperatingMode::::put(self.operating_mode); if let Some(ref owner) = self.owner { @@ -1579,4 +1579,25 @@ pub(crate) mod tests { Some(mock::TOTAL_PARACHAINS * mock::HeadsToKeep::get()), ); } + + #[test] + fn submit_finality_proof_requires_signed_origin() { + run_test(|| { + let (state_root, proof, parachains) = + prepare_parachain_heads_proof::(vec![(1, head_data(1, 0))]); + + initialize(state_root); + + // `submit_parachain_heads()` should fail when the pallet is halted. + assert_noop!( + Pallet::::submit_parachain_heads( + RuntimeOrigin::root(), + (0, test_relay_header(0, state_root).hash()), + parachains, + proof, + ), + DispatchError::BadOrigin + ); + }) + } } diff --git a/bridges/modules/parachains/src/mock.rs b/bridges/modules/parachains/src/mock.rs index a36afa505b3..c72298a5e1d 100644 --- a/bridges/modules/parachains/src/mock.rs +++ b/bridges/modules/parachains/src/mock.rs @@ -19,8 +19,8 @@ use bp_polkadot_core::parachains::ParaId; use bp_runtime::{Chain, Parachain}; use frame_support::{construct_runtime, parameter_types, traits::ConstU32, weights::Weight}; use sp_runtime::{ - testing::{Header, H256}, - traits::{BlakeTwo256, Header as HeaderT, IdentityLookup}, + testing::H256, + traits::{BlakeTwo256, Header, IdentityLookup}, MultiSignature, Perbill, }; @@ -33,7 +33,6 @@ pub type RelayBlockHeader = sp_runtime::generic::Header; type Block = frame_system::mocking::MockBlock; -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; pub const PARAS_PALLET_NAME: &str = "Paras"; pub const UNTRACKED_PARACHAIN_ID: u32 = 10; @@ -49,10 +48,9 @@ pub type BigParachainHeader = sp_runtime::generic::Header; pub struct Parachain1; impl Chain for Parachain1 { - type BlockNumber = u64; + type Block = Block; type Hash = H256; type Hasher = RegularParachainHasher; - type Header = RegularParachainHeader; type AccountId = u64; type Balance = u64; type Nonce = u64; @@ -73,10 +71,9 @@ impl Parachain for Parachain1 { pub struct Parachain2; impl Chain for Parachain2 { - type BlockNumber = u64; + type Block = Block; type Hash = H256; type Hasher = RegularParachainHasher; - type Header = RegularParachainHeader; type AccountId = u64; type Balance = u64; type Nonce = u64; @@ -97,10 +94,9 @@ impl Parachain for Parachain2 { pub struct Parachain3; impl Chain for Parachain3 { - type BlockNumber = u64; + type Block = Block; type Hash = H256; type Hasher = RegularParachainHasher; - type Header = RegularParachainHeader; type AccountId = u64; type Balance = u64; type Nonce = u64; @@ -121,11 +117,12 @@ impl Parachain for Parachain3 { // this parachain is using u128 as block number and stored head data size exceeds limit pub struct BigParachain; +type BigBlock = frame_system::mocking::MockBlockU128; + impl Chain for BigParachain { - type BlockNumber = u128; + type Block = BigBlock; type Hash = H256; type Hasher = RegularParachainHasher; - type Header = BigParachainHeader; type AccountId = u64; type Balance = u64; type Nonce = u64; @@ -144,12 +141,9 @@ impl Parachain for BigParachain { } construct_runtime! { - pub enum TestRuntime where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum TestRuntime { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, Grandpa1: pallet_bridge_grandpa::::{Pallet, Event}, Grandpa2: pallet_bridge_grandpa::::{Pallet, Event}, Parachains: pallet_bridge_parachains::{Call, Pallet, Event}, @@ -167,12 +161,11 @@ impl frame_system::Config for TestRuntime { type RuntimeOrigin = RuntimeOrigin; type Nonce = u64; type RuntimeCall = RuntimeCall; - type BlockNumber = TestNumber; type Hash = H256; type Hashing = RegularParachainHasher; type AccountId = AccountId; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type Version = (); @@ -263,10 +256,9 @@ impl pallet_bridge_parachains::benchmarking::Config<()> for TestRuntime { pub struct TestBridgedChain; impl Chain for TestBridgedChain { - type BlockNumber = crate::RelayBlockNumber; + type Block = crate::RelayBlock; type Hash = crate::RelayBlockHash; type Hasher = crate::RelayBlockHasher; - type Header = RelayBlockHeader; type AccountId = AccountId; type Balance = u32; @@ -294,10 +286,9 @@ impl ChainWithGrandpa for TestBridgedChain { pub struct OtherBridgedChain; impl Chain for OtherBridgedChain { - type BlockNumber = u64; + type Block = Block; type Hash = crate::RelayBlockHash; type Hasher = crate::RelayBlockHasher; - type Header = sp_runtime::generic::Header; type AccountId = AccountId; type Balance = u32; diff --git a/bridges/modules/relayers/Cargo.toml b/bridges/modules/relayers/Cargo.toml index 86253225635..ef41d70a242 100644 --- a/bridges/modules/relayers/Cargo.toml +++ b/bridges/modules/relayers/Cargo.toml @@ -9,7 +9,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false } log = { version = "0.4.19", default-features = false } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } # Bridge dependencies diff --git a/bridges/modules/relayers/src/lib.rs b/bridges/modules/relayers/src/lib.rs index 54b888cf29d..a71c218443b 100644 --- a/bridges/modules/relayers/src/lib.rs +++ b/bridges/modules/relayers/src/lib.rs @@ -66,7 +66,7 @@ pub mod pallet { /// Pay rewards scheme. type PaymentProcedure: PaymentProcedure; /// Stake and slash scheme. - type StakeAndSlash: StakeAndSlash; + type StakeAndSlash: StakeAndSlash, Self::Reward>; /// Pallet call weights. type WeightInfo: WeightInfoExt; } @@ -117,7 +117,7 @@ pub mod pallet { /// Registration allows relayer to get priority boost for its message delivery transactions. #[pallet::call_index(1)] #[pallet::weight(T::WeightInfo::register())] - pub fn register(origin: OriginFor, valid_till: T::BlockNumber) -> DispatchResult { + pub fn register(origin: OriginFor, valid_till: BlockNumberFor) -> DispatchResult { let relayer = ensure_signed(origin)?; // valid till must be larger than the current block number and the lease must be larger @@ -330,10 +330,10 @@ pub mod pallet { } /// Return required registration lease. - pub(crate) fn required_registration_lease() -> T::BlockNumber { + pub(crate) fn required_registration_lease() -> BlockNumberFor { , T::Reward, >>::RequiredRegistrationLease::get() } @@ -342,7 +342,7 @@ pub mod pallet { pub(crate) fn required_stake() -> T::Reward { , T::Reward, >>::RequiredStake::get() } @@ -383,7 +383,7 @@ pub mod pallet { /// Relayer account that has been registered. relayer: T::AccountId, /// Relayer registration. - registration: Registration, + registration: Registration, T::Reward>, }, /// Relayer has been `deregistered`. Deregistered { @@ -395,7 +395,7 @@ pub mod pallet { /// Relayer account that has been `deregistered`. relayer: T::AccountId, /// Registration that was removed. - registration: Registration, + registration: Registration, T::Reward>, }, } @@ -445,7 +445,7 @@ pub mod pallet { _, Blake2_128Concat, T::AccountId, - Registration, + Registration, T::Reward>, OptionQuery, >; } diff --git a/bridges/modules/relayers/src/mock.rs b/bridges/modules/relayers/src/mock.rs index b41d7a88b2b..e9ba058bc4c 100644 --- a/bridges/modules/relayers/src/mock.rs +++ b/bridges/modules/relayers/src/mock.rs @@ -25,8 +25,8 @@ use bp_relayers::{ use frame_support::{parameter_types, traits::fungible::Mutate, weights::RuntimeDbWeight}; use sp_core::H256; use sp_runtime::{ - testing::Header as SubstrateHeader, traits::{BlakeTwo256, ConstU32, IdentityLookup}, + BuildStorage, }; pub type AccountId = u64; @@ -43,15 +43,11 @@ pub type TestStakeAndSlash = pallet_bridge_relayers::StakeAndSlashNamed< >; type Block = frame_system::mocking::MockBlock; -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; frame_support::construct_runtime! { - pub enum TestRuntime where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum TestRuntime { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, Balances: pallet_balances::{Pallet, Event}, Relayers: pallet_bridge_relayers::{Pallet, Call, Event}, } @@ -69,12 +65,11 @@ impl frame_system::Config for TestRuntime { type RuntimeOrigin = RuntimeOrigin; type Nonce = u64; type RuntimeCall = RuntimeCall; - type BlockNumber = BlockNumber; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = AccountId; type Lookup = IdentityLookup; - type Header = SubstrateHeader; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = frame_support::traits::ConstU64<250>; type Version = (); @@ -170,7 +165,7 @@ impl PaymentProcedure for TestPaymentProcedure { /// Return test externalities to use in tests. pub fn new_test_ext() -> sp_io::TestExternalities { - let t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let t = frame_system::GenesisConfig::::default().build_storage().unwrap(); sp_io::TestExternalities::new(t) } diff --git a/bridges/primitives/chain-bridge-hub-cumulus/src/lib.rs b/bridges/primitives/chain-bridge-hub-cumulus/src/lib.rs index bc48c34bb6e..f0826952209 100644 --- a/bridges/primitives/chain-bridge-hub-cumulus/src/lib.rs +++ b/bridges/primitives/chain-bridge-hub-cumulus/src/lib.rs @@ -17,8 +17,8 @@ #![cfg_attr(not(feature = "std"), no_std)] pub use bp_polkadot_core::{ - AccountId, AccountInfoStorageMapKeyProvider, AccountPublic, Balance, BlockNumber, Hash, Hasher, - Hashing, Header, Nonce, Perbill, Signature, SignedBlock, UncheckedExtrinsic, + AccountId, AccountInfoStorageMapKeyProvider, AccountPublic, Balance, Block, BlockNumber, Hash, + Hasher, Hashing, Header, Nonce, Perbill, Signature, SignedBlock, UncheckedExtrinsic, EXTRA_STORAGE_PROOF_SIZE, TX_EXTRA_BYTES, }; @@ -124,9 +124,13 @@ pub type Address = MultiAddress; // `ensure_able_to_receive_confirmation` test. /// Maximal number of unrewarded relayer entries at inbound lane for Cumulus-based parachains. +/// Note: this value is security-relevant, decreasing it should not be done without careful +/// analysis (like the one above). pub const MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX: MessageNonce = 1024; /// Maximal number of unconfirmed messages at inbound lane for Cumulus-based parachains. +/// Note: this value is security-relevant, decreasing it should not be done without careful +/// analysis (like the one above). pub const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce = 4096; /// Extra signed extension data that is used by all bridge hubs. diff --git a/bridges/primitives/chain-bridge-hub-kusama/src/lib.rs b/bridges/primitives/chain-bridge-hub-kusama/src/lib.rs index 7405f561fb2..ac899256343 100644 --- a/bridges/primitives/chain-bridge-hub-kusama/src/lib.rs +++ b/bridges/primitives/chain-bridge-hub-kusama/src/lib.rs @@ -36,11 +36,9 @@ use sp_std::prelude::*; pub struct BridgeHubKusama; impl Chain for BridgeHubKusama { - type BlockNumber = BlockNumber; type Hash = Hash; type Hasher = Hasher; - type Header = Header; - + type Block = Block; type AccountId = AccountId; type Balance = Balance; type Nonce = Nonce; diff --git a/bridges/primitives/chain-bridge-hub-polkadot/src/lib.rs b/bridges/primitives/chain-bridge-hub-polkadot/src/lib.rs index e1fc0d7bc47..76af4b943c4 100644 --- a/bridges/primitives/chain-bridge-hub-polkadot/src/lib.rs +++ b/bridges/primitives/chain-bridge-hub-polkadot/src/lib.rs @@ -32,11 +32,9 @@ use sp_std::prelude::*; pub struct BridgeHubPolkadot; impl Chain for BridgeHubPolkadot { - type BlockNumber = BlockNumber; type Hash = Hash; type Hasher = Hasher; - type Header = Header; - + type Block = Block; type AccountId = AccountId; type Balance = Balance; type Nonce = Nonce; diff --git a/bridges/primitives/chain-bridge-hub-rococo/src/lib.rs b/bridges/primitives/chain-bridge-hub-rococo/src/lib.rs index 50206c8e6b3..a11bc6b8e1f 100644 --- a/bridges/primitives/chain-bridge-hub-rococo/src/lib.rs +++ b/bridges/primitives/chain-bridge-hub-rococo/src/lib.rs @@ -36,11 +36,9 @@ use sp_std::prelude::*; pub struct BridgeHubRococo; impl Chain for BridgeHubRococo { - type BlockNumber = BlockNumber; type Hash = Hash; type Hasher = Hasher; - type Header = Header; - + type Block = Block; type AccountId = AccountId; type Balance = Balance; type Nonce = Nonce; diff --git a/bridges/primitives/chain-bridge-hub-wococo/src/lib.rs b/bridges/primitives/chain-bridge-hub-wococo/src/lib.rs index 7d14460c737..71010695337 100644 --- a/bridges/primitives/chain-bridge-hub-wococo/src/lib.rs +++ b/bridges/primitives/chain-bridge-hub-wococo/src/lib.rs @@ -32,11 +32,9 @@ use sp_std::prelude::*; pub struct BridgeHubWococo; impl Chain for BridgeHubWococo { - type BlockNumber = BlockNumber; type Hash = Hash; type Hasher = Hasher; - type Header = Header; - + type Block = Block; type AccountId = AccountId; type Balance = Balance; type Nonce = Nonce; diff --git a/bridges/primitives/chain-kusama/src/lib.rs b/bridges/primitives/chain-kusama/src/lib.rs index 229905a3d4a..e4b5d330354 100644 --- a/bridges/primitives/chain-kusama/src/lib.rs +++ b/bridges/primitives/chain-kusama/src/lib.rs @@ -28,10 +28,9 @@ use frame_support::weights::Weight; pub struct Kusama; impl Chain for Kusama { - type BlockNumber = ::BlockNumber; + type Block = ::Block; type Hash = ::Hash; type Hasher = ::Hasher; - type Header = ::Header; type AccountId = ::AccountId; type Balance = ::Balance; diff --git a/bridges/primitives/chain-polkadot/src/lib.rs b/bridges/primitives/chain-polkadot/src/lib.rs index 628634bb46f..b57486916d2 100644 --- a/bridges/primitives/chain-polkadot/src/lib.rs +++ b/bridges/primitives/chain-polkadot/src/lib.rs @@ -28,10 +28,9 @@ use frame_support::weights::Weight; pub struct Polkadot; impl Chain for Polkadot { - type BlockNumber = ::BlockNumber; + type Block = ::Block; type Hash = ::Hash; type Hasher = ::Hasher; - type Header = ::Header; type AccountId = ::AccountId; type Balance = ::Balance; diff --git a/bridges/primitives/chain-rococo/src/lib.rs b/bridges/primitives/chain-rococo/src/lib.rs index a825c8b3978..b8a6b47b423 100644 --- a/bridges/primitives/chain-rococo/src/lib.rs +++ b/bridges/primitives/chain-rococo/src/lib.rs @@ -28,11 +28,9 @@ use frame_support::{parameter_types, weights::Weight}; pub struct Rococo; impl Chain for Rococo { - type BlockNumber = ::BlockNumber; + type Block = ::Block; type Hash = ::Hash; type Hasher = ::Hasher; - type Header = ::Header; - type AccountId = ::AccountId; type Balance = ::Balance; type Nonce = ::Nonce; diff --git a/bridges/primitives/chain-wococo/src/lib.rs b/bridges/primitives/chain-wococo/src/lib.rs index fb63613427d..00653267e70 100644 --- a/bridges/primitives/chain-wococo/src/lib.rs +++ b/bridges/primitives/chain-wococo/src/lib.rs @@ -31,11 +31,9 @@ use frame_support::weights::Weight; pub struct Wococo; impl Chain for Wococo { - type BlockNumber = ::BlockNumber; + type Block = ::Block; type Hash = ::Hash; type Hasher = ::Hasher; - type Header = ::Header; - type AccountId = ::AccountId; type Balance = ::Balance; type Nonce = ::Nonce; diff --git a/bridges/primitives/header-chain/Cargo.toml b/bridges/primitives/header-chain/Cargo.toml index 32f81315537..962d262d571 100644 --- a/bridges/primitives/header-chain/Cargo.toml +++ b/bridges/primitives/header-chain/Cargo.toml @@ -9,7 +9,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false } finality-grandpa = { version = "0.16.2", default-features = false } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } serde = { version = "1.0", default-features = false, features = ["alloc", "derive"] } # Bridge dependencies diff --git a/bridges/primitives/header-chain/src/justification.rs b/bridges/primitives/header-chain/src/justification.rs index 8433107fce2..a90f4bab94a 100644 --- a/bridges/primitives/header-chain/src/justification.rs +++ b/bridges/primitives/header-chain/src/justification.rs @@ -75,7 +75,7 @@ impl GrandpaJustification { /// any precise calculations - that's just an estimation. pub fn max_reasonable_size(required_precommits: u32) -> u32 where - C: Chain
+ ChainWithGrandpa, + C: Chain + ChainWithGrandpa, { // we don't need precise results here - just estimations, so some details // are removed from computations (e.g. bytes required to encode vector length) @@ -159,10 +159,7 @@ pub fn verify_and_optimize_justification( authorities_set_id: SetId, authorities_set: &VoterSet, justification: GrandpaJustification
, -) -> Result, Error> -where - Header::Number: finality_grandpa::BlockNumberOps, -{ +) -> Result, Error> { let mut optimizer = OptimizationCallbacks(Vec::new()); verify_justification_with_callbacks( finalized_target, @@ -180,10 +177,7 @@ pub fn verify_justification( authorities_set_id: SetId, authorities_set: &VoterSet, justification: &GrandpaJustification
, -) -> Result<(), Error> -where - Header::Number: finality_grandpa::BlockNumberOps, -{ +) -> Result<(), Error> { verify_justification_with_callbacks( finalized_target, authorities_set_id, @@ -259,10 +253,7 @@ fn verify_justification_with_callbacks, justification: &GrandpaJustification
, callbacks: &mut C, -) -> Result<(), Error> -where - Header::Number: finality_grandpa::BlockNumberOps, -{ +) -> Result<(), Error> { // ensure that it is justification for the expected header if (justification.commit.target_hash, justification.commit.target_number) != finalized_target { return Err(Error::InvalidJustificationTarget) diff --git a/bridges/primitives/header-chain/tests/implementation_match.rs b/bridges/primitives/header-chain/tests/implementation_match.rs index c70683b173d..22f690b8cb2 100644 --- a/bridges/primitives/header-chain/tests/implementation_match.rs +++ b/bridges/primitives/header-chain/tests/implementation_match.rs @@ -104,8 +104,8 @@ pub fn make_default_justification(header: &TestHeader) -> GrandpaJustification"] -edition = "2018" +edition = "2021" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } impl-trait-for-tuples = "0.2" -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } # Bridge dependencies diff --git a/bridges/primitives/polkadot-core/Cargo.toml b/bridges/primitives/polkadot-core/Cargo.toml index 56c6de04d41..b7ba4803473 100644 --- a/bridges/primitives/polkadot-core/Cargo.toml +++ b/bridges/primitives/polkadot-core/Cargo.toml @@ -9,7 +9,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } parity-util-mem = { version = "0.12.0", optional = true } -scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } serde = { version = "1.0", optional = true, features = ["derive"] } # Bridge Dependencies diff --git a/bridges/primitives/polkadot-core/src/lib.rs b/bridges/primitives/polkadot-core/src/lib.rs index c1df9555552..2f812a79538 100644 --- a/bridges/primitives/polkadot-core/src/lib.rs +++ b/bridges/primitives/polkadot-core/src/lib.rs @@ -226,11 +226,9 @@ pub type Address = MultiAddress; pub struct PolkadotLike; impl Chain for PolkadotLike { - type BlockNumber = BlockNumber; type Hash = Hash; type Hasher = Hasher; - type Header = Header; - + type Block = Block; type AccountId = AccountId; type Balance = Balance; type Nonce = Nonce; diff --git a/bridges/primitives/relayers/Cargo.toml b/bridges/primitives/relayers/Cargo.toml index b84b0393adf..fd2c9e19f98 100644 --- a/bridges/primitives/relayers/Cargo.toml +++ b/bridges/primitives/relayers/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive", "bit-vec"] } -scale-info = { version = "2.6.0", default-features = false, features = ["bit-vec", "derive"] } +scale-info = { version = "2.9.0", default-features = false, features = ["bit-vec", "derive"] } # Bridge Dependencies diff --git a/bridges/primitives/runtime/Cargo.toml b/bridges/primitives/runtime/Cargo.toml index 3e6a30a061c..dea3c979b86 100644 --- a/bridges/primitives/runtime/Cargo.toml +++ b/bridges/primitives/runtime/Cargo.toml @@ -11,7 +11,7 @@ codec = { package = "parity-scale-codec", version = "3.1.5", default-features = hash-db = { version = "0.16.0", default-features = false } impl-trait-for-tuples = "0.2.2" num-traits = { version = "0.2", default-features = false } -scale-info = { version = "2.6.0", default-features = false, features = ["derive", "serde"] } +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } serde = { version = "1.0", default-features = false, features = ["alloc", "derive"] } # Substrate Dependencies diff --git a/bridges/primitives/runtime/src/chain.rs b/bridges/primitives/runtime/src/chain.rs index 2f810b19f57..fa0d82311e3 100644 --- a/bridges/primitives/runtime/src/chain.rs +++ b/bridges/primitives/runtime/src/chain.rs @@ -14,18 +14,18 @@ // You should have received a copy of the GNU General Public License // along with Parity Bridges Common. If not, see . -use crate::HeaderIdProvider; use codec::{Decode, Encode, MaxEncodedLen}; use frame_support::{weights::Weight, Parameter}; -use num_traits::{AsPrimitive, Bounded, CheckedSub, Saturating, SaturatingAdd, Zero}; +use num_traits::{Bounded, CheckedSub, SaturatingAdd, Zero}; use sp_runtime::{ traits::{ - AtLeast32Bit, AtLeast32BitUnsigned, Hash as HashT, Header as HeaderT, MaybeDisplay, - MaybeSerialize, MaybeSerializeDeserialize, Member, SimpleBitOps, Verify, + AtLeast32Bit, AtLeast32BitUnsigned, Block as BlockT, Hash as HashT, Header as HeaderT, + HeaderProvider, MaybeDisplay, MaybeSerialize, MaybeSerializeDeserialize, Member, + SimpleBitOps, Verify, }, FixedPointOperand, }; -use sp_std::{convert::TryFrom, fmt::Debug, hash::Hash, str::FromStr, vec, vec::Vec}; +use sp_std::{convert::TryFrom, fmt::Debug, hash::Hash, vec, vec::Vec}; /// Chain call, that is either SCALE-encoded, or decoded. #[derive(Debug, Clone, PartialEq)] @@ -91,27 +91,6 @@ impl Encode for EncodedOrDecodedCall { /// Minimal Substrate-based chain representation that may be used from no_std environment. pub trait Chain: Send + Sync + 'static { - /// A type that fulfills the abstract idea of what a Substrate block number is. - // Constraits come from the associated Number type of `sp_runtime::traits::Header` - // See here for more info: - // https://crates.parity.io/sp_runtime/traits/trait.Header.html#associatedtype.Number - // - // Note that the `AsPrimitive` trait is required by the GRANDPA justification - // verifier, and is not usually part of a Substrate Header's Number type. - type BlockNumber: Parameter - + Member - + MaybeSerializeDeserialize - + Hash - + Copy - + Default - + MaybeDisplay - + AtLeast32BitUnsigned - + FromStr - + AsPrimitive - + Default - + Saturating - + MaxEncodedLen; - /// A type that fulfills the abstract idea of what a Substrate hash is. // Constraits come from the associated Hash type of `sp_runtime::traits::Header` // See here for more info: @@ -136,13 +115,10 @@ pub trait Chain: Send + Sync + 'static { // https://crates.parity.io/sp_runtime/traits/trait.Header.html#associatedtype.Hashing type Hasher: HashT; - /// A type that fulfills the abstract idea of what a Substrate header is. + /// A type that fulfills the abstract idea of what a Substrate block is. // See here for more info: - // https://crates.parity.io/sp_runtime/traits/trait.Header.html - type Header: Parameter - + HeaderT - + HeaderIdProvider - + MaybeSerializeDeserialize; + // https://crates.parity.io/sp_runtime/traits/trait.Block.html + type Block: Parameter + BlockT + MaybeSerialize; /// The user account identifier type for the runtime. type AccountId: Parameter @@ -200,10 +176,9 @@ impl Chain for T where T: Send + Sync + 'static + UnderlyingChainProvider, { - type BlockNumber = ::BlockNumber; type Hash = ::Hash; type Hasher = ::Hasher; - type Header = ::Header; + type Block = ::Block; type AccountId = ::AccountId; type Balance = ::Balance; type Nonce = ::Nonce; @@ -244,7 +219,7 @@ impl frame_support::traits::Get for ParachainIdOf { pub type UnderlyingChainOf = ::Chain; /// Block number used by the chain. -pub type BlockNumberOf = ::BlockNumber; +pub type BlockNumberOf = <<::Block as HeaderProvider>::HeaderT as HeaderT>::Number; /// Hash type used by the chain. pub type HashOf = ::Hash; @@ -253,7 +228,7 @@ pub type HashOf = ::Hash; pub type HasherOf = ::Hasher; /// Header type used by the chain. -pub type HeaderOf = ::Header; +pub type HeaderOf = <::Block as HeaderProvider>::HeaderT; /// Account id type used by the chain. pub type AccountIdOf = ::AccountId; diff --git a/bridges/primitives/runtime/src/messages.rs b/bridges/primitives/runtime/src/messages.rs index 9f7c8ab5ca4..d3085829578 100644 --- a/bridges/primitives/runtime/src/messages.rs +++ b/bridges/primitives/runtime/src/messages.rs @@ -26,8 +26,8 @@ pub struct MessageDispatchResult { /// Unspent dispatch weight. This weight that will be deducted from total delivery transaction /// weight, thus reducing the transaction cost. This shall not be zero in (at least) two cases: /// - /// 1) if message has been dispatched successfully, but post-dispatch weight is less than - /// the weight, declared by the message sender; + /// 1) if message has been dispatched successfully, but post-dispatch weight is less than the + /// weight, declared by the message sender; /// 2) if message has not been dispatched at all. pub unspent_weight: Weight, /// Fine-grained result of single message dispatch (for better diagnostic purposes) diff --git a/client/cli/Cargo.toml b/client/cli/Cargo.toml index 9fd619f802b..a2ca4a2fd4f 100644 --- a/client/cli/Cargo.toml +++ b/client/cli/Cargo.toml @@ -5,12 +5,13 @@ authors = ["Parity Technologies "] edition = "2021" [dependencies] -clap = { version = "4.3.6", features = ["derive"] } +clap = { version = "4.3.11", features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.0.0" } url = "2.4.0" # Substrate sc-cli = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-service = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/client/cli/src/lib.rs b/client/cli/src/lib.rs index d77db6baedf..ad173197b89 100644 --- a/client/cli/src/lib.rs +++ b/client/cli/src/lib.rs @@ -27,6 +27,7 @@ use std::{ use codec::Encode; use sc_chain_spec::ChainSpec; +use sc_client_api::ExecutorProvider; use sc_service::{ config::{PrometheusConfig, TelemetryEndpoints}, BasePath, TransactionPoolOptions, @@ -149,9 +150,14 @@ impl ExportGenesisStateCommand { pub fn run( &self, chain_spec: &dyn ChainSpec, - genesis_state_version: StateVersion, + client: &impl ExecutorProvider, ) -> sc_cli::Result<()> { - let block: Block = generate_genesis_block(chain_spec, genesis_state_version)?; + let state_version = sc_chain_spec::resolve_state_version_from_wasm( + &chain_spec.build_storage()?, + client.executor(), + )?; + + let block: Block = generate_genesis_block(chain_spec, state_version)?; let raw_header = block.header().encode(); let output_buf = if self.raw { raw_header diff --git a/client/collator/src/service.rs b/client/collator/src/service.rs index 7724b0a68a6..3125fea4248 100644 --- a/client/collator/src/service.rs +++ b/client/collator/src/service.rs @@ -58,12 +58,18 @@ pub trait ServiceInterface { candidate: ParachainCandidate, ) -> Option<(Collation, ParachainBlockData)>; - /// Inform networking systems that the block should be announced after an appropriate - /// signal has been received. This returns the sending half of the signal. + /// Inform networking systems that the block should be announced after a signal has + /// been received to indicate the block has been seconded by a relay-chain validator. + /// + /// This sets up the barrier and returns the sending side of a channel, for the signal + /// to be passed through. fn announce_with_barrier( &self, block_hash: Block::Hash, ) -> oneshot::Sender; + + /// Directly announce a block on the network. + fn announce_block(&self, block_hash: Block::Hash, data: Option>); } /// The [`CollatorService`] provides common utilities for parachain consensus and authoring. @@ -74,6 +80,7 @@ pub trait ServiceInterface { pub struct CollatorService { block_status: Arc, wait_to_announce: Arc>>, + announce_block: Arc>) + Send + Sync>, runtime_api: Arc, } @@ -82,6 +89,7 @@ impl Clone for CollatorService { Self { block_status: self.block_status.clone(), wait_to_announce: self.wait_to_announce.clone(), + announce_block: self.announce_block.clone(), runtime_api: self.runtime_api.clone(), } } @@ -101,9 +109,10 @@ where announce_block: Arc>) + Send + Sync>, runtime_api: Arc, ) -> Self { - let wait_to_announce = Arc::new(Mutex::new(WaitToAnnounce::new(spawner, announce_block))); + let wait_to_announce = + Arc::new(Mutex::new(WaitToAnnounce::new(spawner, announce_block.clone()))); - Self { block_status, wait_to_announce, runtime_api } + Self { block_status, wait_to_announce, announce_block, runtime_api } } /// Checks the status of the given block hash in the Parachain. @@ -315,4 +324,8 @@ where ) -> oneshot::Sender { CollatorService::announce_with_barrier(self, block_hash) } + + fn announce_block(&self, block_hash: Block::Hash, data: Option>) { + (self.announce_block)(block_hash, data) + } } diff --git a/client/consensus/aura/Cargo.toml b/client/consensus/aura/Cargo.toml index 114e2ebed5b..c18ff8d5b0c 100644 --- a/client/consensus/aura/Cargo.toml +++ b/client/consensus/aura/Cargo.toml @@ -6,15 +6,17 @@ authors = ["Parity Technologies "] edition = "2021" [dependencies] -async-trait = "0.1.68" +async-trait = "0.1.71" codec = { package = "parity-scale-codec", version = "3.0.0", features = [ "derive" ] } futures = "0.3.28" tracing = "0.1.37" +lru = "0.10.0" # Substrate sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-consensus-slots = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" } @@ -35,6 +37,7 @@ substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate cumulus-client-consensus-common = { path = "../common" } cumulus-relay-chain-interface = { path = "../../relay-chain-interface" } cumulus-client-consensus-proposer = { path = "../proposer" } +cumulus-primitives-aura = { path = "../../../primitives/aura" } cumulus-primitives-core = { path = "../../../primitives/core" } cumulus-primitives-parachain-inherent = { path = "../../../primitives/parachain-inherent" } cumulus-client-collator = { path = "../../collator" } diff --git a/client/consensus/aura/src/collator.rs b/client/consensus/aura/src/collator.rs new file mode 100644 index 00000000000..aa990ae6d3a --- /dev/null +++ b/client/consensus/aura/src/collator.rs @@ -0,0 +1,363 @@ +// Copyright 2023 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 . + +//! The core collator logic for Aura - slot claiming, block proposing, and collation +//! packaging. +//! +//! The [`Collator`] struct exposed here is meant to be a component of higher-level logic +//! which actually manages the control flow of the collator - which slots to claim, how +//! many collations to build, when to work, etc. +//! +//! This module also exposes some standalone functions for common operations when building +//! aura-based collators. + +use codec::{Decode, Encode}; +use cumulus_client_collator::service::ServiceInterface as CollatorServiceInterface; +use cumulus_client_consensus_common::{ + self as consensus_common, ParachainBlockImportMarker, ParachainCandidate, +}; +use cumulus_client_consensus_proposer::ProposerInterface; +use cumulus_primitives_core::{ + relay_chain::Hash as PHash, DigestItem, ParachainBlockData, PersistedValidationData, +}; +use cumulus_primitives_parachain_inherent::ParachainInherentData; +use cumulus_relay_chain_interface::RelayChainInterface; + +use polkadot_node_primitives::{Collation, MaybeCompressedPoV}; +use polkadot_primitives::{Header as PHeader, Id as ParaId}; + +use futures::prelude::*; +use sc_consensus::{BlockImport, BlockImportParams, ForkChoiceStrategy, StateAction}; +use sc_consensus_aura::standalone as aura_internal; +use sp_api::ProvideRuntimeApi; +use sp_application_crypto::AppPublic; +use sp_consensus::BlockOrigin; +use sp_consensus_aura::{AuraApi, Slot, SlotDuration}; +use sp_core::crypto::Pair; +use sp_inherents::{CreateInherentDataProviders, InherentData, InherentDataProvider}; +use sp_keystore::KeystorePtr; +use sp_runtime::{ + generic::Digest, + traits::{Block as BlockT, HashFor, Header as HeaderT, Member}, +}; +use sp_state_machine::StorageChanges; +use sp_timestamp::Timestamp; +use std::{convert::TryFrom, error::Error, hash::Hash, sync::Arc, time::Duration}; + +/// Parameters for instantiating a [`Collator`]. +pub struct Params { + /// A builder for inherent data builders. + pub create_inherent_data_providers: CIDP, + /// The block import handle. + pub block_import: BI, + /// An interface to the relay-chain client. + pub relay_client: Arc, + /// The keystore handle used for accessing parachain key material. + pub keystore: KeystorePtr, + /// The identifier of the parachain within the relay-chain. + pub para_id: ParaId, + /// The block proposer used for building blocks. + pub proposer: Proposer, + /// The collator service used for bundling proposals into collations and announcing + /// to the network. + pub collator_service: CS, +} + +/// A utility struct for writing collation logic that makes use of Aura entirely +/// or in part. See module docs for more details. +pub struct Collator { + create_inherent_data_providers: CIDP, + block_import: BI, + relay_client: Arc, + keystore: KeystorePtr, + para_id: ParaId, + proposer: Proposer, + collator_service: CS, + _marker: std::marker::PhantomData<(Block, P)>, +} + +impl Collator +where + Block: BlockT, + RClient: RelayChainInterface, + CIDP: CreateInherentDataProviders + 'static, + BI: BlockImport + ParachainBlockImportMarker + Send + Sync + 'static, + Proposer: ProposerInterface, + Proposer::Transaction: Sync, + CS: CollatorServiceInterface, + P: Pair + Send + Sync, + P::Public: AppPublic + Hash + Member + Encode + Decode, + P::Signature: TryFrom> + Hash + Member + Encode + Decode, +{ + /// Instantiate a new instance of the `Aura` manager. + pub fn new(params: Params) -> Self { + Collator { + create_inherent_data_providers: params.create_inherent_data_providers, + block_import: params.block_import, + relay_client: params.relay_client, + keystore: params.keystore, + para_id: params.para_id, + proposer: params.proposer, + collator_service: params.collator_service, + _marker: std::marker::PhantomData, + } + } + + /// Explicitly creates the inherent data for parachain block authoring and overrides + /// the timestamp inherent data with the one provided, if any. + pub async fn create_inherent_data( + &self, + relay_parent: PHash, + validation_data: &PersistedValidationData, + parent_hash: Block::Hash, + timestamp: impl Into>, + ) -> Result<(ParachainInherentData, InherentData), Box> { + let paras_inherent_data = ParachainInherentData::create_at( + relay_parent, + &self.relay_client, + validation_data, + self.para_id, + ) + .await; + + let paras_inherent_data = match paras_inherent_data { + Some(p) => p, + None => + return Err( + format!("Could not create paras inherent data at {:?}", relay_parent).into() + ), + }; + + let mut other_inherent_data = self + .create_inherent_data_providers + .create_inherent_data_providers(parent_hash, ()) + .map_err(|e| e as Box) + .await? + .create_inherent_data() + .await + .map_err(Box::new)?; + + if let Some(timestamp) = timestamp.into() { + other_inherent_data.replace_data(sp_timestamp::INHERENT_IDENTIFIER, ×tamp); + } + + Ok((paras_inherent_data, other_inherent_data)) + } + + /// Propose, seal, and import a block, packaging it into a collation. + /// + /// Provide the slot to build at as well as any other necessary pre-digest logs, + /// the inherent data, and the proposal duration and PoV size limits. + /// + /// The Aura pre-digest should not be explicitly provided and is set internally. + /// + /// This does not announce the collation to the parachain network or the relay chain. + pub async fn collate( + &mut self, + parent_header: &Block::Header, + slot_claim: &SlotClaim, + additional_pre_digest: impl Into>>, + inherent_data: (ParachainInherentData, InherentData), + proposal_duration: Duration, + max_pov_size: usize, + ) -> Result<(Collation, ParachainBlockData, Block::Hash), Box> { + let mut digest = additional_pre_digest.into().unwrap_or_default(); + digest.push(slot_claim.pre_digest.clone()); + + let proposal = self + .proposer + .propose( + &parent_header, + &inherent_data.0, + inherent_data.1, + Digest { logs: digest }, + proposal_duration, + Some(max_pov_size), + ) + .await + .map_err(|e| Box::new(e))?; + + let sealed_importable = seal::<_, _, P>( + proposal.block, + proposal.storage_changes, + &slot_claim.author_pub, + &self.keystore, + )?; + + let post_hash = sealed_importable.post_hash(); + let block = Block::new( + sealed_importable.post_header(), + sealed_importable + .body + .as_ref() + .expect("body always created with this `propose` fn; qed") + .clone(), + ); + + self.block_import.import_block(sealed_importable).await?; + + if let Some((collation, block_data)) = self.collator_service.build_collation( + parent_header, + post_hash, + ParachainCandidate { block, proof: proposal.proof }, + ) { + tracing::info!( + target: crate::LOG_TARGET, + "PoV size {{ header: {}kb, extrinsics: {}kb, storage_proof: {}kb }}", + block_data.header().encode().len() as f64 / 1024f64, + block_data.extrinsics().encode().len() as f64 / 1024f64, + block_data.storage_proof().encode().len() as f64 / 1024f64, + ); + + if let MaybeCompressedPoV::Compressed(ref pov) = collation.proof_of_validity { + tracing::info!( + target: crate::LOG_TARGET, + "Compressed PoV size: {}kb", + pov.block_data.0.len() as f64 / 1024f64, + ); + } + + Ok((collation, block_data, post_hash)) + } else { + Err("Unable to produce collation".to_string().into()) + } + } + + /// Get the underlying collator service. + pub fn collator_service(&self) -> &CS { + &self.collator_service + } +} + +/// A claim on an Aura slot. +pub struct SlotClaim { + author_pub: Pub, + pre_digest: DigestItem, + timestamp: Timestamp, +} + +impl SlotClaim { + /// Create a slot-claim from the given author public key, slot, and timestamp. + /// + /// This does not check whether the author actually owns the slot or the timestamp + /// falls within the slot. + pub fn unchecked

(author_pub: Pub, slot: Slot, timestamp: Timestamp) -> Self + where + P: Pair, + P::Public: Encode + Decode, + P::Signature: Encode + Decode, + { + SlotClaim { author_pub, timestamp, pre_digest: aura_internal::pre_digest::

(slot) } + } + + /// Get the author's public key. + pub fn author_pub(&self) -> &Pub { + &self.author_pub + } + + /// Get the Aura pre-digest for this slot. + pub fn pre_digest(&self) -> &DigestItem { + &self.pre_digest + } + + /// Get the timestamp corresponding to the relay-chain slot this claim was + /// generated against. + pub fn timestamp(&self) -> Timestamp { + self.timestamp + } +} + +/// Attempt to claim a slot derived from the given relay-parent header's slot. +pub async fn claim_slot( + client: &C, + parent_hash: B::Hash, + relay_parent_header: &PHeader, + slot_duration: SlotDuration, + relay_chain_slot_duration: SlotDuration, + keystore: &KeystorePtr, +) -> Result>, Box> +where + B: BlockT, + C: ProvideRuntimeApi + Send + Sync + 'static, + C::Api: AuraApi, + P: Pair, + P::Public: Encode + Decode, + P::Signature: Encode + Decode, +{ + // load authorities + let authorities = client.runtime_api().authorities(parent_hash).map_err(Box::new)?; + + // Determine the current slot and timestamp based on the relay-parent's. + let (slot_now, timestamp) = match consensus_common::relay_slot_and_timestamp( + relay_parent_header, + relay_chain_slot_duration, + ) { + Some((_, t)) => (Slot::from_timestamp(t, slot_duration), t), + None => return Ok(None), + }; + + // Try to claim the slot locally. + let author_pub = { + let res = aura_internal::claim_slot::

(slot_now, &authorities, keystore).await; + match res { + Some(p) => p, + None => return Ok(None), + } + }; + + Ok(Some(SlotClaim::unchecked::

(author_pub, slot_now, timestamp))) +} + +/// Seal a block with a signature in the header. +pub fn seal( + pre_sealed: B, + storage_changes: StorageChanges>, + author_pub: &P::Public, + keystore: &KeystorePtr, +) -> Result, Box> +where + P: Pair, + P::Signature: Encode + Decode + TryFrom>, + P::Public: AppPublic, +{ + let (pre_header, body) = pre_sealed.deconstruct(); + let pre_hash = pre_header.hash(); + let block_number = *pre_header.number(); + + // seal the block. + let block_import_params = { + let seal_digest = + aura_internal::seal::<_, P>(&pre_hash, &author_pub, keystore).map_err(Box::new)?; + let mut block_import_params = BlockImportParams::new(BlockOrigin::Own, pre_header); + block_import_params.post_digests.push(seal_digest); + block_import_params.body = Some(body.clone()); + block_import_params.state_action = + StateAction::ApplyChanges(sc_consensus::StorageChanges::Changes(storage_changes)); + block_import_params.fork_choice = Some(ForkChoiceStrategy::LongestChain); + block_import_params + }; + let post_hash = block_import_params.post_hash(); + + tracing::info!( + target: crate::LOG_TARGET, + "🔖 Pre-sealed block for proposal at {}. Hash now {:?}, previously {:?}.", + block_number, + post_hash, + pre_hash, + ); + + Ok(block_import_params) +} diff --git a/client/consensus/aura/src/collators/basic.rs b/client/consensus/aura/src/collators/basic.rs new file mode 100644 index 00000000000..e0ba76ac075 --- /dev/null +++ b/client/consensus/aura/src/collators/basic.rs @@ -0,0 +1,200 @@ +// Copyright 2023 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 . + +//! This provides the option to run a basic relay-chain driven Aura implementation. +//! +//! This collator only builds on top of the most recently included block, limiting the +//! block time to a maximum of two times the relay-chain block time, and requiring the +//! block to be built and distributed to validators between two relay-chain blocks. +//! +//! For more information about AuRa, the Substrate crate should be checked. + +use codec::{Decode, Encode}; +use cumulus_client_collator::service::ServiceInterface as CollatorServiceInterface; +use cumulus_client_consensus_common::ParachainBlockImportMarker; +use cumulus_client_consensus_proposer::ProposerInterface; +use cumulus_primitives_core::{relay_chain::BlockId as RBlockId, CollectCollationInfo}; +use cumulus_relay_chain_interface::RelayChainInterface; + +use polkadot_node_primitives::CollationResult; +use polkadot_overseer::Handle as OverseerHandle; +use polkadot_primitives::{CollatorPair, Id as ParaId}; + +use futures::prelude::*; +use sc_client_api::{backend::AuxStore, BlockBackend, BlockOf}; +use sc_consensus::BlockImport; +use sp_api::ProvideRuntimeApi; +use sp_application_crypto::AppPublic; +use sp_blockchain::HeaderBackend; +use sp_consensus::SyncOracle; +use sp_consensus_aura::{AuraApi, SlotDuration}; +use sp_core::crypto::Pair; +use sp_inherents::CreateInherentDataProviders; +use sp_keystore::KeystorePtr; +use sp_runtime::traits::{Block as BlockT, Header as HeaderT, Member}; +use std::{convert::TryFrom, hash::Hash, sync::Arc, time::Duration}; + +use crate::collator as collator_util; + +/// Parameters for [`run`]. +pub struct Params { + pub create_inherent_data_providers: CIDP, + pub block_import: BI, + pub para_client: Arc, + pub relay_client: Arc, + pub sync_oracle: SO, + pub keystore: KeystorePtr, + pub key: CollatorPair, + pub para_id: ParaId, + pub overseer_handle: OverseerHandle, + pub slot_duration: SlotDuration, + pub relay_chain_slot_duration: SlotDuration, + pub proposer: Proposer, + pub collator_service: CS, +} + +/// Run bare Aura consensus as a relay-chain-driven collator. +pub async fn run( + params: Params, +) where + Block: BlockT, + Client: ProvideRuntimeApi + + BlockOf + + AuxStore + + HeaderBackend + + BlockBackend + + Send + + Sync + + 'static, + Client::Api: AuraApi + CollectCollationInfo, + RClient: RelayChainInterface, + CIDP: CreateInherentDataProviders + 'static, + BI: BlockImport + ParachainBlockImportMarker + Send + Sync + 'static, + SO: SyncOracle + Send + Sync + Clone + 'static, + Proposer: ProposerInterface, + Proposer::Transaction: Sync, + CS: CollatorServiceInterface, + P: Pair + Send + Sync, + P::Public: AppPublic + Hash + Member + Encode + Decode, + P::Signature: TryFrom> + Hash + Member + Encode + Decode, +{ + let mut collation_requests = cumulus_client_collator::relay_chain_driven::init( + params.key, + params.para_id, + params.overseer_handle, + ) + .await; + + let mut collator = { + let params = collator_util::Params { + create_inherent_data_providers: params.create_inherent_data_providers, + block_import: params.block_import, + relay_client: params.relay_client.clone(), + keystore: params.keystore.clone(), + para_id: params.para_id, + proposer: params.proposer, + collator_service: params.collator_service, + }; + + collator_util::Collator::::new(params) + }; + + while let Some(request) = collation_requests.next().await { + macro_rules! reject_with_error { + ($err:expr) => {{ + request.complete(None); + tracing::error!(target: crate::LOG_TARGET, err = ?{ $err }); + continue; + }}; + } + + macro_rules! try_request { + ($x:expr) => {{ + match $x { + Ok(x) => x, + Err(e) => reject_with_error!(e), + } + }}; + } + + let validation_data = request.persisted_validation_data(); + + let parent_header = + try_request!(Block::Header::decode(&mut &validation_data.parent_head.0[..])); + + let parent_hash = parent_header.hash(); + + if !collator.collator_service().check_block_status(parent_hash, &parent_header) { + continue + } + + let relay_parent_header = + match params.relay_client.header(RBlockId::hash(*request.relay_parent())).await { + Err(e) => reject_with_error!(e), + Ok(None) => continue, // sanity: would be inconsistent to get `None` here + Ok(Some(h)) => h, + }; + + let claim = match collator_util::claim_slot::<_, _, P>( + &*params.para_client, + parent_hash, + &relay_parent_header, + params.slot_duration, + params.relay_chain_slot_duration, + ¶ms.keystore, + ) + .await + { + Ok(None) => continue, + Ok(Some(c)) => c, + Err(e) => reject_with_error!(e), + }; + + let (parachain_inherent_data, other_inherent_data) = try_request!( + collator + .create_inherent_data( + *request.relay_parent(), + &validation_data, + parent_hash, + claim.timestamp(), + ) + .await + ); + + let (collation, _, post_hash) = try_request!( + collator + .collate( + &parent_header, + &claim, + None, + (parachain_inherent_data, other_inherent_data), + // TODO [https://github.com/paritytech/cumulus/issues/2439] + // We should call out to a pluggable interface that provides + // the proposal duration. + Duration::from_millis(500), + // Set the block limit to 50% of the maximum PoV size. + // + // TODO: If we got benchmarking that includes the proof size, + // we should be able to use the maximum pov size. + (validation_data.max_pov_size / 2) as usize, + ) + .await + ); + + let result_sender = Some(collator.collator_service().announce_with_barrier(post_hash)); + request.complete(Some(CollationResult { collation, result_sender })); + } +} diff --git a/client/consensus/aura/src/collators/lookahead.rs b/client/consensus/aura/src/collators/lookahead.rs new file mode 100644 index 00000000000..50fdb8b34ba --- /dev/null +++ b/client/consensus/aura/src/collators/lookahead.rs @@ -0,0 +1,346 @@ +// Copyright 2023 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 . + +//! A collator for Aura that looks ahead of the most recently included parachain block +//! when determining what to build upon. +//! +//! This collator also builds additional blocks when the maximum backlog is not saturated. +//! The size of the backlog is determined by invoking a runtime API. If that runtime API +//! is not supported, this assumes a maximum backlog size of 1. +//! +//! This takes more advantage of asynchronous backing, though not complete advantage. +//! When the backlog is not saturated, this approach lets the backlog temporarily 'catch up' +//! with periods of higher throughput. When the backlog is saturated, we typically +//! fall back to the limited cadence of a single parachain block per relay-chain block. +//! +//! Despite this, the fact that there is a backlog at all allows us to spend more time +//! building the block, as there is some buffer before it can get posted to the relay-chain. +//! The main limitation is block propagation time - i.e. the new blocks created by an author +//! must be propagated to the next author before their turn. + +use codec::{Decode, Encode}; +use cumulus_client_collator::service::ServiceInterface as CollatorServiceInterface; +use cumulus_client_consensus_common::{ + self as consensus_common, ParachainBlockImportMarker, ParentSearchParams, +}; +use cumulus_client_consensus_proposer::ProposerInterface; +use cumulus_primitives_aura::AuraUnincludedSegmentApi; +use cumulus_primitives_core::{ + relay_chain::Hash as PHash, CollectCollationInfo, PersistedValidationData, +}; +use cumulus_relay_chain_interface::RelayChainInterface; + +use polkadot_overseer::Handle as OverseerHandle; +use polkadot_primitives::{CollatorPair, Id as ParaId, OccupiedCoreAssumption}; + +use futures::prelude::*; +use sc_client_api::{backend::AuxStore, BlockBackend, BlockOf}; +use sc_consensus::BlockImport; +use sc_consensus_aura::standalone as aura_internal; +use sp_api::ProvideRuntimeApi; +use sp_application_crypto::AppPublic; +use sp_blockchain::HeaderBackend; +use sp_consensus::SyncOracle; +use sp_consensus_aura::{AuraApi, Slot, SlotDuration}; +use sp_core::crypto::Pair; +use sp_inherents::CreateInherentDataProviders; +use sp_keystore::KeystorePtr; +use sp_runtime::traits::{Block as BlockT, Header as HeaderT, Member}; +use sp_timestamp::Timestamp; +use std::{convert::TryFrom, hash::Hash, sync::Arc, time::Duration}; + +use crate::collator::{self as collator_util, SlotClaim}; + +/// Parameters for [`run`]. +pub struct Params { + pub create_inherent_data_providers: CIDP, + pub block_import: BI, + pub para_client: Arc, + pub para_backend: Arc, + pub relay_client: Arc, + pub sync_oracle: SO, + pub keystore: KeystorePtr, + pub key: CollatorPair, + pub para_id: ParaId, + pub overseer_handle: OverseerHandle, + pub slot_duration: SlotDuration, + pub relay_chain_slot_duration: SlotDuration, + pub proposer: Proposer, + pub collator_service: CS, + pub authoring_duration: Duration, +} + +/// Run async-backing-friendly Aura. +pub async fn run( + params: Params, +) where + Block: BlockT, + Client: ProvideRuntimeApi + + BlockOf + + AuxStore + + HeaderBackend + + BlockBackend + + Send + + Sync + + 'static, + Client::Api: + AuraApi + CollectCollationInfo + AuraUnincludedSegmentApi, + Backend: sp_blockchain::Backend, + RClient: RelayChainInterface, + CIDP: CreateInherentDataProviders + 'static, + BI: BlockImport + ParachainBlockImportMarker + Send + Sync + 'static, + SO: SyncOracle + Send + Sync + Clone + 'static, + Proposer: ProposerInterface, + Proposer::Transaction: Sync, + CS: CollatorServiceInterface, + P: Pair + Send + Sync, + P::Public: AppPublic + Hash + Member + Encode + Decode, + P::Signature: TryFrom> + Hash + Member + Encode + Decode, +{ + // This is an arbitrary value which is likely guaranteed to exceed any reasonable + // limit, as it would correspond to 10 non-included blocks. + // + // Since we only search for parent blocks which have already been imported, + // we can guarantee that all imported blocks respect the unincluded segment + // rules specified by the parachain's runtime and thus will never be too deep. + const PARENT_SEARCH_DEPTH: usize = 10; + + let mut import_notifications = match params.relay_client.import_notification_stream().await { + Ok(s) => s, + Err(err) => { + tracing::error!( + target: crate::LOG_TARGET, + ?err, + "Failed to initialize consensus: no relay chain import notification stream" + ); + + return + }, + }; + + let mut collator = { + let params = collator_util::Params { + create_inherent_data_providers: params.create_inherent_data_providers, + block_import: params.block_import, + relay_client: params.relay_client.clone(), + keystore: params.keystore.clone(), + para_id: params.para_id, + proposer: params.proposer, + collator_service: params.collator_service, + }; + + collator_util::Collator::::new(params) + }; + + while let Some(relay_parent_header) = import_notifications.next().await { + let relay_parent = relay_parent_header.hash(); + + let max_pov_size = match params + .relay_client + .persisted_validation_data( + relay_parent, + params.para_id, + OccupiedCoreAssumption::Included, + ) + .await + { + Ok(None) => continue, + Ok(Some(pvd)) => pvd.max_pov_size, + Err(err) => { + tracing::error!(target: crate::LOG_TARGET, ?err, "Failed to gather information from relay-client"); + continue + }, + }; + + let (slot_now, timestamp) = match consensus_common::relay_slot_and_timestamp( + &relay_parent_header, + params.relay_chain_slot_duration, + ) { + None => continue, + Some((_, t)) => (Slot::from_timestamp(t, params.slot_duration), t), + }; + + let parent_search_params = ParentSearchParams { + relay_parent, + para_id: params.para_id, + ancestry_lookback: max_ancestry_lookback(relay_parent, ¶ms.relay_client).await, + max_depth: PARENT_SEARCH_DEPTH, + ignore_alternative_branches: true, + }; + + let potential_parents = cumulus_client_consensus_common::find_potential_parents::( + parent_search_params, + &*params.para_backend, + ¶ms.relay_client, + ) + .await; + + let mut potential_parents = match potential_parents { + Err(e) => { + tracing::error!( + target: crate::LOG_TARGET, + ?relay_parent, + err = ?e, + "Could not fetch potential parents to build upon" + ); + + continue + }, + Ok(x) => x, + }; + + let included_block = match potential_parents.iter().find(|x| x.depth == 0) { + None => continue, // also serves as an `is_empty` check. + Some(b) => b.hash, + }; + + let para_client = &*params.para_client; + let keystore = ¶ms.keystore; + let can_build_upon = |block_hash| { + can_build_upon::<_, _, P>( + slot_now, + timestamp, + block_hash, + included_block, + para_client, + &keystore, + ) + }; + + // Sort by depth, ascending, to choose the longest chain. + // + // If the longest chain has space, build upon that. Otherwise, don't + // build at all. + potential_parents.sort_by_key(|a| a.depth); + let initial_parent = match potential_parents.pop() { + None => continue, + Some(p) => p, + }; + + // Build in a loop until not allowed. Note that the authorities can change + // at any block, so we need to re-claim our slot every time. + let mut parent_hash = initial_parent.hash; + let mut parent_header = initial_parent.header; + loop { + let slot_claim = match can_build_upon(parent_hash).await { + None => break, + Some(c) => c, + }; + + let validation_data = PersistedValidationData { + parent_head: parent_header.encode().into(), + relay_parent_number: *relay_parent_header.number(), + relay_parent_storage_root: *relay_parent_header.state_root(), + max_pov_size, + }; + + // Build and announce collations recursively until + // `can_build_upon` fails or building a collation fails. + let (parachain_inherent_data, other_inherent_data) = match collator + .create_inherent_data( + relay_parent, + &validation_data, + parent_hash, + slot_claim.timestamp(), + ) + .await + { + Err(err) => { + tracing::error!(target: crate::LOG_TARGET, ?err); + break + }, + Ok(x) => x, + }; + + match collator + .collate( + &parent_header, + &slot_claim, + None, + (parachain_inherent_data, other_inherent_data), + params.authoring_duration, + // Set the block limit to 50% of the maximum PoV size. + // + // TODO: If we got benchmarking that includes the proof size, + // we should be able to use the maximum pov size. + (validation_data.max_pov_size / 2) as usize, + ) + .await + { + Ok((_collation, block_data, new_block_hash)) => { + parent_hash = new_block_hash; + parent_header = block_data.into_header(); + + // Here we are assuming that the import logic protects against equivocations + // and provides sybil-resistance, as it should. + collator.collator_service().announce_block(new_block_hash, None); + + // TODO [https://github.com/paritytech/polkadot/issues/5056]: + // announce collation to relay-chain validators. + }, + Err(err) => { + tracing::error!(target: crate::LOG_TARGET, ?err); + break + }, + } + } + } +} + +// Checks if we own the slot at the given block and whether there +// is space in the unincluded segment. +async fn can_build_upon( + slot: Slot, + timestamp: Timestamp, + parent_hash: Block::Hash, + included_block: Block::Hash, + client: &Client, + keystore: &KeystorePtr, +) -> Option> +where + Client: ProvideRuntimeApi, + Client::Api: AuraApi + AuraUnincludedSegmentApi, + P: Pair, + P::Public: Encode + Decode, + P::Signature: Encode + Decode, +{ + let runtime_api = client.runtime_api(); + let authorities = runtime_api.authorities(parent_hash).ok()?; + let author_pub = aura_internal::claim_slot::

(slot, &authorities, keystore).await?; + + // Here we lean on the property that building on an empty unincluded segment must always + // be legal. Skipping the runtime API query here allows us to seamlessly run this + // collator against chains which have not yet upgraded their runtime. + if parent_hash != included_block { + runtime_api.can_build_upon(parent_hash, included_block, slot).ok()?; + } + + Some(SlotClaim::unchecked::

(author_pub, slot, timestamp)) +} + +async fn max_ancestry_lookback( + _relay_parent: PHash, + _relay_client: &impl RelayChainInterface, +) -> usize { + // TODO [https://github.com/paritytech/cumulus/issues/2706] + // We need to read the relay-chain state to know what the maximum + // age truly is, but that depends on those pallets existing. + // + // For now, just provide the conservative value of '2'. + // Overestimating can cause problems, as we'd be building on forks of the + // chain that can never get included. Underestimating is less of an issue. + 2 +} diff --git a/client/consensus/aura/src/collators/mod.rs b/client/consensus/aura/src/collators/mod.rs new file mode 100644 index 00000000000..55128dfdc85 --- /dev/null +++ b/client/consensus/aura/src/collators/mod.rs @@ -0,0 +1,24 @@ +// Copyright 2023 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 . + +//! Stock, pure Aura collators. +//! +//! This includes the [`basic`] collator, which only builds on top of the most recently +//! included parachain block, as well as the [`lookahead`] collator, which prospectively +//! builds on parachain blocks which have not yet been included in the relay chain. + +pub mod basic; +pub mod lookahead; diff --git a/client/consensus/aura/src/equivocation_import_queue.rs b/client/consensus/aura/src/equivocation_import_queue.rs new file mode 100644 index 00000000000..b39fa73117f --- /dev/null +++ b/client/consensus/aura/src/equivocation_import_queue.rs @@ -0,0 +1,249 @@ +// Copyright 2023 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 . + +/// An import queue which provides some equivocation resistance with lenient trait bounds. +/// +/// Equivocation resistance in general is a hard problem, as different nodes in the network +/// may see equivocations in a different order, and therefore may not agree on which blocks +/// should be thrown out and which ones should be kept. +use codec::{Decode, Encode}; +use cumulus_client_consensus_common::ParachainBlockImportMarker; +use lru::LruCache; + +use sc_consensus::{ + import_queue::{BasicQueue, Verifier as VerifierT}, + BlockImport, BlockImportParams, ForkChoiceStrategy, +}; +use sc_consensus_aura::standalone as aura_internal; +use sc_telemetry::{telemetry, TelemetryHandle, CONSENSUS_DEBUG, CONSENSUS_TRACE}; +use sp_api::ProvideRuntimeApi; +use sp_block_builder::BlockBuilder as BlockBuilderApi; +use sp_consensus::error::Error as ConsensusError; +use sp_consensus_aura::{AuraApi, Slot, SlotDuration}; +use sp_core::crypto::Pair; +use sp_inherents::{CreateInherentDataProviders, InherentDataProvider}; +use sp_runtime::traits::{Block as BlockT, Header as HeaderT}; +use std::{fmt::Debug, num::NonZeroUsize, sync::Arc}; + +const LRU_WINDOW: usize = 256; +const EQUIVOCATION_LIMIT: usize = 16; + +struct NaiveEquivocationDefender { + cache: LruCache, +} + +impl Default for NaiveEquivocationDefender { + fn default() -> Self { + NaiveEquivocationDefender { + cache: LruCache::new(NonZeroUsize::new(LRU_WINDOW).expect("window > 0; qed")), + } + } +} + +impl NaiveEquivocationDefender { + // return `true` if equivocation is beyond the limit. + fn insert_and_check(&mut self, slot: Slot) -> bool { + let val = self.cache.get_or_insert_mut(*slot, || 0); + if *val == EQUIVOCATION_LIMIT { + true + } else { + *val += 1; + false + } + } +} + +struct Verifier { + client: Arc, + create_inherent_data_providers: CIDP, + slot_duration: SlotDuration, + defender: NaiveEquivocationDefender, + telemetry: Option, + _marker: std::marker::PhantomData<(Block, P)>, +} + +#[async_trait::async_trait] +impl VerifierT for Verifier +where + P: Pair, + P::Signature: Encode + Decode, + P::Public: Encode + Decode + PartialEq + Clone + Debug, + Block: BlockT, + Client: ProvideRuntimeApi + Send + Sync, + >::Api: BlockBuilderApi + AuraApi, + + CIDP: CreateInherentDataProviders, +{ + async fn verify( + &mut self, + mut block_params: BlockImportParams, + ) -> Result, String> { + // Skip checks that include execution, if being told so, or when importing only state. + // + // This is done for example when gap syncing and it is expected that the block after the gap + // was checked/chosen properly, e.g. by warp syncing to this block using a finality proof. + if block_params.state_action.skip_execution_checks() || block_params.with_state() { + return Ok(block_params) + } + + let post_hash = block_params.header.hash(); + let parent_hash = *block_params.header.parent_hash(); + + // check seal and update pre-hash/post-hash + { + let authorities = aura_internal::fetch_authorities(self.client.as_ref(), parent_hash) + .map_err(|e| { + format!("Could not fetch authorities at {:?}: {}", parent_hash, e) + })?; + + let slot_now = slot_now(self.slot_duration); + let res = aura_internal::check_header_slot_and_seal::( + slot_now, + block_params.header, + &authorities, + ); + + match res { + Ok((pre_header, slot, seal_digest)) => { + telemetry!( + self.telemetry; + CONSENSUS_TRACE; + "aura.checked_and_importing"; + "pre_header" => ?pre_header, + ); + + block_params.header = pre_header; + block_params.post_digests.push(seal_digest); + block_params.fork_choice = Some(ForkChoiceStrategy::LongestChain); + block_params.post_hash = Some(post_hash); + + // Check for and reject egregious amounts of equivocations. + if self.defender.insert_and_check(slot) { + return Err(format!( + "Rejecting block {:?} due to excessive equivocations at slot", + post_hash, + )) + } + }, + Err(aura_internal::SealVerificationError::Deferred(hdr, slot)) => { + telemetry!( + self.telemetry; + CONSENSUS_DEBUG; + "aura.header_too_far_in_future"; + "hash" => ?post_hash, + "a" => ?hdr, + "b" => ?slot, + ); + + return Err(format!( + "Rejecting block ({:?}) from future slot {:?}", + post_hash, slot + )) + }, + Err(e) => + return Err(format!( + "Rejecting block ({:?}) with invalid seal ({:?})", + post_hash, e + )), + } + } + + // check inherents. + if let Some(body) = block_params.body.clone() { + let block = Block::new(block_params.header.clone(), body); + let create_inherent_data_providers = self + .create_inherent_data_providers + .create_inherent_data_providers(parent_hash, ()) + .await + .map_err(|e| format!("Could not create inherent data {:?}", e))?; + + let inherent_data = create_inherent_data_providers + .create_inherent_data() + .await + .map_err(|e| format!("Could not create inherent data {:?}", e))?; + + let inherent_res = self + .client + .runtime_api() + .check_inherents(parent_hash, block, inherent_data) + .map_err(|e| format!("Unable to check block inherents {:?}", e))?; + + if !inherent_res.ok() { + for (i, e) in inherent_res.into_errors() { + match create_inherent_data_providers.try_handle_error(&i, &e).await { + Some(res) => res.map_err(|e| format!("Inherent Error {:?}", e))?, + None => + return Err(format!( + "Unknown inherent error, source {:?}", + String::from_utf8_lossy(&i[..]) + )), + } + } + } + } + + Ok(block_params) + } +} + +fn slot_now(slot_duration: SlotDuration) -> Slot { + let timestamp = sp_timestamp::InherentDataProvider::from_system_time().timestamp(); + Slot::from_timestamp(timestamp, slot_duration) +} + +/// Start an import queue for a Cumulus node which checks blocks' seals and inherent data. +/// +/// Pass in only inherent data providers which don't include aura or parachain consensus inherents, +/// e.g. things like timestamp and custom inherents for the runtime. +/// +/// The others are generated explicitly internally. +/// +/// This should only be used for runtimes where the runtime does not check all inherents and +/// seals in `execute_block` (see ) +pub fn fully_verifying_import_queue( + client: Arc, + block_import: I, + create_inherent_data_providers: CIDP, + slot_duration: SlotDuration, + spawner: &impl sp_core::traits::SpawnEssentialNamed, + registry: Option<&substrate_prometheus_endpoint::Registry>, + telemetry: Option, +) -> BasicQueue +where + P: Pair, + P::Signature: Encode + Decode, + P::Public: Encode + Decode + PartialEq + Clone + Debug, + I: BlockImport + + ParachainBlockImportMarker + + Send + + Sync + + 'static, + I::Transaction: Send, + Client: ProvideRuntimeApi + Send + Sync + 'static, + >::Api: BlockBuilderApi + AuraApi, + CIDP: CreateInherentDataProviders + 'static, +{ + let verifier = Verifier:: { + client, + create_inherent_data_providers, + defender: NaiveEquivocationDefender::default(), + slot_duration, + telemetry, + _marker: std::marker::PhantomData, + }; + + BasicQueue::new(verifier, Box::new(block_import), None, spawner, registry) +} diff --git a/client/consensus/aura/src/lib.rs b/client/consensus/aura/src/lib.rs index 416ae776da1..51d54bf5714 100644 --- a/client/consensus/aura/src/lib.rs +++ b/client/consensus/aura/src/lib.rs @@ -50,7 +50,9 @@ pub use import_queue::{build_verifier, import_queue, BuildVerifierParams, Import pub use sc_consensus_aura::{slot_duration, AuraVerifier, BuildAuraWorkerParams, SlotProportion}; pub use sc_consensus_slots::InherentDataProviderExt; -pub mod unstable_reimpl; +pub mod collator; +pub mod collators; +pub mod equivocation_import_queue; const LOG_TARGET: &str = "aura::cumulus"; diff --git a/client/consensus/aura/src/unstable_reimpl.rs b/client/consensus/aura/src/unstable_reimpl.rs deleted file mode 100644 index f9602a363bf..00000000000 --- a/client/consensus/aura/src/unstable_reimpl.rs +++ /dev/null @@ -1,529 +0,0 @@ -// Copyright 2023 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 . - -//! The AuRa consensus algorithm for parachains. -//! -//! This extends the Substrate provided AuRa consensus implementation to make it compatible for -//! parachains. This provides the option to run a "bare" relay-chain driven Aura implementation, -//! but also exposes the core functionalities separately to be composed into more complex implementations. -//! -//! For more information about AuRa, the Substrate crate should be checked. - -use codec::{Decode, Encode}; -use cumulus_client_collator::service::ServiceInterface as CollatorServiceInterface; -use cumulus_client_consensus_common::{ParachainBlockImportMarker, ParachainCandidate}; -use cumulus_client_consensus_proposer::ProposerInterface; -use cumulus_primitives_core::{ - relay_chain::Hash as PHash, CollectCollationInfo, PersistedValidationData, -}; -use cumulus_primitives_parachain_inherent::ParachainInherentData; -use cumulus_relay_chain_interface::RelayChainInterface; - -use polkadot_node_primitives::{CollationResult, MaybeCompressedPoV}; -use polkadot_overseer::Handle as OverseerHandle; -use polkadot_primitives::{CollatorPair, Id as ParaId}; - -use futures::prelude::*; -use sc_client_api::{backend::AuxStore, BlockBackend, BlockOf}; -use sc_consensus::{ - import_queue::{BasicQueue, Verifier as VerifierT}, - BlockImport, BlockImportParams, ForkChoiceStrategy, StateAction, -}; -use sc_consensus_aura::standalone as aura_internal; -use sc_telemetry::{telemetry, TelemetryHandle, CONSENSUS_DEBUG, CONSENSUS_TRACE}; -use sp_api::ProvideRuntimeApi; -use sp_application_crypto::AppPublic; -use sp_block_builder::BlockBuilder as BlockBuilderApi; -use sp_blockchain::HeaderBackend; -use sp_consensus::{error::Error as ConsensusError, BlockOrigin, SyncOracle}; -use sp_consensus_aura::{AuraApi, Slot, SlotDuration}; -use sp_core::crypto::Pair; -use sp_inherents::{CreateInherentDataProviders, InherentData, InherentDataProvider}; -use sp_keystore::KeystorePtr; -use sp_runtime::{ - generic::Digest, - traits::{Block as BlockT, HashFor, Header as HeaderT, Member}, -}; -use sp_state_machine::StorageChanges; -use std::{convert::TryFrom, error::Error, fmt::Debug, hash::Hash, sync::Arc, time::Duration}; - -/// Parameters for [`run_bare_relay_driven`]. -pub struct Params { - pub create_inherent_data_providers: CIDP, - pub block_import: BI, - pub para_client: Arc, - pub relay_client: Arc, - pub sync_oracle: SO, - pub keystore: KeystorePtr, - pub key: CollatorPair, - pub para_id: ParaId, - pub overseer_handle: OverseerHandle, - pub slot_duration: SlotDuration, - pub proposer: Proposer, - pub collator_service: CS, -} - -/// Run bare Aura consensus as a relay-chain-driven collator. -pub async fn run_bare_relay_driven( - params: Params, -) where - Block: BlockT, - Client: ProvideRuntimeApi - + BlockOf - + AuxStore - + HeaderBackend - + BlockBackend - + Send - + Sync - + 'static, - Client::Api: AuraApi + CollectCollationInfo, - RClient: RelayChainInterface, - CIDP: CreateInherentDataProviders + 'static, - BI: BlockImport + ParachainBlockImportMarker + Send + Sync + 'static, - SO: SyncOracle + Send + Sync + Clone + 'static, - Proposer: ProposerInterface, - Proposer::Transaction: Sync, - CS: CollatorServiceInterface, - P: Pair + Send + Sync, - P::Public: AppPublic + Hash + Member + Encode + Decode, - P::Signature: TryFrom> + Hash + Member + Encode + Decode, -{ - let mut proposer = params.proposer; - let mut block_import = params.block_import; - - let mut collation_requests = cumulus_client_collator::relay_chain_driven::init( - params.key, - params.para_id, - params.overseer_handle, - ) - .await; - - while let Some(request) = collation_requests.next().await { - macro_rules! reject_with_error { - ($err:expr) => {{ - request.complete(None); - tracing::error!(target: crate::LOG_TARGET, err = ?{ $err }); - continue; - }}; - } - - let validation_data = request.persisted_validation_data(); - - let parent_header = match Block::Header::decode(&mut &validation_data.parent_head.0[..]) { - Ok(x) => x, - Err(e) => reject_with_error!(e), - }; - - let parent_hash = parent_header.hash(); - - if !params.collator_service.check_block_status(parent_hash, &parent_header) { - continue - } - - let claim = match claim_slot::<_, _, P>( - &*params.para_client, - parent_hash, - params.slot_duration, - ¶ms.keystore, - ) - .await - { - Ok(None) => continue, - Ok(Some(c)) => c, - Err(e) => reject_with_error!(e), - }; - - let (parachain_inherent_data, other_inherent_data) = match create_inherent_data( - *request.relay_parent(), - &validation_data, - parent_hash, - params.para_id, - ¶ms.relay_client, - ¶ms.create_inherent_data_providers, - ) - .await - { - Ok(x) => x, - Err(e) => reject_with_error!(e), - }; - - let proposal = match proposer - .propose( - &parent_header, - ¶chain_inherent_data, - other_inherent_data, - Digest { logs: vec![claim.pre_digest] }, - // TODO [https://github.com/paritytech/cumulus/issues/2439] - // We should call out to a pluggable interface that provides - // the proposal duration. - Duration::from_millis(500), - // Set the block limit to 50% of the maximum PoV size. - // - // TODO: If we got benchmarking that includes the proof size, - // we should be able to use the maximum pov size. - Some((validation_data.max_pov_size / 2) as usize), - ) - .await - { - Ok(p) => p, - Err(e) => reject_with_error!(e), - }; - - let sealed_importable = match seal::<_, _, P>( - proposal.block, - proposal.storage_changes, - &claim.author_pub, - ¶ms.keystore, - ) { - Ok(s) => s, - Err(e) => reject_with_error!(e), - }; - - let post_hash = sealed_importable.post_hash(); - let block = Block::new( - sealed_importable.post_header(), - sealed_importable - .body - .as_ref() - .expect("body always created with this `propose` fn; qed") - .clone(), - ); - - if let Err(e) = block_import.import_block(sealed_importable).await { - reject_with_error!(e); - } - - let response = if let Some((collation, b)) = params.collator_service.build_collation( - &parent_header, - post_hash, - ParachainCandidate { block, proof: proposal.proof }, - ) { - tracing::info!( - target: crate::LOG_TARGET, - "PoV size {{ header: {}kb, extrinsics: {}kb, storage_proof: {}kb }}", - b.header().encode().len() as f64 / 1024f64, - b.extrinsics().encode().len() as f64 / 1024f64, - b.storage_proof().encode().len() as f64 / 1024f64, - ); - - if let MaybeCompressedPoV::Compressed(ref pov) = collation.proof_of_validity { - tracing::info!( - target: crate::LOG_TARGET, - "Compressed PoV size: {}kb", - pov.block_data.0.len() as f64 / 1024f64, - ); - } - - let result_sender = params.collator_service.announce_with_barrier(post_hash); - Some(CollationResult { collation, result_sender: Some(result_sender) }) - } else { - None - }; - - request.complete(response); - } -} - -fn slot_now(slot_duration: SlotDuration) -> Slot { - let timestamp = sp_timestamp::InherentDataProvider::from_system_time().timestamp(); - Slot::from_timestamp(timestamp, slot_duration) -} - -/// A claim on an Aura slot. -struct SlotClaim { - author_pub: Pub, - pre_digest: sp_runtime::DigestItem, -} - -async fn claim_slot( - client: &C, - parent_hash: B::Hash, - slot_duration: SlotDuration, - keystore: &KeystorePtr, -) -> Result>, Box> -where - B: BlockT, - C: ProvideRuntimeApi + Send + Sync + 'static, - C::Api: AuraApi, - P: Pair, - P::Public: Encode + Decode, - P::Signature: Encode + Decode, -{ - // load authorities - let authorities = client.runtime_api().authorities(parent_hash).map_err(Box::new)?; - - // Determine the current slot. - let slot_now = slot_now(slot_duration); - - // Try to claim the slot locally. - let author_pub = { - let res = aura_internal::claim_slot::

(slot_now, &authorities, keystore).await; - match res { - Some(p) => p, - None => return Ok(None), - } - }; - - // Produce the pre-digest. - let pre_digest = aura_internal::pre_digest::

(slot_now); - - Ok(Some(SlotClaim { author_pub, pre_digest })) -} - -async fn create_inherent_data( - relay_parent: PHash, - validation_data: &PersistedValidationData, - parent_hash: B::Hash, - para_id: ParaId, - relay_chain_interface: &impl RelayChainInterface, - create_inherent_data_providers: &impl CreateInherentDataProviders, -) -> Result<(ParachainInherentData, InherentData), Box> { - let paras_inherent_data = ParachainInherentData::create_at( - relay_parent, - relay_chain_interface, - validation_data, - para_id, - ) - .await; - - let paras_inherent_data = match paras_inherent_data { - Some(p) => p, - None => - return Err(format!("Could not create paras inherent data at {:?}", relay_parent).into()), - }; - - let other_inherent_data = create_inherent_data_providers - .create_inherent_data_providers(parent_hash, ()) - .map_err(|e| e as Box) - .await? - .create_inherent_data() - .await - .map_err(Box::new)?; - - Ok((paras_inherent_data, other_inherent_data)) -} - -fn seal( - pre_sealed: B, - storage_changes: StorageChanges>, - author_pub: &P::Public, - keystore: &KeystorePtr, -) -> Result, Box> -where - P: Pair, - P::Signature: Encode + Decode + TryFrom>, - P::Public: AppPublic, -{ - let (pre_header, body) = pre_sealed.deconstruct(); - let pre_hash = pre_header.hash(); - let block_number = *pre_header.number(); - - // seal the block. - let block_import_params = { - let seal_digest = - aura_internal::seal::<_, P>(&pre_hash, &author_pub, keystore).map_err(Box::new)?; - let mut block_import_params = BlockImportParams::new(BlockOrigin::Own, pre_header); - block_import_params.post_digests.push(seal_digest); - block_import_params.body = Some(body.clone()); - block_import_params.state_action = - StateAction::ApplyChanges(sc_consensus::StorageChanges::Changes(storage_changes)); - block_import_params.fork_choice = Some(ForkChoiceStrategy::LongestChain); - block_import_params - }; - let post_hash = block_import_params.post_hash(); - - tracing::info!( - target: crate::LOG_TARGET, - "🔖 Pre-sealed block for proposal at {}. Hash now {:?}, previously {:?}.", - block_number, - post_hash, - pre_hash, - ); - - Ok(block_import_params) -} - -struct Verifier { - client: Arc, - create_inherent_data_providers: CIDP, - slot_duration: SlotDuration, - telemetry: Option, - _marker: std::marker::PhantomData<(Block, P)>, -} - -#[async_trait::async_trait] -impl VerifierT for Verifier -where - P: Pair, - P::Signature: Encode + Decode, - P::Public: Encode + Decode + PartialEq + Clone + Debug, - Block: BlockT, - Client: ProvideRuntimeApi + Send + Sync, - >::Api: BlockBuilderApi + AuraApi, - - CIDP: CreateInherentDataProviders, -{ - async fn verify( - &mut self, - mut block_params: BlockImportParams, - ) -> Result, String> { - // Skip checks that include execution, if being told so, or when importing only state. - // - // This is done for example when gap syncing and it is expected that the block after the gap - // was checked/chosen properly, e.g. by warp syncing to this block using a finality proof. - if block_params.state_action.skip_execution_checks() || block_params.with_state() { - return Ok(block_params) - } - - let post_hash = block_params.header.hash(); - let parent_hash = *block_params.header.parent_hash(); - - // check seal and update pre-hash/post-hash - { - let authorities = aura_internal::fetch_authorities(self.client.as_ref(), parent_hash) - .map_err(|e| { - format!("Could not fetch authorities at {:?}: {}", parent_hash, e) - })?; - - let slot_now = slot_now(self.slot_duration); - let res = aura_internal::check_header_slot_and_seal::( - slot_now, - block_params.header, - &authorities, - ); - - match res { - Ok((pre_header, _slot, seal_digest)) => { - telemetry!( - self.telemetry; - CONSENSUS_TRACE; - "aura.checked_and_importing"; - "pre_header" => ?pre_header, - ); - - block_params.header = pre_header; - block_params.post_digests.push(seal_digest); - block_params.fork_choice = Some(ForkChoiceStrategy::LongestChain); - block_params.post_hash = Some(post_hash); - }, - Err(aura_internal::SealVerificationError::Deferred(hdr, slot)) => { - telemetry!( - self.telemetry; - CONSENSUS_DEBUG; - "aura.header_too_far_in_future"; - "hash" => ?post_hash, - "a" => ?hdr, - "b" => ?slot, - ); - - return Err(format!( - "Rejecting block ({:?}) from future slot {:?}", - post_hash, slot - )) - }, - Err(e) => - return Err(format!( - "Rejecting block ({:?}) with invalid seal ({:?})", - post_hash, e - )), - } - } - - // check inherents. - if let Some(body) = block_params.body.clone() { - let block = Block::new(block_params.header.clone(), body); - let create_inherent_data_providers = self - .create_inherent_data_providers - .create_inherent_data_providers(parent_hash, ()) - .await - .map_err(|e| format!("Could not create inherent data {:?}", e))?; - - let inherent_data = create_inherent_data_providers - .create_inherent_data() - .await - .map_err(|e| format!("Could not create inherent data {:?}", e))?; - - let inherent_res = self - .client - .runtime_api() - .check_inherents_with_context( - parent_hash, - block_params.origin.into(), - block, - inherent_data, - ) - .map_err(|e| format!("Unable to check block inherents {:?}", e))?; - - if !inherent_res.ok() { - for (i, e) in inherent_res.into_errors() { - match create_inherent_data_providers.try_handle_error(&i, &e).await { - Some(res) => res.map_err(|e| format!("Inherent Error {:?}", e))?, - None => - return Err(format!( - "Unknown inherent error, source {:?}", - String::from_utf8_lossy(&i[..]) - )), - } - } - } - } - - Ok(block_params) - } -} - -/// Start an import queue for a Cumulus node which checks blocks' seals and inherent data. -/// -/// Pass in only inherent data providers which don't include aura or parachain consensus inherents, -/// e.g. things like timestamp and custom inherents for the runtime. -/// -/// The others are generated explicitly internally. -/// -/// This should only be used for runtimes where the runtime does not check all inherents and -/// seals in `execute_block` (see ) -pub fn fully_verifying_import_queue( - client: Arc, - block_import: I, - create_inherent_data_providers: CIDP, - slot_duration: SlotDuration, - spawner: &impl sp_core::traits::SpawnEssentialNamed, - registry: Option<&substrate_prometheus_endpoint::Registry>, - telemetry: Option, -) -> BasicQueue -where - P: Pair, - P::Signature: Encode + Decode, - P::Public: Encode + Decode + PartialEq + Clone + Debug, - I: BlockImport - + ParachainBlockImportMarker - + Send - + Sync - + 'static, - I::Transaction: Send, - Client: ProvideRuntimeApi + Send + Sync + 'static, - >::Api: BlockBuilderApi + AuraApi, - CIDP: CreateInherentDataProviders + 'static, -{ - let verifier = Verifier:: { - client, - create_inherent_data_providers, - slot_duration, - telemetry, - _marker: std::marker::PhantomData, - }; - - BasicQueue::new(verifier, Box::new(block_import), None, spawner, registry) -} diff --git a/client/consensus/common/Cargo.toml b/client/consensus/common/Cargo.toml index 9b5f9e4f1de..c6e48ca95bc 100644 --- a/client/consensus/common/Cargo.toml +++ b/client/consensus/common/Cargo.toml @@ -6,7 +6,7 @@ authors = ["Parity Technologies "] edition = "2021" [dependencies] -async-trait = "0.1.68" +async-trait = "0.1.71" codec = { package = "parity-scale-codec", version = "3.0.0", features = [ "derive" ] } dyn-clone = "1.0.11" futures = "0.3.28" @@ -16,10 +16,13 @@ tracing = "0.1.37" # Substrate sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-consensus-slots = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" } substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/client/consensus/common/src/lib.rs b/client/consensus/common/src/lib.rs index f3ef4a3023a..48ac4e96344 100644 --- a/client/consensus/common/src/lib.rs +++ b/client/consensus/common/src/lib.rs @@ -14,11 +14,22 @@ // You should have received a copy of the GNU General Public License // along with Cumulus. If not, see . -use polkadot_primitives::{Hash as PHash, PersistedValidationData}; +use codec::Decode; +use polkadot_primitives::{ + Block as PBlock, Hash as PHash, Header as PHeader, PersistedValidationData, +}; + +use cumulus_primitives_core::{ + relay_chain::{BlockId as RBlockId, OccupiedCoreAssumption}, + ParaId, +}; +use cumulus_relay_chain_interface::{RelayChainError, RelayChainInterface}; use sc_client_api::Backend; use sc_consensus::{shared_data::SharedData, BlockImport, ImportResult}; +use sp_consensus_slots::{Slot, SlotDuration}; use sp_runtime::traits::{Block as BlockT, Header as HeaderT}; +use sp_timestamp::Timestamp; use std::sync::Arc; @@ -181,3 +192,193 @@ where pub trait ParachainBlockImportMarker {} impl ParachainBlockImportMarker for ParachainBlockImport {} + +/// Parameters when searching for suitable parents to build on top of. +pub struct ParentSearchParams { + /// The relay-parent that is intended to be used. + pub relay_parent: PHash, + /// The ID of the parachain. + pub para_id: ParaId, + /// A limitation on the age of relay parents for parachain blocks that are being + /// considered. This is relative to the `relay_parent` number. + pub ancestry_lookback: usize, + /// How "deep" parents can be relative to the included parachain block at the relay-parent. + /// The included block has depth 0. + pub max_depth: usize, + /// Whether to only ignore "alternative" branches, i.e. branches of the chain + /// which do not contain the block pending availability. + pub ignore_alternative_branches: bool, +} + +/// A potential parent block returned from [`find_potential_parents`] +pub struct PotentialParent { + /// The hash of the block. + pub hash: B::Hash, + /// The header of the block. + pub header: B::Header, + /// The depth of the block. + pub depth: usize, + /// Whether the block is the included block, is itself pending on-chain, or descends + /// from the block pending availability. + pub aligned_with_pending: bool, +} + +/// Perform a recursive search through blocks to find potential +/// parent blocks for a new block. +/// +/// This accepts a relay-chain block to be used as an anchor and a maximum search depth, +/// along with some arguments for filtering parachain blocks and performs a recursive search +/// for parachain blocks. The search begins at the last included parachain block and returns +/// a set of [`PotentialParent`]s which could be potential parents of a new block with this +/// relay-parent according to the search parameters. +/// +/// A parachain block is a potential parent if it is either the last included parachain block, the pending +/// parachain block (when `max_depth` >= 1), or all of the following hold: +/// * its parent is a potential parent +/// * its relay-parent is within `ancestry_lookback` of the targeted relay-parent. +/// * the block number is within `max_depth` blocks of the included block +pub async fn find_potential_parents( + params: ParentSearchParams, + client: &impl sp_blockchain::Backend, + relay_client: &impl RelayChainInterface, +) -> Result>, RelayChainError> { + // 1. Build up the ancestry record of the relay chain to compare against. + let rp_ancestry = { + let mut ancestry = Vec::with_capacity(params.ancestry_lookback + 1); + let mut current_rp = params.relay_parent; + while ancestry.len() <= params.ancestry_lookback { + let header = match relay_client.header(RBlockId::hash(current_rp)).await? { + None => break, + Some(h) => h, + }; + + ancestry.push((current_rp, *header.state_root())); + current_rp = *header.parent_hash(); + + // don't iterate back into the genesis block. + if header.number == 1 { + break + } + } + + ancestry + }; + + let is_hash_in_ancestry = |hash| rp_ancestry.iter().any(|x| x.0 == hash); + let is_root_in_ancestry = |root| rp_ancestry.iter().any(|x| x.1 == root); + + // 2. Get the included and pending availability blocks. + let included_header = relay_client + .persisted_validation_data( + params.relay_parent, + params.para_id, + OccupiedCoreAssumption::TimedOut, + ) + .await?; + + let included_header = match included_header { + Some(pvd) => pvd.parent_head, + None => return Ok(Vec::new()), // this implies the para doesn't exist. + }; + + let pending_header = relay_client + .persisted_validation_data( + params.relay_parent, + params.para_id, + OccupiedCoreAssumption::Included, + ) + .await? + .and_then(|x| if x.parent_head != included_header { Some(x.parent_head) } else { None }); + + let included_header = match B::Header::decode(&mut &included_header.0[..]).ok() { + None => return Ok(Vec::new()), + Some(x) => x, + }; + // Silently swallow if pending block can't decode. + let pending_header = pending_header.and_then(|p| B::Header::decode(&mut &p.0[..]).ok()); + let included_hash = included_header.hash(); + let pending_hash = pending_header.as_ref().map(|hdr| hdr.hash()); + + let mut frontier = vec![PotentialParent:: { + hash: included_hash, + header: included_header, + depth: 0, + aligned_with_pending: true, + }]; + + // Recursive search through descendants of the included block which have acceptable + // relay parents. + let mut potential_parents = Vec::new(); + while let Some(entry) = frontier.pop() { + let is_pending = + entry.depth == 1 && pending_hash.as_ref().map_or(false, |h| &entry.hash == h); + let is_included = entry.depth == 0; + + // note: even if the pending block or included block have a relay parent + // outside of the expected part of the relay chain, they are always allowed + // because they have already been posted on chain. + let is_potential = is_pending || is_included || { + let digest = entry.header.digest(); + cumulus_primitives_core::extract_relay_parent(digest).map_or(false, is_hash_in_ancestry) || + cumulus_primitives_core::rpsr_digest::extract_relay_parent_storage_root(digest) + .map(|(r, _n)| r) + .map_or(false, is_root_in_ancestry) + }; + + let parent_aligned_with_pending = entry.aligned_with_pending; + let child_depth = entry.depth + 1; + let hash = entry.hash; + + if is_potential { + potential_parents.push(entry); + } + + if !is_potential || child_depth > params.max_depth { + continue + } + + // push children onto search frontier. + for child in client.children(hash).ok().into_iter().flatten() { + let aligned_with_pending = parent_aligned_with_pending && + if child_depth == 1 { + pending_hash.as_ref().map_or(true, |h| &child == h) + } else { + true + }; + + if params.ignore_alternative_branches && !aligned_with_pending { + continue + } + + let header = match client.header(child) { + Ok(Some(h)) => h, + Ok(None) => continue, + Err(_) => continue, + }; + + frontier.push(PotentialParent { + hash: child, + header, + depth: child_depth, + aligned_with_pending, + }); + } + } + + Ok(potential_parents) +} + +/// Get the relay-parent slot and timestamp from a header. +pub fn relay_slot_and_timestamp( + relay_parent_header: &PHeader, + relay_chain_slot_duration: SlotDuration, +) -> Option<(Slot, Timestamp)> { + sc_consensus_babe::find_pre_digest::(relay_parent_header) + .map(|babe_pre_digest| { + let slot = babe_pre_digest.slot(); + let t = Timestamp::new(relay_chain_slot_duration.as_millis() * *slot); + + (slot, t) + }) + .ok() +} diff --git a/client/consensus/common/src/tests.rs b/client/consensus/common/src/tests.rs index f1bc4d42b8a..c13f839ad82 100644 --- a/client/consensus/common/src/tests.rs +++ b/client/consensus/common/src/tests.rs @@ -19,7 +19,7 @@ use crate::*; use async_trait::async_trait; use codec::Encode; use cumulus_client_pov_recovery::RecoveryKind; -use cumulus_primitives_core::{InboundDownwardMessage, InboundHrmpMessage}; +use cumulus_primitives_core::{relay_chain::BlockId, InboundDownwardMessage, InboundHrmpMessage}; use cumulus_relay_chain_interface::{ CommittedCandidateReceipt, OccupiedCoreAssumption, OverseerHandle, PHeader, ParaId, RelayChainInterface, RelayChainResult, SessionIndex, StorageValue, ValidatorId, @@ -186,7 +186,7 @@ impl RelayChainInterface for Relaychain { } async fn wait_for_block(&self, _: PHash) -> RelayChainResult<()> { - unimplemented!("Not needed for test") + Ok(()) } async fn new_best_notification_stream( @@ -207,6 +207,10 @@ impl RelayChainInterface for Relaychain { }) .boxed()) } + + async fn header(&self, _block_id: BlockId) -> RelayChainResult> { + unimplemented!("Not needed for test") + } } fn build_block( diff --git a/client/consensus/proposer/Cargo.toml b/client/consensus/proposer/Cargo.toml index 7dff8d31950..b8179e5c8c3 100644 --- a/client/consensus/proposer/Cargo.toml +++ b/client/consensus/proposer/Cargo.toml @@ -7,8 +7,8 @@ edition = "2021" [dependencies] anyhow = "1.0" -async-trait = "0.1.68" -thiserror = "1.0.40" +async-trait = "0.1.71" +thiserror = "1.0.43" # Substrate sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/client/consensus/relay-chain/Cargo.toml b/client/consensus/relay-chain/Cargo.toml index 98331588ac1..658338e82e6 100644 --- a/client/consensus/relay-chain/Cargo.toml +++ b/client/consensus/relay-chain/Cargo.toml @@ -6,7 +6,7 @@ authors = ["Parity Technologies "] edition = "2021" [dependencies] -async-trait = "0.1.68" +async-trait = "0.1.71" futures = "0.3.28" parking_lot = "0.12.1" tracing = "0.1.37" diff --git a/client/network/Cargo.toml b/client/network/Cargo.toml index f8915beb82e..b0314648558 100644 --- a/client/network/Cargo.toml +++ b/client/network/Cargo.toml @@ -6,7 +6,7 @@ description = "Cumulus-specific networking protocol" edition = "2021" [dependencies] -async-trait = "0.1.68" +async-trait = "0.1.71" codec = { package = "parity-scale-codec", version = "3.0.0", features = [ "derive" ] } futures = "0.3.28" futures-timer = "3.0.2" @@ -31,7 +31,7 @@ cumulus-relay-chain-interface = { path = "../relay-chain-interface" } [dev-dependencies] portpicker = "0.1.1" -tokio = { version = "1.28.2", features = ["macros"] } +tokio = { version = "1.29.1", features = ["macros"] } url = "2.4.0" # Substrate @@ -44,7 +44,6 @@ sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "maste substrate-test-utils = { git = "https://github.com/paritytech/substrate", branch = "master" } # Polkadot -polkadot-client = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-test-client = { git = "https://github.com/paritytech/polkadot", branch = "master" } # Cumulus diff --git a/client/network/src/lib.rs b/client/network/src/lib.rs index e226170d7c5..7783ba13b6c 100644 --- a/client/network/src/lib.rs +++ b/client/network/src/lib.rs @@ -17,7 +17,7 @@ //! Parachain specific networking //! //! Provides a custom block announcement implementation for parachains -//! that use the relay chain provided consensus. See [`BlockAnnounceValidator`] +//! that use the relay chain provided consensus. See [`RequireSecondedInBlockAnnounce`] //! and [`WaitToAnnounce`] for more information about this implementation. use sp_consensus::block_validation::{ @@ -185,8 +185,17 @@ impl TryFrom<&'_ CollationSecondedSignal> for BlockAnnounceData { } } +/// A type alias for the [`RequireSecondedInBlockAnnounce`] validator. +#[deprecated = "This has been renamed to RequireSecondedInBlockAnnounce"] +pub type BlockAnnounceValidator = + RequireSecondedInBlockAnnounce; + /// Parachain specific block announce validator. /// +/// This is not required when the collation mechanism itself is sybil-resistant, as it is a spam protection +/// mechanism used to prevent nodes from dealing with unbounded numbers of blocks. For sybil-resistant +/// collation mechanisms, this will only slow things down. +/// /// This block announce validator is required if the parachain is running /// with the relay chain provided consensus to make sure each node only /// imports a reasonable number of blocks per round. The relay chain provided @@ -213,23 +222,23 @@ impl TryFrom<&'_ CollationSecondedSignal> for BlockAnnounceData { /// it. However, if the announcement is for a block below the tip the announcement is accepted /// as it probably comes from a node that is currently syncing the chain. #[derive(Clone)] -pub struct BlockAnnounceValidator { +pub struct RequireSecondedInBlockAnnounce { phantom: PhantomData, relay_chain_interface: RCInterface, para_id: ParaId, } -impl BlockAnnounceValidator +impl RequireSecondedInBlockAnnounce where RCInterface: Clone, { - /// Create a new [`BlockAnnounceValidator`]. + /// Create a new [`RequireSecondedInBlockAnnounce`]. pub fn new(relay_chain_interface: RCInterface, para_id: ParaId) -> Self { Self { phantom: Default::default(), relay_chain_interface, para_id } } } -impl BlockAnnounceValidator +impl RequireSecondedInBlockAnnounce where RCInterface: RelayChainInterface + Clone, { @@ -314,7 +323,7 @@ where } impl BlockAnnounceValidatorT - for BlockAnnounceValidator + for RequireSecondedInBlockAnnounce where RCInterface: RelayChainInterface + Clone + 'static, { @@ -452,3 +461,51 @@ async fn wait_to_announce( ); } } + +/// A [`BlockAnnounceValidator`] which accepts all block announcements, as it assumes +/// sybil resistance is handled elsewhere. +#[derive(Debug, Clone)] +pub struct AssumeSybilResistance(bool); + +impl AssumeSybilResistance { + /// Instantiate this block announcement validator while permissively allowing (but ignoring) + /// announcements which come tagged with seconded messages. + /// + /// This is useful for backwards compatibility when upgrading nodes: old nodes will continue + /// to broadcast announcements with seconded messages, so these announcements shouldn't be rejected + /// and the peers not punished. + pub fn allow_seconded_messages() -> Self { + AssumeSybilResistance(true) + } + + /// Instantiate this block announcement validator while rejecting announcements that come with + /// data. + pub fn reject_seconded_messages() -> Self { + AssumeSybilResistance(false) + } +} + +impl BlockAnnounceValidatorT for AssumeSybilResistance { + fn validate( + &mut self, + _header: &Block::Header, + data: &[u8], + ) -> Pin> + Send>> { + let allow_seconded_messages = self.0; + let data = data.to_vec(); + + async move { + Ok(if data.is_empty() { + Validation::Success { is_new_best: false } + } else if !allow_seconded_messages { + Validation::Failure { disconnect: false } + } else { + match BlockAnnounceData::decode_all(&mut data.as_slice()) { + Ok(_) => Validation::Success { is_new_best: false }, + Err(_) => Validation::Failure { disconnect: true }, + } + }) + } + .boxed() + } +} diff --git a/client/network/src/tests.rs b/client/network/src/tests.rs index 08127fe390a..e1bb961c75f 100644 --- a/client/network/src/tests.rs +++ b/client/network/src/tests.rs @@ -16,6 +16,7 @@ use super::*; use async_trait::async_trait; +use cumulus_primitives_core::relay_chain::BlockId; use cumulus_relay_chain_inprocess_interface::{check_block_in_chain, BlockCheckStatus}; use cumulus_relay_chain_interface::{ OverseerHandle, PHeader, ParaId, RelayChainError, RelayChainResult, @@ -237,13 +238,30 @@ impl RelayChainInterface for DummyRelayChainInterface { }); Ok(Box::pin(notifications_stream)) } + + async fn header(&self, block_id: BlockId) -> RelayChainResult> { + let hash = match block_id { + BlockId::Hash(hash) => hash, + BlockId::Number(num) => + if let Some(hash) = self.relay_client.hash(num)? { + hash + } else { + return Ok(None) + }, + }; + let header = self.relay_client.header(hash)?; + + Ok(header) + } } -fn make_validator_and_api( -) -> (BlockAnnounceValidator>, Arc) { +fn make_validator_and_api() -> ( + RequireSecondedInBlockAnnounce>, + Arc, +) { let relay_chain_interface = Arc::new(DummyRelayChainInterface::new()); ( - BlockAnnounceValidator::new(relay_chain_interface.clone(), ParaId::from(56)), + RequireSecondedInBlockAnnounce::new(relay_chain_interface.clone(), ParaId::from(56)), relay_chain_interface, ) } diff --git a/client/pov-recovery/Cargo.toml b/client/pov-recovery/Cargo.toml index 62922176e25..7817d1d4d65 100644 --- a/client/pov-recovery/Cargo.toml +++ b/client/pov-recovery/Cargo.toml @@ -28,10 +28,10 @@ polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = # Cumulus cumulus-primitives-core = { path = "../../primitives/core" } cumulus-relay-chain-interface = {path = "../relay-chain-interface"} -async-trait = "0.1.68" +async-trait = "0.1.71" [dev-dependencies] -tokio = { version = "1.28.2", features = ["macros"] } +tokio = { version = "1.29.1", features = ["macros"] } portpicker = "0.1.1" # Cumulus diff --git a/client/relay-chain-inprocess-interface/Cargo.toml b/client/relay-chain-inprocess-interface/Cargo.toml index a3bc7de0eb1..c2fcb04f3be 100644 --- a/client/relay-chain-inprocess-interface/Cargo.toml +++ b/client/relay-chain-inprocess-interface/Cargo.toml @@ -5,7 +5,7 @@ version = "0.1.0" edition = "2021" [dependencies] -async-trait = "0.1.68" +async-trait = "0.1.71" futures = "0.3.28" futures-timer = "3.0.2" @@ -23,7 +23,6 @@ sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = " # Polkadot polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false, features = ["cli"] } -polkadot-client = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "master" } # Cumulus diff --git a/client/relay-chain-inprocess-interface/src/lib.rs b/client/relay-chain-inprocess-interface/src/lib.rs index c1e19bd20b6..77a523b3407 100644 --- a/client/relay-chain-inprocess-interface/src/lib.rs +++ b/client/relay-chain-inprocess-interface/src/lib.rs @@ -19,21 +19,21 @@ use std::{pin::Pin, sync::Arc, time::Duration}; use async_trait::async_trait; use cumulus_primitives_core::{ relay_chain::{ - runtime_api::ParachainHost, Block as PBlock, CommittedCandidateReceipt, Hash as PHash, - Header as PHeader, InboundHrmpMessage, OccupiedCoreAssumption, SessionIndex, ValidatorId, + runtime_api::ParachainHost, Block as PBlock, BlockId, CommittedCandidateReceipt, + Hash as PHash, Header as PHeader, InboundHrmpMessage, OccupiedCoreAssumption, SessionIndex, + ValidatorId, }, InboundDownwardMessage, ParaId, PersistedValidationData, }; use cumulus_relay_chain_interface::{RelayChainError, RelayChainInterface, RelayChainResult}; use futures::{FutureExt, Stream, StreamExt}; -use polkadot_client::{ClientHandle, ExecuteWithClient, FullBackend}; use polkadot_service::{ - AuxStore, BabeApi, CollatorPair, Configuration, Handle, NewFull, TaskManager, + CollatorPair, Configuration, FullBackend, FullClient, Handle, NewFull, TaskManager, }; use sc_cli::SubstrateCli; use sc_client_api::{ blockchain::BlockStatus, Backend, BlockchainEvents, HeaderBackend, ImportNotifications, - StorageProof, UsageProvider, + StorageProof, }; use sc_telemetry::TelemetryWorkerHandle; use sp_api::ProvideRuntimeApi; @@ -45,17 +45,18 @@ use sp_state_machine::{Backend as StateBackend, StorageValue}; const TIMEOUT_IN_SECONDS: u64 = 6; /// Provides an implementation of the [`RelayChainInterface`] using a local in-process relay chain node. -pub struct RelayChainInProcessInterface { - full_client: Arc, +#[derive(Clone)] +pub struct RelayChainInProcessInterface { + full_client: Arc, backend: Arc, sync_oracle: Arc, overseer_handle: Handle, } -impl RelayChainInProcessInterface { +impl RelayChainInProcessInterface { /// Create a new instance of [`RelayChainInProcessInterface`] pub fn new( - full_client: Arc, + full_client: Arc, backend: Arc, sync_oracle: Arc, overseer_handle: Handle, @@ -64,38 +65,14 @@ impl RelayChainInProcessInterface { } } -impl Clone for RelayChainInProcessInterface { - fn clone(&self) -> Self { - Self { - full_client: self.full_client.clone(), - backend: self.backend.clone(), - sync_oracle: self.sync_oracle.clone(), - overseer_handle: self.overseer_handle.clone(), - } - } -} - #[async_trait] -impl RelayChainInterface for RelayChainInProcessInterface -where - Client: ProvideRuntimeApi - + BlockchainEvents - + AuxStore - + UsageProvider - + Sync - + Send, - Client::Api: ParachainHost + BabeApi, -{ +impl RelayChainInterface for RelayChainInProcessInterface { async fn retrieve_dmq_contents( &self, para_id: ParaId, relay_parent: PHash, ) -> RelayChainResult> { - Ok(self.full_client.runtime_api().dmq_contents_with_context( - relay_parent, - sp_core::ExecutionContext::Importing, - para_id, - )?) + Ok(self.full_client.runtime_api().dmq_contents(relay_parent, para_id)?) } async fn retrieve_all_inbound_hrmp_channel_contents( @@ -103,11 +80,25 @@ where para_id: ParaId, relay_parent: PHash, ) -> RelayChainResult>> { - Ok(self.full_client.runtime_api().inbound_hrmp_channels_contents_with_context( - relay_parent, - sp_core::ExecutionContext::Importing, - para_id, - )?) + Ok(self + .full_client + .runtime_api() + .inbound_hrmp_channels_contents(relay_parent, para_id)?) + } + + async fn header(&self, block_id: BlockId) -> RelayChainResult> { + let hash = match block_id { + BlockId::Hash(hash) => hash, + BlockId::Number(num) => + if let Some(hash) = self.full_client.hash(num)? { + hash + } else { + return Ok(None) + }, + }; + let header = self.full_client.header(hash)?; + + Ok(header) } async fn persisted_validation_data( @@ -255,14 +246,11 @@ pub enum BlockCheckStatus { } // Helper function to check if a block is in chain. -pub fn check_block_in_chain( +pub fn check_block_in_chain( backend: Arc, - client: Arc, + client: Arc, hash: PHash, -) -> RelayChainResult -where - Client: BlockchainEvents, -{ +) -> RelayChainResult { let _lock = backend.get_import_lock().read(); if backend.blockchain().status(hash)? == BlockStatus::InChain { @@ -274,48 +262,6 @@ where Ok(BlockCheckStatus::Unknown(listener)) } -/// Builder for a concrete relay chain interface, created from a full node. Builds -/// a [`RelayChainInProcessInterface`] to access relay chain data necessary for parachain operation. -/// -/// The builder takes a [`polkadot_client::Client`] -/// that wraps a concrete instance. By using [`polkadot_client::ExecuteWithClient`] -/// the builder gets access to this concrete instance and instantiates a [`RelayChainInProcessInterface`] with it. -struct RelayChainInProcessInterfaceBuilder { - polkadot_client: polkadot_client::Client, - backend: Arc, - sync_oracle: Arc, - overseer_handle: Handle, -} - -impl RelayChainInProcessInterfaceBuilder { - pub fn build(self) -> Arc { - self.polkadot_client.clone().execute_with(self) - } -} - -impl ExecuteWithClient for RelayChainInProcessInterfaceBuilder { - type Output = Arc; - - fn execute_with_client(self, client: Arc) -> Self::Output - where - Client: ProvideRuntimeApi - + BlockchainEvents - + AuxStore - + UsageProvider - + 'static - + Sync - + Send, - Client::Api: ParachainHost + BabeApi, - { - Arc::new(RelayChainInProcessInterface::new( - client, - self.backend, - self.sync_oracle, - self.overseer_handle, - )) - } -} - /// Build the Polkadot full node using the given `config`. #[sc_tracing::logging::prefix_logs_with("Relaychain")] fn build_polkadot_full_node( @@ -323,7 +269,7 @@ fn build_polkadot_full_node( parachain_config: &Configuration, telemetry_worker_handle: Option, hwbench: Option, -) -> Result<(NewFull, Option), polkadot_service::Error> { +) -> Result<(NewFull, Option), polkadot_service::Error> { let (is_collator, maybe_collator_key) = if parachain_config.role.is_authority() { let collator_key = CollatorPair::generate().0; (polkadot_service::IsCollator::Yes(collator_key.clone()), Some(collator_key)) @@ -370,18 +316,18 @@ pub fn build_inprocess_relay_chain( ) .map_err(|e| RelayChainError::Application(Box::new(e) as Box<_>))?; - let relay_chain_interface_builder = RelayChainInProcessInterfaceBuilder { - polkadot_client: full_node.client.clone(), - backend: full_node.backend.clone(), - sync_oracle: full_node.sync_service.clone(), - overseer_handle: full_node.overseer_handle.clone().ok_or(RelayChainError::GenericError( + let relay_chain_interface = Arc::new(RelayChainInProcessInterface::new( + full_node.client, + full_node.backend, + full_node.sync_service, + full_node.overseer_handle.clone().ok_or(RelayChainError::GenericError( "Overseer not running in full node.".to_string(), ))?, - }; + )); task_manager.add_child(full_node.task_manager); - Ok((relay_chain_interface_builder.build(), collator_key)) + Ok((relay_chain_interface, collator_key)) } #[cfg(test)] @@ -391,8 +337,8 @@ mod tests { use polkadot_primitives::Block as PBlock; use polkadot_test_client::{ construct_transfer_extrinsic, BlockBuilderExt, Client, ClientBlockImportExt, - DefaultTestClientBuilderExt, ExecutionStrategy, InitPolkadotBlockBuilder, - TestClientBuilder, TestClientBuilderExt, + DefaultTestClientBuilderExt, InitPolkadotBlockBuilder, TestClientBuilder, + TestClientBuilderExt, }; use sp_consensus::{BlockOrigin, SyncOracle}; use sp_runtime::traits::Block as BlockT; @@ -412,10 +358,8 @@ mod tests { } } - fn build_client_backend_and_block( - ) -> (Arc, PBlock, RelayChainInProcessInterface) { - let builder = - TestClientBuilder::new().set_execution_strategy(ExecutionStrategy::NativeWhenPossible); + fn build_client_backend_and_block() -> (Arc, PBlock, RelayChainInProcessInterface) { + let builder = TestClientBuilder::new(); let backend = builder.backend(); let client = Arc::new(builder.build()); diff --git a/client/relay-chain-interface/Cargo.toml b/client/relay-chain-interface/Cargo.toml index 9c776bd5753..f0799b51d5c 100644 --- a/client/relay-chain-interface/Cargo.toml +++ b/client/relay-chain-interface/Cargo.toml @@ -15,7 +15,7 @@ sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = " sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" } futures = "0.3.28" -async-trait = "0.1.68" -thiserror = "1.0.40" +async-trait = "0.1.71" +thiserror = "1.0.43" jsonrpsee-core = "0.16.2" -parity-scale-codec = "3.6.1" +parity-scale-codec = "3.6.3" diff --git a/client/relay-chain-interface/src/lib.rs b/client/relay-chain-interface/src/lib.rs index 3629aea84cd..a0258e20632 100644 --- a/client/relay-chain-interface/src/lib.rs +++ b/client/relay-chain-interface/src/lib.rs @@ -26,6 +26,7 @@ use jsonrpsee_core::Error as JsonRpcError; use parity_scale_codec::Error as CodecError; use sp_api::ApiError; +use cumulus_primitives_core::relay_chain::BlockId; pub use cumulus_primitives_core::{ relay_chain::{ CommittedCandidateReceipt, Hash as PHash, Header as PHeader, InboundHrmpMessage, @@ -110,6 +111,9 @@ pub trait RelayChainInterface: Send + Sync { /// Get the hash of the current best block. async fn best_block_hash(&self) -> RelayChainResult; + /// Fetch the block header of a given hash or height, if it exists. + async fn header(&self, block_id: BlockId) -> RelayChainResult>; + /// Get the hash of the finalized block. async fn finalized_block_hash(&self) -> RelayChainResult; @@ -293,4 +297,8 @@ where ) -> RelayChainResult + Send>>> { (**self).new_best_notification_stream().await } + + async fn header(&self, block_id: BlockId) -> RelayChainResult> { + (**self).header(block_id).await + } } diff --git a/client/relay-chain-minimal-node/Cargo.toml b/client/relay-chain-minimal-node/Cargo.toml index c9efb6d5e52..96d635051e0 100644 --- a/client/relay-chain-minimal-node/Cargo.toml +++ b/client/relay-chain-minimal-node/Cargo.toml @@ -40,6 +40,6 @@ cumulus-primitives-core = { path = "../../primitives/core" } array-bytes = "6.1" lru = "0.9" tracing = "0.1.37" -async-trait = "0.1.68" +async-trait = "0.1.71" futures = "0.3.28" -tokio = { version = "1.28.2", features = ["macros"] } +tokio = { version = "1.29.1", features = ["macros"] } diff --git a/client/relay-chain-rpc-interface/Cargo.toml b/client/relay-chain-rpc-interface/Cargo.toml index b55981774d9..4582b46b6e8 100644 --- a/client/relay-chain-rpc-interface/Cargo.toml +++ b/client/relay-chain-rpc-interface/Cargo.toml @@ -21,15 +21,15 @@ sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "mas sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-service = { git = "https://github.com/paritytech/substrate", branch = "master" } -tokio = { version = "1.28.2", features = ["sync"] } +tokio = { version = "1.29.1", features = ["sync"] } futures = "0.3.28" futures-timer = "3.0.2" -parity-scale-codec = "3.6.1" +parity-scale-codec = "3.6.3" jsonrpsee = { version = "0.16.2", features = ["ws-client"] } tracing = "0.1.37" -async-trait = "0.1.68" +async-trait = "0.1.71" url = "2.4.0" -serde_json = "1.0.97" -serde = "1.0.164" +serde_json = "1.0.102" +serde = "1.0.171" lru = "0.9.0" diff --git a/client/relay-chain-rpc-interface/src/lib.rs b/client/relay-chain-rpc-interface/src/lib.rs index 475d5d905b6..964d47eff91 100644 --- a/client/relay-chain-rpc-interface/src/lib.rs +++ b/client/relay-chain-rpc-interface/src/lib.rs @@ -23,7 +23,9 @@ use cumulus_primitives_core::{ }, InboundDownwardMessage, ParaId, PersistedValidationData, }; -use cumulus_relay_chain_interface::{RelayChainError, RelayChainInterface, RelayChainResult}; +use cumulus_relay_chain_interface::{ + PHeader, RelayChainError, RelayChainInterface, RelayChainResult, +}; use futures::{FutureExt, Stream, StreamExt}; use polkadot_overseer::Handle; @@ -33,6 +35,7 @@ use sp_state_machine::StorageValue; use sp_storage::StorageKey; use std::pin::Pin; +use cumulus_primitives_core::relay_chain::BlockId; pub use url::Url; mod reconnecting_ws_client; @@ -75,6 +78,21 @@ impl RelayChainInterface for RelayChainRpcInterface { .await } + async fn header(&self, block_id: BlockId) -> RelayChainResult> { + let hash = match block_id { + BlockId::Hash(hash) => hash, + BlockId::Number(num) => + if let Some(hash) = self.rpc_client.chain_get_block_hash(Some(num)).await? { + hash + } else { + return Ok(None) + }, + }; + let header = self.rpc_client.chain_get_header(Some(hash)).await?; + + Ok(header) + } + async fn persisted_validation_data( &self, hash: RelayHash, diff --git a/client/relay-chain-rpc-interface/src/reconnecting_ws_client.rs b/client/relay-chain-rpc-interface/src/reconnecting_ws_client.rs index 803a27d00f6..5b5babed0d6 100644 --- a/client/relay-chain-rpc-interface/src/reconnecting_ws_client.rs +++ b/client/relay-chain-rpc-interface/src/reconnecting_ws_client.rs @@ -414,11 +414,11 @@ impl ReconnectingWebsocketWorker { let urls = std::mem::take(&mut self.ws_urls); let Ok(mut client_manager) = ClientManager::new(urls).await else { tracing::error!(target: LOG_TARGET, "No valid RPC url found. Stopping RPC worker."); - return; + return }; let Ok(mut subscriptions) = client_manager.get_subscriptions().await else { tracing::error!(target: LOG_TARGET, "Unable to fetch subscriptions on initial connection."); - return; + return }; let mut imported_blocks_cache = diff --git a/client/service/src/lib.rs b/client/service/src/lib.rs index 42b9916d468..117e203d1ab 100644 --- a/client/service/src/lib.rs +++ b/client/service/src/lib.rs @@ -20,7 +20,7 @@ use cumulus_client_cli::CollatorOptions; use cumulus_client_consensus_common::ParachainConsensus; -use cumulus_client_network::BlockAnnounceValidator; +use cumulus_client_network::RequireSecondedInBlockAnnounce; use cumulus_client_pov_recovery::{PoVRecovery, RecoveryDelayRange, RecoveryHandle}; use cumulus_primitives_core::{CollectCollationInfo, ParaId}; use cumulus_relay_chain_inprocess_interface::build_inprocess_relay_chain; @@ -361,7 +361,8 @@ where _ => None, }; - let block_announce_validator = BlockAnnounceValidator::new(relay_chain_interface, para_id); + let block_announce_validator = + RequireSecondedInBlockAnnounce::new(relay_chain_interface, para_id); let block_announce_validator_builder = move |_| Box::new(block_announce_validator) as Box<_>; sc_service::build_network(sc_service::BuildNetworkParams { diff --git a/pallets/aura-ext/Cargo.toml b/pallets/aura-ext/Cargo.toml index af20233b8bb..a3c0a5bb6b8 100644 --- a/pallets/aura-ext/Cargo.toml +++ b/pallets/aura-ext/Cargo.toml @@ -7,7 +7,7 @@ description = "AURA consensus extension pallet for parachains" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } # Substrate frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/pallets/aura-ext/src/lib.rs b/pallets/aura-ext/src/lib.rs index 15e82edeefe..35892571f6f 100644 --- a/pallets/aura-ext/src/lib.rs +++ b/pallets/aura-ext/src/lib.rs @@ -85,11 +85,14 @@ pub mod pallet { >; #[pallet::genesis_config] - #[derive(Default)] - pub struct GenesisConfig; + #[derive(frame_support::DefaultNoBound)] + pub struct GenesisConfig { + #[serde(skip)] + pub _config: sp_std::marker::PhantomData, + } #[pallet::genesis_build] - impl GenesisBuild for GenesisConfig { + impl BuildGenesisConfig for GenesisConfig { fn build(&self) { let authorities = Aura::::authorities(); diff --git a/pallets/collator-selection/Cargo.toml b/pallets/collator-selection/Cargo.toml index adebdbd7458..dbb7f452162 100644 --- a/pallets/collator-selection/Cargo.toml +++ b/pallets/collator-selection/Cargo.toml @@ -16,7 +16,7 @@ targets = ["x86_64-unknown-linux-gnu"] log = { version = "0.4.19", default-features = false } codec = { default-features = false, features = ["derive"], package = "parity-scale-codec", version = "3.0.0" } rand = { version = "0.8.5", features = ["std_rng"], default-features = false } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/pallets/collator-selection/src/benchmarking.rs b/pallets/collator-selection/src/benchmarking.rs index 2e363fd6042..816e2cd1d72 100644 --- a/pallets/collator-selection/src/benchmarking.rs +++ b/pallets/collator-selection/src/benchmarking.rs @@ -25,9 +25,10 @@ use frame_benchmarking::{ use frame_support::{ assert_ok, codec::Decode, - traits::{Currency, EnsureOrigin, Get}, + dispatch::DispatchResult, + traits::{Currency, EnsureOrigin, Get, ReservableCurrency}, }; -use frame_system::{EventRecord, RawOrigin}; +use frame_system::{pallet_prelude::BlockNumberFor, EventRecord, RawOrigin}; use pallet_authorship::EventHandler; use pallet_session::{self as session, SessionManager}; use sp_std::prelude::*; @@ -106,6 +107,18 @@ fn register_candidates(count: u32) { } } +fn min_candidates() -> u32 { + let min_collators = T::MinEligibleCollators::get(); + let invulnerable_length = >::get().len(); + min_collators.saturating_sub(invulnerable_length.try_into().unwrap()) +} + +fn min_invulnerables() -> u32 { + let min_collators = T::MinEligibleCollators::get(); + let candidates_length = >::get().len(); + min_collators.saturating_sub(candidates_length.try_into().unwrap()) +} + benchmarks! { where_clause { where T: pallet_authorship::Config + session::Config } @@ -128,34 +141,67 @@ benchmarks! { } add_invulnerable { + let b in 1 .. T::MaxInvulnerables::get() - 1; + let c in 1 .. T::MaxCandidates::get() - 1; + let origin = T::UpdateOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?; - // we're going to add one, so need one less than max set as invulnerables to start - let b in 1 .. T::MaxInvulnerables::get() - 1; + + // need to fill up candidates + >::put(T::Currency::minimum_balance()); + >::put(c); + // get accounts and keys for the `c` candidates + let mut candidates = (0..c).map(|cc| validator::(cc)).collect::>(); + // add one more to the list. should not be in `b` (invulnerables) because it's the account + // we will _add_ to invulnerables. we want it to be in `candidates` because we need the + // weight associated with removing it. + let (new_invulnerable, new_invulnerable_keys) = validator::(b.max(c) + 1); + candidates.push((new_invulnerable.clone(), new_invulnerable_keys)); + // set their keys ... + for (who, keys) in candidates.clone() { + >::set_keys(RawOrigin::Signed(who).into(), keys, Vec::new()).unwrap(); + } + // ... and register them. + for (who, _) in candidates { + let deposit = >::get(); + T::Currency::make_free_balance_be(&who, deposit * 1000_u32.into()); + let incoming = CandidateInfo { who: who.clone(), deposit }; + >::try_mutate(|candidates| -> DispatchResult { + if !candidates.iter().any(|candidate| candidate.who == who) { + T::Currency::reserve(&who, deposit)?; + candidates.try_push(incoming).expect("we've respected the bounded vec limit"); + >::insert( + who.clone(), + frame_system::Pallet::::block_number() + T::KickThreshold::get(), + ); + } + Ok(()) + }).expect("only returns ok"); + } + + // now we need to fill up invulnerables let mut invulnerables = register_validators::(b); invulnerables.sort(); - let invulnerables: frame_support::BoundedVec<_, T::MaxInvulnerables> = frame_support::BoundedVec::try_from(invulnerables).unwrap(); + let invulnerables: frame_support::BoundedVec<_, T::MaxInvulnerables> = + frame_support::BoundedVec::try_from(invulnerables).unwrap(); >::put(invulnerables); - - // now let's set up a new one to add - let (new, keys) = validator::(b + 1); - >::set_keys(RawOrigin::Signed(new.clone()).into(), keys, Vec::new()).unwrap(); }: { assert_ok!( - >::add_invulnerable(origin, new.clone()) + >::add_invulnerable(origin, new_invulnerable.clone()) ); } verify { - assert_last_event::(Event::InvulnerableAdded{account_id: new}.into()); + assert_last_event::(Event::InvulnerableAdded{account_id: new_invulnerable}.into()); } remove_invulnerable { let origin = T::UpdateOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?; - let b in 1 .. T::MaxInvulnerables::get(); + let b in (min_invulnerables::() + 1) .. T::MaxInvulnerables::get(); let mut invulnerables = register_validators::(b); invulnerables.sort(); - let invulnerables: frame_support::BoundedVec<_, T::MaxInvulnerables> = frame_support::BoundedVec::try_from(invulnerables).unwrap(); + let invulnerables: frame_support::BoundedVec<_, T::MaxInvulnerables> = + frame_support::BoundedVec::try_from(invulnerables).unwrap(); >::put(invulnerables); let to_remove = >::get().first().unwrap().clone(); }: { @@ -221,7 +267,7 @@ benchmarks! { // worse case is the last candidate leaving. leave_intent { - let c in (T::MinCandidates::get() + 1) .. T::MaxCandidates::get(); + let c in (min_candidates::() + 1) .. T::MaxCandidates::get(); >::put(T::Currency::minimum_balance()); >::put(c); @@ -243,7 +289,7 @@ benchmarks! { T::Currency::minimum_balance() * 4u32.into(), ); let author = account("author", 0, SEED); - let new_block: T::BlockNumber = 10u32.into(); + let new_block: BlockNumberFor = 10u32.into(); frame_system::Pallet::::set_block_number(new_block); assert!(T::Currency::free_balance(&author) == 0u32.into()); @@ -266,8 +312,8 @@ benchmarks! { register_validators::(c); register_candidates::(c); - let new_block: T::BlockNumber = 1800u32.into(); - let zero_block: T::BlockNumber = 0u32.into(); + let new_block: BlockNumberFor = 1800u32.into(); + let zero_block: BlockNumberFor = 0u32.into(); let candidates = >::get(); let non_removals = c.saturating_sub(r); @@ -286,6 +332,7 @@ benchmarks! { } } + let min_candidates = min_candidates::(); let pre_length = >::get().len(); frame_system::Pallet::::set_block_number(new_block); @@ -294,11 +341,19 @@ benchmarks! { }: { as SessionManager<_>>::new_session(0) } verify { - if c > r && non_removals >= T::MinCandidates::get() { + if c > r && non_removals >= min_candidates { + // candidates > removals and remaining candidates > min candidates + // => remaining candidates should be shorter than before removal, i.e. some were + // actually removed. assert!(>::get().len() < pre_length); - } else if c > r && non_removals < T::MinCandidates::get() { - assert!(>::get().len() == T::MinCandidates::get() as usize); + } else if c > r && non_removals < min_candidates { + // candidates > removals and remaining candidates would be less than min candidates + // => remaining candidates should equal min candidates, i.e. some were removed up to + // the minimum, but then any more were "forced" to stay in candidates. + assert!(>::get().len() == min_candidates as usize); } else { + // removals >= candidates, non removals must == 0 + // can't remove more than exist assert!(>::get().len() == pre_length); } } diff --git a/pallets/collator-selection/src/lib.rs b/pallets/collator-selection/src/lib.rs index b6a9e109a11..539a4d8bd95 100644 --- a/pallets/collator-selection/src/lib.rs +++ b/pallets/collator-selection/src/lib.rs @@ -41,8 +41,9 @@ //! The current implementation resolves congestion of [`Candidates`] in a first-come-first-serve //! manner. //! -//! Candidates will not be allowed to get kicked or leave_intent if the total number of candidates -//! fall below MinCandidates. This is for potential disaster recovery scenarios. +//! Candidates will not be allowed to get kicked or `leave_intent` if the total number of collators +//! would fall below `MinEligibleCollators`. This is to ensure that some collators will always +//! exist, i.e. someone is eligible to produce a block. //! //! ### Rewards //! @@ -53,7 +54,7 @@ //! - Half the value of the transaction fees within the block. The other half of the transaction //! fees are deposited into the Pot. //! -//! To initiate rewards an ED needs to be transferred to the pot address. +//! To initiate rewards, an ED needs to be transferred to the pot address. //! //! Note: Eventually the Pot distribution may be modified as discussed in //! [this issue](https://github.com/paritytech/statemint/issues/21#issuecomment-810481073). @@ -128,21 +129,21 @@ pub mod pallet { /// Account Identifier from which the internal Pot is generated. type PotId: Get; - /// Maximum number of candidates that we should have. This is enforced in code. + /// Maximum number of candidates that we should have. /// /// This does not take into account the invulnerables. type MaxCandidates: Get; - /// Minimum number of candidates that we should have. This is used for disaster recovery. - /// - /// This does not take into account the invulnerables. - type MinCandidates: Get; + /// Minimum number eligible collators. Should always be greater than zero. This includes + /// Invulnerable collators. This ensures that there will always be one collator who can + /// produce a block. + type MinEligibleCollators: Get; - /// Maximum number of invulnerables. This is enforced in code. + /// Maximum number of invulnerables. type MaxInvulnerables: Get; // Will be kicked if block is not produced in threshold. - type KickThreshold: Get; + type KickThreshold: Get>; /// A stable ID for a validator. type ValidatorId: Member + Parameter; @@ -180,7 +181,8 @@ pub mod pallet { pub type Invulnerables = StorageValue<_, BoundedVec, ValueQuery>; - /// The (community, limited) collation candidates. + /// The (community, limited) collation candidates. `Candidates` and `Invulnerables` should be + /// mutually exclusive. #[pallet::storage] #[pallet::getter(fn candidates)] pub type Candidates = StorageValue< @@ -193,7 +195,7 @@ pub mod pallet { #[pallet::storage] #[pallet::getter(fn last_authored_block)] pub type LastAuthoredBlock = - StorageMap<_, Twox64Concat, T::AccountId, T::BlockNumber, ValueQuery>; + StorageMap<_, Twox64Concat, T::AccountId, BlockNumberFor, ValueQuery>; /// Desired number of candidates. /// @@ -218,7 +220,7 @@ pub mod pallet { } #[pallet::genesis_build] - impl GenesisBuild for GenesisConfig { + impl BuildGenesisConfig for GenesisConfig { fn build(&self) { let duplicate_invulnerables = self .invulnerables @@ -262,6 +264,9 @@ pub mod pallet { CandidateAdded { account_id: T::AccountId, deposit: BalanceOf }, /// A candidate was removed. CandidateRemoved { account_id: T::AccountId }, + /// An account was unable to be added to the Invulnerables because they did not have keys + /// registered. Other Invulnerables may have been set. + InvalidInvulnerableSkipped { account_id: T::AccountId }, } #[pallet::error] @@ -269,7 +274,7 @@ pub mod pallet { /// The pallet has too many candidates. TooManyCandidates, /// Leaving would result in too few candidates. - TooFewCandidates, + TooFewEligibleCollators, /// Account is already a candidate. AlreadyCandidate, /// Account is not a candidate. @@ -287,31 +292,82 @@ pub mod pallet { } #[pallet::hooks] - impl Hooks> for Pallet {} + impl Hooks> for Pallet { + fn integrity_test() { + assert!(T::MinEligibleCollators::get() > 0, "chain must require at least one collator"); + } + } #[pallet::call] impl Pallet { - /// Set the list of invulnerable (fixed) collators. + /// Set the list of invulnerable (fixed) collators. These collators must do some + /// preparation, namely to have registered session keys. + /// + /// The call will remove any accounts that have not registered keys from the set. That is, + /// it is non-atomic; the caller accepts all `AccountId`s passed in `new` _individually_ as + /// acceptable Invulnerables, and is not proposing a _set_ of new Invulnerables. + /// + /// This call does not maintain mutual exclusivity of `Invulnerables` and `Candidates`. It + /// is recommended to use a batch of `add_invulnerable` and `remove_invulnerable` instead. + /// A `batch_all` can also be used to enforce atomicity. If any candidates are included in + /// `new`, they should be removed with `remove_invulnerable_candidate` after execution. + /// + /// Must be called by the `UpdateOrigin`. #[pallet::call_index(0)] #[pallet::weight(T::WeightInfo::set_invulnerables(new.len() as u32))] - pub fn set_invulnerables( - origin: OriginFor, - new: Vec, - ) -> DispatchResultWithPostInfo { + pub fn set_invulnerables(origin: OriginFor, new: Vec) -> DispatchResult { T::UpdateOrigin::ensure_origin(origin)?; - let mut bounded_invulnerables = BoundedVec::<_, T::MaxInvulnerables>::try_from(new) - .map_err(|_| Error::::TooManyInvulnerables)?; - // check if the invulnerables have associated validator keys before they are set - for account_id in bounded_invulnerables.iter() { - let validator_key = T::ValidatorIdOf::convert(account_id.clone()) - .ok_or(Error::::NoAssociatedValidatorId)?; + // don't wipe out the collator set + if new.is_empty() { ensure!( - T::ValidatorRegistration::is_registered(&validator_key), - Error::::ValidatorNotRegistered + Candidates::::decode_len().unwrap_or_default() >= + T::MinEligibleCollators::get() as usize, + Error::::TooFewEligibleCollators ); } + // Will need to check the length again when putting into a bounded vec, but this + // prevents the iterator from having too many elements. + ensure!( + new.len() as u32 <= T::MaxInvulnerables::get(), + Error::::TooManyInvulnerables + ); + + let mut new_with_keys = Vec::new(); + + // check if the invulnerables have associated validator keys before they are set + for account_id in &new { + // don't let one unprepared collator ruin things for everyone. + let validator_key = T::ValidatorIdOf::convert(account_id.clone()); + match validator_key { + Some(key) => { + // key is not registered + if !T::ValidatorRegistration::is_registered(&key) { + Self::deposit_event(Event::InvalidInvulnerableSkipped { + account_id: account_id.clone(), + }); + continue + } + // else condition passes; key is registered + }, + // key does not exist + None => { + Self::deposit_event(Event::InvalidInvulnerableSkipped { + account_id: account_id.clone(), + }); + continue + }, + } + + new_with_keys.push(account_id.clone()); + } + + // should never fail since `new_with_keys` must be equal to or shorter than `new` + let mut bounded_invulnerables = + BoundedVec::<_, T::MaxInvulnerables>::try_from(new_with_keys) + .map_err(|_| Error::::TooManyInvulnerables)?; + // Invulnerables must be sorted for removal. bounded_invulnerables.sort(); @@ -319,12 +375,15 @@ pub mod pallet { Self::deposit_event(Event::NewInvulnerables { invulnerables: bounded_invulnerables.to_vec(), }); - Ok(().into()) + + Ok(()) } - /// Set the ideal number of collators (not including the invulnerables). - /// If lowering this number, then the number of running collators could be higher than this figure. - /// Aside from that edge case, there should be no other way to have more collators than the desired number. + /// Set the ideal number of non-invulnerable collators. If lowering this number, then the + /// number of running collators could be higher than this figure. Aside from that edge case, + /// there should be no other way to have more candidates than the desired number. + /// + /// The origin for this call must be the `UpdateOrigin`. #[pallet::call_index(1)] #[pallet::weight(T::WeightInfo::set_desired_candidates())] pub fn set_desired_candidates( @@ -342,6 +401,8 @@ pub mod pallet { } /// Set the candidacy bond amount. + /// + /// The origin for this call must be the `UpdateOrigin`. #[pallet::call_index(2)] #[pallet::weight(T::WeightInfo::set_candidacy_bond())] pub fn set_candidacy_bond( @@ -401,28 +462,35 @@ pub mod pallet { /// Deregister `origin` as a collator candidate. Note that the collator can only leave on /// session change. The `CandidacyBond` will be unreserved immediately. /// - /// This call will fail if the total number of candidates would drop below `MinCandidates`. - /// - /// This call is not available to `Invulnerable` collators. + /// This call will fail if the total number of candidates would drop below + /// `MinEligibleCollators`. #[pallet::call_index(4)] #[pallet::weight(T::WeightInfo::leave_intent(T::MaxCandidates::get()))] pub fn leave_intent(origin: OriginFor) -> DispatchResultWithPostInfo { let who = ensure_signed(origin)?; ensure!( - Self::candidates().len() as u32 > T::MinCandidates::get(), - Error::::TooFewCandidates + Self::eligible_collators() > T::MinEligibleCollators::get() as usize, + Error::::TooFewEligibleCollators ); - let current_count = Self::try_remove_candidate(&who)?; + // Do remove their last authored block. + let current_count = Self::try_remove_candidate(&who, true)?; Ok(Some(T::WeightInfo::leave_intent(current_count as u32)).into()) } - /// Add a new account `who` to the list of `Invulnerables` collators. + /// Add a new account `who` to the list of `Invulnerables` collators. `who` must have + /// registered session keys. If `who` is a candidate, they will be removed. /// /// The origin for this call must be the `UpdateOrigin`. #[pallet::call_index(5)] - #[pallet::weight(T::WeightInfo::add_invulnerable(T::MaxInvulnerables::get() - 1))] - pub fn add_invulnerable(origin: OriginFor, who: T::AccountId) -> DispatchResult { + #[pallet::weight(T::WeightInfo::add_invulnerable( + T::MaxInvulnerables::get().saturating_sub(1), + T::MaxCandidates::get() + ))] + pub fn add_invulnerable( + origin: OriginFor, + who: T::AccountId, + ) -> DispatchResultWithPostInfo { T::UpdateOrigin::ensure_origin(origin)?; // ensure `who` has registered a validator key @@ -443,8 +511,24 @@ pub mod pallet { Ok(()) })?; + // Error just means `who` wasn't a candidate, which is the state we want anyway. Don't + // remove their last authored block, as they are still a collator. + let _ = Self::try_remove_candidate(&who, false); + Self::deposit_event(Event::InvulnerableAdded { account_id: who }); - Ok(()) + + let weight_used = T::WeightInfo::add_invulnerable( + Invulnerables::::decode_len() + .unwrap_or_default() + .try_into() + .unwrap_or(T::MaxInvulnerables::get().saturating_sub(1)), + Candidates::::decode_len() + .unwrap_or_default() + .try_into() + .unwrap_or(T::MaxCandidates::get()), + ); + + Ok(Some(weight_used).into()) } /// Remove an account `who` from the list of `Invulnerables` collators. `Invulnerables` must @@ -456,6 +540,11 @@ pub mod pallet { pub fn remove_invulnerable(origin: OriginFor, who: T::AccountId) -> DispatchResult { T::UpdateOrigin::ensure_origin(origin)?; + ensure!( + Self::eligible_collators() > T::MinEligibleCollators::get() as usize, + Error::::TooFewEligibleCollators + ); + >::try_mutate(|invulnerables| -> DispatchResult { let pos = invulnerables.binary_search(&who).map_err(|_| Error::::NotInvulnerable)?; @@ -469,13 +558,24 @@ pub mod pallet { } impl Pallet { - /// Get a unique, inaccessible account id from the `PotId`. + /// Get a unique, inaccessible account ID from the `PotId`. pub fn account_id() -> T::AccountId { T::PotId::get().into_account_truncating() } - /// Removes a candidate if they exist and sends them back their deposit - fn try_remove_candidate(who: &T::AccountId) -> Result { + /// Return the total number of accounts that are eligible collators (candidates and + /// invulnerables). + fn eligible_collators() -> usize { + Candidates::::decode_len() + .unwrap_or_default() + .saturating_add(Invulnerables::::decode_len().unwrap_or_default()) + } + + /// Removes a candidate if they exist and sends them back their deposit. + fn try_remove_candidate( + who: &T::AccountId, + remove_last_authored: bool, + ) -> Result { let current_count = >::try_mutate(|candidates| -> Result { let index = candidates @@ -484,7 +584,9 @@ pub mod pallet { .ok_or(Error::::NotCandidate)?; let candidate = candidates.remove(index); T::Currency::unreserve(who, candidate.deposit); - >::remove(who.clone()); + if remove_last_authored { + >::remove(who.clone()) + }; Ok(candidates.len()) })?; Self::deposit_event(Event::CandidateRemoved { account_id: who.clone() }); @@ -502,29 +604,39 @@ pub mod pallet { collators } - /// Kicks out candidates that did not produce a block in the kick threshold - /// and refund their deposits. + /// Kicks out candidates that did not produce a block in the kick threshold and refunds + /// their deposits. pub fn kick_stale_candidates( candidates: BoundedVec>, T::MaxCandidates>, ) -> BoundedVec { let now = frame_system::Pallet::::block_number(); let kick_threshold = T::KickThreshold::get(); + let min_collators = T::MinEligibleCollators::get(); candidates .into_iter() .filter_map(|c| { let last_block = >::get(c.who.clone()); let since_last = now.saturating_sub(last_block); - if since_last < kick_threshold || - Self::candidates().len() as u32 <= T::MinCandidates::get() - { - Some(c.who) + + let is_invulnerable = Self::invulnerables().contains(&c.who); + let is_lazy = since_last >= kick_threshold; + + if is_invulnerable { + // They are invulnerable. No reason for them to be in Candidates also. + // We don't even care about the min collators here, because an Account + // should not be a collator twice. + let _ = Self::try_remove_candidate(&c.who, false); + None } else { - let outcome = Self::try_remove_candidate(&c.who); - if let Err(why) = outcome { - log::warn!("Failed to remove candidate {:?}", why); - debug_assert!(false, "failed to remove candidate {:?}", why); + if Self::eligible_collators() <= min_collators as usize || !is_lazy { + // Either this is a good collator (not lazy) or we are at the minimum + // that the system needs. They get to stay. + Some(c.who) + } else { + // This collator has not produced a block recently enough. Bye bye. + let _ = Self::try_remove_candidate(&c.who, true); + None } - None } }) .collect::>() @@ -536,7 +648,7 @@ pub mod pallet { /// Keep track of number of authored blocks per authority, uncles are counted as well since /// they're a valid proof of being online. impl - pallet_authorship::EventHandler for Pallet + pallet_authorship::EventHandler> for Pallet { fn note_author(author: T::AccountId) { let pot = Self::account_id(); diff --git a/pallets/collator-selection/src/mock.rs b/pallets/collator-selection/src/mock.rs index e9ad44f9db4..7e8b1595d2c 100644 --- a/pallets/collator-selection/src/mock.rs +++ b/pallets/collator-selection/src/mock.rs @@ -17,27 +17,23 @@ use super::*; use crate as collator_selection; use frame_support::{ ord_parameter_types, parameter_types, - traits::{ConstBool, ConstU32, ConstU64, FindAuthor, GenesisBuild, ValidatorRegistration}, + traits::{ConstBool, ConstU32, ConstU64, FindAuthor, ValidatorRegistration}, PalletId, }; use frame_system as system; use frame_system::EnsureSignedBy; use sp_core::H256; use sp_runtime::{ - testing::{Header, UintAuthorityId}, + testing::UintAuthorityId, traits::{BlakeTwo256, IdentityLookup, OpaqueKeys}, - RuntimeAppPublic, + BuildStorage, RuntimeAppPublic, }; -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; // Configure a mock runtime to test the pallet. frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { System: frame_system, Timestamp: pallet_timestamp, @@ -62,12 +58,11 @@ impl system::Config for Test { type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; type Nonce = u64; - type BlockNumber = u64; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = u64; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type Version = (); @@ -188,9 +183,6 @@ ord_parameter_types! { parameter_types! { pub const PotId: PalletId = PalletId(*b"PotStake"); - pub const MaxCandidates: u32 = 20; - pub const MaxInvulnerables: u32 = 20; - pub const MinCandidates: u32 = 1; } pub struct IsRegistered; @@ -205,9 +197,9 @@ impl Config for Test { type Currency = Balances; type UpdateOrigin = EnsureSignedBy; type PotId = PotId; - type MaxCandidates = MaxCandidates; - type MinCandidates = MinCandidates; - type MaxInvulnerables = MaxInvulnerables; + type MaxCandidates = ConstU32<20>; + type MinEligibleCollators = ConstU32<1>; + type MaxInvulnerables = ConstU32<20>; type KickThreshold = Period; type ValidatorId = ::AccountId; type ValidatorIdOf = IdentityCollator; @@ -217,7 +209,7 @@ impl Config for Test { pub fn new_test_ext() -> sp_io::TestExternalities { sp_tracing::try_init_simple(); - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); let invulnerables = vec![2, 1]; // unsorted let balances = vec![(1, 100), (2, 100), (3, 100), (4, 100), (5, 100)]; diff --git a/pallets/collator-selection/src/tests.rs b/pallets/collator-selection/src/tests.rs index 9014b6eff65..cbfbde743f0 100644 --- a/pallets/collator-selection/src/tests.rs +++ b/pallets/collator-selection/src/tests.rs @@ -17,10 +17,10 @@ use crate as collator_selection; use crate::{mock::*, CandidateInfo, Error}; use frame_support::{ assert_noop, assert_ok, - traits::{Currency, GenesisBuild, OnInitialize}, + traits::{Currency, OnInitialize}, }; use pallet_balances::Error as BalancesError; -use sp_runtime::{testing::UintAuthorityId, traits::BadOrigin}; +use sp_runtime::{testing::UintAuthorityId, traits::BadOrigin, BuildStorage}; #[test] fn basic_setup_works() { @@ -50,16 +50,22 @@ fn it_should_set_invulnerables() { CollatorSelection::set_invulnerables(RuntimeOrigin::signed(1), new_set), BadOrigin ); + }); +} - // cannot set invulnerables without associated validator keys - let invulnerables = vec![42]; - assert_noop!( - CollatorSelection::set_invulnerables( - RuntimeOrigin::signed(RootAccount::get()), - invulnerables - ), - Error::::ValidatorNotRegistered - ); +#[test] +fn it_should_set_invulnerables_even_with_some_invalid() { + new_test_ext().execute_with(|| { + assert_eq!(CollatorSelection::invulnerables(), vec![1, 2]); + let new_with_invalid = vec![1, 4, 3, 42, 2]; + + assert_ok!(CollatorSelection::set_invulnerables( + RuntimeOrigin::signed(RootAccount::get()), + new_with_invalid + )); + + // should succeed and order them, but not include 42 + assert_eq!(CollatorSelection::invulnerables(), vec![1, 2, 3, 4]); }); } @@ -190,6 +196,54 @@ fn remove_invulnerable_works() { }); } +#[test] +fn candidate_to_invulnerable_works() { + new_test_ext().execute_with(|| { + initialize_to_block(1); + assert_eq!(CollatorSelection::desired_candidates(), 2); + assert_eq!(CollatorSelection::candidacy_bond(), 10); + assert_eq!(CollatorSelection::candidates(), Vec::new()); + assert_eq!(CollatorSelection::invulnerables(), vec![1, 2]); + + assert_eq!(Balances::free_balance(3), 100); + assert_eq!(Balances::free_balance(4), 100); + + assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(3))); + assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(4))); + + assert_eq!(Balances::free_balance(3), 90); + assert_eq!(Balances::free_balance(4), 90); + + assert_ok!(CollatorSelection::add_invulnerable( + RuntimeOrigin::signed(RootAccount::get()), + 3 + )); + System::assert_has_event(RuntimeEvent::CollatorSelection(crate::Event::CandidateRemoved { + account_id: 3, + })); + System::assert_has_event(RuntimeEvent::CollatorSelection( + crate::Event::InvulnerableAdded { account_id: 3 }, + )); + assert!(CollatorSelection::invulnerables().to_vec().contains(&3)); + assert_eq!(Balances::free_balance(3), 100); + assert_eq!(CollatorSelection::candidates().len(), 1); + + assert_ok!(CollatorSelection::add_invulnerable( + RuntimeOrigin::signed(RootAccount::get()), + 4 + )); + System::assert_has_event(RuntimeEvent::CollatorSelection(crate::Event::CandidateRemoved { + account_id: 4, + })); + System::assert_has_event(RuntimeEvent::CollatorSelection( + crate::Event::InvulnerableAdded { account_id: 4 }, + )); + assert!(CollatorSelection::invulnerables().to_vec().contains(&4)); + assert_eq!(Balances::free_balance(4), 100); + assert_eq!(CollatorSelection::candidates().len(), 0); + }); +} + #[test] fn set_desired_candidates_works() { new_test_ext().execute_with(|| { @@ -256,14 +310,31 @@ fn cannot_register_candidate_if_too_many() { #[test] fn cannot_unregister_candidate_if_too_few() { new_test_ext().execute_with(|| { + assert_eq!(CollatorSelection::candidates(), Vec::new()); + assert_eq!(CollatorSelection::invulnerables(), vec![1, 2]); + assert_ok!(CollatorSelection::remove_invulnerable( + RuntimeOrigin::signed(RootAccount::get()), + 1 + )); + assert_noop!( + CollatorSelection::remove_invulnerable(RuntimeOrigin::signed(RootAccount::get()), 2), + Error::::TooFewEligibleCollators, + ); + // reset desired candidates: >::put(1); assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(4))); + // now we can remove `2` + assert_ok!(CollatorSelection::remove_invulnerable( + RuntimeOrigin::signed(RootAccount::get()), + 2 + )); + // can not remove too few assert_noop!( CollatorSelection::leave_intent(RuntimeOrigin::signed(4)), - Error::::TooFewCandidates, + Error::::TooFewEligibleCollators, ); }) } @@ -487,33 +558,76 @@ fn kick_mechanism() { #[test] fn should_not_kick_mechanism_too_few() { new_test_ext().execute_with(|| { - // add a new collator + // remove the invulnerables and add new collators 3 and 5 + assert_eq!(CollatorSelection::candidates(), Vec::new()); + assert_eq!(CollatorSelection::invulnerables(), vec![1, 2]); + assert_ok!(CollatorSelection::remove_invulnerable( + RuntimeOrigin::signed(RootAccount::get()), + 1 + )); assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(3))); assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(5))); + assert_ok!(CollatorSelection::remove_invulnerable( + RuntimeOrigin::signed(RootAccount::get()), + 2 + )); + initialize_to_block(10); assert_eq!(CollatorSelection::candidates().len(), 2); + initialize_to_block(20); assert_eq!(SessionChangeBlock::get(), 20); - // 4 authored this block, 5 gets to stay too few 3 was kicked + // 4 authored this block, 3 is kicked, 5 stays because of too few collators assert_eq!(CollatorSelection::candidates().len(), 1); // 3 will be kicked after 1 session delay - assert_eq!(SessionHandlerCollators::get(), vec![1, 2, 3, 5]); + assert_eq!(SessionHandlerCollators::get(), vec![3, 5]); let collator = CandidateInfo { who: 5, deposit: 10 }; assert_eq!(CollatorSelection::candidates(), vec![collator]); assert_eq!(CollatorSelection::last_authored_block(4), 20); + initialize_to_block(30); // 3 gets kicked after 1 session delay - assert_eq!(SessionHandlerCollators::get(), vec![1, 2, 5]); + assert_eq!(SessionHandlerCollators::get(), vec![5]); // kicked collator gets funds back assert_eq!(Balances::free_balance(3), 100); }); } +#[test] +fn should_kick_invulnerables_from_candidates_on_session_change() { + new_test_ext().execute_with(|| { + assert_eq!(CollatorSelection::candidates(), Vec::new()); + assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(3))); + assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(4))); + assert_eq!(Balances::free_balance(3), 90); + assert_eq!(Balances::free_balance(4), 90); + assert_ok!(CollatorSelection::set_invulnerables( + RuntimeOrigin::signed(RootAccount::get()), + vec![1, 2, 3] + )); + + let collator_3 = CandidateInfo { who: 3, deposit: 10 }; + let collator_4 = CandidateInfo { who: 4, deposit: 10 }; + + assert_eq!(CollatorSelection::candidates(), vec![collator_3, collator_4.clone()]); + assert_eq!(CollatorSelection::invulnerables(), vec![1, 2, 3]); + + // session change + initialize_to_block(10); + // 3 is removed from candidates + assert_eq!(CollatorSelection::candidates(), vec![collator_4]); + // but not from invulnerables + assert_eq!(CollatorSelection::invulnerables(), vec![1, 2, 3]); + // and it got its deposit back + assert_eq!(Balances::free_balance(3), 100); + }); +} + #[test] #[should_panic = "duplicate invulnerables in genesis."] fn cannot_set_genesis_value_twice() { sp_tracing::try_init_simple(); - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); let invulnerables = vec![1, 1]; let collator_selection = collator_selection::GenesisConfig:: { diff --git a/pallets/collator-selection/src/weights.rs b/pallets/collator-selection/src/weights.rs index 6b02d28d673..7d227da291a 100644 --- a/pallets/collator-selection/src/weights.rs +++ b/pallets/collator-selection/src/weights.rs @@ -27,7 +27,7 @@ use sp_std::marker::PhantomData; // The weight info trait for `pallet_collator_selection`. pub trait WeightInfo { fn set_invulnerables(_b: u32) -> Weight; - fn add_invulnerable(_b: u32) -> Weight; + fn add_invulnerable(_b: u32, _c: u32) -> Weight; fn remove_invulnerable(_b: u32) -> Weight; fn set_desired_candidates() -> Weight; fn set_candidacy_bond() -> Weight; @@ -82,23 +82,31 @@ impl WeightInfo for SubstrateWeight { .saturating_add(T::DbWeight::get().writes(2_u64.saturating_mul(r as u64))) .saturating_add(T::DbWeight::get().writes(2_u64.saturating_mul(c as u64))) } - /// Storage: CollatorSelection Invulnerables (r:1 w:1) - /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) /// Storage: Session NextKeys (r:1 w:0) /// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured) - /// The range of component `b` is `[1, 99]`. - fn add_invulnerable(b: u32) -> Weight { + /// Storage: CollatorSelection Invulnerables (r:1 w:1) + /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(641), added: 1136, mode: MaxEncodedLen) + /// Storage: CollatorSelection Candidates (r:1 w:1) + /// Proof: CollatorSelection Candidates (max_values: Some(1), max_size: Some(4802), added: 5297, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// The range of component `b` is `[1, 19]`. + /// The range of component `c` is `[1, 99]`. + fn add_invulnerable(b: u32, c: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `581 + b * (37 ±0)` - // Estimated: `4687 + b * (37 ±0)` - // Minimum execution time: 269_126_000 picoseconds. - Weight::from_parts(286_711_880, 0) - .saturating_add(Weight::from_parts(0, 4687)) - // Standard Error: 22_887 - .saturating_add(Weight::from_parts(813_399, 0).saturating_mul(b.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `757 + b * (32 ±0) + c * (53 ±0)` + // Estimated: `6287 + b * (37 ±0) + c * (53 ±0)` + // Minimum execution time: 52_720_000 picoseconds. + Weight::from_parts(56_102_459, 0) + .saturating_add(Weight::from_parts(0, 6287)) + // Standard Error: 12_957 + .saturating_add(Weight::from_parts(26_422, 0).saturating_mul(b.into())) + // Standard Error: 2_456 + .saturating_add(Weight::from_parts(128_528, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 37).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(0, 53).saturating_mul(c.into())) } /// Storage: CollatorSelection Invulnerables (r:1 w:1) /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) @@ -161,23 +169,31 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().writes(2_u64.saturating_mul(r as u64))) .saturating_add(RocksDbWeight::get().writes(2_u64.saturating_mul(c as u64))) } - /// Storage: CollatorSelection Invulnerables (r:1 w:1) - /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) /// Storage: Session NextKeys (r:1 w:0) /// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured) - /// The range of component `b` is `[1, 99]`. - fn add_invulnerable(b: u32) -> Weight { + /// Storage: CollatorSelection Invulnerables (r:1 w:1) + /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(641), added: 1136, mode: MaxEncodedLen) + /// Storage: CollatorSelection Candidates (r:1 w:1) + /// Proof: CollatorSelection Candidates (max_values: Some(1), max_size: Some(4802), added: 5297, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// The range of component `b` is `[1, 19]`. + /// The range of component `c` is `[1, 99]`. + fn add_invulnerable(b: u32, c: u32) -> Weight { // Proof Size summary in bytes: - // Measured: `581 + b * (37 ±0)` - // Estimated: `4687 + b * (37 ±0)` - // Minimum execution time: 269_126_000 picoseconds. - Weight::from_parts(286_711_880, 0) - .saturating_add(Weight::from_parts(0, 4687)) - // Standard Error: 22_887 - .saturating_add(Weight::from_parts(813_399, 0).saturating_mul(b.into())) - .saturating_add(RocksDbWeight::get().reads(2)) - .saturating_add(RocksDbWeight::get().writes(1)) + // Measured: `757 + b * (32 ±0) + c * (53 ±0)` + // Estimated: `6287 + b * (37 ±0) + c * (53 ±0)` + // Minimum execution time: 52_720_000 picoseconds. + Weight::from_parts(56_102_459, 0) + .saturating_add(Weight::from_parts(0, 6287)) + // Standard Error: 12_957 + .saturating_add(Weight::from_parts(26_422, 0).saturating_mul(b.into())) + // Standard Error: 2_456 + .saturating_add(Weight::from_parts(128_528, 0).saturating_mul(c.into())) + .saturating_add(RocksDbWeight::get().reads(4)) + .saturating_add(RocksDbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 37).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(0, 53).saturating_mul(c.into())) } /// Storage: CollatorSelection Invulnerables (r:1 w:1) /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) diff --git a/pallets/dmp-queue/Cargo.toml b/pallets/dmp-queue/Cargo.toml index ce7f532d1b3..cc05b407821 100644 --- a/pallets/dmp-queue/Cargo.toml +++ b/pallets/dmp-queue/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", features = [ "derive" ], default-features = false } log = { version = "0.4.19", default-features = false } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } # Substrate frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/pallets/dmp-queue/src/lib.rs b/pallets/dmp-queue/src/lib.rs index 29fab7be889..627124da994 100644 --- a/pallets/dmp-queue/src/lib.rs +++ b/pallets/dmp-queue/src/lib.rs @@ -139,7 +139,7 @@ pub mod pallet { #[pallet::hooks] impl Hooks> for Pallet { - fn on_idle(_now: T::BlockNumber, max_weight: Weight) -> Weight { + fn on_idle(_now: BlockNumberFor, max_weight: Weight) -> Weight { // on_idle processes additional messages with any remaining block weight. Self::service_queue(max_weight) } @@ -414,25 +414,21 @@ mod tests { use frame_support::{assert_noop, parameter_types, traits::OnIdle}; use sp_core::H256; use sp_runtime::{ - testing::Header, traits::{BlakeTwo256, IdentityLookup}, + BuildStorage, DispatchError::BadOrigin, }; use sp_version::RuntimeVersion; use std::cell::RefCell; use xcm::latest::{MultiLocation, OriginKind}; - type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; type Xcm = xcm::latest::Xcm; frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, DmpQueue: dmp_queue::{Pallet, Call, Storage, Event}, } ); @@ -460,12 +456,11 @@ mod tests { type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; type Nonce = u64; - type BlockNumber = u64; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = AccountId; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type BlockLength = (); @@ -542,7 +537,7 @@ mod tests { } pub(crate) fn new_test_ext() -> sp_io::TestExternalities { - frame_system::GenesisConfig::default().build_storage::().unwrap().into() + frame_system::GenesisConfig::::default().build_storage().unwrap().into() } fn enqueue(enqueued: &[Xcm]) { diff --git a/pallets/parachain-system/Cargo.toml b/pallets/parachain-system/Cargo.toml index ec3cd55862c..f3d8a3bee44 100644 --- a/pallets/parachain-system/Cargo.toml +++ b/pallets/parachain-system/Cargo.toml @@ -11,7 +11,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features = environmental = { version = "1.1.4", default-features = false } impl-trait-for-tuples = "0.2.1" log = { version = "0.4.19", default-features = false } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } # Substrate frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/pallets/parachain-system/proc-macro/Cargo.toml b/pallets/parachain-system/proc-macro/Cargo.toml index b0883135324..c75ac23d619 100644 --- a/pallets/parachain-system/proc-macro/Cargo.toml +++ b/pallets/parachain-system/proc-macro/Cargo.toml @@ -9,9 +9,9 @@ description = "Proc macros provided by the parachain-system pallet" proc-macro = true [dependencies] -syn = "2.0.18" -proc-macro2 = "1.0.60" -quote = "1.0.28" +syn = "2.0.25" +proc-macro2 = "1.0.64" +quote = "1.0.29" proc-macro-crate = "1.3.1" [features] diff --git a/pallets/parachain-system/src/lib.rs b/pallets/parachain-system/src/lib.rs index cda0ffe6b3d..cb215272a00 100644 --- a/pallets/parachain-system/src/lib.rs +++ b/pallets/parachain-system/src/lib.rs @@ -44,7 +44,7 @@ use frame_support::{ weights::Weight, RuntimeDebug, }; -use frame_system::{ensure_none, ensure_root}; +use frame_system::{ensure_none, ensure_root, pallet_prelude::HeaderFor}; use polkadot_parachain::primitives::RelayChainBlockNumber; use scale_info::TypeInfo; use sp_runtime::{ @@ -197,7 +197,7 @@ pub mod pallet { #[pallet::hooks] impl Hooks> for Pallet { - fn on_finalize(_: T::BlockNumber) { + fn on_finalize(_: BlockNumberFor) { >::kill(); >::kill(); @@ -229,7 +229,7 @@ pub mod pallet { }; >::mutate(|up| { - let queue_size = relevant_messaging_state.relay_dispatch_queue_size; + let queue_size = relevant_messaging_state.relay_dispatch_queue_remaining_capacity; let available_capacity = cmp::min( queue_size.remaining_count, @@ -281,7 +281,7 @@ pub mod pallet { HrmpOutboundMessages::::put(outbound_messages); } - fn on_initialize(_n: T::BlockNumber) -> Weight { + fn on_initialize(_n: BlockNumberFor) -> Weight { let mut weight = Weight::zero(); // To prevent removing `NewValidationCode` that was set by another `on_initialize` @@ -714,11 +714,14 @@ pub mod pallet { } #[pallet::genesis_config] - #[derive(Default)] - pub struct GenesisConfig; + #[derive(frame_support::DefaultNoBound)] + pub struct GenesisConfig { + #[serde(skip)] + pub _config: sp_std::marker::PhantomData, + } #[pallet::genesis_build] - impl GenesisBuild for GenesisConfig { + impl BuildGenesisConfig for GenesisConfig { fn build(&self) { // TODO: Remove after https://github.com/paritytech/cumulus/issues/479 sp_io::storage::set(b":c", &[]); @@ -1013,7 +1016,7 @@ impl Pallet { /// /// This is expected to be used by the /// [`CollectCollationInfo`](cumulus_primitives_core::CollectCollationInfo) runtime api. - pub fn collect_collation_info(header: &T::Header) -> CollationInfo { + pub fn collect_collation_info(header: &HeaderFor) -> CollationInfo { CollationInfo { hrmp_watermark: HrmpWatermark::::get(), horizontal_messages: HrmpOutboundMessages::::get(), @@ -1052,7 +1055,7 @@ impl Pallet { pub fn open_outbound_hrmp_channel_for_benchmarks(target_parachain: ParaId) { RelevantMessagingState::::put(MessagingStateSnapshot { dmq_mqc_head: Default::default(), - relay_dispatch_queue_size: Default::default(), + relay_dispatch_queue_remaining_capacity: Default::default(), ingress_channels: Default::default(), egress_channels: vec![( target_parachain, diff --git a/pallets/parachain-system/src/relay_state_snapshot.rs b/pallets/parachain-system/src/relay_state_snapshot.rs index e3763549d44..306252ca773 100644 --- a/pallets/parachain-system/src/relay_state_snapshot.rs +++ b/pallets/parachain-system/src/relay_state_snapshot.rs @@ -28,7 +28,7 @@ use sp_trie::{HashDBT, MemoryDB, StorageProof, EMPTY_PREFIX}; // The field order should stay the same as the data can be found in the proof to ensure both are // have the same encoded representation. #[derive(Clone, Encode, Decode, TypeInfo, Default)] -pub struct RelayDispachQueueSize { +pub struct RelayDispatchQueueRemainingCapacity { /// The number of additional messages that can be enqueued. pub remaining_count: u32, /// The total size of additional messages that can be enqueued. @@ -48,7 +48,7 @@ pub struct MessagingStateSnapshot { pub dmq_mqc_head: relay_chain::Hash, /// The current capacity of the upward message queue of the current parachain on the relay chain. - pub relay_dispatch_queue_size: RelayDispachQueueSize, + pub relay_dispatch_queue_remaining_capacity: RelayDispatchQueueRemainingCapacity, /// Information about all the inbound HRMP channels. /// @@ -86,7 +86,7 @@ pub enum Error { /// The DMQ MQC head cannot be extracted. DmqMqcHead(ReadEntryErr), /// Relay dispatch queue cannot be extracted. - RelayDispatchQueueSize(ReadEntryErr), + RelayDispatchQueueRemainingCapacity(ReadEntryErr), /// The hrmp inress channel index cannot be extracted. HrmpIngressChannelIndex(ReadEntryErr), /// The hrmp egress channel index cannot be extracted. @@ -183,7 +183,10 @@ impl RelayChainStateProof { ) .map_err(Error::DmqMqcHead)?; - let relay_dispatch_queue_size = read_optional_entry::( + let relay_dispatch_queue_remaining_capacity = read_optional_entry::< + RelayDispatchQueueRemainingCapacity, + _, + >( &self.trie_backend, &relay_chain::well_known_keys::relay_dispatch_queue_remaining_capacity(self.para_id) .key, @@ -195,22 +198,26 @@ impl RelayChainStateProof { // this code here needs to be removed and above needs to be changed to `read_entry` that // returns an error if `relay_dispatch_queue_remaining_capacity` can not be found/decoded. // - // For now we just fallback to the old dispatch queue size if there is an error. - let relay_dispatch_queue_size = match relay_dispatch_queue_size { + // For now we just fallback to the old dispatch queue size on `ReadEntryErr::Absent`. + // `ReadEntryErr::Decode` and `ReadEntryErr::Proof` are potentially subject to meddling + // by malicious collators, so we reject the block in those cases. + let relay_dispatch_queue_remaining_capacity = match relay_dispatch_queue_remaining_capacity + { Ok(Some(r)) => r, - _ => { + Ok(None) => { let res = read_entry::<(u32, u32), _>( &self.trie_backend, #[allow(deprecated)] &relay_chain::well_known_keys::relay_dispatch_queue_size(self.para_id), Some((0, 0)), ) - .map_err(Error::RelayDispatchQueueSize)?; + .map_err(Error::RelayDispatchQueueRemainingCapacity)?; let remaining_count = host_config.max_upward_queue_count.saturating_sub(res.0); let remaining_size = host_config.max_upward_queue_size.saturating_sub(res.1); - RelayDispachQueueSize { remaining_count, remaining_size } + RelayDispatchQueueRemainingCapacity { remaining_count, remaining_size } }, + Err(e) => return Err(Error::RelayDispatchQueueRemainingCapacity(e)), }; let ingress_channel_index: Vec = read_entry( @@ -255,7 +262,7 @@ impl RelayChainStateProof { // by relying on the fact that `ingress_channel_index` and `egress_channel_index` are themselves sorted. Ok(MessagingStateSnapshot { dmq_mqc_head, - relay_dispatch_queue_size, + relay_dispatch_queue_remaining_capacity, ingress_channels, egress_channels, }) diff --git a/pallets/parachain-system/src/tests.rs b/pallets/parachain-system/src/tests.rs index 0c03e23763d..5d259eabb72 100755 --- a/pallets/parachain-system/src/tests.rs +++ b/pallets/parachain-system/src/tests.rs @@ -29,31 +29,26 @@ use frame_support::{ traits::{OnFinalize, OnInitialize}, weights::Weight, }; -use frame_system::RawOrigin; +use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin}; use hex_literal::hex; use relay_chain::HrmpChannelId; use sp_core::{blake2_256, H256}; use sp_runtime::{ - testing::Header, traits::{BlakeTwo256, IdentityLookup}, - DispatchErrorWithPostInfo, + BuildStorage, DispatchErrorWithPostInfo, }; use sp_version::RuntimeVersion; use std::cell::RefCell; use crate as parachain_system; -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { - System: frame_system::{Pallet, Call, Config, Storage, Event}, - ParachainSystem: parachain_system::{Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, + ParachainSystem: parachain_system::{Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned}, } ); @@ -77,12 +72,11 @@ impl frame_system::Config for Test { type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; type Nonce = u64; - type BlockNumber = u64; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = u64; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type BlockLength = (); @@ -181,7 +175,7 @@ fn new_test_ext() -> sp_io::TestExternalities { HANDLED_DMP_MESSAGES.with(|m| m.borrow_mut().clear()); HANDLED_XCMP_MESSAGES.with(|m| m.borrow_mut().clear()); - frame_system::GenesisConfig::default().build_storage::().unwrap().into() + frame_system::GenesisConfig::::default().build_storage().unwrap().into() } struct ReadRuntimeVersion(Vec); @@ -212,7 +206,7 @@ fn wasm_ext() -> sp_io::TestExternalities { } struct BlockTest { - n: ::BlockNumber, + n: BlockNumberFor, within_block: Box, after_block: Option>, } @@ -243,7 +237,7 @@ impl BlockTests { self } - fn add(self, n: ::BlockNumber, within_block: F) -> Self + fn add(self, n: BlockNumberFor, within_block: F) -> Self where F: 'static + Fn(), { @@ -252,7 +246,7 @@ impl BlockTests { fn add_with_post_test( self, - n: ::BlockNumber, + n: BlockNumberFor, within_block: F1, after_block: F2, ) -> Self diff --git a/pallets/parachain-system/src/validate_block/tests.rs b/pallets/parachain-system/src/validate_block/tests.rs index 4801b62e7b5..eab3ed6d213 100644 --- a/pallets/parachain-system/src/validate_block/tests.rs +++ b/pallets/parachain-system/src/validate_block/tests.rs @@ -56,10 +56,7 @@ fn call_validate_block( } fn create_test_client() -> (Client, Header) { - let client = TestClientBuilder::new() - // NOTE: this allows easier debugging - .set_execution_strategy(sc_client_api::ExecutionStrategy::NativeWhenPossible) - .build(); + let client = TestClientBuilder::new().build(); let genesis_header = client .header(client.chain_info().genesis_hash) diff --git a/pallets/session-benchmarking/Cargo.toml b/pallets/session-benchmarking/Cargo.toml index 59d85666449..8615edd0a07 100644 --- a/pallets/session-benchmarking/Cargo.toml +++ b/pallets/session-benchmarking/Cargo.toml @@ -13,7 +13,7 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -parity-scale-codec = { version = "3.6.1", default-features = false } +parity-scale-codec = { version = "3.6.3", default-features = false } sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/pallets/solo-to-para/Cargo.toml b/pallets/solo-to-para/Cargo.toml index 27023d58fb2..c884c8a6b9f 100644 --- a/pallets/solo-to-para/Cargo.toml +++ b/pallets/solo-to-para/Cargo.toml @@ -7,7 +7,7 @@ description = "Adds functionality to migrate from a Solo to a Parachain" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } # Substrate frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/pallets/xcm/Cargo.toml b/pallets/xcm/Cargo.toml index 6aeb51163f1..213af07fdc5 100644 --- a/pallets/xcm/Cargo.toml +++ b/pallets/xcm/Cargo.toml @@ -6,7 +6,7 @@ version = "0.1.0" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/pallets/xcmp-queue/Cargo.toml b/pallets/xcmp-queue/Cargo.toml index 0cbc423e159..ff42da14bc8 100644 --- a/pallets/xcmp-queue/Cargo.toml +++ b/pallets/xcmp-queue/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" codec = { package = "parity-scale-codec", version = "3.0.0", features = [ "derive" ], default-features = false } log = { version = "0.4.19", default-features = false } rand_chacha = { version = "0.3.0", default-features = false } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } # Substrate frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/pallets/xcmp-queue/src/lib.rs b/pallets/xcmp-queue/src/lib.rs index 12ee6dae25a..b7b3c64f218 100644 --- a/pallets/xcmp-queue/src/lib.rs +++ b/pallets/xcmp-queue/src/lib.rs @@ -115,7 +115,7 @@ pub mod pallet { #[pallet::hooks] impl Hooks> for Pallet { - fn on_idle(_now: T::BlockNumber, max_weight: Weight) -> Weight { + fn on_idle(_now: BlockNumberFor, max_weight: Weight) -> Weight { // on_idle processes additional messages with any remaining block weight. Self::service_xcmp_queue(max_weight) } diff --git a/pallets/xcmp-queue/src/mock.rs b/pallets/xcmp-queue/src/mock.rs index af7251ea941..2c27568115f 100644 --- a/pallets/xcmp-queue/src/mock.rs +++ b/pallets/xcmp-queue/src/mock.rs @@ -25,27 +25,23 @@ use frame_support::{ use frame_system::EnsureRoot; use sp_core::H256; use sp_runtime::{ - testing::Header, traits::{BlakeTwo256, IdentityLookup}, + BuildStorage, }; use xcm::prelude::*; use xcm_builder::{CurrencyAdapter, FixedWeightBounds, IsConcrete, NativeAsset, ParentIsPreset}; use xcm_executor::traits::ConvertOrigin; -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; // Configure a mock runtime to test the pallet. frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, ParachainSystem: cumulus_pallet_parachain_system::{ - Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, + Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, }, XcmpQueue: xcmp_queue::{Pallet, Call, Storage, Event}, } @@ -66,12 +62,11 @@ impl frame_system::Config for Test { type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; type Nonce = u64; - type BlockNumber = u64; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = AccountId; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type Version = (); @@ -213,6 +208,6 @@ impl Config for Test { } pub fn new_test_ext() -> sp_io::TestExternalities { - let t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let t = frame_system::GenesisConfig::::default().build_storage().unwrap(); t.into() } diff --git a/parachain-template/node/Cargo.toml b/parachain-template/node/Cargo.toml index 77cde5f4165..e47a8ad0f7e 100644 --- a/parachain-template/node/Cargo.toml +++ b/parachain-template/node/Cargo.toml @@ -10,11 +10,12 @@ edition = "2021" build = "build.rs" [dependencies] -clap = { version = "4.3.6", features = ["derive"] } +clap = { version = "4.3.11", features = ["derive"] } log = "0.4.19" codec = { package = "parity-scale-codec", version = "3.0.0" } -serde = { version = "1.0.164", features = ["derive"] } +serde = { version = "1.0.171", features = ["derive"] } jsonrpsee = { version = "0.16.2", features = ["server"] } +futures = "0.3.28" # Local parachain-template-runtime = { path = "../runtime" } @@ -27,6 +28,7 @@ sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-cli = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" } +sc-offchain = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/parachain-template/node/src/chain_spec.rs b/parachain-template/node/src/chain_spec.rs index 68588c28494..0ca3c51900f 100644 --- a/parachain-template/node/src/chain_spec.rs +++ b/parachain-template/node/src/chain_spec.rs @@ -190,11 +190,15 @@ fn testnet_genesis( code: parachain_template_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), + ..Default::default() }, balances: parachain_template_runtime::BalancesConfig { balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(), }, - parachain_info: parachain_template_runtime::ParachainInfoConfig { parachain_id: id }, + parachain_info: parachain_template_runtime::ParachainInfoConfig { + parachain_id: id, + ..Default::default() + }, collator_selection: parachain_template_runtime::CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: EXISTENTIAL_DEPOSIT * 16, @@ -219,6 +223,7 @@ fn testnet_genesis( parachain_system: Default::default(), polkadot_xcm: parachain_template_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), + ..Default::default() }, transaction_payment: Default::default(), sudo: parachain_template_runtime::SudoConfig { key: Some(root) }, diff --git a/parachain-template/node/src/command.rs b/parachain-template/node/src/command.rs index c3e79ebe387..46c57aa2c67 100644 --- a/parachain-template/node/src/command.rs +++ b/parachain-template/node/src/command.rs @@ -1,23 +1,20 @@ use std::net::SocketAddr; -use codec::Encode; -use cumulus_client_cli::generate_genesis_block; use cumulus_primitives_core::ParaId; use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE}; use log::{info, warn}; use parachain_template_runtime::Block; use sc_cli::{ ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams, - NetworkParams, Result, RuntimeVersion, SharedParams, SubstrateCli, + NetworkParams, Result, SharedParams, SubstrateCli, }; use sc_service::config::{BasePath, PrometheusConfig}; -use sp_core::hexdisplay::HexDisplay; -use sp_runtime::traits::{AccountIdConversion, Block as BlockT}; +use sp_runtime::traits::AccountIdConversion; use crate::{ chain_spec, cli::{Cli, RelayChainCli, Subcommand}, - service::{new_partial, ParachainNativeExecutor}, + service::new_partial, }; fn load_spec(id: &str) -> std::result::Result, String> { @@ -63,10 +60,6 @@ impl SubstrateCli for Cli { fn load_spec(&self, id: &str) -> std::result::Result, String> { load_spec(id) } - - fn native_runtime_version(_: &Box) -> &'static RuntimeVersion { - ¶chain_template_runtime::VERSION - } } impl SubstrateCli for RelayChainCli { @@ -103,10 +96,6 @@ impl SubstrateCli for RelayChainCli { fn load_spec(&self, id: &str) -> std::result::Result, String> { polkadot_cli::Cli::from_iter([RelayChainCli::executable_name()].iter()).load_spec(id) } - - fn native_runtime_version(chain_spec: &Box) -> &'static RuntimeVersion { - polkadot_cli::Cli::native_runtime_version(chain_spec) - } } macro_rules! construct_async_run { @@ -175,10 +164,10 @@ pub fn run() -> Result<()> { }, Some(Subcommand::ExportGenesisState(cmd)) => { let runner = cli.create_runner(cmd)?; - runner.sync_run(|_config| { - let spec = cli.load_spec(&cmd.shared_params.chain.clone().unwrap_or_default())?; - let state_version = Cli::native_runtime_version(&spec).state_version(); - cmd.run::(&*spec, state_version) + runner.sync_run(|config| { + let partials = new_partial(&config)?; + + cmd.run(&*config.chain_spec, &*partials.client) }) }, Some(Subcommand::ExportGenesisWasm(cmd)) => { @@ -194,7 +183,7 @@ pub fn run() -> Result<()> { match cmd { BenchmarkCmd::Pallet(cmd) => if cfg!(feature = "runtime-benchmarks") { - runner.sync_run(|config| cmd.run::(config)) + runner.sync_run(|config| cmd.run::(config)) } else { Err("Benchmarking wasn't enabled when building the node. \ You can enable it with `--features runtime-benchmarks`." @@ -230,15 +219,12 @@ pub fn run() -> Result<()> { #[cfg(feature = "try-runtime")] Some(Subcommand::TryRuntime(cmd)) => { use parachain_template_runtime::MILLISECS_PER_BLOCK; - use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch}; use try_runtime_cli::block_building_info::timestamp_with_aura_info; let runner = cli.create_runner(cmd)?; - type HostFunctionsOf = ExtendedHostFunctions< - sp_io::SubstrateHostFunctions, - ::ExtendHostFunctions, - >; + type HostFunctions = + (sp_io::SubstrateHostFunctions, frame_benchmarking::benchmarking::HostFunctions); // grab the task manager. let registry = &runner.config().prometheus_config.as_ref().map(|cfg| &cfg.registry); @@ -249,12 +235,7 @@ pub fn run() -> Result<()> { let info_provider = timestamp_with_aura_info(MILLISECS_PER_BLOCK); runner.async_run(|_| { - Ok(( - cmd.run::, _>(Some( - info_provider, - )), - task_manager, - )) + Ok((cmd.run::(Some(info_provider)), task_manager)) }) }, #[cfg(not(feature = "try-runtime"))] @@ -266,11 +247,12 @@ pub fn run() -> Result<()> { let collator_options = cli.run.collator_options(); runner.run_node_until_exit(|config| async move { - let hwbench = (!cli.no_hardware_benchmarks).then_some( - config.database.path().map(|database_path| { + let hwbench = (!cli.no_hardware_benchmarks) + .then_some(config.database.path().map(|database_path| { let _ = std::fs::create_dir_all(database_path); sc_sysinfo::gather_hwbench(Some(database_path)) - })).flatten(); + })) + .flatten(); let para_id = chain_spec::Extensions::try_get(&*config.chain_spec) .map(|e| e.para_id) @@ -284,25 +266,26 @@ pub fn run() -> Result<()> { let id = ParaId::from(para_id); let parachain_account = - AccountIdConversion::::into_account_truncating(&id); - - let state_version = Cli::native_runtime_version(&config.chain_spec).state_version(); - let block: Block = generate_genesis_block(&*config.chain_spec, state_version) - .map_err(|e| format!("{:?}", e))?; - let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode())); + AccountIdConversion::::into_account_truncating( + &id, + ); let tokio_handle = config.tokio_handle.clone(); let polkadot_config = SubstrateCli::create_configuration(&polkadot_cli, &polkadot_cli, tokio_handle) .map_err(|err| format!("Relay chain argument error: {}", err))?; - info!("Parachain id: {:?}", id); - info!("Parachain Account: {}", parachain_account); - info!("Parachain genesis state: {}", genesis_state); + info!("Parachain Account: {parachain_account}"); info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" }); - if !collator_options.relay_chain_rpc_urls.is_empty() && !cli.relay_chain_args.is_empty() { - warn!("Detected relay chain node arguments together with --relay-chain-rpc-url. This command starts a minimal Polkadot node that only uses a network-related subset of all relay chain CLI options."); + if !collator_options.relay_chain_rpc_urls.is_empty() && + !cli.relay_chain_args.is_empty() + { + warn!( + "Detected relay chain node arguments together with --relay-chain-rpc-url. \ + This command starts a minimal Polkadot node that only uses a \ + network-related subset of all relay chain CLI options." + ); } crate::service::start_parachain_node( diff --git a/parachain-template/node/src/service.rs b/parachain-template/node/src/service.rs index fb311a48b48..9ad3c1ad3cc 100644 --- a/parachain-template/node/src/service.rs +++ b/parachain-template/node/src/service.rs @@ -21,6 +21,7 @@ use cumulus_relay_chain_interface::RelayChainInterface; // Substrate Imports use frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE; +use sc_client_api::Backend; use sc_consensus::ImportQueue; use sc_executor::{ HeapAllocStrategy, NativeElseWasmExecutor, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY, @@ -29,6 +30,7 @@ use sc_network::NetworkBlock; use sc_network_sync::SyncingService; use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, TaskManager}; use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle}; +use sc_transaction_pool_api::OffchainTransactionPoolFactory; use sp_keystore::KeystorePtr; use substrate_prometheus_endpoint::Registry; @@ -194,11 +196,25 @@ async fn start_node_impl( .await?; if parachain_config.offchain_worker.enabled { - sc_service::build_offchain_workers( - ¶chain_config, - task_manager.spawn_handle(), - client.clone(), - network.clone(), + use futures::FutureExt; + + task_manager.spawn_handle().spawn( + "offchain-workers-runner", + "offchain-work", + sc_offchain::OffchainWorkers::new(sc_offchain::OffchainWorkerOptions { + runtime_api_provider: client.clone(), + keystore: Some(params.keystore_container.keystore()), + offchain_db: backend.offchain_storage(), + transaction_pool: Some(OffchainTransactionPoolFactory::new( + transaction_pool.clone(), + )), + network_provider: network.clone(), + is_validator: parachain_config.role.is_authority(), + enable_http_requests: false, + custom_extensions: move |_| vec![], + }) + .run(client.clone(), task_manager.spawn_handle()) + .boxed(), ); } diff --git a/parachain-template/pallets/template/src/mock.rs b/parachain-template/pallets/template/src/mock.rs index 1edf380b0a7..8fae1019f42 100644 --- a/parachain-template/pallets/template/src/mock.rs +++ b/parachain-template/pallets/template/src/mock.rs @@ -2,21 +2,17 @@ use frame_support::{parameter_types, traits::Everything}; use frame_system as system; use sp_core::H256; use sp_runtime::{ - testing::Header, traits::{BlakeTwo256, IdentityLookup}, + BuildStorage, }; -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; // Configure a mock runtime to test the pallet. frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, TemplateModule: crate::{Pallet, Call, Storage, Event}, } ); @@ -34,12 +30,11 @@ impl system::Config for Test { type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; type Nonce = u64; - type BlockNumber = u64; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = u64; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type Version = (); @@ -59,5 +54,5 @@ impl crate::Config for Test { // Build genesis storage according to the mock runtime. pub fn new_test_ext() -> sp_io::TestExternalities { - system::GenesisConfig::default().build_storage::().unwrap().into() + system::GenesisConfig::::default().build_storage().unwrap().into() } diff --git a/parachain-template/runtime/Cargo.toml b/parachain-template/runtime/Cargo.toml index a299f747cfb..59bd61124a2 100644 --- a/parachain-template/runtime/Cargo.toml +++ b/parachain-template/runtime/Cargo.toml @@ -18,8 +18,8 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } hex-literal = { version = "0.4.1", optional = true } log = { version = "0.4.19", default-features = false } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } -smallvec = "1.10.0" +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } +smallvec = "1.11.0" # Local pallet-parachain-template = { path = "../pallets/template", default-features = false } diff --git a/parachain-template/runtime/src/lib.rs b/parachain-template/runtime/src/lib.rs index 5a9212bf134..761a3944afb 100644 --- a/parachain-template/runtime/src/lib.rs +++ b/parachain-template/runtime/src/lib.rs @@ -270,14 +270,12 @@ impl frame_system::Config for Runtime { type Lookup = AccountIdLookup; /// The index type for storing how many extrinsics an account has signed. type Nonce = Nonce; - /// 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 block type. + type Block = Block; /// The ubiquitous event type. type RuntimeEvent = RuntimeEvent; /// The ubiquitous origin type. @@ -433,10 +431,7 @@ impl pallet_aura::Config for Runtime { parameter_types! { pub const PotId: PalletId = PalletId(*b"PotStake"); - pub const MaxCandidates: u32 = 1000; - pub const MinCandidates: u32 = 5; pub const SessionLength: BlockNumber = 6 * HOURS; - pub const MaxInvulnerables: u32 = 100; // StakingAdmin pluralistic body. pub const StakingAdminBodyId: BodyId = BodyId::Defense; } @@ -452,9 +447,9 @@ impl pallet_collator_selection::Config for Runtime { type Currency = Balances; type UpdateOrigin = CollatorSelectionUpdateOrigin; type PotId = PotId; - type MaxCandidates = MaxCandidates; - type MinCandidates = MinCandidates; - type MaxInvulnerables = MaxInvulnerables; + type MaxCandidates = ConstU32<100>; + type MinEligibleCollators = ConstU32<4>; + type MaxInvulnerables = ConstU32<20>; // should be a multiple of session or things will get inconsistent type KickThreshold = Period; type ValidatorId = ::AccountId; @@ -470,10 +465,7 @@ impl pallet_parachain_template::Config for Runtime { // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( - pub enum Runtime where - Block = Block, - NodeBlock = opaque::Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Runtime { // System support stuff. System: frame_system = 0, diff --git a/parachains/common/Cargo.toml b/parachains/common/Cargo.toml index 576659d94ea..3fb3a2c8622 100644 --- a/parachains/common/Cargo.toml +++ b/parachains/common/Cargo.toml @@ -10,7 +10,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", features = ["derive"], default-features = false } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } num-traits = { version = "0.2", default-features = false} # Substrate diff --git a/parachains/common/src/impls.rs b/parachains/common/src/impls.rs index 47c3a315ef4..4a1f4f90d05 100644 --- a/parachains/common/src/impls.rs +++ b/parachains/common/src/impls.rs @@ -131,23 +131,18 @@ mod tests { use polkadot_primitives::AccountId; use sp_core::{ConstU64, H256}; use sp_runtime::{ - testing::Header, traits::{BlakeTwo256, IdentityLookup}, - Perbill, + BuildStorage, Perbill, }; use xcm::prelude::*; - type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; const TEST_ACCOUNT: AccountId = AccountId::new([1; 32]); frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Test { - System: frame_system::{Pallet, Call, Config, Storage, Event}, + System: frame_system::{Pallet, Call, Config, Storage, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, CollatorSelection: pallet_collator_selection::{Pallet, Call, Storage, Event}, } @@ -164,13 +159,12 @@ mod tests { type BaseCallFilter = frame_support::traits::Everything; type RuntimeOrigin = RuntimeOrigin; type Nonce = u64; - type BlockNumber = u64; type RuntimeCall = RuntimeCall; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = AccountId; type Lookup = IdentityLookup; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type BlockLength = BlockLength; @@ -222,9 +216,6 @@ mod tests { parameter_types! { pub const PotId: PalletId = PalletId(*b"PotStake"); - pub const MaxCandidates: u32 = 20; - pub const MaxInvulnerables: u32 = 20; - pub const MinCandidates: u32 = 1; } impl pallet_collator_selection::Config for Test { @@ -232,9 +223,9 @@ mod tests { type Currency = Balances; type UpdateOrigin = EnsureRoot; type PotId = PotId; - type MaxCandidates = MaxCandidates; - type MinCandidates = MinCandidates; - type MaxInvulnerables = MaxInvulnerables; + type MaxCandidates = ConstU32<20>; + type MinEligibleCollators = ConstU32<1>; + type MaxInvulnerables = ConstU32<20>; type ValidatorId = ::AccountId; type ValidatorIdOf = IdentityCollator; type ValidatorRegistration = IsRegistered; @@ -248,7 +239,7 @@ mod tests { } pub fn new_test_ext() -> sp_io::TestExternalities { - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); // We use default for brevity, but you can configure as desired if needed. pallet_balances::GenesisConfig::::default() .assimilate_storage(&mut t) diff --git a/parachains/integration-tests/e2e/assets/asset-hub-kusama/0_xcm/0_init.yml b/parachains/integration-tests/e2e/assets/asset-hub-kusama/0_xcm/0_init.yml index ebcbe417bbb..fdc1aa258d4 100644 --- a/parachains/integration-tests/e2e/assets/asset-hub-kusama/0_xcm/0_init.yml +++ b/parachains/integration-tests/e2e/assets/asset-hub-kusama/0_xcm/0_init.yml @@ -59,7 +59,7 @@ tests: - name: sudo.Sudid result: { sudoResult: Ok } - name: xcmPallet.SupportedVersionChanged - result: [{ parents: 0, interior: { X1: { Parachain: *ap_id }}}, *xcm_version ] + result: { location: { parents: 0, interior: { X1: { Parachain: *ap_id }}}, version: *xcm_version } - extrinsics: # Relay Chain sets supported version for Penpal Parachain - chain: *relay_chain sudo: true @@ -81,7 +81,7 @@ tests: - name: sudo.Sudid result: { sudoResult: Ok } - name: xcmPallet.SupportedVersionChanged - result: [{ parents: 0, interior: { X1: { Parachain: *pp_id }}}, *xcm_version ] + result: { location: { parents: 0, interior: { X1: { Parachain: *pp_id }}}, version: *xcm_version } - extrinsics: # Asset Parachain sets supported version for Relay Chain through it - chain: *relay_chain signer: *rc_signer @@ -124,7 +124,7 @@ tests: } - name: polkadotXcm.SupportedVersionChanged chain: *assets_parachain - result: [{ parents: 1, interior: Here }, *xcm_version ] + result: { location: { parents: 1, interior: Here }, version: *xcm_version } - extrinsics: # Penpal Parachain sets supported version for Relay Chain - chain: *penpal_parachain signer: *pp_signer @@ -142,4 +142,4 @@ tests: - name: sudo.Sudid result: { sudoResult: Ok } - name: polkadotXcm.SupportedVersionChanged - result: [{ parents: 1, interior: Here }, *xcm_version ] + result: { location: { parents: 1, interior: Here }, version: *xcm_version } diff --git a/parachains/integration-tests/e2e/assets/asset-hub-kusama/0_xcm/1_dmp.yml b/parachains/integration-tests/e2e/assets/asset-hub-kusama/0_xcm/1_dmp.yml index 1fb4a8abb84..0e207e632a0 100644 --- a/parachains/integration-tests/e2e/assets/asset-hub-kusama/0_xcm/1_dmp.yml +++ b/parachains/integration-tests/e2e/assets/asset-hub-kusama/0_xcm/1_dmp.yml @@ -73,13 +73,11 @@ tests: events: - name: xcmPallet.Attempted threshold: *weight_threshold - result: [{ Complete: { refTime: '764,772,000', proofSize: 0 }}] + result: { outcome: { Complete: { refTime: '764,772,000', proofSize: 0 }}} - name: dmpQueue.ExecutedDownward chain: *assets_parachain threshold: *weight_threshold - result: { - outcome: { Complete: { refTime: '166,944,000', proofSize: 0 }} - } + result: { outcome: { Complete: { refTime: '166,944,000', proofSize: 0 }}} - queries: balance_rc_sender_after: chain: *relay_chain @@ -153,9 +151,7 @@ tests: - name: dmpQueue.ExecutedDownward chain: *assets_parachain threshold: *weight_threshold - result: { - outcome: { Complete: { refTime: '1,014,103,000', proofSize: '200,000' }} - } + result: { outcome: { Complete: { refTime: '1,014,103,000', proofSize: '200,000' }}} - queries: forced_created_asset: chain: *assets_parachain @@ -218,7 +214,7 @@ tests: events: - name: xcmPallet.Attempted threshold: *weight_threshold - result: [{ Complete: { refTime: '750,645,000', proofSize: 0 }}] + result: { outcome: { Complete: { refTime: '750,645,000', proofSize: 0 }}} - name: dmpQueue.ExecutedDownward chain: *assets_parachain threshold: *weight_threshold diff --git a/parachains/integration-tests/e2e/assets/asset-hub-kusama/0_xcm/2_ump.yml b/parachains/integration-tests/e2e/assets/asset-hub-kusama/0_xcm/2_ump.yml index 9b885cb33e9..2a0bb88090e 100644 --- a/parachains/integration-tests/e2e/assets/asset-hub-kusama/0_xcm/2_ump.yml +++ b/parachains/integration-tests/e2e/assets/asset-hub-kusama/0_xcm/2_ump.yml @@ -57,13 +57,11 @@ tests: events: - name: xcmPallet.Attempted threshold: *weight_threshold - result: [{ Complete: { refTime: '761,173,000', proofSize: 0 }}] + result: { outcome: { Complete: { refTime: '761,173,000', proofSize: 0 }}} - name: dmpQueue.ExecutedDownward chain: *assets_parachain threshold: *weight_threshold - result: { - outcome: { Complete: { refTime: '166,944,000', proofSize: 0 }} - } + result: { outcome: { Complete: { refTime: '166,944,000', proofSize: 0 }}} - name: Get the balances of the Assets Parachain's sender & Relay Chain's receiver actions: @@ -96,7 +94,7 @@ tests: events: - name: polkadotXcm.Attempted threshold: *weight_threshold - result: [{ Complete: { refTime: '539,494,000', proofSize: '7,133' }}] + result: { outcome: { Complete: { refTime: '539,494,000', proofSize: '7,133' }}} - name: messageQueue.Processed chain: *relay_chain threshold: *weight_threshold @@ -190,4 +188,4 @@ tests: ] events: - name: polkadotXcm.Attempted - result: [{ Error: Barrier }] + result: { outcome: { Error: Barrier }} diff --git a/parachains/integration-tests/e2e/assets/asset-hub-kusama/0_xcm/4_hrmp.yml b/parachains/integration-tests/e2e/assets/asset-hub-kusama/0_xcm/4_hrmp.yml index 9e2decffe15..02e53da7558 100644 --- a/parachains/integration-tests/e2e/assets/asset-hub-kusama/0_xcm/4_hrmp.yml +++ b/parachains/integration-tests/e2e/assets/asset-hub-kusama/0_xcm/4_hrmp.yml @@ -101,9 +101,7 @@ tests: - name: dmpQueue.ExecutedDownward chain: *assets_parachain threshold: *weight_threshold - result: { - outcome: { Complete: { refTime: '1,216,703,000', proofSize: '20,000' }} - } + result: { outcome: { Complete: { refTime: '1,216,703,000', proofSize: '20,000' }}} - queries: forced_created_asset: chain: *assets_parachain @@ -182,7 +180,7 @@ tests: events: - name: polkadotXcm.Attempted threshold: *weight_threshold - result: [{ Complete: { refTime: '679,150,000', proofSize: '6,196' }}] + result: { outcome: { Complete: { refTime: '679,150,000', proofSize: '6,196' }}} - name: assets.Transferred result: { assetId: *asset_id, @@ -225,7 +223,7 @@ tests: events: - name: polkadotXcm.Attempted threshold: *weight_threshold - result: [{ Complete: { refTime: '679,150,000', proofSize: '6,196' }}] + result: { outcome: { Complete: { refTime: '679,150,000', proofSize: '6,196' }}} - name: balances.Endowed result: { account: *pp_sovereign_sibl, diff --git a/parachains/integration-tests/e2e/assets/asset-hub-polkadot/0_xcm/0_init.yml b/parachains/integration-tests/e2e/assets/asset-hub-polkadot/0_xcm/0_init.yml index 55dbab6ba4c..a6d3fb3ec83 100644 --- a/parachains/integration-tests/e2e/assets/asset-hub-polkadot/0_xcm/0_init.yml +++ b/parachains/integration-tests/e2e/assets/asset-hub-polkadot/0_xcm/0_init.yml @@ -59,7 +59,7 @@ tests: - name: sudo.Sudid result: { sudoResult: Ok } - name: xcmPallet.SupportedVersionChanged - result: [{ parents: 0, interior: { X1: { Parachain: *ap_id }}}, *xcm_version ] + result: { location: { parents: 0, interior: { X1: { Parachain: *ap_id }}}, version: *xcm_version } - extrinsics: # Relay Chain sets supported version for Penpal Parachain - chain: *relay_chain sudo: true @@ -81,7 +81,7 @@ tests: - name: sudo.Sudid result: { sudoResult: Ok } - name: xcmPallet.SupportedVersionChanged - result: [{ parents: 0, interior: { X1: { Parachain: *pp_id }}}, *xcm_version ] + result: { location: { parents: 0, interior: { X1: { Parachain: *pp_id }}}, version: *xcm_version } - extrinsics: # Asset Parachain sets supported version for Relay Chain through it - chain: *relay_chain signer: *rc_signer @@ -124,7 +124,7 @@ tests: } - name: polkadotXcm.SupportedVersionChanged chain: *assets_parachain - result: [{ parents: 1, interior: Here }, *xcm_version ] + result: { location: { parents: 1, interior: Here }, version: *xcm_version } - extrinsics: # Penpal Parachain sets supported version for Relay Chain - chain: *penpal_parachain signer: *pp_signer @@ -142,4 +142,4 @@ tests: - name: sudo.Sudid result: { sudoResult: Ok } - name: polkadotXcm.SupportedVersionChanged - result: [{ parents: 1, interior: Here }, *xcm_version ] + result: { location: { parents: 1, interior: Here}, version: *xcm_version } diff --git a/parachains/integration-tests/e2e/assets/asset-hub-polkadot/0_xcm/1_dmp.yml b/parachains/integration-tests/e2e/assets/asset-hub-polkadot/0_xcm/1_dmp.yml index 823974ad806..36b296f3eb1 100644 --- a/parachains/integration-tests/e2e/assets/asset-hub-polkadot/0_xcm/1_dmp.yml +++ b/parachains/integration-tests/e2e/assets/asset-hub-polkadot/0_xcm/1_dmp.yml @@ -73,13 +73,11 @@ tests: events: - name: xcmPallet.Attempted threshold: *weight_threshold - result: [{ Complete: { refTime: '3,000,000,000', proofSize: 0 }}] + result: { outcome: { Complete: { refTime: '3,000,000,000', proofSize: 0 }}} - name: dmpQueue.ExecutedDownward chain: *assets_parachain threshold: *weight_threshold - result: { - outcome: { Complete: { refTime: '166,944,000', proofSize: 0 }} - } + result: { outcome: { Complete: { refTime: '166,944,000', proofSize: 0 }}} - queries: balance_rc_sender_after: chain: *relay_chain @@ -153,9 +151,7 @@ tests: - name: dmpQueue.ExecutedDownward chain: *assets_parachain threshold: *weight_threshold - result: { - outcome: { Complete: { refTime: '1,014,103,000', proofSize: '200,000' }} - } + result: { outcome: { Complete: { refTime: '1,014,103,000', proofSize: '200,000' }}} - queries: forced_created_asset: chain: *assets_parachain @@ -218,7 +214,7 @@ tests: events: - name: xcmPallet.Attempted threshold: *weight_threshold - result: [{ Complete: { refTime: '2,000,000,000', proofSize: 0 }}] + result: { outcome: { Complete: { refTime: '2,000,000,000', proofSize: 0 }}} - name: dmpQueue.ExecutedDownward chain: *assets_parachain threshold: *weight_threshold diff --git a/parachains/integration-tests/e2e/assets/asset-hub-polkadot/0_xcm/2_ump.yml b/parachains/integration-tests/e2e/assets/asset-hub-polkadot/0_xcm/2_ump.yml index 2e38756aeef..fa84d4b006a 100644 --- a/parachains/integration-tests/e2e/assets/asset-hub-polkadot/0_xcm/2_ump.yml +++ b/parachains/integration-tests/e2e/assets/asset-hub-polkadot/0_xcm/2_ump.yml @@ -57,13 +57,11 @@ tests: events: - name: xcmPallet.Attempted threshold: *weight_threshold - result: [{ Complete: { refTime: '3,000,000,000', proofSize: 0 }}] + result: { outcome: { Complete: { refTime: '3,000,000,000', proofSize: 0 }}} - name: dmpQueue.ExecutedDownward chain: *assets_parachain threshold: *weight_threshold - result: { - outcome: { Complete: { refTime: '166,944,000', proofSize: 0 }} - } + result: { outcome: { Complete: { refTime: '166,944,000', proofSize: 0 }}} - name: Get the balances of the Assets Parachain's sender & Relay Chain's receiver actions: @@ -97,7 +95,7 @@ tests: events: - name: polkadotXcm.Attempted threshold: *weight_threshold - result: [{ Complete: { refTime: '533,283,000', proofSize: '7,096' }}] + result: { outcome: { Complete: { refTime: '533,283,000', proofSize: '7,096' }}} - name: messageQueue.Processed chain: *relay_chain threshold: *weight_threshold @@ -193,4 +191,4 @@ tests: ] events: - name: polkadotXcm.Attempted - result: [{ Error: Barrier }] + result: { outcome: { Error: Barrier }} diff --git a/parachains/integration-tests/e2e/assets/asset-hub-polkadot/0_xcm/4_hrmp.yml b/parachains/integration-tests/e2e/assets/asset-hub-polkadot/0_xcm/4_hrmp.yml index 4ff2fbc59a4..681af698c16 100644 --- a/parachains/integration-tests/e2e/assets/asset-hub-polkadot/0_xcm/4_hrmp.yml +++ b/parachains/integration-tests/e2e/assets/asset-hub-polkadot/0_xcm/4_hrmp.yml @@ -101,9 +101,7 @@ tests: - name: dmpQueue.ExecutedDownward chain: *assets_parachain threshold: *weight_threshold - result: { - outcome: { Complete: { refTime: '1,216,703,000', proofSize: '20,000' }} - } + result: { outcome: { Complete: { refTime: '1,216,703,000', proofSize: '20,000' }}} - queries: forced_created_asset: chain: *assets_parachain @@ -182,7 +180,7 @@ tests: events: - name: polkadotXcm.Attempted threshold: *weight_threshold - result: [{ Complete: { refTime: '673,627,000', proofSize: '6,196' }}] + result: { outcome: { Complete: { refTime: '673,627,000', proofSize: '6,196' }}} - name: assets.Transferred result: { assetId: *asset_id, @@ -225,7 +223,7 @@ tests: events: - name: polkadotXcm.Attempted threshold: *weight_threshold - result: [{ Complete: { refTime: '679,150,000', proofSize: '6,196' }}] + result: { outcome: { Complete: { refTime: '679,150,000', proofSize: '6,196' }}} - name: balances.Endowed result: { account: *pp_sovereign_sibl, diff --git a/parachains/integration-tests/e2e/collectives/collectives-polkadot/0_xcm/0_init.yml b/parachains/integration-tests/e2e/collectives/collectives-polkadot/0_xcm/0_init.yml index d4824469523..20ec0037715 100644 --- a/parachains/integration-tests/e2e/collectives/collectives-polkadot/0_xcm/0_init.yml +++ b/parachains/integration-tests/e2e/collectives/collectives-polkadot/0_xcm/0_init.yml @@ -51,7 +51,7 @@ tests: - name: sudo.Sudid result: { sudoResult: Ok } - name: xcmPallet.SupportedVersionChanged - result: [{ parents: 0, interior: { X1: { Parachain: *cp_id }}}, *xcm_version ] + result: { location: { parents: 0, interior: { X1: { Parachain: *cp_id }}}, version: *xcm_version } - extrinsics: # Collectives Parachain sets supported version for Relay Chain through it - chain: *relay_chain signer: *alice_signer @@ -92,9 +92,7 @@ tests: - name: dmpQueue.ExecutedDownward chain: *collectives_parachain threshold: *weight_threshold - result: { - outcome: { Complete: { refTime: '2,200,000,000', proofSize: 0 }} - } + result: { outcome: { Complete: { refTime: '2,200,000,000', proofSize: 0 }}} - name: polkadotXcm.SupportedVersionChanged chain: *collectives_parachain - result: [{ parents: 1, interior: Here }, *xcm_version ] + result: { location: { parents: 1, interior: Here }, version: *xcm_version } diff --git a/parachains/integration-tests/e2e/collectives/collectives-polkadot/0_xcm/1_teleport.yml b/parachains/integration-tests/e2e/collectives/collectives-polkadot/0_xcm/1_teleport.yml index 1171aa50da5..5f477f799d8 100644 --- a/parachains/integration-tests/e2e/collectives/collectives-polkadot/0_xcm/1_teleport.yml +++ b/parachains/integration-tests/e2e/collectives/collectives-polkadot/0_xcm/1_teleport.yml @@ -61,13 +61,11 @@ tests: events: - name: xcmPallet.Attempted threshold: *weight_threshold - result: [{ Complete: { refTime: '3,000,000,000', proofSize: 0 }}] + result: { outcome: { Complete: { refTime: '3,000,000,000', proofSize: 0 }}} - name: dmpQueue.ExecutedDownward chain: *collectives_parachain threshold: *weight_threshold - result: { - outcome: { Complete: { refTime: '4,000,000,000', proofSize: 0 }} - } + result: { outcome: { Complete: { refTime: '4,000,000,000', proofSize: 0 }}} - queries: balance_rc_alice_2: chain: *relay_chain @@ -126,7 +124,7 @@ tests: result: { who: *acc_alice_ss58, amount: 10000000000000 } - name: polkadotXcm.Attempted threshold: *weight_threshold - result: [{ Complete: { refTime: '3,000,000,000', proofSize: 0 }}] + result: { outcome: { Complete: { refTime: '3,000,000,000', proofSize: 0 }}} - name: balances.Withdraw chain: *relay_chain result: { who: *checking_account, amount: 10000000000000 } # amount received and withdrawn from registry account diff --git a/parachains/integration-tests/e2e/collectives/collectives-polkadot/0_xcm/2_reserve.yml b/parachains/integration-tests/e2e/collectives/collectives-polkadot/0_xcm/2_reserve.yml index 0695f1201b0..bd17f07524a 100644 --- a/parachains/integration-tests/e2e/collectives/collectives-polkadot/0_xcm/2_reserve.yml +++ b/parachains/integration-tests/e2e/collectives/collectives-polkadot/0_xcm/2_reserve.yml @@ -39,7 +39,7 @@ tests: events: - name: xcmPallet.Attempted threshold: *weight_threshold - result: [{ Complete: { refTime: '2,000,000,000', proofSize: 0 }}] + result: { outcome: { Complete: { refTime: '2,000,000,000', proofSize: 0 }}} - name: dmpQueue.ExecutedDownward chain: *collectives_parachain threshold: *weight_threshold diff --git a/parachains/integration-tests/e2e/collectives/collectives-polkadot/1_alliance/1_init_alliance.yml b/parachains/integration-tests/e2e/collectives/collectives-polkadot/1_alliance/1_init_alliance.yml index 15140e6946c..a455335fedc 100644 --- a/parachains/integration-tests/e2e/collectives/collectives-polkadot/1_alliance/1_init_alliance.yml +++ b/parachains/integration-tests/e2e/collectives/collectives-polkadot/1_alliance/1_init_alliance.yml @@ -109,9 +109,7 @@ tests: - name: dmpQueue.ExecutedDownward chain: *collectives_parachain threshold: *weight_threshold - result: { - outcome: { Complete: { refTime: '3,000,000,000', proofSize: '1,000,000' }} - } + result: { outcome: { Complete: { refTime: '3,000,000,000', proofSize: '1,000,000' }}} - name: Alliance init call fails. actions: @@ -159,9 +157,7 @@ tests: - name: dmpQueue.ExecutedDownward chain: *collectives_parachain threshold: *weight_threshold - result: { - outcome: { Complete: { refTime: '3,000,000,000', proofSize: '1,000,000' }} - } + result: { outcome: { Complete: { refTime: '3,000,000,000', proofSize: '1,000,000' }}} - name: Alliance disbanded and initialized again. actions: @@ -208,9 +204,7 @@ tests: - name: dmpQueue.ExecutedDownward chain: *collectives_parachain threshold: *weight_threshold - result: { - outcome: { Complete: { refTime: '3,321,495,872', proofSize: '181,779' }} - } + result: { outcome: { Complete: { refTime: '3,321,495,872', proofSize: '181,779' }}} - name: Alliance initiated, founders and fellows are set. actions: - extrinsics: @@ -255,6 +249,4 @@ tests: - name: dmpQueue.ExecutedDownward chain: *collectives_parachain threshold: *weight_threshold - result: { - outcome: { Complete: { refTime: '3,000,000,000', proofSize: '1,000,000' }} - } + result: { outcome: { Complete: { refTime: '3,000,000,000', proofSize: '1,000,000' }}} diff --git a/parachains/integration-tests/emulated/assets/asset-hub-kusama/src/lib.rs b/parachains/integration-tests/emulated/assets/asset-hub-kusama/src/lib.rs index 596d5893809..b090432fa7c 100644 --- a/parachains/integration-tests/emulated/assets/asset-hub-kusama/src/lib.rs +++ b/parachains/integration-tests/emulated/assets/asset-hub-kusama/src/lib.rs @@ -25,12 +25,12 @@ pub use integration_tests_common::{ PROOF_SIZE_THRESHOLD, REF_TIME_THRESHOLD, XCM_V3, }, AccountId, AssetHubKusama, AssetHubKusamaPallet, AssetHubKusamaReceiver, AssetHubKusamaSender, - BHKusama, BHKusamaPallet, BHKusamaReceiver, BHKusamaSender, BHPolkadot, BHPolkadotPallet, - BHPolkadotReceiver, BHPolkadotSender, Collectives, CollectivesPallet, CollectivesReceiver, - CollectivesSender, Kusama, KusamaMockNet, KusamaPallet, KusamaReceiver, KusamaSender, - PenpalKusama, PenpalKusamaReceiver, PenpalKusamaSender, PenpalPolkadot, PenpalPolkadotReceiver, - PenpalPolkadotSender, Polkadot, PolkadotMockNet, PolkadotPallet, PolkadotReceiver, - PolkadotSender, + BridgeHubKusama, BridgeHubKusamaPallet, BridgeHubKusamaReceiver, BridgeHubKusamaSender, + BridgeHubPolkadot, BridgeHubPolkadotPallet, BridgeHubPolkadotReceiver, BridgeHubPolkadotSender, + Collectives, CollectivesPallet, CollectivesReceiver, CollectivesSender, Kusama, KusamaMockNet, + KusamaPallet, KusamaReceiver, KusamaSender, PenpalKusama, PenpalKusamaReceiver, + PenpalKusamaSender, PenpalPolkadot, PenpalPolkadotReceiver, PenpalPolkadotSender, Polkadot, + PolkadotMockNet, PolkadotPallet, PolkadotReceiver, PolkadotSender, }; pub use polkadot_core_primitives::InboundDownwardMessage; pub use xcm::{ diff --git a/parachains/integration-tests/emulated/assets/asset-hub-polkadot/src/lib.rs b/parachains/integration-tests/emulated/assets/asset-hub-polkadot/src/lib.rs index 02296fa996e..70506d98cbc 100644 --- a/parachains/integration-tests/emulated/assets/asset-hub-polkadot/src/lib.rs +++ b/parachains/integration-tests/emulated/assets/asset-hub-polkadot/src/lib.rs @@ -26,12 +26,12 @@ pub use integration_tests_common::{ }, AccountId, AssetHubKusama, AssetHubKusamaPallet, AssetHubKusamaReceiver, AssetHubKusamaSender, AssetHubPolkadot, AssetHubPolkadotPallet, AssetHubPolkadotReceiver, AssetHubPolkadotSender, - BHKusama, BHKusamaPallet, BHKusamaReceiver, BHKusamaSender, BHPolkadot, BHPolkadotPallet, - BHPolkadotReceiver, BHPolkadotSender, Collectives, CollectivesPallet, CollectivesReceiver, - CollectivesSender, Kusama, KusamaMockNet, KusamaPallet, KusamaReceiver, KusamaSender, - PenpalKusama, PenpalKusamaReceiver, PenpalKusamaSender, PenpalPolkadot, PenpalPolkadotReceiver, - PenpalPolkadotSender, Polkadot, PolkadotMockNet, PolkadotPallet, PolkadotReceiver, - PolkadotSender, + BridgeHubKusama, BridgeHubKusamaPallet, BridgeHubKusamaReceiver, BridgeHubKusamaSender, + BridgeHubPolkadot, BridgeHubPolkadotPallet, BridgeHubPolkadotReceiver, BridgeHubPolkadotSender, + Collectives, CollectivesPallet, CollectivesReceiver, CollectivesSender, Kusama, KusamaMockNet, + KusamaPallet, KusamaReceiver, KusamaSender, PenpalKusama, PenpalKusamaReceiver, + PenpalKusamaSender, PenpalPolkadot, PenpalPolkadotReceiver, PenpalPolkadotSender, Polkadot, + PolkadotMockNet, PolkadotPallet, PolkadotReceiver, PolkadotSender, }; pub use polkadot_core_primitives::InboundDownwardMessage; pub use xcm::{ diff --git a/parachains/integration-tests/emulated/bridges/bridge-hub-rococo/Cargo.toml b/parachains/integration-tests/emulated/bridges/bridge-hub-rococo/Cargo.toml new file mode 100644 index 00000000000..d61de30915a --- /dev/null +++ b/parachains/integration-tests/emulated/bridges/bridge-hub-rococo/Cargo.toml @@ -0,0 +1,38 @@ +[package] +name = "bridge-hub-rococo-integration-tests" +version = "1.0.0" +authors = ["Parity Technologies "] +edition = "2021" +description = "Bridge Hub Rococo runtime integration tests with xcm-emulator" + +[dependencies] +codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false } + +# Substrate +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +sp-weights = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } + +# Polkadot +polkadot-core-primitives = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-runtime = { git = "https://github.com/paritytech/polkadot", branch = "master" } +xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } + +# Cumulus +parachains-common = { path = "../../../../common" } +cumulus-pallet-xcmp-queue = { default-features = false, path = "../../../../../pallets/xcmp-queue" } +bridge-hub-rococo-runtime = { path = "../../../../runtimes/bridge-hubs/bridge-hub-rococo" } +pallet-bridge-messages = { default-features = false, path = "../../../../../bridges/modules/messages" } +bp-messages = { default-features = false, path = "../../../../../bridges/primitives/messages" } + +# Local +xcm-emulator = { default-features = false, path = "../../../../../xcm/xcm-emulator" } +integration-tests-common = { default-features = false, path = "../../common" } diff --git a/parachains/integration-tests/emulated/bridges/bridge-hub-rococo/src/lib.rs b/parachains/integration-tests/emulated/bridges/bridge-hub-rococo/src/lib.rs new file mode 100644 index 00000000000..105212b1907 --- /dev/null +++ b/parachains/integration-tests/emulated/bridges/bridge-hub-rococo/src/lib.rs @@ -0,0 +1,48 @@ +// Copyright 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 . + +pub use bp_messages::LaneId; +pub use codec::Encode; +pub use frame_support::{assert_ok, pallet_prelude::Weight}; +pub use integration_tests_common::{ + constants::{ + accounts::{ALICE, BOB}, + rococo::{ED as ROCOCO_ED, ED as WOCOCO_ED}, + PROOF_SIZE_THRESHOLD, REF_TIME_THRESHOLD, XCM_V3, + }, + AccountId, AssetHubWococo, BridgeHubPolkadot, BridgeHubPolkadotPallet, + BridgeHubPolkadotReceiver, BridgeHubPolkadotSender, BridgeHubRococo, BridgeHubRococoPallet, + BridgeHubRococoReceiver, BridgeHubRococoSender, BridgeHubWococo, Collectives, + CollectivesPallet, CollectivesReceiver, CollectivesSender, Kusama, KusamaPallet, + PenpalPolkadot, PenpalPolkadotReceiver, PenpalPolkadotSender, Polkadot, PolkadotMockNet, + PolkadotPallet, PolkadotReceiver, PolkadotSender, Rococo, RococoMockNet, RococoPallet, + RococoReceiver, RococoSender, +}; +// pub use polkadot_core_primitives::InboundDownwardMessage; +pub use xcm::{ + prelude::*, + v3::{ + Error, + NetworkId::{Rococo as RococoId, Wococo as WococoId}, + }, +}; +pub use xcm_emulator::{ + assert_expected_events, bx, cumulus_pallet_dmp_queue, helpers::weight_within_threshold, + Parachain as Para, RelayChain as Relay, TestExt, +}; + +#[cfg(test)] +mod tests; diff --git a/parachains/integration-tests/emulated/bridges/bridge-hub-rococo/src/tests/example.rs b/parachains/integration-tests/emulated/bridges/bridge-hub-rococo/src/tests/example.rs new file mode 100644 index 00000000000..1d06d7f9fcd --- /dev/null +++ b/parachains/integration-tests/emulated/bridges/bridge-hub-rococo/src/tests/example.rs @@ -0,0 +1,99 @@ +// Copyright 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 crate::*; + +#[test] +fn example() { + // Init tests variables + // XcmPallet send arguments + let sudo_origin = ::RuntimeOrigin::root(); + let destination = Rococo::child_location_of(BridgeHubRococo::para_id()).into(); + let weight_limit = WeightLimit::Unlimited; + let check_origin = None; + + let remote_xcm = Xcm(vec![ClearOrigin]); + + let xcm = VersionedXcm::from(Xcm(vec![ + UnpaidExecution { weight_limit, check_origin }, + ExportMessage { + network: WococoId, + destination: X1(Parachain(AssetHubWococo::para_id().into())), + xcm: remote_xcm, + }, + ])); + + //Rococo Global Consensus + // Send XCM message from Relay Chain to Bridge Hub source Parachain + Rococo::execute_with(|| { + assert_ok!(::XcmPallet::send( + sudo_origin, + bx!(destination), + bx!(xcm), + )); + + type RuntimeEvent = ::RuntimeEvent; + + assert_expected_events!( + Rococo, + vec![ + RuntimeEvent::XcmPallet(pallet_xcm::Event::Sent { .. }) => {}, + ] + ); + }); + // Receive XCM message in Bridge Hub source Parachain + BridgeHubRococo::execute_with(|| { + type RuntimeEvent = ::RuntimeEvent; + + assert_expected_events!( + BridgeHubRococo, + vec![ + RuntimeEvent::DmpQueue(cumulus_pallet_dmp_queue::Event::ExecutedDownward { + outcome: Outcome::Complete(_), + .. + }) => {}, + RuntimeEvent::BridgeWococoMessages(pallet_bridge_messages::Event::MessageAccepted { + lane_id: LaneId([0, 0, 0, 1]), + nonce: 1, + }) => {}, + ] + ); + }); + + // Wococo GLobal Consensus + // Receive XCM message in Bridge Hub target Parachain + BridgeHubWococo::execute_with(|| { + type RuntimeEvent = ::RuntimeEvent; + + assert_expected_events!( + BridgeHubWococo, + vec![ + RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::XcmpMessageSent { .. }) => {}, + ] + ); + }); + // Receive embeded XCM message within `ExportMessage` in Parachain destination + AssetHubWococo::execute_with(|| { + type RuntimeEvent = ::RuntimeEvent; + + assert_expected_events!( + AssetHubWococo, + vec![ + RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::Fail { .. }) => {}, + ] + ); + }); +} diff --git a/parachains/integration-tests/emulated/bridges/bridge-hub-rococo/src/tests/mod.rs b/parachains/integration-tests/emulated/bridges/bridge-hub-rococo/src/tests/mod.rs new file mode 100644 index 00000000000..532e31aa1a6 --- /dev/null +++ b/parachains/integration-tests/emulated/bridges/bridge-hub-rococo/src/tests/mod.rs @@ -0,0 +1,17 @@ +// Copyright 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 . + +mod example; diff --git a/parachains/integration-tests/emulated/collectives/collectives-polkadot/Cargo.toml b/parachains/integration-tests/emulated/collectives/collectives-polkadot/Cargo.toml index b836994e5f8..2f81d34b51a 100644 --- a/parachains/integration-tests/emulated/collectives/collectives-polkadot/Cargo.toml +++ b/parachains/integration-tests/emulated/collectives/collectives-polkadot/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "collectives-polkadot-it" +name = "collectives-polkadot-integration-tests" version = "0.1.0" authors = ["Parity Technologies "] edition = "2021" diff --git a/parachains/integration-tests/emulated/common/Cargo.toml b/parachains/integration-tests/emulated/common/Cargo.toml index 340ca874993..ec9f0c24e1e 100644 --- a/parachains/integration-tests/emulated/common/Cargo.toml +++ b/parachains/integration-tests/emulated/common/Cargo.toml @@ -21,6 +21,7 @@ pallet-balances = { default-features = false, git = "https://github.com/parityte pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } pallet-staking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } pallet-im-online = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +beefy-primitives = { package = "sp-consensus-beefy", git = "https://github.com/paritytech/substrate", branch = "master" } # Polkadot polkadot-core-primitives = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } @@ -32,7 +33,9 @@ polkadot-runtime = { git = "https://github.com/paritytech/polkadot", branch = "m polkadot-runtime-constants = { git = "https://github.com/paritytech/polkadot", branch = "master" } kusama-runtime = { git = "https://github.com/paritytech/polkadot", branch = "master" } kusama-runtime-constants = { git = "https://github.com/paritytech/polkadot", branch = "master" } -westend-runtime = { git = "https://github.com/paritytech/polkadot", branch = "master" } +rococo-runtime = { git = "https://github.com/paritytech/polkadot", branch = "master" } +rococo-runtime-constants = { git = "https://github.com/paritytech/polkadot", branch = "master" } +westend-runtime = { git = "https://github.com/paritytech/polkadot", branch = "master" } westend-runtime-constants = { git = "https://github.com/paritytech/polkadot", branch = "master" } xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } @@ -49,7 +52,12 @@ asset-hub-westend-runtime = { path = "../../../runtimes/assets/asset-hub-westend collectives-polkadot-runtime = { path = "../../../runtimes/collectives/collectives-polkadot" } bridge-hub-kusama-runtime = { path = "../../../runtimes/bridge-hubs/bridge-hub-kusama" } bridge-hub-polkadot-runtime = { path = "../../../runtimes/bridge-hubs/bridge-hub-polkadot" } +bridge-hub-rococo-runtime = { path = "../../../runtimes/bridge-hubs/bridge-hub-rococo" } xcm-emulator = { default-features = false, path = "../../../../xcm/xcm-emulator" } +bp-messages = { path = "../../../../bridges/primitives/messages"} +bp-runtime = { path = "../../../../bridges/primitives/runtime"} +pallet-bridge-messages = { path = "../../../../bridges/modules/messages" } +bridge-runtime-common = { path = "../../../../bridges/bin/runtime-common"} [features] runtime-benchmarks = [ diff --git a/parachains/integration-tests/emulated/common/src/constants.rs b/parachains/integration-tests/emulated/common/src/constants.rs index 4155a4a5b97..7c3eaba5956 100644 --- a/parachains/integration-tests/emulated/common/src/constants.rs +++ b/parachains/integration-tests/emulated/common/src/constants.rs @@ -1,8 +1,9 @@ +use beefy_primitives::crypto::AuthorityId as BeefyId; use grandpa::AuthorityId as GrandpaId; use pallet_im_online::sr25519::AuthorityId as ImOnlineId; -pub use parachains_common::{AccountId, AssetHubPolkadotAuraId, AuraId, Balance, BlockNumber}; +use parachains_common::{AccountId, AssetHubPolkadotAuraId, AuraId, Balance, BlockNumber}; use polkadot_primitives::{AssignmentId, ValidatorId}; -pub use polkadot_runtime_parachains::configuration::HostConfiguration; +use polkadot_runtime_parachains::configuration::HostConfiguration; use polkadot_service::chain_spec::get_authority_keys_from_seed_no_beefy; use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; use sp_consensus_babe::AuthorityId as BabeId; @@ -11,7 +12,7 @@ use sp_runtime::{ traits::{IdentifyAccount, Verify}, BuildStorage, MultiSignature, Perbill, }; -pub use xcm; +use xcm; pub const XCM_V2: u32 = 3; pub const XCM_V3: u32 = 2; @@ -49,6 +50,7 @@ pub mod accounts { pub const DAVE_STASH: &str = "Dave//stash"; pub const EVE_STASH: &str = "Eve//stash"; pub const FERDIE_STASH: &str = "Ferdie//stash"; + pub const FERDIE_BEEFY: &str = "Ferdie//stash"; pub fn init_balances() -> Vec { vec![ @@ -153,6 +155,7 @@ pub mod polkadot { let genesis_config = polkadot_runtime::RuntimeGenesisConfig { system: polkadot_runtime::SystemConfig { code: polkadot_runtime::WASM_BINARY.unwrap().to_vec(), + ..Default::default() }, balances: polkadot_runtime::BalancesConfig { balances: accounts::init_balances() @@ -200,6 +203,7 @@ pub mod polkadot { babe: polkadot_runtime::BabeConfig { authorities: Default::default(), epoch_config: Some(polkadot_runtime::BABE_GENESIS_EPOCH_CONFIG), + ..Default::default() }, configuration: polkadot_runtime::ConfigurationConfig { config: get_host_config() }, ..Default::default() @@ -209,6 +213,7 @@ pub mod polkadot { } } +// Westend pub mod westend { use super::*; use westend_runtime_constants::currency::UNITS as WND; @@ -249,6 +254,7 @@ pub mod westend { let genesis_config = westend_runtime::RuntimeGenesisConfig { system: westend_runtime::SystemConfig { code: westend_runtime::WASM_BINARY.unwrap().to_vec(), + ..Default::default() }, balances: westend_runtime::BalancesConfig { balances: accounts::init_balances() @@ -296,6 +302,7 @@ pub mod westend { babe: westend_runtime::BabeConfig { authorities: Default::default(), epoch_config: Some(westend_runtime::BABE_GENESIS_EPOCH_CONFIG), + ..Default::default() }, configuration: westend_runtime::ConfigurationConfig { config: get_host_config() }, ..Default::default() @@ -346,6 +353,7 @@ pub mod kusama { let genesis_config = kusama_runtime::RuntimeGenesisConfig { system: kusama_runtime::SystemConfig { code: kusama_runtime::WASM_BINARY.unwrap().to_vec(), + ..Default::default() }, balances: kusama_runtime::BalancesConfig { balances: accounts::init_balances() @@ -392,6 +400,7 @@ pub mod kusama { babe: kusama_runtime::BabeConfig { authorities: Default::default(), epoch_config: Some(kusama_runtime::BABE_GENESIS_EPOCH_CONFIG), + ..Default::default() }, configuration: kusama_runtime::ConfigurationConfig { config: get_host_config() }, ..Default::default() @@ -401,6 +410,96 @@ pub mod kusama { } } +// Rococo +pub mod rococo { + use super::*; + pub const ED: Balance = rococo_runtime_constants::currency::EXISTENTIAL_DEPOSIT; + use rococo_runtime_constants::currency::UNITS as ROC; + const ENDOWMENT: u128 = 1_000_000 * ROC; + + pub fn get_host_config() -> HostConfiguration { + HostConfiguration { + max_upward_queue_size: 51200, + max_upward_message_size: 51200, + max_upward_message_num_per_candidate: 10, + max_downward_message_size: 51200, + ..Default::default() + } + } + + fn session_keys( + babe: BabeId, + grandpa: GrandpaId, + im_online: ImOnlineId, + para_validator: ValidatorId, + para_assignment: AssignmentId, + authority_discovery: AuthorityDiscoveryId, + beefy: BeefyId, + ) -> rococo_runtime::SessionKeys { + rococo_runtime::SessionKeys { + babe, + grandpa, + im_online, + para_validator, + para_assignment, + authority_discovery, + beefy, + } + } + + pub fn genesis() -> Storage { + let genesis_config = rococo_runtime::RuntimeGenesisConfig { + system: rococo_runtime::SystemConfig { + code: rococo_runtime::WASM_BINARY.unwrap().to_vec(), + ..Default::default() + }, + balances: rococo_runtime::BalancesConfig { + balances: accounts::init_balances() + .iter() + .map(|k| (k.clone(), ENDOWMENT)) + .collect(), + }, + // indices: rococo_runtime::IndicesConfig { indices: vec![] }, + session: rococo_runtime::SessionConfig { + keys: validators::initial_authorities() + .iter() + .map(|x| { + ( + x.0.clone(), + x.0.clone(), + session_keys( + x.2.clone(), + x.3.clone(), + x.4.clone(), + x.5.clone(), + x.6.clone(), + x.7.clone(), + get_from_seed::("Alice"), + ), + ) + }) + .collect::>(), + }, + babe: rococo_runtime::BabeConfig { + authorities: Default::default(), + epoch_config: Some(rococo_runtime::BABE_GENESIS_EPOCH_CONFIG), + ..Default::default() + }, + sudo: rococo_runtime::SudoConfig { + key: Some(get_account_id_from_seed::("Alice")), + }, + configuration: rococo_runtime::ConfigurationConfig { config: get_host_config() }, + registrar: rococo_runtime::RegistrarConfig { + next_free_para_id: polkadot_primitives::LOWEST_PUBLIC_ID, + ..Default::default() + }, + ..Default::default() + }; + + genesis_config.build_storage().unwrap() + } +} + // Asset Hub Polkadot pub mod asset_hub_polkadot { use super::*; @@ -413,6 +512,7 @@ pub mod asset_hub_polkadot { code: asset_hub_polkadot_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), + ..Default::default() }, balances: asset_hub_polkadot_runtime::BalancesConfig { balances: accounts::init_balances() @@ -423,6 +523,7 @@ pub mod asset_hub_polkadot { }, parachain_info: asset_hub_polkadot_runtime::ParachainInfoConfig { parachain_id: PARA_ID.into(), + ..Default::default() }, collator_selection: asset_hub_polkadot_runtime::CollatorSelectionConfig { invulnerables: collators::invulnerables_asset_hub_polkadot() @@ -445,12 +546,11 @@ pub mod asset_hub_polkadot { }) .collect(), }, - aura: Default::default(), - aura_ext: Default::default(), - parachain_system: Default::default(), polkadot_xcm: asset_hub_polkadot_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), + ..Default::default() }, + ..Default::default() }; genesis_config.build_storage().unwrap() @@ -469,6 +569,7 @@ pub mod asset_hub_westend { code: asset_hub_westend_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), + ..Default::default() }, balances: asset_hub_westend_runtime::BalancesConfig { balances: accounts::init_balances() @@ -479,6 +580,7 @@ pub mod asset_hub_westend { }, parachain_info: asset_hub_westend_runtime::ParachainInfoConfig { parachain_id: PARA_ID.into(), + ..Default::default() }, collator_selection: asset_hub_westend_runtime::CollatorSelectionConfig { invulnerables: collators::invulnerables() @@ -501,12 +603,11 @@ pub mod asset_hub_westend { }) .collect(), }, - aura: Default::default(), - aura_ext: Default::default(), - parachain_system: Default::default(), polkadot_xcm: asset_hub_westend_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), + ..Default::default() }, + ..Default::default() }; genesis_config.build_storage().unwrap() @@ -525,6 +626,7 @@ pub mod asset_hub_kusama { code: asset_hub_kusama_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), + ..Default::default() }, balances: asset_hub_kusama_runtime::BalancesConfig { balances: accounts::init_balances() @@ -535,6 +637,7 @@ pub mod asset_hub_kusama { }, parachain_info: asset_hub_kusama_runtime::ParachainInfoConfig { parachain_id: PARA_ID.into(), + ..Default::default() }, collator_selection: asset_hub_kusama_runtime::CollatorSelectionConfig { invulnerables: collators::invulnerables() @@ -557,12 +660,11 @@ pub mod asset_hub_kusama { }) .collect(), }, - aura: Default::default(), - aura_ext: Default::default(), - parachain_system: Default::default(), polkadot_xcm: asset_hub_kusama_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), + ..Default::default() }, + ..Default::default() }; genesis_config.build_storage().unwrap() @@ -581,6 +683,7 @@ pub mod penpal { code: penpal_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), + ..Default::default() }, balances: penpal_runtime::BalancesConfig { balances: accounts::init_balances() @@ -589,7 +692,10 @@ pub mod penpal { .map(|k| (k, ED * 4096)) .collect(), }, - parachain_info: penpal_runtime::ParachainInfoConfig { parachain_id: para_id.into() }, + parachain_info: penpal_runtime::ParachainInfoConfig { + parachain_id: para_id.into(), + ..Default::default() + }, collator_selection: penpal_runtime::CollatorSelectionConfig { invulnerables: collators::invulnerables() .iter() @@ -611,15 +717,14 @@ pub mod penpal { }) .collect(), }, - aura: Default::default(), - aura_ext: Default::default(), - parachain_system: Default::default(), polkadot_xcm: penpal_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), + ..Default::default() }, sudo: penpal_runtime::SudoConfig { key: Some(get_account_id_from_seed::("Alice")), }, + ..Default::default() }; genesis_config.build_storage().unwrap() @@ -638,6 +743,7 @@ pub mod collectives { code: collectives_polkadot_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), + ..Default::default() }, balances: collectives_polkadot_runtime::BalancesConfig { balances: accounts::init_balances() @@ -648,6 +754,7 @@ pub mod collectives { }, parachain_info: collectives_polkadot_runtime::ParachainInfoConfig { parachain_id: PARA_ID.into(), + ..Default::default() }, collator_selection: collectives_polkadot_runtime::CollatorSelectionConfig { invulnerables: collators::invulnerables() @@ -670,22 +777,18 @@ pub mod collectives { }) .collect(), }, - // no need to pass anything to aura, in fact it will panic if we do. Session will take care - // of this. - aura: Default::default(), - aura_ext: Default::default(), - parachain_system: Default::default(), polkadot_xcm: collectives_polkadot_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), + ..Default::default() }, - alliance: Default::default(), - alliance_motion: Default::default(), + ..Default::default() }; genesis_config.build_storage().unwrap() } } +// Bridge Hub Kusama pub mod bridge_hub_kusama { use super::*; pub const PARA_ID: u32 = 1002; @@ -697,6 +800,7 @@ pub mod bridge_hub_kusama { code: bridge_hub_kusama_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), + ..Default::default() }, balances: bridge_hub_kusama_runtime::BalancesConfig { balances: accounts::init_balances() @@ -707,6 +811,7 @@ pub mod bridge_hub_kusama { }, parachain_info: bridge_hub_kusama_runtime::ParachainInfoConfig { parachain_id: PARA_ID.into(), + ..Default::default() }, collator_selection: bridge_hub_kusama_runtime::CollatorSelectionConfig { invulnerables: collators::invulnerables() @@ -729,18 +834,18 @@ pub mod bridge_hub_kusama { }) .collect(), }, - aura: Default::default(), - aura_ext: Default::default(), - parachain_system: Default::default(), polkadot_xcm: bridge_hub_kusama_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), + ..Default::default() }, + ..Default::default() }; genesis_config.build_storage().unwrap() } } +// Bridge Hub Polkadot pub mod bridge_hub_polkadot { use super::*; pub const PARA_ID: u32 = 1002; @@ -752,6 +857,7 @@ pub mod bridge_hub_polkadot { code: bridge_hub_polkadot_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), + ..Default::default() }, balances: bridge_hub_polkadot_runtime::BalancesConfig { balances: accounts::init_balances() @@ -762,6 +868,7 @@ pub mod bridge_hub_polkadot { }, parachain_info: bridge_hub_polkadot_runtime::ParachainInfoConfig { parachain_id: PARA_ID.into(), + ..Default::default() }, collator_selection: bridge_hub_polkadot_runtime::CollatorSelectionConfig { invulnerables: collators::invulnerables() @@ -784,12 +891,84 @@ pub mod bridge_hub_polkadot { }) .collect(), }, - aura: Default::default(), - aura_ext: Default::default(), - parachain_system: Default::default(), polkadot_xcm: bridge_hub_polkadot_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), + ..Default::default() + }, + ..Default::default() + }; + + genesis_config.build_storage().unwrap() + } +} + +// Bridge Hub Rococo & Bridge Hub Wococo +pub mod bridge_hub_rococo { + use super::*; + pub const PARA_ID: u32 = 1013; + pub const ED: Balance = bridge_hub_rococo_runtime::constants::currency::EXISTENTIAL_DEPOSIT; + + pub fn genesis() -> Storage { + let genesis_config = bridge_hub_rococo_runtime::RuntimeGenesisConfig { + system: bridge_hub_rococo_runtime::SystemConfig { + code: bridge_hub_rococo_runtime::WASM_BINARY + .expect("WASM binary was not build, please build it!") + .to_vec(), + ..Default::default() + }, + balances: bridge_hub_rococo_runtime::BalancesConfig { + balances: accounts::init_balances() + .iter() + .cloned() + .map(|k| (k, ED * 4096)) + .collect(), + }, + parachain_info: bridge_hub_rococo_runtime::ParachainInfoConfig { + parachain_id: PARA_ID.into(), + ..Default::default() + }, + collator_selection: bridge_hub_rococo_runtime::CollatorSelectionConfig { + invulnerables: collators::invulnerables() + .iter() + .cloned() + .map(|(acc, _)| acc) + .collect(), + candidacy_bond: ED * 16, + ..Default::default() + }, + session: bridge_hub_rococo_runtime::SessionConfig { + keys: collators::invulnerables() + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + bridge_hub_rococo_runtime::SessionKeys { aura }, // session keys + ) + }) + .collect(), + }, + polkadot_xcm: bridge_hub_rococo_runtime::PolkadotXcmConfig { + safe_xcm_version: Some(SAFE_XCM_VERSION), + ..Default::default() }, + bridge_wococo_grandpa: bridge_hub_rococo_runtime::BridgeWococoGrandpaConfig { + owner: Some(get_account_id_from_seed::("Alice")), + ..Default::default() + }, + bridge_rococo_grandpa: bridge_hub_rococo_runtime::BridgeRococoGrandpaConfig { + owner: Some(get_account_id_from_seed::("Alice")), + ..Default::default() + }, + bridge_rococo_messages: bridge_hub_rococo_runtime::BridgeRococoMessagesConfig { + owner: Some(get_account_id_from_seed::("Alice")), + ..Default::default() + }, + bridge_wococo_messages: bridge_hub_rococo_runtime::BridgeWococoMessagesConfig { + owner: Some(get_account_id_from_seed::("Alice")), + ..Default::default() + }, + ..Default::default() }; genesis_config.build_storage().unwrap() diff --git a/parachains/integration-tests/emulated/common/src/impls.rs b/parachains/integration-tests/emulated/common/src/impls.rs new file mode 100644 index 00000000000..9c4acf4637e --- /dev/null +++ b/parachains/integration-tests/emulated/common/src/impls.rs @@ -0,0 +1,126 @@ +use super::{BridgeHubRococo, BridgeHubWococo}; +use bp_messages::{ + target_chain::{DispatchMessage, DispatchMessageData, MessageDispatch}, + LaneId, MessageKey, OutboundLaneData, +}; +use bridge_runtime_common::messages_xcm_extension::XcmBlobMessageDispatchResult; +use codec::Decode; +pub use cumulus_primitives_core::{DmpMessageHandler, XcmpMessageHandler}; +use pallet_bridge_messages::{Config, Instance1, Instance2, OutboundLanes, Pallet}; +use sp_core::Get; +use xcm_emulator::{BridgeMessage, BridgeMessageDispatchError, BridgeMessageHandler, Parachain}; + +pub struct BridgeHubMessageHandler { + _marker: std::marker::PhantomData<(S, T, I)>, +} + +struct LaneIdWrapper(LaneId); + +impl From for u32 { + fn from(lane_id: LaneIdWrapper) -> u32 { + u32::from_be_bytes(lane_id.0 .0) + } +} + +impl From for LaneIdWrapper { + fn from(id: u32) -> LaneIdWrapper { + LaneIdWrapper(LaneId(id.to_be_bytes())) + } +} + +type BridgeHubRococoRuntime = ::Runtime; +type BridgeHubWococoRuntime = ::Runtime; + +// TODO: uncomment when https://github.com/paritytech/cumulus/pull/2528 is merged +// type BridgeHubPolkadotRuntime = ::Runtime; +// type BridgeHubKusamaRuntime = ::Runtime; + +pub type RococoWococoMessageHandler = + BridgeHubMessageHandler; +pub type WococoRococoMessageHandler = + BridgeHubMessageHandler; + +// TODO: uncomment when https://github.com/paritytech/cumulus/pull/2528 is merged +// pub type PolkadotKusamaMessageHandler +// = BridgeHubMessageHandler; +// pub type KusamaPolkadotMessageHandler +// = BridgeHubMessageHandler; + +impl BridgeMessageHandler for BridgeHubMessageHandler +where + S: Config, + T: Config, + I: 'static, + >::InboundPayload: From>, + >::MessageDispatch: + MessageDispatch, +{ + fn get_source_outbound_messages() -> Vec { + // get the source active outbound lanes + let active_lanes = S::ActiveOutboundLanes::get(); + + let mut messages: Vec = Default::default(); + + // collect messages from `OutboundMessages` for each active outbound lane in the source + for lane in active_lanes { + let latest_generated_nonce = + OutboundLanes::::get(lane).latest_generated_nonce; + let latest_received_nonce = + OutboundLanes::::get(lane).latest_received_nonce; + + (latest_received_nonce + 1..=latest_generated_nonce).for_each(|nonce| { + let encoded_payload: Vec = + Pallet::::outbound_message_data(*lane, nonce) + .expect("Bridge message does not exist") + .into(); + let payload = Vec::::decode(&mut &encoded_payload[..]) + .expect("Decodign XCM message failed"); + let id: u32 = LaneIdWrapper(*lane).into(); + let message = BridgeMessage { id, nonce, payload }; + + messages.push(message); + }); + } + messages + } + + fn dispatch_target_inbound_message( + message: BridgeMessage, + ) -> Result<(), BridgeMessageDispatchError> { + type TargetMessageDispatch = >::MessageDispatch; + type InboundPayload = >::InboundPayload; + + let lane_id = LaneIdWrapper::from(message.id).0; + let nonce = message.nonce; + let payload = Ok(From::from(message.payload)); + + // Directly dispatch outbound messages assuming everything is correct + // and bypassing the `Relayers` and `InboundLane` logic + let dispatch_result = TargetMessageDispatch::::dispatch(DispatchMessage { + key: MessageKey { lane_id, nonce }, + data: DispatchMessageData::> { payload }, + }); + + let result = match dispatch_result.dispatch_level_result { + XcmBlobMessageDispatchResult::Dispatched => Ok(()), + XcmBlobMessageDispatchResult::InvalidPayload => Err(BridgeMessageDispatchError( + Box::new(XcmBlobMessageDispatchResult::InvalidPayload), + )), + XcmBlobMessageDispatchResult::NotDispatched(e) => Err(BridgeMessageDispatchError( + Box::new(XcmBlobMessageDispatchResult::NotDispatched(e)), + )), + }; + result + } + + fn notify_source_message_delivery(lane_id: u32) { + let data = OutboundLanes::::get(LaneIdWrapper::from(lane_id).0); + let new_data = OutboundLaneData { + oldest_unpruned_nonce: data.oldest_unpruned_nonce + 1, + latest_received_nonce: data.latest_received_nonce + 1, + ..data + }; + + OutboundLanes::::insert(LaneIdWrapper::from(lane_id).0, new_data); + } +} diff --git a/parachains/integration-tests/emulated/common/src/lib.rs b/parachains/integration-tests/emulated/common/src/lib.rs index dba3ef7dca3..d88f1ddd3e3 100644 --- a/parachains/integration-tests/emulated/common/src/lib.rs +++ b/parachains/integration-tests/emulated/common/src/lib.rs @@ -1,41 +1,25 @@ pub mod constants; +pub mod impls; pub use constants::{ accounts::{ALICE, BOB}, asset_hub_kusama, asset_hub_polkadot, asset_hub_westend, bridge_hub_kusama, - bridge_hub_polkadot, collectives, kusama, penpal, polkadot, westend, + bridge_hub_polkadot, bridge_hub_rococo, collectives, kusama, penpal, polkadot, rococo, westend, }; +pub use impls::{RococoWococoMessageHandler, WococoRococoMessageHandler}; + use frame_support::{parameter_types, sp_io, sp_tracing}; pub use parachains_common::{AccountId, AssetHubPolkadotAuraId, AuraId, Balance, BlockNumber}; pub use sp_core::{sr25519, storage::Storage, Get}; use xcm::prelude::*; use xcm_emulator::{ - decl_test_networks, decl_test_parachains, decl_test_relay_chains, Parachain, RelayChain, - TestExt, + decl_test_bridges, decl_test_networks, decl_test_parachains, decl_test_relay_chains, + decl_test_sender_receiver_accounts_parameter_types, BridgeMessageHandler, Parachain, + RelayChain, TestExt, }; use xcm_executor::traits::ConvertLocation; decl_test_relay_chains! { - #[api_version(5)] - pub struct Westend { - genesis = westend::genesis(), - on_init = (), - runtime = { - Runtime: westend_runtime::Runtime, - RuntimeOrigin: westend_runtime::RuntimeOrigin, - RuntimeCall: westend_runtime::RuntimeCall, - RuntimeEvent: westend_runtime::RuntimeEvent, - MessageQueue: westend_runtime::MessageQueue, - XcmConfig: westend_runtime::xcm_config::XcmConfig, - SovereignAccountOf: westend_runtime::xcm_config::LocationConverter, //TODO: rename to SovereignAccountOf, - System: westend_runtime::System, - Balances: westend_runtime::Balances, - }, - pallets_extra = { - XcmPallet: westend_runtime::XcmPallet, - Sudo: westend_runtime::Sudo, - } - }, #[api_version(5)] pub struct Polkadot { genesis = polkadot::genesis(), @@ -73,35 +57,71 @@ decl_test_relay_chains! { pallets_extra = { XcmPallet: kusama_runtime::XcmPallet, } - } -} - -decl_test_parachains! { - // Westend - pub struct AssetHubWestend { - genesis = asset_hub_westend::genesis(), + }, + #[api_version(5)] + pub struct Westend { + genesis = westend::genesis(), on_init = (), runtime = { - Runtime: asset_hub_westend_runtime::Runtime, - RuntimeOrigin: asset_hub_westend_runtime::RuntimeOrigin, - RuntimeCall: asset_hub_westend_runtime::RuntimeCall, - RuntimeEvent: asset_hub_westend_runtime::RuntimeEvent, - XcmpMessageHandler: asset_hub_westend_runtime::XcmpQueue, - DmpMessageHandler: asset_hub_westend_runtime::DmpQueue, - LocationToAccountId: asset_hub_westend_runtime::xcm_config::LocationToAccountId, - System: asset_hub_westend_runtime::System, - Balances: asset_hub_westend_runtime::Balances, - ParachainSystem: asset_hub_westend_runtime::ParachainSystem, - ParachainInfo: asset_hub_westend_runtime::ParachainInfo, + Runtime: westend_runtime::Runtime, + RuntimeOrigin: westend_runtime::RuntimeOrigin, + RuntimeCall: westend_runtime::RuntimeCall, + RuntimeEvent: westend_runtime::RuntimeEvent, + MessageQueue: westend_runtime::MessageQueue, + XcmConfig: westend_runtime::xcm_config::XcmConfig, + SovereignAccountOf: westend_runtime::xcm_config::LocationConverter, //TODO: rename to SovereignAccountOf, + System: westend_runtime::System, + Balances: westend_runtime::Balances, }, pallets_extra = { - PolkadotXcm: asset_hub_westend_runtime::PolkadotXcm, - Assets: asset_hub_westend_runtime::Assets, - ForeignAssets: asset_hub_westend_runtime::ForeignAssets, - AssetConversion: asset_hub_westend_runtime::AssetConversion, + XcmPallet: westend_runtime::XcmPallet, + Sudo: westend_runtime::Sudo, + } + }, + #[api_version(5)] + pub struct Rococo { + genesis = rococo::genesis(), + on_init = (), + runtime = { + Runtime: rococo_runtime::Runtime, + RuntimeOrigin: rococo_runtime::RuntimeOrigin, + RuntimeCall: rococo_runtime::RuntimeCall, + RuntimeEvent: rococo_runtime::RuntimeEvent, + MessageQueue: rococo_runtime::MessageQueue, + XcmConfig: rococo_runtime::xcm_config::XcmConfig, + SovereignAccountOf: rococo_runtime::xcm_config::LocationConverter, //TODO: rename to SovereignAccountOf, + System: rococo_runtime::System, + Balances: rococo_runtime::Balances, + }, + pallets_extra = { + XcmPallet: rococo_runtime::XcmPallet, + Sudo: rococo_runtime::Sudo, } }, - // Polkadot + #[api_version(5)] + pub struct Wococo { + genesis = rococo::genesis(), + on_init = (), + runtime = { + Runtime: rococo_runtime::Runtime, + RuntimeOrigin: rococo_runtime::RuntimeOrigin, + RuntimeCall: rococo_runtime::RuntimeCall, + RuntimeEvent: rococo_runtime::RuntimeEvent, + MessageQueue: rococo_runtime::MessageQueue, + XcmConfig: rococo_runtime::xcm_config::XcmConfig, + SovereignAccountOf: rococo_runtime::xcm_config::LocationConverter, //TODO: rename to SovereignAccountOf, + System: rococo_runtime::System, + Balances: rococo_runtime::Balances, + }, + pallets_extra = { + XcmPallet: rococo_runtime::XcmPallet, + Sudo: rococo_runtime::Sudo, + } + } +} + +decl_test_parachains! { + // Polkadot Parachains pub struct AssetHubPolkadot { genesis = asset_hub_polkadot::genesis(), on_init = (), @@ -123,28 +143,47 @@ decl_test_parachains! { Assets: asset_hub_polkadot_runtime::Assets, } }, - pub struct PenpalPolkadot { - genesis = penpal::genesis(penpal::PARA_ID), + pub struct Collectives { + genesis = collectives::genesis(), on_init = (), runtime = { - Runtime: penpal_runtime::Runtime, - RuntimeOrigin: penpal_runtime::RuntimeOrigin, - RuntimeCall: penpal_runtime::RuntimeCall, - RuntimeEvent: penpal_runtime::RuntimeEvent, - XcmpMessageHandler: penpal_runtime::XcmpQueue, - DmpMessageHandler: penpal_runtime::DmpQueue, - LocationToAccountId: penpal_runtime::xcm_config::LocationToAccountId, - System: penpal_runtime::System, - Balances: penpal_runtime::Balances, - ParachainSystem: penpal_runtime::ParachainSystem, - ParachainInfo: penpal_runtime::ParachainInfo, + Runtime: collectives_polkadot_runtime::Runtime, + RuntimeOrigin: collectives_polkadot_runtime::RuntimeOrigin, + RuntimeCall: collectives_polkadot_runtime::RuntimeCall, + RuntimeEvent: collectives_polkadot_runtime::RuntimeEvent, + XcmpMessageHandler: collectives_polkadot_runtime::XcmpQueue, + DmpMessageHandler: collectives_polkadot_runtime::DmpQueue, + LocationToAccountId: collectives_polkadot_runtime::xcm_config::LocationToAccountId, + System: collectives_polkadot_runtime::System, + Balances: collectives_polkadot_runtime::Balances, + ParachainSystem: collectives_polkadot_runtime::ParachainSystem, + ParachainInfo: collectives_polkadot_runtime::ParachainInfo, }, pallets_extra = { - PolkadotXcm: penpal_runtime::PolkadotXcm, - Assets: penpal_runtime::Assets, + PolkadotXcm: collectives_polkadot_runtime::PolkadotXcm, } }, - pub struct PenpalWestend { + pub struct BridgeHubPolkadot { + genesis = bridge_hub_polkadot::genesis(), + on_init = (), + runtime = { + Runtime: bridge_hub_polkadot_runtime::Runtime, + RuntimeOrigin: bridge_hub_polkadot_runtime::RuntimeOrigin, + RuntimeCall: bridge_hub_polkadot_runtime::RuntimeCall, + RuntimeEvent: bridge_hub_polkadot_runtime::RuntimeEvent, + XcmpMessageHandler: bridge_hub_polkadot_runtime::XcmpQueue, + DmpMessageHandler: bridge_hub_polkadot_runtime::DmpQueue, + LocationToAccountId: bridge_hub_polkadot_runtime::xcm_config::LocationToAccountId, + System: bridge_hub_polkadot_runtime::System, + Balances: bridge_hub_polkadot_runtime::Balances, + ParachainSystem: bridge_hub_polkadot_runtime::ParachainSystem, + ParachainInfo: bridge_hub_polkadot_runtime::ParachainInfo, + }, + pallets_extra = { + PolkadotXcm: bridge_hub_polkadot_runtime::PolkadotXcm, + } + }, + pub struct PenpalPolkadot { genesis = penpal::genesis(penpal::PARA_ID), on_init = (), runtime = { @@ -165,8 +204,7 @@ decl_test_parachains! { Assets: penpal_runtime::Assets, } }, - - // Kusama + // Kusama Parachains pub struct AssetHubKusama { genesis = asset_hub_kusama::genesis(), on_init = (), @@ -189,6 +227,26 @@ decl_test_parachains! { ForeignAssets: asset_hub_kusama_runtime::Assets, } }, + pub struct BridgeHubKusama { + genesis = bridge_hub_kusama::genesis(), + on_init = (), + runtime = { + Runtime: bridge_hub_kusama_runtime::Runtime, + RuntimeOrigin: bridge_hub_kusama_runtime::RuntimeOrigin, + RuntimeCall: bridge_hub_kusama_runtime::RuntimeCall, + RuntimeEvent: bridge_hub_kusama_runtime::RuntimeEvent, + XcmpMessageHandler: bridge_hub_kusama_runtime::XcmpQueue, + DmpMessageHandler: bridge_hub_kusama_runtime::DmpQueue, + LocationToAccountId: bridge_hub_kusama_runtime::xcm_config::LocationToAccountId, + System: bridge_hub_kusama_runtime::System, + Balances: bridge_hub_kusama_runtime::Balances, + ParachainSystem: bridge_hub_kusama_runtime::ParachainSystem, + ParachainInfo: bridge_hub_kusama_runtime::ParachainInfo, + }, + pallets_extra = { + PolkadotXcm: bridge_hub_kusama_runtime::PolkadotXcm, + } + }, pub struct PenpalKusama { genesis = penpal::genesis(penpal::PARA_ID), on_init = (), @@ -210,64 +268,133 @@ decl_test_parachains! { Assets: penpal_runtime::Assets, } }, - pub struct Collectives { - genesis = collectives::genesis(), + // Westend Parachains + pub struct AssetHubWestend { + genesis = asset_hub_westend::genesis(), on_init = (), runtime = { - Runtime: collectives_polkadot_runtime::Runtime, - RuntimeOrigin: collectives_polkadot_runtime::RuntimeOrigin, - RuntimeCall: collectives_polkadot_runtime::RuntimeCall, - RuntimeEvent: collectives_polkadot_runtime::RuntimeEvent, - XcmpMessageHandler: collectives_polkadot_runtime::XcmpQueue, - DmpMessageHandler: collectives_polkadot_runtime::DmpQueue, - LocationToAccountId: collectives_polkadot_runtime::xcm_config::LocationToAccountId, - System: collectives_polkadot_runtime::System, - Balances: collectives_polkadot_runtime::Balances, - ParachainSystem: collectives_polkadot_runtime::ParachainSystem, - ParachainInfo: collectives_polkadot_runtime::ParachainInfo, + Runtime: asset_hub_westend_runtime::Runtime, + RuntimeOrigin: asset_hub_westend_runtime::RuntimeOrigin, + RuntimeCall: asset_hub_westend_runtime::RuntimeCall, + RuntimeEvent: asset_hub_westend_runtime::RuntimeEvent, + XcmpMessageHandler: asset_hub_westend_runtime::XcmpQueue, + DmpMessageHandler: asset_hub_westend_runtime::DmpQueue, + LocationToAccountId: asset_hub_westend_runtime::xcm_config::LocationToAccountId, + System: asset_hub_westend_runtime::System, + Balances: asset_hub_westend_runtime::Balances, + ParachainSystem: asset_hub_westend_runtime::ParachainSystem, + ParachainInfo: asset_hub_westend_runtime::ParachainInfo, }, pallets_extra = { - PolkadotXcm: collectives_polkadot_runtime::PolkadotXcm, + PolkadotXcm: asset_hub_westend_runtime::PolkadotXcm, + Assets: asset_hub_westend_runtime::Assets, + ForeignAssets: asset_hub_westend_runtime::ForeignAssets, + AssetConversion: asset_hub_westend_runtime::AssetConversion, } }, - pub struct BHKusama { - genesis = bridge_hub_kusama::genesis(), + pub struct PenpalWestend { + genesis = penpal::genesis(penpal::PARA_ID), on_init = (), runtime = { - Runtime: bridge_hub_kusama_runtime::Runtime, - RuntimeOrigin: bridge_hub_kusama_runtime::RuntimeOrigin, - RuntimeCall: bridge_hub_kusama_runtime::RuntimeCall, - RuntimeEvent: bridge_hub_kusama_runtime::RuntimeEvent, - XcmpMessageHandler: bridge_hub_kusama_runtime::XcmpQueue, - DmpMessageHandler: bridge_hub_kusama_runtime::DmpQueue, - LocationToAccountId: bridge_hub_kusama_runtime::xcm_config::LocationToAccountId, - System: bridge_hub_kusama_runtime::System, - Balances: bridge_hub_kusama_runtime::Balances, - ParachainSystem: bridge_hub_kusama_runtime::ParachainSystem, - ParachainInfo:bridge_hub_kusama_runtime::ParachainInfo, + Runtime: penpal_runtime::Runtime, + RuntimeOrigin: penpal_runtime::RuntimeOrigin, + RuntimeCall: penpal_runtime::RuntimeCall, + RuntimeEvent: penpal_runtime::RuntimeEvent, + XcmpMessageHandler: penpal_runtime::XcmpQueue, + DmpMessageHandler: penpal_runtime::DmpQueue, + LocationToAccountId: penpal_runtime::xcm_config::LocationToAccountId, + System: penpal_runtime::System, + Balances: penpal_runtime::Balances, + ParachainSystem: penpal_runtime::ParachainSystem, + ParachainInfo: penpal_runtime::ParachainInfo, }, pallets_extra = { - PolkadotXcm: bridge_hub_kusama_runtime::PolkadotXcm, + PolkadotXcm: penpal_runtime::PolkadotXcm, + Assets: penpal_runtime::Assets, } }, - pub struct BHPolkadot { - genesis = bridge_hub_polkadot::genesis(), + // Rococo Parachains + pub struct BridgeHubRococo { + genesis = bridge_hub_rococo::genesis(), on_init = (), runtime = { - Runtime: bridge_hub_polkadot_runtime::Runtime, - RuntimeOrigin: bridge_hub_polkadot_runtime::RuntimeOrigin, - RuntimeCall: bridge_hub_polkadot_runtime::RuntimeCall, - RuntimeEvent: bridge_hub_polkadot_runtime::RuntimeEvent, - XcmpMessageHandler: bridge_hub_polkadot_runtime::XcmpQueue, - DmpMessageHandler: bridge_hub_polkadot_runtime::DmpQueue, - LocationToAccountId: bridge_hub_polkadot_runtime::xcm_config::LocationToAccountId, - System: bridge_hub_polkadot_runtime::System, - Balances: bridge_hub_polkadot_runtime::Balances, - ParachainSystem: bridge_hub_polkadot_runtime::ParachainSystem, - ParachainInfo:bridge_hub_polkadot_runtime::ParachainInfo, + Runtime: bridge_hub_rococo_runtime::Runtime, + RuntimeOrigin: bridge_hub_rococo_runtime::RuntimeOrigin, + RuntimeCall: bridge_hub_rococo_runtime::RuntimeCall, + RuntimeEvent: bridge_hub_rococo_runtime::RuntimeEvent, + XcmpMessageHandler: bridge_hub_rococo_runtime::XcmpQueue, + DmpMessageHandler: bridge_hub_rococo_runtime::DmpQueue, + LocationToAccountId: bridge_hub_rococo_runtime::xcm_config::LocationToAccountId, + System: bridge_hub_rococo_runtime::System, + Balances: bridge_hub_rococo_runtime::Balances, + ParachainSystem: bridge_hub_rococo_runtime::ParachainSystem, + ParachainInfo: bridge_hub_rococo_runtime::ParachainInfo, }, pallets_extra = { - PolkadotXcm: bridge_hub_polkadot_runtime::PolkadotXcm, + PolkadotXcm: bridge_hub_rococo_runtime::PolkadotXcm, + } + }, + pub struct AssetHubRococo { + genesis = asset_hub_polkadot::genesis(), + on_init = (), + runtime = { + Runtime: asset_hub_polkadot_runtime::Runtime, + RuntimeOrigin: asset_hub_polkadot_runtime::RuntimeOrigin, + RuntimeCall: asset_hub_polkadot_runtime::RuntimeCall, + RuntimeEvent: asset_hub_polkadot_runtime::RuntimeEvent, + XcmpMessageHandler: asset_hub_polkadot_runtime::XcmpQueue, + DmpMessageHandler: asset_hub_polkadot_runtime::DmpQueue, + LocationToAccountId: asset_hub_polkadot_runtime::xcm_config::LocationToAccountId, + System: asset_hub_polkadot_runtime::System, + Balances: asset_hub_polkadot_runtime::Balances, + ParachainSystem: asset_hub_polkadot_runtime::ParachainSystem, + ParachainInfo: asset_hub_polkadot_runtime::ParachainInfo, + }, + pallets_extra = { + PolkadotXcm: asset_hub_polkadot_runtime::PolkadotXcm, + Assets: asset_hub_polkadot_runtime::Assets, + } + }, + // Wococo Parachains + pub struct BridgeHubWococo { + genesis = bridge_hub_rococo::genesis(), + on_init = (), + runtime = { + Runtime: bridge_hub_rococo_runtime::Runtime, + RuntimeOrigin: bridge_hub_rococo_runtime::RuntimeOrigin, + RuntimeCall: bridge_hub_rococo_runtime::RuntimeCall, + RuntimeEvent: bridge_hub_rococo_runtime::RuntimeEvent, + XcmpMessageHandler: bridge_hub_rococo_runtime::XcmpQueue, + DmpMessageHandler: bridge_hub_rococo_runtime::DmpQueue, + LocationToAccountId: bridge_hub_rococo_runtime::xcm_config::LocationToAccountId, + System: bridge_hub_rococo_runtime::System, + Balances: bridge_hub_rococo_runtime::Balances, + ParachainSystem: bridge_hub_rococo_runtime::ParachainSystem, + ParachainInfo: bridge_hub_rococo_runtime::ParachainInfo, + }, + pallets_extra = { + PolkadotXcm: bridge_hub_rococo_runtime::PolkadotXcm, + } + }, + pub struct AssetHubWococo { + genesis = asset_hub_polkadot::genesis(), + on_init = (), + runtime = { + Runtime: asset_hub_polkadot_runtime::Runtime, + RuntimeOrigin: asset_hub_polkadot_runtime::RuntimeOrigin, + RuntimeCall: asset_hub_polkadot_runtime::RuntimeCall, + RuntimeEvent: asset_hub_polkadot_runtime::RuntimeEvent, + XcmpMessageHandler: asset_hub_polkadot_runtime::XcmpQueue, + DmpMessageHandler: asset_hub_polkadot_runtime::DmpQueue, + LocationToAccountId: asset_hub_polkadot_runtime::xcm_config::LocationToAccountId, + System: asset_hub_polkadot_runtime::System, + Balances: asset_hub_polkadot_runtime::Balances, + ParachainSystem: asset_hub_polkadot_runtime::ParachainSystem, + ParachainInfo: asset_hub_polkadot_runtime::ParachainInfo, + }, + pallets_extra = { + PolkadotXcm: asset_hub_polkadot_runtime::PolkadotXcm, + Assets: asset_hub_polkadot_runtime::Assets, } } } @@ -279,16 +406,22 @@ decl_test_networks! { AssetHubPolkadot, PenpalPolkadot, Collectives, - BHPolkadot, + BridgeHubPolkadot, ], + // TODO: uncomment when https://github.com/paritytech/cumulus/pull/2528 is merged + // bridge = PolkadotKusamaMockBridge + bridge = () }, pub struct KusamaMockNet { relay_chain = Kusama, parachains = vec![ AssetHubKusama, PenpalKusama, - BHKusama, + BridgeHubKusama, ], + // TODO: uncomment when https://github.com/paritytech/cumulus/pull/2528 is merged + // bridge = KusamaPolkadotMockBridge + bridge = () }, pub struct WestendMockNet { relay_chain = Westend, @@ -296,44 +429,72 @@ decl_test_networks! { AssetHubWestend, PenpalWestend, ], + bridge = () + }, + pub struct RococoMockNet { + relay_chain = Rococo, + parachains = vec![ + AssetHubRococo, + BridgeHubRococo, + ], + bridge = RococoWococoMockBridge + }, + pub struct WococoMockNet { + relay_chain = Wococo, + parachains = vec![ + AssetHubWococo, + BridgeHubWococo, + ], + bridge = WococoRococoMockBridge + } +} + +decl_test_bridges! { + pub struct RococoWococoMockBridge { + source = BridgeHubRococo, + target = BridgeHubWococo, + handler = RococoWococoMessageHandler + }, + pub struct WococoRococoMockBridge { + source = BridgeHubWococo, + target = BridgeHubRococo, + handler = WococoRococoMessageHandler } + // TODO: uncomment when https://github.com/paritytech/cumulus/pull/2528 is merged + // pub struct PolkadotKusamaMockBridge { + // source = BridgeHubPolkadot, + // target = BridgeHubKusama, + // handler = PolkadotKusamaMessageHandler + // }, + // pub struct KusamaPolkadotMockBridge { + // source = BridgeHubKusama, + // target = BridgeHubPolkadot, + // handler = KusamaPolkadotMessageHandler + // } } -parameter_types! { - // Polkadot - pub PolkadotSender: AccountId = Polkadot::account_id_of(ALICE); - pub PolkadotReceiver: AccountId = Polkadot::account_id_of(BOB); - // Kusama - pub KusamaSender: AccountId = Kusama::account_id_of(ALICE); - pub KusamaReceiver: AccountId = Kusama::account_id_of(BOB); - // Westend - pub WestendSender: AccountId = Westend::account_id_of(ALICE); - pub WestendReceiver: AccountId = Westend::account_id_of(BOB); - // Asset Hub Westend - pub AssetHubWestendSender: AccountId = AssetHubWestend::account_id_of(ALICE); - pub AssetHubWestendReceiver: AccountId = AssetHubWestend::account_id_of(BOB); - // Asset Hub Polkadot - pub AssetHubPolkadotSender: AccountId = AssetHubPolkadot::account_id_of(ALICE); - pub AssetHubPolkadotReceiver: AccountId = AssetHubPolkadot::account_id_of(BOB); - // Asset Hub Kusama - pub AssetHubKusamaSender: AccountId = AssetHubKusama::account_id_of(ALICE); - pub AssetHubKusamaReceiver: AccountId = AssetHubKusama::account_id_of(BOB); - // Penpal Polkadot - pub PenpalPolkadotSender: AccountId = PenpalPolkadot::account_id_of(ALICE); - pub PenpalPolkadotReceiver: AccountId = PenpalPolkadot::account_id_of(BOB); - // Penpal Kusama - pub PenpalKusamaSender: AccountId = PenpalKusama::account_id_of(ALICE); - pub PenpalKusamaReceiver: AccountId = PenpalKusama::account_id_of(BOB); - // Penpal Westend - pub PenpalWestendSender: AccountId = PenpalWestend::account_id_of(ALICE); - pub PenpalWestendReceiver: AccountId = PenpalWestend::account_id_of(BOB); +decl_test_sender_receiver_accounts_parameter_types! { + // Relays + Polkadot { sender: ALICE, receiver: BOB }, + Kusama { sender: ALICE, receiver: BOB }, + Westend { sender: ALICE, receiver: BOB }, + Rococo { sender: ALICE, receiver: BOB }, + Wococo { sender: ALICE, receiver: BOB }, + // Asset Hubs + AssetHubPolkadot { sender: ALICE, receiver: BOB }, + AssetHubKusama { sender: ALICE, receiver: BOB }, + AssetHubWestend { sender: ALICE, receiver: BOB }, + AssetHubRococo { sender: ALICE, receiver: BOB }, + AssetHubWococo { sender: ALICE, receiver: BOB }, // Collectives - pub CollectivesSender: AccountId = Collectives::account_id_of(ALICE); - pub CollectivesReceiver: AccountId = Collectives::account_id_of(BOB); - // Bridge Hub Polkadot - pub BHPolkadotSender: AccountId = BHPolkadot::account_id_of(ALICE); - pub BHPolkadotReceiver: AccountId = BHPolkadot::account_id_of(BOB); - // Bridge Hub Kusama - pub BHKusamaSender: AccountId = BHKusama::account_id_of(ALICE); - pub BHKusamaReceiver: AccountId = BHKusama::account_id_of(BOB); + Collectives { sender: ALICE, receiver: BOB }, + // Bridged Hubs + BridgeHubPolkadot { sender: ALICE, receiver: BOB }, + BridgeHubKusama { sender: ALICE, receiver: BOB }, + BridgeHubRococo { sender: ALICE, receiver: BOB }, + BridgeHubWococo { sender: ALICE, receiver: BOB }, + // Penpals + PenpalPolkadot { sender: ALICE, receiver: BOB }, + PenpalKusama { sender: ALICE, receiver: BOB }, + PenpalWestend { sender: ALICE, receiver: BOB } } diff --git a/parachains/pallets/parachain-info/Cargo.toml b/parachains/pallets/parachain-info/Cargo.toml index 5d7336969c7..b71bd261af6 100644 --- a/parachains/pallets/parachain-info/Cargo.toml +++ b/parachains/pallets/parachain-info/Cargo.toml @@ -6,11 +6,14 @@ version = "0.1.0" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } 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" } +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } + cumulus-primitives-core = { path = "../../../primitives/core", default-features = false } [features] diff --git a/parachains/pallets/parachain-info/src/lib.rs b/parachains/pallets/parachain-info/src/lib.rs index 1910d6cf241..6a9707365c3 100644 --- a/parachains/pallets/parachain-info/src/lib.rs +++ b/parachains/pallets/parachain-info/src/lib.rs @@ -39,18 +39,20 @@ pub mod pallet { impl Pallet {} #[pallet::genesis_config] - pub struct GenesisConfig { + pub struct GenesisConfig { + #[serde(skip)] + pub _config: sp_std::marker::PhantomData, pub parachain_id: ParaId, } - impl Default for GenesisConfig { + impl Default for GenesisConfig { fn default() -> Self { - Self { parachain_id: 100.into() } + Self { parachain_id: 100.into(), _config: Default::default() } } } #[pallet::genesis_build] - impl GenesisBuild for GenesisConfig { + impl BuildGenesisConfig for GenesisConfig { fn build(&self) { >::put(self.parachain_id); } diff --git a/parachains/pallets/ping/Cargo.toml b/parachains/pallets/ping/Cargo.toml index 4f2a9748b10..d897ecb7a0a 100644 --- a/parachains/pallets/ping/Cargo.toml +++ b/parachains/pallets/ping/Cargo.toml @@ -6,7 +6,7 @@ version = "0.1.0" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.9.0", default-features = false, 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" } diff --git a/parachains/pallets/ping/src/lib.rs b/parachains/pallets/ping/src/lib.rs index 0260f05dad2..7425b5bd52f 100644 --- a/parachains/pallets/ping/src/lib.rs +++ b/parachains/pallets/ping/src/lib.rs @@ -72,7 +72,7 @@ pub mod pallet { /// The sent pings. #[pallet::storage] pub(super) type Pings = - StorageMap<_, Blake2_128Concat, u32, T::BlockNumber, OptionQuery>; + StorageMap<_, Blake2_128Concat, u32, BlockNumberFor, OptionQuery>; #[pallet::event] #[pallet::generate_deposit(pub(super) fn deposit_event)] @@ -80,7 +80,7 @@ pub mod pallet { PingSent(ParaId, u32, Vec, XcmHash, MultiAssets), Pinged(ParaId, u32, Vec), PongSent(ParaId, u32, Vec, XcmHash, MultiAssets), - Ponged(ParaId, u32, Vec, T::BlockNumber), + Ponged(ParaId, u32, Vec, BlockNumberFor), ErrorSendingPing(SendError, ParaId, u32, Vec), ErrorSendingPong(SendError, ParaId, u32, Vec), UnknownPong(ParaId, u32, Vec), @@ -96,7 +96,7 @@ pub mod pallet { #[pallet::hooks] impl Hooks> for Pallet { - fn on_finalize(n: T::BlockNumber) { + fn on_finalize(n: BlockNumberFor) { for (para, payload) in Targets::::get().into_iter() { let seq = PingCount::::mutate(|seq| { *seq += 1; diff --git a/parachains/runtimes/assets/asset-hub-kusama/Cargo.toml b/parachains/runtimes/assets/asset-hub-kusama/Cargo.toml index 3e06ab43bee..97ee646fd73 100644 --- a/parachains/runtimes/assets/asset-hub-kusama/Cargo.toml +++ b/parachains/runtimes/assets/asset-hub-kusama/Cargo.toml @@ -9,8 +9,8 @@ description = "Kusama variant of Asset Hub parachain runtime" codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "max-encoded-len"] } hex-literal = { version = "0.4.1" } log = { version = "0.4.19", default-features = false } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } -smallvec = "1.10.0" +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } +smallvec = "1.11.0" # Substrate frame-benchmarking = { git = "https://github.com/paritytech/substrate", optional = true, default-features = false, branch = "master" } @@ -26,6 +26,7 @@ pallet-aura = { git = "https://github.com/paritytech/substrate", default-feature pallet-authorship = { 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-multisig = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +pallet-nft-fractionalization = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-nfts = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-nfts-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-proxy = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } @@ -99,6 +100,7 @@ runtime-benchmarks = [ "pallet-assets/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "pallet-multisig/runtime-benchmarks", + "pallet-nft-fractionalization/runtime-benchmarks", "pallet-nfts/runtime-benchmarks", "pallet-proxy/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", @@ -131,6 +133,7 @@ try-runtime = [ "pallet-balances/try-runtime", "pallet-collator-selection/try-runtime", "pallet-multisig/try-runtime", + "pallet-nft-fractionalization/try-runtime", "pallet-nfts/try-runtime", "pallet-proxy/try-runtime", "pallet-session/try-runtime", @@ -157,6 +160,7 @@ std = [ "pallet-authorship/std", "pallet-balances/std", "pallet-multisig/std", + "pallet-nft-fractionalization/std", "pallet-nfts/std", "pallet-nfts-runtime-api/std", "pallet-proxy/std", diff --git a/parachains/runtimes/assets/asset-hub-kusama/src/lib.rs b/parachains/runtimes/assets/asset-hub-kusama/src/lib.rs index 385313c31ba..e17ea94686f 100644 --- a/parachains/runtimes/assets/asset-hub-kusama/src/lib.rs +++ b/parachains/runtimes/assets/asset-hub-kusama/src/lib.rs @@ -57,7 +57,7 @@ use frame_support::{ InstanceFilter, }, weights::{ConstantMultiplier, Weight}, - PalletId, RuntimeDebug, + BoundedVec, PalletId, RuntimeDebug, }; use frame_system::{ limits::{BlockLength, BlockWeights}, @@ -67,8 +67,8 @@ use pallet_nfts::PalletFeatures; pub use parachains_common as common; use parachains_common::{ impls::{AssetsToBlockAuthor, DealWithFees}, - opaque, AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, BlockNumber, Hash, Header, - Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, + AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, BlockNumber, Hash, Header, Nonce, + Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION, }; use xcm_config::{ @@ -166,10 +166,9 @@ impl frame_system::Config for Runtime { type RuntimeCall = RuntimeCall; type Lookup = AccountIdLookup; type Nonce = Nonce; - type BlockNumber = BlockNumber; type Hash = Hash; type Hashing = BlakeTwo256; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; type BlockHashCount = BlockHashCount; @@ -216,7 +215,9 @@ impl pallet_balances::Config for Runtime { type ReserveIdentifier = [u8; 8]; type RuntimeHoldReason = RuntimeHoldReason; type FreezeIdentifier = (); - type MaxHolds = ConstU32<0>; + // We allow each account to have holds on it from: + // - `NftFractionalization`: 1 + type MaxHolds = ConstU32<1>; type MaxFreezes = ConstU32<0>; } @@ -400,6 +401,7 @@ impl InstanceFilter for ProxyType { c, RuntimeCall::Balances { .. } | RuntimeCall::Assets { .. } | + RuntimeCall::NftFractionalization { .. } | RuntimeCall::Nfts { .. } | RuntimeCall::Uniques { .. } ), @@ -415,6 +417,7 @@ impl InstanceFilter for ProxyType { RuntimeCall::Assets { .. } | RuntimeCall::Utility { .. } | RuntimeCall::Multisig { .. } | + RuntimeCall::NftFractionalization { .. } | RuntimeCall::Nfts { .. } | RuntimeCall::Uniques { .. } ) }, @@ -429,6 +432,7 @@ impl InstanceFilter for ProxyType { RuntimeCall::Assets(TrustBackedAssetsCall::set_team { .. }) | RuntimeCall::Assets(TrustBackedAssetsCall::set_metadata { .. }) | RuntimeCall::Assets(TrustBackedAssetsCall::clear_metadata { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::set_min_balance { .. }) | RuntimeCall::Nfts(pallet_nfts::Call::create { .. }) | RuntimeCall::Nfts(pallet_nfts::Call::destroy { .. }) | RuntimeCall::Nfts(pallet_nfts::Call::redeposit { .. }) | @@ -455,9 +459,12 @@ impl InstanceFilter for ProxyType { RuntimeCall::Assets(TrustBackedAssetsCall::mint { .. }) | RuntimeCall::Assets(TrustBackedAssetsCall::burn { .. }) | RuntimeCall::Assets(TrustBackedAssetsCall::freeze { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::block { .. }) | RuntimeCall::Assets(TrustBackedAssetsCall::thaw { .. }) | RuntimeCall::Assets(TrustBackedAssetsCall::freeze_asset { .. }) | RuntimeCall::Assets(TrustBackedAssetsCall::thaw_asset { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::touch_other { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::refund_other { .. }) | RuntimeCall::Nfts(pallet_nfts::Call::force_mint { .. }) | RuntimeCall::Nfts(pallet_nfts::Call::update_mint_settings { .. }) | RuntimeCall::Nfts(pallet_nfts::Call::mint_pre_signed { .. }) | @@ -590,10 +597,7 @@ impl pallet_aura::Config for Runtime { parameter_types! { pub const PotId: PalletId = PalletId(*b"PotStake"); - pub const MaxCandidates: u32 = 1000; - pub const MinCandidates: u32 = 5; pub const SessionLength: BlockNumber = 6 * HOURS; - pub const MaxInvulnerables: u32 = 100; // StakingAdmin pluralistic body. pub const StakingAdminBodyId: BodyId = BodyId::Defense; } @@ -609,9 +613,9 @@ impl pallet_collator_selection::Config for Runtime { type Currency = Balances; type UpdateOrigin = CollatorSelectionUpdateOrigin; type PotId = PotId; - type MaxCandidates = MaxCandidates; - type MinCandidates = MinCandidates; - type MaxInvulnerables = MaxInvulnerables; + type MaxCandidates = ConstU32<100>; + type MinEligibleCollators = ConstU32<4>; + type MaxInvulnerables = ConstU32<20>; // should be a multiple of session or things will get inconsistent type KickThreshold = Period; type ValidatorId = ::AccountId; @@ -663,6 +667,32 @@ impl pallet_uniques::Config for Runtime { type Locker = (); } +parameter_types! { + pub const NftFractionalizationPalletId: PalletId = PalletId(*b"fraction"); + pub NewAssetSymbol: BoundedVec = (*b"FRAC").to_vec().try_into().unwrap(); + pub NewAssetName: BoundedVec = (*b"Frac").to_vec().try_into().unwrap(); +} + +impl pallet_nft_fractionalization::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Deposit = AssetDeposit; + type Currency = Balances; + type NewAssetSymbol = NewAssetSymbol; + type NewAssetName = NewAssetName; + type StringLimit = AssetsStringLimit; + type NftCollectionId = ::CollectionId; + type NftId = ::ItemId; + type AssetBalance = ::Balance; + type AssetId = >::AssetId; + type Assets = Assets; + type Nfts = Nfts; + type PalletId = NftFractionalizationPalletId; + type WeightInfo = pallet_nft_fractionalization::weights::SubstrateWeight; + type RuntimeHoldReason = RuntimeHoldReason; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = (); +} + parameter_types! { pub NftsPalletFeatures: PalletFeatures = PalletFeatures::all_enabled(); pub const NftsMaxDeadlineDuration: BlockNumber = 12 * 30 * DAYS; @@ -705,19 +735,16 @@ impl pallet_nfts::Config for Runtime { // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( - pub enum Runtime where - Block = Block, - NodeBlock = opaque::Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Runtime { // System support stuff. - System: frame_system::{Pallet, Call, Config, Storage, Event} = 0, + System: frame_system::{Pallet, Call, Config, Storage, Event} = 0, ParachainSystem: cumulus_pallet_parachain_system::{ - Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, + Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, } = 1, // RandomnessCollectiveFlip = 2 removed Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 3, - ParachainInfo: parachain_info::{Pallet, Storage, Config} = 4, + ParachainInfo: parachain_info::{Pallet, Storage, Config} = 4, // Monetary stuff. Balances: pallet_balances::{Pallet, Call, Storage, Config, Event} = 10, @@ -729,11 +756,11 @@ construct_runtime!( CollatorSelection: pallet_collator_selection::{Pallet, Call, Storage, Event, Config} = 21, Session: pallet_session::{Pallet, Call, Storage, Event, Config} = 22, Aura: pallet_aura::{Pallet, Storage, Config} = 23, - AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 24, + AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 24, // XCM helpers. XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event} = 30, - PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event, Origin, Config} = 31, + PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event, Origin, Config} = 31, CumulusXcm: cumulus_pallet_xcm::{Pallet, Event, Origin} = 32, DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event} = 33, @@ -747,6 +774,7 @@ construct_runtime!( Uniques: pallet_uniques::{Pallet, Call, Storage, Event} = 51, Nfts: pallet_nfts::{Pallet, Call, Storage, Event} = 52, ForeignAssets: pallet_assets::::{Pallet, Call, Storage, Event} = 53, + NftFractionalization: pallet_nft_fractionalization::{Pallet, Call, Storage, Event, HoldReason} = 54, #[cfg(feature = "state-trie-version-1")] StateTrieMigration: pallet_state_trie_migration = 70, @@ -802,6 +830,7 @@ mod benches { [pallet_assets, Foreign] [pallet_balances, Balances] [pallet_multisig, Multisig] + [pallet_nft_fractionalization, NftFractionalization] [pallet_nfts, Nfts] [pallet_proxy, Proxy] [pallet_session, SessionBench::] diff --git a/parachains/runtimes/assets/asset-hub-kusama/src/weights/mod.rs b/parachains/runtimes/assets/asset-hub-kusama/src/weights/mod.rs index 2cf514a5598..6948d2b6d53 100644 --- a/parachains/runtimes/assets/asset-hub-kusama/src/weights/mod.rs +++ b/parachains/runtimes/assets/asset-hub-kusama/src/weights/mod.rs @@ -7,6 +7,7 @@ pub mod pallet_assets_local; pub mod pallet_balances; pub mod pallet_collator_selection; pub mod pallet_multisig; +pub mod pallet_nft_fractionalization; pub mod pallet_nfts; pub mod pallet_proxy; pub mod pallet_session; diff --git a/parachains/runtimes/assets/asset-hub-kusama/src/weights/pallet_collator_selection.rs b/parachains/runtimes/assets/asset-hub-kusama/src/weights/pallet_collator_selection.rs index bac78a8d37b..910dce813f7 100644 --- a/parachains/runtimes/assets/asset-hub-kusama/src/weights/pallet_collator_selection.rs +++ b/parachains/runtimes/assets/asset-hub-kusama/src/weights/pallet_collator_selection.rs @@ -147,23 +147,31 @@ impl pallet_collator_selection::WeightInfo for WeightIn .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(4)) } - /// Storage: CollatorSelection Invulnerables (r:1 w:1) - /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) /// Storage: Session NextKeys (r:1 w:0) /// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured) - /// The range of component `b` is `[1, 99]`. - fn add_invulnerable(b: u32, ) -> Weight { + /// Storage: CollatorSelection Invulnerables (r:1 w:1) + /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(641), added: 1136, mode: MaxEncodedLen) + /// Storage: CollatorSelection Candidates (r:1 w:1) + /// Proof: CollatorSelection Candidates (max_values: Some(1), max_size: Some(4802), added: 5297, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// The range of component `b` is `[1, 19]`. + /// The range of component `c` is `[1, 99]`. + fn add_invulnerable(b: u32, c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `581 + b * (37 ±0)` - // Estimated: `4687 + b * (37 ±0)` - // Minimum execution time: 269_126_000 picoseconds. - Weight::from_parts(286_711_880, 0) - .saturating_add(Weight::from_parts(0, 4687)) - // Standard Error: 22_887 - .saturating_add(Weight::from_parts(813_399, 0).saturating_mul(b.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `757 + b * (32 ±0) + c * (53 ±0)` + // Estimated: `6287 + b * (37 ±0) + c * (53 ±0)` + // Minimum execution time: 52_720_000 picoseconds. + Weight::from_parts(56_102_459, 0) + .saturating_add(Weight::from_parts(0, 6287)) + // Standard Error: 12_957 + .saturating_add(Weight::from_parts(26_422, 0).saturating_mul(b.into())) + // Standard Error: 2_456 + .saturating_add(Weight::from_parts(128_528, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 37).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(0, 53).saturating_mul(c.into())) } /// Storage: CollatorSelection Invulnerables (r:1 w:1) /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) diff --git a/parachains/runtimes/assets/asset-hub-kusama/src/weights/pallet_nft_fractionalization.rs b/parachains/runtimes/assets/asset-hub-kusama/src/weights/pallet_nft_fractionalization.rs new file mode 100644 index 00000000000..4a678eff37f --- /dev/null +++ b/parachains/runtimes/assets/asset-hub-kusama/src/weights/pallet_nft_fractionalization.rs @@ -0,0 +1,113 @@ +// Copyright 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 . + +//! Autogenerated weights for `pallet_nft_fractionalization` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-05-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `bm6`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("asset-hub-kusama-dev"), DB CACHE: 1024 + +// Executed Command: +// ./artifacts/polkadot-parachain +// benchmark +// pallet +// --chain=asset-hub-kusama-dev +// --execution=wasm +// --wasm-execution=compiled +// --pallet=pallet_nft_fractionalization +// --extrinsic=* +// --steps=50 +// --repeat=20 +// --json +// --header=./file_header.txt +// --output=./parachains/runtimes/assets/asset-hub-kusama/src/weights/pallet_nft_fractionalization.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_nft_fractionalization`. +pub struct WeightInfo(PhantomData); +impl pallet_nft_fractionalization::WeightInfo for WeightInfo { + /// Storage: Nfts Item (r:1 w:0) + /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) + /// Storage: Balances Holds (r:1 w:1) + /// Proof: Balances Holds (max_values: None, max_size: Some(66), added: 2541, mode: MaxEncodedLen) + /// Storage: Nfts Collection (r:1 w:1) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts Attribute (r:1 w:1) + /// Proof: Nfts Attribute (max_values: None, max_size: Some(479), added: 2954, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// Storage: Assets Metadata (r:1 w:1) + /// Proof: Assets Metadata (max_values: None, max_size: Some(140), added: 2615, mode: MaxEncodedLen) + /// Storage: NftFractionalization NftToAsset (r:0 w:1) + /// Proof: NftFractionalization NftToAsset (max_values: None, max_size: Some(92), added: 2567, mode: MaxEncodedLen) + fn fractionalize() -> Weight { + // Proof Size summary in bytes: + // Measured: `462` + // Estimated: `4326` + // Minimum execution time: 167_532_000 picoseconds. + Weight::from_parts(168_850_000, 0) + .saturating_add(Weight::from_parts(0, 4326)) + .saturating_add(T::DbWeight::get().reads(8)) + .saturating_add(T::DbWeight::get().writes(8)) + } + /// Storage: NftFractionalization NftToAsset (r:1 w:1) + /// Proof: NftFractionalization NftToAsset (max_values: None, max_size: Some(92), added: 2567, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Nfts Attribute (r:1 w:1) + /// Proof: Nfts Attribute (max_values: None, max_size: Some(479), added: 2954, mode: MaxEncodedLen) + /// Storage: Nfts Collection (r:1 w:1) + /// Proof: Nfts Collection (max_values: None, max_size: Some(84), added: 2559, mode: MaxEncodedLen) + /// Storage: Nfts CollectionConfigOf (r:1 w:0) + /// Proof: Nfts CollectionConfigOf (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + /// Storage: Nfts ItemConfigOf (r:1 w:0) + /// Proof: Nfts ItemConfigOf (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen) + /// Storage: Nfts Item (r:1 w:1) + /// Proof: Nfts Item (max_values: None, max_size: Some(861), added: 3336, mode: MaxEncodedLen) + /// Storage: Balances Holds (r:1 w:1) + /// Proof: Balances Holds (max_values: None, max_size: Some(66), added: 2541, mode: MaxEncodedLen) + /// Storage: Nfts Account (r:0 w:1) + /// Proof: Nfts Account (max_values: None, max_size: Some(88), added: 2563, mode: MaxEncodedLen) + /// Storage: Nfts ItemPriceOf (r:0 w:1) + /// Proof: Nfts ItemPriceOf (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen) + /// Storage: Nfts PendingSwapOf (r:0 w:1) + /// Proof: Nfts PendingSwapOf (max_values: None, max_size: Some(71), added: 2546, mode: MaxEncodedLen) + fn unify() -> Weight { + // Proof Size summary in bytes: + // Measured: `1274` + // Estimated: `4326` + // Minimum execution time: 122_877_000 picoseconds. + Weight::from_parts(124_095_000, 0) + .saturating_add(Weight::from_parts(0, 4326)) + .saturating_add(T::DbWeight::get().reads(9)) + .saturating_add(T::DbWeight::get().writes(10)) + } +} diff --git a/parachains/runtimes/assets/asset-hub-kusama/src/xcm_config.rs b/parachains/runtimes/assets/asset-hub-kusama/src/xcm_config.rs index 49fd807b6f4..2cba64dcb9c 100644 --- a/parachains/runtimes/assets/asset-hub-kusama/src/xcm_config.rs +++ b/parachains/runtimes/assets/asset-hub-kusama/src/xcm_config.rs @@ -274,6 +274,9 @@ impl Contains for SafeCallFilter { pallet_assets::Call::transfer_approved { .. } | pallet_assets::Call::touch { .. } | pallet_assets::Call::refund { .. }, + ) | RuntimeCall::NftFractionalization( + pallet_nft_fractionalization::Call::fractionalize { .. } | + pallet_nft_fractionalization::Call::unify { .. }, ) | RuntimeCall::Nfts( pallet_nfts::Call::create { .. } | pallet_nfts::Call::force_create { .. } | diff --git a/parachains/runtimes/assets/asset-hub-polkadot/Cargo.toml b/parachains/runtimes/assets/asset-hub-polkadot/Cargo.toml index 5e62fa35db9..0856fe9b1ca 100644 --- a/parachains/runtimes/assets/asset-hub-polkadot/Cargo.toml +++ b/parachains/runtimes/assets/asset-hub-polkadot/Cargo.toml @@ -9,8 +9,8 @@ description = "Asset Hub Polkadot parachain runtime" codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "max-encoded-len"] } hex-literal = { version = "0.4.1", optional = true } log = { version = "0.4.19", default-features = false } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } -smallvec = "1.10.0" +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } +smallvec = "1.11.0" # Substrate frame-benchmarking = { git = "https://github.com/paritytech/substrate", optional = true, default-features = false, branch = "master" } diff --git a/parachains/runtimes/assets/asset-hub-polkadot/src/lib.rs b/parachains/runtimes/assets/asset-hub-polkadot/src/lib.rs index af36926e5c1..4f1e80cdc0d 100644 --- a/parachains/runtimes/assets/asset-hub-polkadot/src/lib.rs +++ b/parachains/runtimes/assets/asset-hub-polkadot/src/lib.rs @@ -102,9 +102,9 @@ use pallet_nfts::PalletFeatures; pub use parachains_common as common; use parachains_common::{ impls::{AssetsToBlockAuthor, DealWithFees}, - opaque, AccountId, AssetHubPolkadotAuraId as AuraId, AssetIdForTrustBackedAssets, Balance, - BlockNumber, Hash, Header, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, - MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION, + AccountId, AssetHubPolkadotAuraId as AuraId, AssetIdForTrustBackedAssets, Balance, BlockNumber, + Hash, Header, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, + NORMAL_DISPATCH_RATIO, SLOT_DURATION, }; use xcm_config::{ DotLocation, FellowshipLocation, ForeignAssetsConvertedConcreteId, GovernanceLocation, @@ -184,10 +184,9 @@ impl frame_system::Config for Runtime { type RuntimeCall = RuntimeCall; type Lookup = AccountIdLookup; type Nonce = Nonce; - type BlockNumber = BlockNumber; type Hash = Hash; type Hashing = BlakeTwo256; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; type BlockHashCount = BlockHashCount; @@ -446,6 +445,7 @@ impl InstanceFilter for ProxyType { RuntimeCall::Assets(TrustBackedAssetsCall::set_team { .. }) | RuntimeCall::Assets(TrustBackedAssetsCall::set_metadata { .. }) | RuntimeCall::Assets(TrustBackedAssetsCall::clear_metadata { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::set_min_balance { .. }) | RuntimeCall::Nfts(pallet_nfts::Call::create { .. }) | RuntimeCall::Nfts(pallet_nfts::Call::destroy { .. }) | RuntimeCall::Nfts(pallet_nfts::Call::redeposit { .. }) | @@ -472,9 +472,12 @@ impl InstanceFilter for ProxyType { RuntimeCall::Assets(TrustBackedAssetsCall::mint { .. }) | RuntimeCall::Assets(TrustBackedAssetsCall::burn { .. }) | RuntimeCall::Assets(TrustBackedAssetsCall::freeze { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::block { .. }) | RuntimeCall::Assets(TrustBackedAssetsCall::thaw { .. }) | RuntimeCall::Assets(TrustBackedAssetsCall::freeze_asset { .. }) | RuntimeCall::Assets(TrustBackedAssetsCall::thaw_asset { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::touch_other { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::refund_other { .. }) | RuntimeCall::Nfts(pallet_nfts::Call::force_mint { .. }) | RuntimeCall::Nfts(pallet_nfts::Call::update_mint_settings { .. }) | RuntimeCall::Nfts(pallet_nfts::Call::mint_pre_signed { .. }) | @@ -607,10 +610,7 @@ impl pallet_aura::Config for Runtime { parameter_types! { pub const PotId: PalletId = PalletId(*b"PotStake"); - pub const MaxCandidates: u32 = 1000; - pub const MinCandidates: u32 = 5; pub const SessionLength: BlockNumber = 6 * HOURS; - pub const MaxInvulnerables: u32 = 100; // `StakingAdmin` pluralistic body. pub const StakingAdminBodyId: BodyId = BodyId::Defense; } @@ -626,9 +626,9 @@ impl pallet_collator_selection::Config for Runtime { type Currency = Balances; type UpdateOrigin = CollatorSelectionUpdateOrigin; type PotId = PotId; - type MaxCandidates = MaxCandidates; - type MinCandidates = MinCandidates; - type MaxInvulnerables = MaxInvulnerables; + type MaxCandidates = ConstU32<100>; + type MinEligibleCollators = ConstU32<4>; + type MaxInvulnerables = ConstU32<20>; // should be a multiple of session or things will get inconsistent type KickThreshold = Period; type ValidatorId = ::AccountId; @@ -722,19 +722,16 @@ impl pallet_nfts::Config for Runtime { // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( - pub enum Runtime where - Block = Block, - NodeBlock = opaque::Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Runtime { // System support stuff. - System: frame_system::{Pallet, Call, Config, Storage, Event} = 0, + System: frame_system::{Pallet, Call, Config, Storage, Event} = 0, ParachainSystem: cumulus_pallet_parachain_system::{ - Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, + Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, } = 1, // RandomnessCollectiveFlip = 2 removed Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 3, - ParachainInfo: parachain_info::{Pallet, Storage, Config} = 4, + ParachainInfo: parachain_info::{Pallet, Storage, Config} = 4, // Monetary stuff. Balances: pallet_balances::{Pallet, Call, Storage, Config, Event} = 10, @@ -746,11 +743,11 @@ construct_runtime!( CollatorSelection: pallet_collator_selection::{Pallet, Call, Storage, Event, Config} = 21, Session: pallet_session::{Pallet, Call, Storage, Event, Config} = 22, Aura: pallet_aura::{Pallet, Storage, Config} = 23, - AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 24, + AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 24, // XCM helpers. XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event} = 30, - PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event, Origin, Config} = 31, + PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event, Origin, Config} = 31, CumulusXcm: cumulus_pallet_xcm::{Pallet, Event, Origin} = 32, DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event} = 33, diff --git a/parachains/runtimes/assets/asset-hub-polkadot/src/weights/pallet_collator_selection.rs b/parachains/runtimes/assets/asset-hub-polkadot/src/weights/pallet_collator_selection.rs index f26fd83b17b..c82a6342585 100644 --- a/parachains/runtimes/assets/asset-hub-polkadot/src/weights/pallet_collator_selection.rs +++ b/parachains/runtimes/assets/asset-hub-polkadot/src/weights/pallet_collator_selection.rs @@ -147,23 +147,31 @@ impl pallet_collator_selection::WeightInfo for WeightIn .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(4)) } - /// Storage: CollatorSelection Invulnerables (r:1 w:1) - /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) /// Storage: Session NextKeys (r:1 w:0) /// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured) - /// The range of component `b` is `[1, 99]`. - fn add_invulnerable(b: u32, ) -> Weight { + /// Storage: CollatorSelection Invulnerables (r:1 w:1) + /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(641), added: 1136, mode: MaxEncodedLen) + /// Storage: CollatorSelection Candidates (r:1 w:1) + /// Proof: CollatorSelection Candidates (max_values: Some(1), max_size: Some(4802), added: 5297, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// The range of component `b` is `[1, 19]`. + /// The range of component `c` is `[1, 99]`. + fn add_invulnerable(b: u32, c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `581 + b * (37 ±0)` - // Estimated: `4687 + b * (37 ±0)` - // Minimum execution time: 269_126_000 picoseconds. - Weight::from_parts(286_711_880, 0) - .saturating_add(Weight::from_parts(0, 4687)) - // Standard Error: 22_887 - .saturating_add(Weight::from_parts(813_399, 0).saturating_mul(b.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `757 + b * (32 ±0) + c * (53 ±0)` + // Estimated: `6287 + b * (37 ±0) + c * (53 ±0)` + // Minimum execution time: 52_720_000 picoseconds. + Weight::from_parts(56_102_459, 0) + .saturating_add(Weight::from_parts(0, 6287)) + // Standard Error: 12_957 + .saturating_add(Weight::from_parts(26_422, 0).saturating_mul(b.into())) + // Standard Error: 2_456 + .saturating_add(Weight::from_parts(128_528, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 37).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(0, 53).saturating_mul(c.into())) } /// Storage: CollatorSelection Invulnerables (r:1 w:1) /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) diff --git a/parachains/runtimes/assets/asset-hub-westend/Cargo.toml b/parachains/runtimes/assets/asset-hub-westend/Cargo.toml index 4ea285f5c3e..ff9e6b9ded6 100644 --- a/parachains/runtimes/assets/asset-hub-westend/Cargo.toml +++ b/parachains/runtimes/assets/asset-hub-westend/Cargo.toml @@ -9,8 +9,8 @@ description = "Westend variant of Asset Hub parachain runtime" codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "max-encoded-len"] } hex-literal = { version = "0.4.1", optional = true } log = { version = "0.4.19", default-features = false } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } -smallvec = "1.10.0" +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } +smallvec = "1.11.0" # Substrate frame-benchmarking = { git = "https://github.com/paritytech/substrate", optional = true, default-features = false, branch = "master" } diff --git a/parachains/runtimes/assets/asset-hub-westend/src/lib.rs b/parachains/runtimes/assets/asset-hub-westend/src/lib.rs index 1cdef204cb4..204179f4a9d 100644 --- a/parachains/runtimes/assets/asset-hub-westend/src/lib.rs +++ b/parachains/runtimes/assets/asset-hub-westend/src/lib.rs @@ -52,9 +52,9 @@ use pallet_asset_conversion_tx_payment::AssetConversionAdapter; use pallet_nfts::PalletFeatures; pub use parachains_common as common; use parachains_common::{ - impls::DealWithFees, opaque, AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, - BlockNumber, Hash, Header, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, - MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION, + impls::DealWithFees, AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, BlockNumber, + Hash, Header, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, + NORMAL_DISPATCH_RATIO, SLOT_DURATION, }; use sp_api::impl_runtime_apis; use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; @@ -148,10 +148,9 @@ impl frame_system::Config for Runtime { type RuntimeCall = RuntimeCall; type Lookup = AccountIdLookup; type Nonce = Nonce; - type BlockNumber = BlockNumber; type Hash = Hash; type Hashing = BlakeTwo256; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; type BlockHashCount = BlockHashCount; @@ -198,6 +197,8 @@ impl pallet_balances::Config for Runtime { type ReserveIdentifier = [u8; 8]; type RuntimeHoldReason = RuntimeHoldReason; type FreezeIdentifier = (); + // We allow each account to have holds on it from: + // - `NftFractionalization`: 1 type MaxHolds = ConstU32<1>; type MaxFreezes = ConstU32<0>; } @@ -478,6 +479,7 @@ impl InstanceFilter for ProxyType { RuntimeCall::Assets(TrustBackedAssetsCall::set_team { .. }) | RuntimeCall::Assets(TrustBackedAssetsCall::set_metadata { .. }) | RuntimeCall::Assets(TrustBackedAssetsCall::clear_metadata { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::set_min_balance { .. }) | RuntimeCall::Nfts(pallet_nfts::Call::create { .. }) | RuntimeCall::Nfts(pallet_nfts::Call::destroy { .. }) | RuntimeCall::Nfts(pallet_nfts::Call::redeposit { .. }) | @@ -504,9 +506,12 @@ impl InstanceFilter for ProxyType { RuntimeCall::Assets(TrustBackedAssetsCall::mint { .. }) | RuntimeCall::Assets(TrustBackedAssetsCall::burn { .. }) | RuntimeCall::Assets(TrustBackedAssetsCall::freeze { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::block { .. }) | RuntimeCall::Assets(TrustBackedAssetsCall::thaw { .. }) | RuntimeCall::Assets(TrustBackedAssetsCall::freeze_asset { .. }) | RuntimeCall::Assets(TrustBackedAssetsCall::thaw_asset { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::touch_other { .. }) | + RuntimeCall::Assets(TrustBackedAssetsCall::refund_other { .. }) | RuntimeCall::Nfts(pallet_nfts::Call::force_mint { .. }) | RuntimeCall::Nfts(pallet_nfts::Call::update_mint_settings { .. }) | RuntimeCall::Nfts(pallet_nfts::Call::mint_pre_signed { .. }) | @@ -631,10 +636,7 @@ impl pallet_aura::Config for Runtime { parameter_types! { pub const PotId: PalletId = PalletId(*b"PotStake"); - pub const MaxCandidates: u32 = 1000; - pub const MinCandidates: u32 = 1; pub const SessionLength: BlockNumber = 6 * HOURS; - pub const MaxInvulnerables: u32 = 100; } pub type CollatorSelectionUpdateOrigin = EnsureRoot; @@ -644,9 +646,9 @@ impl pallet_collator_selection::Config for Runtime { type Currency = Balances; type UpdateOrigin = CollatorSelectionUpdateOrigin; type PotId = PotId; - type MaxCandidates = MaxCandidates; - type MinCandidates = MinCandidates; - type MaxInvulnerables = MaxInvulnerables; + type MaxCandidates = ConstU32<100>; + type MinEligibleCollators = ConstU32<4>; + type MaxInvulnerables = ConstU32<20>; // should be a multiple of session or things will get inconsistent type KickThreshold = Period; type ValidatorId = ::AccountId; @@ -758,19 +760,16 @@ impl pallet_nfts::Config for Runtime { // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( - pub enum Runtime where - Block = Block, - NodeBlock = opaque::Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Runtime { // System support stuff. - System: frame_system::{Pallet, Call, Config, Storage, Event} = 0, + System: frame_system::{Pallet, Call, Config, Storage, Event} = 0, ParachainSystem: cumulus_pallet_parachain_system::{ - Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, + Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, } = 1, // RandomnessCollectiveFlip = 2 removed Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 3, - ParachainInfo: parachain_info::{Pallet, Storage, Config} = 4, + ParachainInfo: parachain_info::{Pallet, Storage, Config} = 4, // Monetary stuff. Balances: pallet_balances::{Pallet, Call, Storage, Config, Event} = 10, @@ -783,11 +782,11 @@ construct_runtime!( CollatorSelection: pallet_collator_selection::{Pallet, Call, Storage, Event, Config} = 21, Session: pallet_session::{Pallet, Call, Storage, Event, Config} = 22, Aura: pallet_aura::{Pallet, Storage, Config} = 23, - AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 24, + AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 24, // XCM helpers. XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event} = 30, - PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event, Origin, Config} = 31, + PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event, Origin, Config} = 31, CumulusXcm: cumulus_pallet_xcm::{Pallet, Event, Origin} = 32, DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event} = 33, @@ -858,7 +857,7 @@ mod benches { [frame_system, SystemBench::] [pallet_assets, Local] [pallet_assets, Foreign] - [pallet_assets, PoolAssets] + [pallet_assets, Pool] [pallet_asset_conversion, AssetConversion] [pallet_balances, Balances] [pallet_multisig, Multisig] diff --git a/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_collator_selection.rs b/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_collator_selection.rs index 07466709885..9ff6de553e8 100644 --- a/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_collator_selection.rs +++ b/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_collator_selection.rs @@ -147,23 +147,31 @@ impl pallet_collator_selection::WeightInfo for WeightIn .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(4)) } - /// Storage: CollatorSelection Invulnerables (r:1 w:1) - /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) /// Storage: Session NextKeys (r:1 w:0) /// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured) - /// The range of component `b` is `[1, 99]`. - fn add_invulnerable(b: u32, ) -> Weight { + /// Storage: CollatorSelection Invulnerables (r:1 w:1) + /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(641), added: 1136, mode: MaxEncodedLen) + /// Storage: CollatorSelection Candidates (r:1 w:1) + /// Proof: CollatorSelection Candidates (max_values: Some(1), max_size: Some(4802), added: 5297, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// The range of component `b` is `[1, 19]`. + /// The range of component `c` is `[1, 99]`. + fn add_invulnerable(b: u32, c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `581 + b * (37 ±0)` - // Estimated: `4687 + b * (37 ±0)` - // Minimum execution time: 269_126_000 picoseconds. - Weight::from_parts(286_711_880, 0) - .saturating_add(Weight::from_parts(0, 4687)) - // Standard Error: 22_887 - .saturating_add(Weight::from_parts(813_399, 0).saturating_mul(b.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `757 + b * (32 ±0) + c * (53 ±0)` + // Estimated: `6287 + b * (37 ±0) + c * (53 ±0)` + // Minimum execution time: 52_720_000 picoseconds. + Weight::from_parts(56_102_459, 0) + .saturating_add(Weight::from_parts(0, 6287)) + // Standard Error: 12_957 + .saturating_add(Weight::from_parts(26_422, 0).saturating_mul(b.into())) + // Standard Error: 2_456 + .saturating_add(Weight::from_parts(128_528, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 37).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(0, 53).saturating_mul(c.into())) } /// Storage: CollatorSelection Invulnerables (r:1 w:1) /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) diff --git a/parachains/runtimes/assets/common/Cargo.toml b/parachains/runtimes/assets/common/Cargo.toml index f60aa037174..79937ec4363 100644 --- a/parachains/runtimes/assets/common/Cargo.toml +++ b/parachains/runtimes/assets/common/Cargo.toml @@ -7,7 +7,7 @@ description = "Assets common utilities" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } log = { version = "0.4.19", default-features = false } # Substrate diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/Cargo.toml b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/Cargo.toml index a969812c026..d9368351083 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/Cargo.toml +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/Cargo.toml @@ -12,9 +12,9 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } hex-literal = { version = "0.4.1" } log = { version = "0.4.19", default-features = false } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.164", optional = true, features = ["derive"] } -smallvec = "1.8.1" +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } +serde = { version = "1.0.171", optional = true, features = ["derive"] } +smallvec = "1.11.0" # Substrate frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "master" } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs index b48d47ff8ed..e7c8216e644 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs @@ -69,7 +69,7 @@ use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate}; use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; use parachains_common::{ - impls::DealWithFees, opaque, AccountId, Balance, BlockNumber, Hash, Header, Nonce, Signature, + impls::DealWithFees, AccountId, Balance, BlockNumber, Hash, Header, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION, }; @@ -181,14 +181,12 @@ impl frame_system::Config for Runtime { type Lookup = AccountIdLookup; /// The index type for storing how many extrinsics an account has signed. type Nonce = Nonce; - /// 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 block type. + type Block = Block; /// The ubiquitous event type. type RuntimeEvent = RuntimeEvent; /// The ubiquitous origin type. @@ -352,7 +350,7 @@ parameter_types! { pub const StakingAdminBodyId: BodyId = BodyId::Defense; } -/// We allow root, the StakingAdmin to execute privileged collator selection operations. +/// We allow Root and the `StakingAdmin` to execute privileged collator selection operations. pub type CollatorSelectionUpdateOrigin = EitherOfDiverse< EnsureRoot, EnsureXcm>, @@ -363,9 +361,9 @@ impl pallet_collator_selection::Config for Runtime { type Currency = Balances; type UpdateOrigin = CollatorSelectionUpdateOrigin; type PotId = PotId; - type MaxCandidates = ConstU32<1000>; - type MinCandidates = ConstU32<5>; - type MaxInvulnerables = ConstU32<100>; + type MaxCandidates = ConstU32<100>; + type MinEligibleCollators = ConstU32<4>; + type MaxInvulnerables = ConstU32<20>; // should be a multiple of session or things will get inconsistent type KickThreshold = ConstU32; type ValidatorId = ::AccountId; @@ -400,18 +398,15 @@ impl pallet_utility::Config for Runtime { // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( - pub enum Runtime where - Block = Block, - NodeBlock = opaque::Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Runtime { // System support stuff. - System: frame_system::{Pallet, Call, Config, Storage, Event} = 0, + System: frame_system::{Pallet, Call, Config, Storage, Event} = 0, ParachainSystem: cumulus_pallet_parachain_system::{ - Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, + Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, } = 1, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2, - ParachainInfo: parachain_info::{Pallet, Storage, Config} = 3, + ParachainInfo: parachain_info::{Pallet, Storage, Config} = 3, // Monetary stuff. Balances: pallet_balances::{Pallet, Call, Storage, Config, Event} = 10, @@ -422,11 +417,11 @@ construct_runtime!( CollatorSelection: pallet_collator_selection::{Pallet, Call, Storage, Event, Config} = 21, Session: pallet_session::{Pallet, Call, Storage, Event, Config} = 22, Aura: pallet_aura::{Pallet, Storage, Config} = 23, - AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 24, + AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 24, // XCM helpers. XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event} = 30, - PolkadotXcm: pallet_xcm::{Pallet, Call, Event, Origin, Config} = 31, + PolkadotXcm: pallet_xcm::{Pallet, Call, Event, Origin, Config} = 31, CumulusXcm: cumulus_pallet_xcm::{Pallet, Event, Origin} = 32, DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event} = 33, diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_collator_selection.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_collator_selection.rs index 59a867d8ab2..ba550555214 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_collator_selection.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_collator_selection.rs @@ -147,23 +147,31 @@ impl pallet_collator_selection::WeightInfo for WeightIn .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(4)) } - /// Storage: CollatorSelection Invulnerables (r:1 w:1) - /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) /// Storage: Session NextKeys (r:1 w:0) /// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured) - /// The range of component `b` is `[1, 99]`. - fn add_invulnerable(b: u32, ) -> Weight { + /// Storage: CollatorSelection Invulnerables (r:1 w:1) + /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(641), added: 1136, mode: MaxEncodedLen) + /// Storage: CollatorSelection Candidates (r:1 w:1) + /// Proof: CollatorSelection Candidates (max_values: Some(1), max_size: Some(4802), added: 5297, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// The range of component `b` is `[1, 19]`. + /// The range of component `c` is `[1, 99]`. + fn add_invulnerable(b: u32, c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `581 + b * (37 ±0)` - // Estimated: `4687 + b * (37 ±0)` - // Minimum execution time: 269_126_000 picoseconds. - Weight::from_parts(286_711_880, 0) - .saturating_add(Weight::from_parts(0, 4687)) - // Standard Error: 22_887 - .saturating_add(Weight::from_parts(813_399, 0).saturating_mul(b.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `757 + b * (32 ±0) + c * (53 ±0)` + // Estimated: `6287 + b * (37 ±0) + c * (53 ±0)` + // Minimum execution time: 52_720_000 picoseconds. + Weight::from_parts(56_102_459, 0) + .saturating_add(Weight::from_parts(0, 6287)) + // Standard Error: 12_957 + .saturating_add(Weight::from_parts(26_422, 0).saturating_mul(b.into())) + // Standard Error: 2_456 + .saturating_add(Weight::from_parts(128_528, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 37).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(0, 53).saturating_mul(c.into())) } /// Storage: CollatorSelection Invulnerables (r:1 w:1) /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/Cargo.toml b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/Cargo.toml index e4a08fc9b12..6b8d7d2bf2a 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/Cargo.toml +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/Cargo.toml @@ -12,9 +12,9 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } hex-literal = { version = "0.4.1" } log = { version = "0.4.19", default-features = false } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.164", optional = true, features = ["derive"] } -smallvec = "1.8.1" +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } +serde = { version = "1.0.171", optional = true, features = ["derive"] } +smallvec = "1.11.0" # Substrate frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "master" } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs index 4f31af3d3bc..b82c3a461e9 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs @@ -70,7 +70,7 @@ use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate}; use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; use parachains_common::{ - impls::DealWithFees, opaque, AccountId, Balance, BlockNumber, Hash, Header, Nonce, Signature, + impls::DealWithFees, AccountId, Balance, BlockNumber, Hash, Header, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION, }; // XCM Imports @@ -181,14 +181,12 @@ impl frame_system::Config for Runtime { type Lookup = AccountIdLookup; /// The index type for storing how many extrinsics an account has signed. type Nonce = Nonce; - /// 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 block type. + type Block = Block; /// The ubiquitous event type. type RuntimeEvent = RuntimeEvent; /// The ubiquitous origin type. @@ -363,9 +361,9 @@ impl pallet_collator_selection::Config for Runtime { type Currency = Balances; type UpdateOrigin = CollatorSelectionUpdateOrigin; type PotId = PotId; - type MaxCandidates = ConstU32<1000>; - type MinCandidates = ConstU32<5>; - type MaxInvulnerables = ConstU32<100>; + type MaxCandidates = ConstU32<100>; + type MinEligibleCollators = ConstU32<4>; + type MaxInvulnerables = ConstU32<20>; // should be a multiple of session or things will get inconsistent type KickThreshold = ConstU32; type ValidatorId = ::AccountId; @@ -400,18 +398,15 @@ impl pallet_utility::Config for Runtime { // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( - pub enum Runtime where - Block = Block, - NodeBlock = opaque::Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Runtime { // System support stuff. - System: frame_system::{Pallet, Call, Config, Storage, Event} = 0, + System: frame_system::{Pallet, Call, Config, Storage, Event} = 0, ParachainSystem: cumulus_pallet_parachain_system::{ - Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, + Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, } = 1, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2, - ParachainInfo: parachain_info::{Pallet, Storage, Config} = 3, + ParachainInfo: parachain_info::{Pallet, Storage, Config} = 3, // Monetary stuff. Balances: pallet_balances::{Pallet, Call, Storage, Config, Event} = 10, @@ -422,11 +417,11 @@ construct_runtime!( CollatorSelection: pallet_collator_selection::{Pallet, Call, Storage, Event, Config} = 21, Session: pallet_session::{Pallet, Call, Storage, Event, Config} = 22, Aura: pallet_aura::{Pallet, Storage, Config} = 23, - AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 24, + AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 24, // XCM helpers. XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event} = 30, - PolkadotXcm: pallet_xcm::{Pallet, Call, Event, Origin, Config} = 31, + PolkadotXcm: pallet_xcm::{Pallet, Call, Event, Origin, Config} = 31, CumulusXcm: cumulus_pallet_xcm::{Pallet, Event, Origin} = 32, DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event} = 33, diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_collator_selection.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_collator_selection.rs index 424da202302..9c54874229f 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_collator_selection.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_collator_selection.rs @@ -147,23 +147,31 @@ impl pallet_collator_selection::WeightInfo for WeightIn .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(4)) } - /// Storage: CollatorSelection Invulnerables (r:1 w:1) - /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) /// Storage: Session NextKeys (r:1 w:0) /// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured) - /// The range of component `b` is `[1, 99]`. - fn add_invulnerable(b: u32, ) -> Weight { + /// Storage: CollatorSelection Invulnerables (r:1 w:1) + /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(641), added: 1136, mode: MaxEncodedLen) + /// Storage: CollatorSelection Candidates (r:1 w:1) + /// Proof: CollatorSelection Candidates (max_values: Some(1), max_size: Some(4802), added: 5297, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// The range of component `b` is `[1, 19]`. + /// The range of component `c` is `[1, 99]`. + fn add_invulnerable(b: u32, c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `581 + b * (37 ±0)` - // Estimated: `4687 + b * (37 ±0)` - // Minimum execution time: 269_126_000 picoseconds. - Weight::from_parts(286_711_880, 0) - .saturating_add(Weight::from_parts(0, 4687)) - // Standard Error: 22_887 - .saturating_add(Weight::from_parts(813_399, 0).saturating_mul(b.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `757 + b * (32 ±0) + c * (53 ±0)` + // Estimated: `6287 + b * (37 ±0) + c * (53 ±0)` + // Minimum execution time: 52_720_000 picoseconds. + Weight::from_parts(56_102_459, 0) + .saturating_add(Weight::from_parts(0, 6287)) + // Standard Error: 12_957 + .saturating_add(Weight::from_parts(26_422, 0).saturating_mul(b.into())) + // Standard Error: 2_456 + .saturating_add(Weight::from_parts(128_528, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 37).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(0, 53).saturating_mul(c.into())) } /// Storage: CollatorSelection Invulnerables (r:1 w:1) /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml index 2e645948e0e..4aaa9969f66 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml @@ -12,9 +12,9 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } hex-literal = { version = "0.4.1" } log = { version = "0.4.19", default-features = false } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.164", optional = true, features = ["derive"] } -smallvec = "1.8.1" +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } +serde = { version = "1.0.171", optional = true, features = ["derive"] } +smallvec = "1.11.0" # Substrate frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "master" } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_rococo_config.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_rococo_config.rs index 8a85076e33e..fd155e35604 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_rococo_config.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_rococo_config.rs @@ -17,8 +17,8 @@ //! Bridge definitions that are used on Rococo to bridge with Wococo. use crate::{ - BridgeParachainWococoInstance, ParachainInfo, Runtime, WithBridgeHubWococoMessagesInstance, - XcmRouter, + BridgeParachainWococoInstance, BridgeWococoMessages, ParachainInfo, Runtime, + WithBridgeHubWococoMessagesInstance, XcmRouter, }; use bp_messages::LaneId; use bridge_runtime_common::{ @@ -33,7 +33,7 @@ use bridge_runtime_common::{ RefundableParachain, }, }; -use frame_support::{parameter_types, RuntimeDebug}; +use frame_support::{parameter_types, traits::PalletInfoAccess, RuntimeDebug}; use xcm::{ latest::prelude::*, prelude::{InteriorMultiLocation, NetworkId}, @@ -46,6 +46,7 @@ parameter_types! { pub const MaxUnconfirmedMessagesAtInboundLane: bp_messages::MessageNonce = bp_bridge_hub_rococo::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX; pub const BridgeHubWococoChainId: bp_runtime::ChainId = bp_runtime::BRIDGE_HUB_WOCOCO_CHAIN_ID; + pub BridgeWococoMessagesPalletInstance: InteriorMultiLocation = X1(PalletInstance(::index() as u8)); pub BridgeHubRococoUniversalLocation: InteriorMultiLocation = X2(GlobalConsensus(Rococo), Parachain(ParachainInfo::parachain_id().into())); pub WococoGlobalConsensusNetwork: NetworkId = NetworkId::Wococo; pub ActiveOutboundLanesToBridgeHubWococo: &'static [bp_messages::LaneId] = &[DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO]; @@ -60,8 +61,11 @@ pub type ToWococoBridgeHubMessagesDeliveryProof = FromBridgedChainMessagesDeliveryProof; /// Dispatches received XCM messages from other bridge -pub type OnBridgeHubRococoBlobDispatcher = - BridgeBlobDispatcher; +pub type OnBridgeHubRococoBlobDispatcher = BridgeBlobDispatcher< + XcmRouter, + BridgeHubRococoUniversalLocation, + BridgeWococoMessagesPalletInstance, +>; /// Export XCM messages to be relayed to the otherside pub type ToBridgeHubWococoHaulBlobExporter = HaulBlobExporter< diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_wococo_config.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_wococo_config.rs index 025486d43ca..563e8cd294e 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_wococo_config.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_wococo_config.rs @@ -17,8 +17,8 @@ //! Bridge definitions that are used on Wococo to bridge with Rococo. use crate::{ - BridgeParachainRococoInstance, ParachainInfo, Runtime, WithBridgeHubRococoMessagesInstance, - XcmRouter, + BridgeParachainRococoInstance, BridgeRococoMessages, ParachainInfo, Runtime, + WithBridgeHubRococoMessagesInstance, XcmRouter, }; use bp_messages::LaneId; use bridge_runtime_common::{ @@ -33,7 +33,7 @@ use bridge_runtime_common::{ RefundableParachain, }, }; -use frame_support::{parameter_types, RuntimeDebug}; +use frame_support::{parameter_types, traits::PalletInfoAccess, RuntimeDebug}; use xcm::{ latest::prelude::*, prelude::{InteriorMultiLocation, NetworkId}, @@ -47,6 +47,7 @@ parameter_types! { bp_bridge_hub_wococo::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX; pub const BridgeHubRococoChainId: bp_runtime::ChainId = bp_runtime::BRIDGE_HUB_ROCOCO_CHAIN_ID; pub BridgeHubWococoUniversalLocation: InteriorMultiLocation = X2(GlobalConsensus(Wococo), Parachain(ParachainInfo::parachain_id().into())); + pub BridgeRococoMessagesPalletInstance: InteriorMultiLocation = X1(PalletInstance(::index() as u8)); pub RococoGlobalConsensusNetwork: NetworkId = NetworkId::Rococo; pub ActiveOutboundLanesToBridgeHubRococo: &'static [bp_messages::LaneId] = &[DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO]; pub PriorityBoostPerMessage: u64 = 921_900_294; @@ -60,8 +61,11 @@ pub type ToRococoBridgeHubMessagesDeliveryProof = FromBridgedChainMessagesDeliveryProof; /// Dispatches received XCM messages from other bridge -pub type OnBridgeHubWococoBlobDispatcher = - BridgeBlobDispatcher; +pub type OnBridgeHubWococoBlobDispatcher = BridgeBlobDispatcher< + XcmRouter, + BridgeHubWococoUniversalLocation, + BridgeRococoMessagesPalletInstance, +>; /// Export XCM messages to be relayed to the otherside pub type ToBridgeHubRococoHaulBlobExporter = HaulBlobExporter< diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index 26c50546392..c4bfa641db0 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -87,7 +87,7 @@ use bridge_runtime_common::{ messages_xcm_extension::{XcmAsPlainPayload, XcmBlobMessageDispatch}, }; use parachains_common::{ - impls::DealWithFees, opaque, AccountId, Balance, BlockNumber, Hash, Header, Nonce, Signature, + impls::DealWithFees, AccountId, Balance, BlockNumber, Hash, Header, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION, }; use xcm_executor::XcmExecutor; @@ -195,14 +195,12 @@ impl frame_system::Config for Runtime { type Lookup = AccountIdLookup; /// The index type for storing how many extrinsics an account has signed. type Nonce = Nonce; - /// 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 block type. + type Block = Block; /// The ubiquitous event type. type RuntimeEvent = RuntimeEvent; /// The ubiquitous origin type. @@ -361,9 +359,9 @@ impl pallet_collator_selection::Config for Runtime { type Currency = Balances; type UpdateOrigin = CollatorSelectionUpdateOrigin; type PotId = PotId; - type MaxCandidates = ConstU32<1000>; - type MinCandidates = ConstU32<5>; - type MaxInvulnerables = ConstU32<100>; + type MaxCandidates = ConstU32<100>; + type MinEligibleCollators = ConstU32<4>; + type MaxInvulnerables = ConstU32<20>; // should be a multiple of session or things will get inconsistent type KickThreshold = ConstU32; type ValidatorId = ::AccountId; @@ -545,18 +543,15 @@ impl pallet_bridge_relayers::Config for Runtime { // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( - pub enum Runtime where - Block = Block, - NodeBlock = opaque::Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Runtime { // System support stuff. - System: frame_system::{Pallet, Call, Config, Storage, Event} = 0, + System: frame_system::{Pallet, Call, Config, Storage, Event} = 0, ParachainSystem: cumulus_pallet_parachain_system::{ - Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, + Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, } = 1, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2, - ParachainInfo: parachain_info::{Pallet, Storage, Config} = 3, + ParachainInfo: parachain_info::{Pallet, Storage, Config} = 3, // Monetary stuff. Balances: pallet_balances::{Pallet, Call, Storage, Config, Event} = 10, @@ -567,11 +562,11 @@ construct_runtime!( CollatorSelection: pallet_collator_selection::{Pallet, Call, Storage, Event, Config} = 21, Session: pallet_session::{Pallet, Call, Storage, Event, Config} = 22, Aura: pallet_aura::{Pallet, Storage, Config} = 23, - AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 24, + AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 24, // XCM helpers. XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event} = 30, - PolkadotXcm: pallet_xcm::{Pallet, Call, Event, Origin, Config} = 31, + PolkadotXcm: pallet_xcm::{Pallet, Call, Event, Origin, Config} = 31, CumulusXcm: cumulus_pallet_xcm::{Pallet, Event, Origin} = 32, DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event} = 33, diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_collator_selection.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_collator_selection.rs index a91daf3ea87..c525871e522 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_collator_selection.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_collator_selection.rs @@ -147,23 +147,31 @@ impl pallet_collator_selection::WeightInfo for WeightIn .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(4)) } - /// Storage: CollatorSelection Invulnerables (r:1 w:1) - /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) /// Storage: Session NextKeys (r:1 w:0) /// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured) - /// The range of component `b` is `[1, 99]`. - fn add_invulnerable(b: u32, ) -> Weight { + /// Storage: CollatorSelection Invulnerables (r:1 w:1) + /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(641), added: 1136, mode: MaxEncodedLen) + /// Storage: CollatorSelection Candidates (r:1 w:1) + /// Proof: CollatorSelection Candidates (max_values: Some(1), max_size: Some(4802), added: 5297, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// The range of component `b` is `[1, 19]`. + /// The range of component `c` is `[1, 99]`. + fn add_invulnerable(b: u32, c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `581 + b * (37 ±0)` - // Estimated: `4687 + b * (37 ±0)` - // Minimum execution time: 269_126_000 picoseconds. - Weight::from_parts(286_711_880, 0) - .saturating_add(Weight::from_parts(0, 4687)) - // Standard Error: 22_887 - .saturating_add(Weight::from_parts(813_399, 0).saturating_mul(b.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `757 + b * (32 ±0) + c * (53 ±0)` + // Estimated: `6287 + b * (37 ±0) + c * (53 ±0)` + // Minimum execution time: 52_720_000 picoseconds. + Weight::from_parts(56_102_459, 0) + .saturating_add(Weight::from_parts(0, 6287)) + // Standard Error: 12_957 + .saturating_add(Weight::from_parts(26_422, 0).saturating_mul(b.into())) + // Standard Error: 2_456 + .saturating_add(Weight::from_parts(128_528, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 37).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(0, 53).saturating_mul(c.into())) } /// Storage: CollatorSelection Invulnerables (r:1 w:1) /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/tests.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/tests.rs index 6a1ec2793f2..eb12e7742dc 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/tests.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/tests.rs @@ -27,6 +27,7 @@ use bridge_hub_rococo_runtime::{ }; use codec::{Decode, Encode}; use frame_support::parameter_types; +use frame_system::pallet_prelude::HeaderFor; use parachains_common::{AccountId, AuraId, Balance}; use sp_keyring::AccountKeyring::Alice; use sp_runtime::{ @@ -81,7 +82,7 @@ fn construct_and_apply_extrinsic( r.unwrap() } -fn executive_init_block(header: &::Header) { +fn executive_init_block(header: &HeaderFor) { Executive::initialize_block(header) } diff --git a/parachains/runtimes/bridge-hubs/test-utils/src/test_cases.rs b/parachains/runtimes/bridge-hubs/test-utils/src/test_cases.rs index 14792067e43..03be3f28619 100644 --- a/parachains/runtimes/bridge-hubs/test-utils/src/test_cases.rs +++ b/parachains/runtimes/bridge-hubs/test-utils/src/test_cases.rs @@ -36,8 +36,9 @@ use bridge_runtime_common::{ use codec::Encode; use frame_support::{ assert_ok, - traits::{Get, OriginTrait}, + traits::{Get, OriginTrait, PalletInfoAccess}, }; +use frame_system::pallet_prelude::{BlockNumberFor, HeaderFor}; use pallet_bridge_grandpa::BridgedHeader; use parachains_runtimes_test_utils::{ mock_open_hrmp_channel, AccountIdOf, BalanceOf, CollatorSessionKeys, ExtBuilder, RuntimeHelper, @@ -463,7 +464,18 @@ pub fn relayed_incoming_message_works::ClearOrigin; 42]; - let expected_dispatch = xcm::latest::Xcm::<()>(xcm.clone()); + let expected_dispatch = xcm::latest::Xcm::<()>({ + let mut expected_instructions = xcm.clone(); + // dispatch prepends bridge pallet instance + expected_instructions.insert( + 0, + DescendOrigin(X1(PalletInstance( + as PalletInfoAccess>::index() + as u8, + ))), + ); + expected_instructions + }); // generate bridged relay chain finality, parachain heads and message proofs, // to be submitted by relayer to this chain. let ( @@ -579,7 +591,7 @@ pub fn complex_relay_extrinsic_works, - executive_init_block: fn(&::Header), + executive_init_block: fn(&HeaderFor), construct_and_apply_extrinsic: fn( sp_keyring::AccountKeyring, pallet_utility::Call:: @@ -642,10 +654,9 @@ pub fn complex_relay_extrinsic_works::BlockNumber = 0u32.into(); + let zero: BlockNumberFor = 0u32.into(); let genesis_hash = frame_system::Pallet::::block_hash(zero); - let mut header: ::Header = - bp_test_utils::test_header(1u32.into()); + let mut header: HeaderFor = bp_test_utils::test_header(1u32.into()); header.set_parent_hash(genesis_hash); executive_init_block(&header); @@ -672,7 +683,18 @@ pub fn complex_relay_extrinsic_works::ClearOrigin; 42]; - let expected_dispatch = xcm::latest::Xcm::<()>(xcm.clone()); + let expected_dispatch = xcm::latest::Xcm::<()>({ + let mut expected_instructions = xcm.clone(); + // dispatch prepends bridge pallet instance + expected_instructions.insert( + 0, + DescendOrigin(X1(PalletInstance( + as PalletInfoAccess>::index() + as u8, + ))), + ); + expected_instructions + }); // generate bridged relay chain finality, parachain heads and message proofs, // to be submitted by relayer to this chain. let ( diff --git a/parachains/runtimes/collectives/collectives-polkadot/Cargo.toml b/parachains/runtimes/collectives/collectives-polkadot/Cargo.toml index 7c5892ef4c1..bf3582dde65 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/Cargo.toml +++ b/parachains/runtimes/collectives/collectives-polkadot/Cargo.toml @@ -9,8 +9,8 @@ description = "Polkadot Collectives Parachain Runtime" codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "max-encoded-len"] } hex-literal = { version = "0.4.1" } log = { version = "0.4.19", default-features = false } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } -smallvec = "1.10.0" +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } +smallvec = "1.11.0" # Substrate frame-benchmarking = { git = "https://github.com/paritytech/substrate", optional = true, default-features = false, branch = "master" } diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/migration.rs b/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/migration.rs index 8ceb1c403b0..fb30551b9ca 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/migration.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/migration.rs @@ -165,7 +165,7 @@ pub mod tests { use pallet_ranked_collective::Rank; use parachains_common::AccountId; use sp_core::crypto::Ss58Codec; - use sp_runtime::AccountId32; + use sp_runtime::{AccountId32, BuildStorage}; #[test] fn check_fellowship_addresses() { @@ -236,7 +236,7 @@ pub mod tests { use super::import_kusama_fellowship::Migration; use pallet_ranked_collective::{IdToIndex, IndexToId, MemberCount, MemberRecord, Members}; - let t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let t = frame_system::GenesisConfig::::default().build_storage().unwrap(); let mut ext = sp_io::TestExternalities::new(t); ext.execute_with(|| System::set_block_number(1)); ext.execute_with(|| { diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/mod.rs b/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/mod.rs index d3526715344..99613542a2e 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/mod.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/mod.rs @@ -42,6 +42,9 @@ use sp_runtime::traits::{AccountIdConversion, ConstU16, ConvertToValue, Replace, use xcm::latest::BodyId; use xcm_builder::{AliasesIntoAccountId32, LocatableAssetId, PayOverXcm}; +#[cfg(feature = "runtime-benchmarks")] +use crate::impls::benchmarks::{OpenHrmpChannel, PayWithEnsure}; + /// The Fellowship members' ranks. pub mod ranks { use pallet_ranked_collective::Rank; @@ -105,13 +108,21 @@ pub type FellowshipCollectiveInstance = pallet_ranked_collective::Instance1; impl pallet_ranked_collective::Config for Runtime { type WeightInfo = weights::pallet_ranked_collective::WeightInfo; type RuntimeEvent = RuntimeEvent; + + #[cfg(not(feature = "runtime-benchmarks"))] // Promotions and the induction of new members are serviced by `FellowshipCore` pallet instance. - type PromoteOrigin = EnsureRootWithSuccess>; + type PromoteOrigin = frame_system::EnsureNever; + #[cfg(feature = "runtime-benchmarks")] + // The maximum value of `u16` set as a success value for the root to ensure the benchmarks will pass. + type PromoteOrigin = EnsureRootWithSuccess>; + // Demotion is by any of: // - Root can demote arbitrarily. // - the FellowshipAdmin origin (i.e. token holder referendum); + // + // The maximum value of `u16` set as a success value for the root to ensure the benchmarks will pass. type DemoteOrigin = EitherOf< - EnsureRootWithSuccess>, + EnsureRootWithSuccess>, MapSuccess< EnsureXcm>, Replace>, @@ -211,7 +222,11 @@ pub type FellowshipSalaryPaymaster = PayOverXcm< impl pallet_salary::Config for Runtime { type WeightInfo = weights::pallet_salary::WeightInfo; type RuntimeEvent = RuntimeEvent; + + #[cfg(not(feature = "runtime-benchmarks"))] type Paymaster = FellowshipSalaryPaymaster; + #[cfg(feature = "runtime-benchmarks")] + type Paymaster = PayWithEnsure>>; type Members = pallet_ranked_collective::Pallet; #[cfg(not(feature = "runtime-benchmarks"))] diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/impls.rs b/parachains/runtimes/collectives/collectives-polkadot/src/impls.rs index 6ccff8bda1c..784f6149b81 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/impls.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/impls.rs @@ -150,12 +150,17 @@ impl PrivilegeCmp for EqualOrGreatestRootCmp { #[cfg(feature = "runtime-benchmarks")] pub mod benchmarks { use super::*; - use frame_support::traits::fungible; + use crate::ParachainSystem; + use cumulus_primitives_core::{ChannelStatus, GetChannelInfo}; + use frame_support::traits::{ + fungible, + tokens::{Pay, PaymentStatus}, + }; use pallet_ranked_collective::Rank; use parachains_common::{AccountId, Balance}; use sp_runtime::traits::Convert; - /// Rank to salary conversion helper type.` + /// Rank to salary conversion helper type. pub struct RankToSalary(PhantomData); impl Convert for RankToSalary where @@ -165,4 +170,57 @@ pub mod benchmarks { Balance::from(r).saturating_mul(Fungible::minimum_balance()) } } + + /// Trait for setting up any prerequisites for successful execution of benchmarks. + pub trait EnsureSuccessful { + fn ensure_successful(); + } + + /// Implementation of the [`EnsureSuccessful`] trait which opens an HRMP channel between + /// the Collectives and a parachain with a given ID. + pub struct OpenHrmpChannel(PhantomData); + impl> EnsureSuccessful for OpenHrmpChannel { + fn ensure_successful() { + if let ChannelStatus::Closed = ParachainSystem::get_channel_status(I::get().into()) { + ParachainSystem::open_outbound_hrmp_channel_for_benchmarks(I::get().into()) + } + } + } + + /// Type that wraps a type implementing the [`Pay`] trait to decorate its [`Pay::ensure_successful`] + /// function with a provided implementation of the [`EnsureSuccessful`] trait. + pub struct PayWithEnsure(PhantomData<(O, E)>); + impl Pay for PayWithEnsure + where + O: Pay, + E: EnsureSuccessful, + { + type AssetKind = O::AssetKind; + type Balance = O::Balance; + type Beneficiary = O::Beneficiary; + type Error = O::Error; + type Id = O::Id; + + fn pay( + who: &Self::Beneficiary, + asset_kind: Self::AssetKind, + amount: Self::Balance, + ) -> Result { + O::pay(who, asset_kind, amount) + } + fn check_payment(id: Self::Id) -> PaymentStatus { + O::check_payment(id) + } + fn ensure_successful( + who: &Self::Beneficiary, + asset_kind: Self::AssetKind, + amount: Self::Balance, + ) { + E::ensure_successful(); + O::ensure_successful(who, asset_kind, amount) + } + fn ensure_concluded(id: Self::Id) { + O::ensure_concluded(id) + } + } } diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs b/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs index 175de698c51..aff30706c46 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs @@ -80,9 +80,9 @@ use frame_system::{ }; pub use parachains_common as common; use parachains_common::{ - impls::DealWithFees, opaque, AccountId, AuraId, Balance, BlockNumber, Hash, Header, Nonce, - Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, MINUTES, - NORMAL_DISPATCH_RATIO, SLOT_DURATION, + impls::DealWithFees, AccountId, AuraId, Balance, BlockNumber, Hash, Header, Nonce, Signature, + AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, MINUTES, NORMAL_DISPATCH_RATIO, + SLOT_DURATION, }; use xcm_config::{GovernanceLocation, XcmConfig, XcmOriginToTransactDispatchOrigin}; @@ -160,10 +160,9 @@ impl frame_system::Config for Runtime { type RuntimeCall = RuntimeCall; type Lookup = AccountIdLookup; type Nonce = Nonce; - type BlockNumber = BlockNumber; type Hash = Hash; type Hashing = BlakeTwo256; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; type BlockHashCount = BlockHashCount; @@ -436,9 +435,9 @@ impl pallet_collator_selection::Config for Runtime { type Currency = Balances; type UpdateOrigin = CollatorSelectionUpdateOrigin; type PotId = PotId; - type MaxCandidates = ConstU32<1000>; - type MinCandidates = ConstU32<5>; - type MaxInvulnerables = ConstU32<100>; + type MaxCandidates = ConstU32<100>; + type MinEligibleCollators = ConstU32<4>; + type MaxInvulnerables = ConstU32<20>; // should be a multiple of session or things will get inconsistent type KickThreshold = ConstU32; type ValidatorId = ::AccountId; @@ -551,18 +550,15 @@ impl pallet_preimage::Config for Runtime { // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( - pub enum Runtime where - Block = Block, - NodeBlock = opaque::Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Runtime { // System support stuff. - System: frame_system::{Pallet, Call, Config, Storage, Event} = 0, + System: frame_system::{Pallet, Call, Config, Storage, Event} = 0, ParachainSystem: cumulus_pallet_parachain_system::{ - Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, + Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, } = 1, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2, - ParachainInfo: parachain_info::{Pallet, Storage, Config} = 3, + ParachainInfo: parachain_info::{Pallet, Storage, Config} = 3, // Monetary stuff. Balances: pallet_balances::{Pallet, Call, Storage, Config, Event} = 10, @@ -573,11 +569,11 @@ construct_runtime!( CollatorSelection: pallet_collator_selection::{Pallet, Call, Storage, Event, Config} = 21, Session: pallet_session::{Pallet, Call, Storage, Event, Config} = 22, Aura: pallet_aura::{Pallet, Storage, Config} = 23, - AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 24, + AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 24, // XCM helpers. XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event} = 30, - PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event, Origin, Config} = 31, + PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event, Origin, Config} = 31, CumulusXcm: cumulus_pallet_xcm::{Pallet, Event, Origin} = 32, DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event} = 33, diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_collator_selection.rs b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_collator_selection.rs index 05843b159a7..f55cfead0ee 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_collator_selection.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_collator_selection.rs @@ -147,23 +147,31 @@ impl pallet_collator_selection::WeightInfo for WeightIn .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(4)) } - /// Storage: CollatorSelection Invulnerables (r:1 w:1) - /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) /// Storage: Session NextKeys (r:1 w:0) /// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured) - /// The range of component `b` is `[1, 99]`. - fn add_invulnerable(b: u32, ) -> Weight { + /// Storage: CollatorSelection Invulnerables (r:1 w:1) + /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(641), added: 1136, mode: MaxEncodedLen) + /// Storage: CollatorSelection Candidates (r:1 w:1) + /// Proof: CollatorSelection Candidates (max_values: Some(1), max_size: Some(4802), added: 5297, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// The range of component `b` is `[1, 19]`. + /// The range of component `c` is `[1, 99]`. + fn add_invulnerable(b: u32, c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `581 + b * (37 ±0)` - // Estimated: `4687 + b * (37 ±0)` - // Minimum execution time: 269_126_000 picoseconds. - Weight::from_parts(286_711_880, 0) - .saturating_add(Weight::from_parts(0, 4687)) - // Standard Error: 22_887 - .saturating_add(Weight::from_parts(813_399, 0).saturating_mul(b.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) + // Measured: `757 + b * (32 ±0) + c * (53 ±0)` + // Estimated: `6287 + b * (37 ±0) + c * (53 ±0)` + // Minimum execution time: 52_720_000 picoseconds. + Weight::from_parts(56_102_459, 0) + .saturating_add(Weight::from_parts(0, 6287)) + // Standard Error: 12_957 + .saturating_add(Weight::from_parts(26_422, 0).saturating_mul(b.into())) + // Standard Error: 2_456 + .saturating_add(Weight::from_parts(128_528, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 37).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(0, 53).saturating_mul(c.into())) } /// Storage: CollatorSelection Invulnerables (r:1 w:1) /// Proof: CollatorSelection Invulnerables (max_values: Some(1), max_size: Some(3202), added: 3697, mode: MaxEncodedLen) diff --git a/parachains/runtimes/contracts/contracts-rococo/Cargo.toml b/parachains/runtimes/contracts/contracts-rococo/Cargo.toml index cc527fe7663..fa989781441 100644 --- a/parachains/runtimes/contracts/contracts-rococo/Cargo.toml +++ b/parachains/runtimes/contracts/contracts-rococo/Cargo.toml @@ -14,8 +14,8 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } hex-literal = { version = "0.4.1", optional = true } log = { version = "0.4.19", default-features = false } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } -smallvec = "1.10.0" +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } +smallvec = "1.11.0" # Substrate sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs b/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs index b049b450169..6a7c976d1b9 100644 --- a/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs +++ b/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs @@ -7,8 +7,10 @@ use frame_support::{ traits::{ConstBool, ConstU32, Nothing}, }; use pallet_contracts::{ - weights::SubstrateWeight, Config, DebugInfo, DefaultAddressGenerator, Frame, Schedule, + migration::v12, weights::SubstrateWeight, Config, DebugInfo, DefaultAddressGenerator, Frame, + Schedule, }; + pub use parachains_common::AVERAGE_ON_INITIALIZE_RATIO; // Prints debug output of the `contracts` pallet to stdout if the node is @@ -48,5 +50,5 @@ impl Config for Runtime { type MaxStorageKeyLen = ConstU32<128>; type UnsafeUnstableInterface = ConstBool; type MaxDebugBufferLen = ConstU32<{ 2 * 1024 * 1024 }>; - type Migrations = (); + type Migrations = (v12::Migration,); } diff --git a/parachains/runtimes/contracts/contracts-rococo/src/lib.rs b/parachains/runtimes/contracts/contracts-rococo/src/lib.rs index e2e6780ccae..1923c651156 100644 --- a/parachains/runtimes/contracts/contracts-rococo/src/lib.rs +++ b/parachains/runtimes/contracts/contracts-rococo/src/lib.rs @@ -57,7 +57,7 @@ use frame_support::{ use frame_system::limits::{BlockLength, BlockWeights}; pub use parachains_common as common; use parachains_common::{ - impls::DealWithFees, opaque, AccountId, BlockNumber, Hash, Header, Nonce, Signature, + impls::DealWithFees, AccountId, BlockNumber, Hash, Header, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO, MAXIMUM_BLOCK_WEIGHT, MINUTES, NORMAL_DISPATCH_RATIO, SLOT_DURATION, }; @@ -100,6 +100,7 @@ pub type Migrations = ( cumulus_pallet_dmp_queue::migration::Migration, cumulus_pallet_parachain_system::migration::Migration, cumulus_pallet_xcmp_queue::migration::Migration, + pallet_contracts::Migration, ); type EventRecord = frame_system::EventRecord< @@ -174,10 +175,9 @@ impl frame_system::Config for Runtime { type RuntimeCall = RuntimeCall; type Lookup = AccountIdLookup; type Nonce = Nonce; - type BlockNumber = BlockNumber; type Hash = Hash; type Hashing = BlakeTwo256; - type Header = Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; type BlockHashCount = BlockHashCount; @@ -317,9 +317,9 @@ impl pallet_collator_selection::Config for Runtime { type Currency = Balances; type UpdateOrigin = CollatorSelectionUpdateOrigin; type PotId = PotId; - type MaxCandidates = ConstU32<1000>; - type MinCandidates = ConstU32<0>; - type MaxInvulnerables = ConstU32<100>; + type MaxCandidates = ConstU32<100>; + type MinEligibleCollators = ConstU32<1>; + type MaxInvulnerables = ConstU32<20>; // should be a multiple of session or things will get inconsistent type KickThreshold = Period; type ValidatorId = ::AccountId; @@ -336,19 +336,16 @@ impl pallet_sudo::Config for Runtime { // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( - pub enum Runtime where - Block = Block, - NodeBlock = opaque::Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Runtime { // System support stuff. - System: frame_system::{Pallet, Call, Config, Storage, Event} = 0, + System: frame_system::{Pallet, Call, Config, Storage, Event} = 0, ParachainSystem: cumulus_pallet_parachain_system::{ - Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, + Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, } = 1, RandomnessCollectiveFlip: pallet_insecure_randomness_collective_flip::{Pallet, Storage} = 2, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 3, - ParachainInfo: parachain_info::{Pallet, Storage, Config} = 4, + ParachainInfo: parachain_info::{Pallet, Storage, Config} = 4, // Monetary stuff. Balances: pallet_balances::{Pallet, Call, Storage, Config, Event} = 10, @@ -359,11 +356,11 @@ construct_runtime!( CollatorSelection: pallet_collator_selection::{Pallet, Call, Storage, Event, Config} = 21, Session: pallet_session::{Pallet, Call, Storage, Event, Config} = 22, Aura: pallet_aura::{Pallet, Storage, Config} = 23, - AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 24, + AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 24, // XCM helpers. XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event} = 30, - PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event, Origin, Config} = 31, + PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event, Origin, Config} = 31, CumulusXcm: cumulus_pallet_xcm::{Pallet, Event, Origin} = 32, DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event} = 33, diff --git a/parachains/runtimes/glutton/glutton-kusama/Cargo.toml b/parachains/runtimes/glutton/glutton-kusama/Cargo.toml index 2408c9431e1..da90f290cca 100644 --- a/parachains/runtimes/glutton/glutton-kusama/Cargo.toml +++ b/parachains/runtimes/glutton/glutton-kusama/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } # Substrate frame-benchmarking = { git = "https://github.com/paritytech/substrate", optional = true, default-features = false, branch = "master" } diff --git a/parachains/runtimes/glutton/glutton-kusama/src/lib.rs b/parachains/runtimes/glutton/glutton-kusama/src/lib.rs index 9ac5bde0b4e..6be2459e912 100644 --- a/parachains/runtimes/glutton/glutton-kusama/src/lib.rs +++ b/parachains/runtimes/glutton/glutton-kusama/src/lib.rs @@ -143,10 +143,9 @@ impl frame_system::Config for Runtime { type RuntimeCall = RuntimeCall; type Lookup = AccountIdLookup; type Nonce = Nonce; - type BlockNumber = BlockNumber; type Hash = Hash; type Hashing = BlakeTwo256; - type Header = generic::Header; + type Block = Block; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; type BlockHashCount = BlockHashCount; @@ -197,22 +196,19 @@ impl pallet_sudo::Config for Runtime { } construct_runtime! { - pub enum Runtime where - Block = Block, - NodeBlock = generic::Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Runtime { - System: frame_system::{Pallet, Call, Storage, Config, Event} = 0, + System: frame_system::{Pallet, Call, Storage, Config, Event} = 0, ParachainSystem: cumulus_pallet_parachain_system::{ - Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, + Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, } = 1, - ParachainInfo: parachain_info::{Pallet, Storage, Config} = 2, + ParachainInfo: parachain_info::{Pallet, Storage, Config} = 2, // DMP handler. CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Storage, Event, Origin} = 10, // The main stage. - Glutton: pallet_glutton::{Pallet, Call, Storage, Event, Config} = 20, + Glutton: pallet_glutton::{Pallet, Call, Storage, Event, Config} = 20, // Sudo. Sudo: pallet_sudo::{Pallet, Call, Storage, Event, Config} = 255, diff --git a/parachains/runtimes/starters/seedling/Cargo.toml b/parachains/runtimes/starters/seedling/Cargo.toml index 72ccf68114e..49a72c7ea35 100644 --- a/parachains/runtimes/starters/seedling/Cargo.toml +++ b/parachains/runtimes/starters/seedling/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } # Substrate frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/parachains/runtimes/starters/seedling/src/lib.rs b/parachains/runtimes/starters/seedling/src/lib.rs index 854441010a4..87575e5389d 100644 --- a/parachains/runtimes/starters/seedling/src/lib.rs +++ b/parachains/runtimes/starters/seedling/src/lib.rs @@ -126,14 +126,12 @@ impl frame_system::Config for Runtime { type Lookup = AccountIdLookup; /// The index type for storing how many extrinsics an account has signed. type Nonce = Nonce; - /// 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 block type. + type Block = Block; /// The ubiquitous event type. type RuntimeEvent = RuntimeEvent; /// The ubiquitous origin type. @@ -182,18 +180,15 @@ impl cumulus_pallet_parachain_system::Config for Runtime { impl parachain_info::Config for Runtime {} construct_runtime! { - pub enum Runtime where - Block = Block, - NodeBlock = generic::Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Runtime { - System: frame_system::{Pallet, Call, Storage, Config, Event}, + System: frame_system::{Pallet, Call, Storage, Config, Event}, Sudo: pallet_sudo::{Pallet, Call, Storage, Config, Event}, ParachainSystem: cumulus_pallet_parachain_system::{ - Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, + Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, }, - ParachainInfo: parachain_info::{Pallet, Storage, Config}, + ParachainInfo: parachain_info::{Pallet, Storage, Config}, SoloToPara: cumulus_pallet_solo_to_para::{Pallet, Call, Storage, Event}, } } diff --git a/parachains/runtimes/starters/shell/Cargo.toml b/parachains/runtimes/starters/shell/Cargo.toml index 7ad8b26bdf8..50e05f7b17c 100644 --- a/parachains/runtimes/starters/shell/Cargo.toml +++ b/parachains/runtimes/starters/shell/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } # Substrate frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/parachains/runtimes/starters/shell/src/lib.rs b/parachains/runtimes/starters/shell/src/lib.rs index ed376d8d9b4..aa14c83fef0 100644 --- a/parachains/runtimes/starters/shell/src/lib.rs +++ b/parachains/runtimes/starters/shell/src/lib.rs @@ -134,14 +134,12 @@ impl frame_system::Config for Runtime { type Lookup = AccountIdLookup; /// The index type for storing how many extrinsics an account has signed. type Nonce = Nonce; - /// 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 block type. + type Block = Block; /// The ubiquitous event type. type RuntimeEvent = RuntimeEvent; /// The ubiquitous origin type. @@ -185,16 +183,13 @@ impl cumulus_pallet_parachain_system::Config for Runtime { impl parachain_info::Config for Runtime {} construct_runtime! { - pub enum Runtime where - Block = Block, - NodeBlock = generic::Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Runtime { - System: frame_system::{Pallet, Call, Storage, Config, Event}, + System: frame_system::{Pallet, Call, Storage, Config, Event}, ParachainSystem: cumulus_pallet_parachain_system::{ - Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, + Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, }, - ParachainInfo: parachain_info::{Pallet, Storage, Config}, + ParachainInfo: parachain_info::{Pallet, Storage, Config}, // DMP handler. CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Storage, Event, Origin}, diff --git a/parachains/runtimes/test-utils/src/lib.rs b/parachains/runtimes/test-utils/src/lib.rs index 8ff85438b3f..9328ac492d3 100644 --- a/parachains/runtimes/test-utils/src/lib.rs +++ b/parachains/runtimes/test-utils/src/lib.rs @@ -22,14 +22,14 @@ use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder; use frame_support::{ dispatch::{DispatchResult, RawOrigin, UnfilteredDispatchable}, inherent::{InherentData, ProvideInherent}, - traits::{GenesisBuild, OriginTrait}, + traits::OriginTrait, weights::Weight, }; use parachains_common::AccountId; use polkadot_parachain::primitives::{HrmpChannelId, RelayChainBlockNumber, XcmpMessageFormat}; use sp_consensus_aura::AURA_ENGINE_ID; use sp_core::Encode; -use sp_runtime::{Digest, DigestItem}; +use sp_runtime::{BuildStorage, Digest, DigestItem}; use xcm::{ latest::{MultiAsset, MultiLocation, XcmContext, XcmHash}, prelude::*, @@ -161,20 +161,22 @@ impl< pallet_collator_selection::Config + pallet_balances::Config + pallet_session::Config, ValidatorIdOf: From>, { - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); - >::assimilate_storage( - &pallet_xcm::GenesisConfig { safe_xcm_version: self.safe_xcm_version }, - &mut t, - ) + pallet_xcm::GenesisConfig:: { + safe_xcm_version: self.safe_xcm_version, + ..Default::default() + } + .assimilate_storage(&mut t) .unwrap(); if let Some(para_id) = self.para_id { - >::assimilate_storage( - ¶chain_info::GenesisConfig { parachain_id: para_id }, - &mut t, - ) - .unwrap(); + parachain_info::GenesisConfig:: { + parachain_id: para_id, + ..Default::default() + } + .assimilate_storage(&mut t) + .unwrap(); } pallet_balances::GenesisConfig:: { balances: self.balances } diff --git a/parachains/runtimes/testing/penpal/Cargo.toml b/parachains/runtimes/testing/penpal/Cargo.toml index a3e0a7564d7..b13b3467681 100644 --- a/parachains/runtimes/testing/penpal/Cargo.toml +++ b/parachains/runtimes/testing/penpal/Cargo.toml @@ -18,8 +18,8 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } hex-literal = { version = "0.4.1", optional = true } log = { version = "0.4.19", default-features = false } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } -smallvec = "1.10.0" +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } +smallvec = "1.11.0" # Substrate frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "master" } diff --git a/parachains/runtimes/testing/penpal/src/lib.rs b/parachains/runtimes/testing/penpal/src/lib.rs index a741c4f59f2..3c2c53a9878 100644 --- a/parachains/runtimes/testing/penpal/src/lib.rs +++ b/parachains/runtimes/testing/penpal/src/lib.rs @@ -318,14 +318,12 @@ impl frame_system::Config for Runtime { type Lookup = AccountIdLookup; /// The index type for storing how many extrinsics an account has signed. type Nonce = Nonce; - /// 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 block type. + type Block = Block; /// The ubiquitous event type. type RuntimeEvent = RuntimeEvent; /// The ubiquitous origin type. @@ -511,10 +509,7 @@ impl pallet_aura::Config for Runtime { parameter_types! { pub const PotId: PalletId = PalletId(*b"PotStake"); - pub const MaxCandidates: u32 = 1000; - pub const MinCandidates: u32 = 5; pub const SessionLength: BlockNumber = 6 * HOURS; - pub const MaxInvulnerables: u32 = 100; pub const ExecutiveBody: BodyId = BodyId::Executive; } @@ -526,9 +521,9 @@ impl pallet_collator_selection::Config for Runtime { type Currency = Balances; type UpdateOrigin = CollatorSelectionUpdateOrigin; type PotId = PotId; - type MaxCandidates = MaxCandidates; - type MinCandidates = MinCandidates; - type MaxInvulnerables = MaxInvulnerables; + type MaxCandidates = ConstU32<100>; + type MinEligibleCollators = ConstU32<4>; + type MaxInvulnerables = ConstU32<20>; // should be a multiple of session or things will get inconsistent type KickThreshold = Period; type ValidatorId = ::AccountId; @@ -554,18 +549,15 @@ impl pallet_sudo::Config for Runtime { // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( - pub enum Runtime where - Block = Block, - NodeBlock = opaque::Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Runtime { // System support stuff. - System: frame_system::{Pallet, Call, Config, Storage, Event} = 0, + System: frame_system::{Pallet, Call, Config, Storage, Event} = 0, ParachainSystem: cumulus_pallet_parachain_system::{ - Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, + Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, } = 1, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 2, - ParachainInfo: parachain_info::{Pallet, Storage, Config} = 3, + ParachainInfo: parachain_info::{Pallet, Storage, Config} = 3, // Monetary stuff. Balances: pallet_balances::{Pallet, Call, Storage, Config, Event} = 10, @@ -577,11 +569,11 @@ construct_runtime!( CollatorSelection: pallet_collator_selection::{Pallet, Call, Storage, Event, Config} = 21, Session: pallet_session::{Pallet, Call, Storage, Event, Config} = 22, Aura: pallet_aura::{Pallet, Storage, Config} = 23, - AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 24, + AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 24, // XCM helpers. XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event} = 30, - PolkadotXcm: pallet_xcm::{Pallet, Call, Event, Origin, Config} = 31, + PolkadotXcm: pallet_xcm::{Pallet, Call, Event, Origin, Config} = 31, CumulusXcm: cumulus_pallet_xcm::{Pallet, Event, Origin} = 32, DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event} = 33, diff --git a/parachains/runtimes/testing/rococo-parachain/Cargo.toml b/parachains/runtimes/testing/rococo-parachain/Cargo.toml index fa24608c8bb..c295995cce8 100644 --- a/parachains/runtimes/testing/rococo-parachain/Cargo.toml +++ b/parachains/runtimes/testing/rococo-parachain/Cargo.toml @@ -7,7 +7,7 @@ description = "Simple runtime used by the rococo parachain(s)" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } # Substrate frame-benchmarking = { git = "https://github.com/paritytech/substrate", optional = true, default-features = false, branch = "master" } diff --git a/parachains/runtimes/testing/rococo-parachain/src/lib.rs b/parachains/runtimes/testing/rococo-parachain/src/lib.rs index 52d0446589f..4e072647ce6 100644 --- a/parachains/runtimes/testing/rococo-parachain/src/lib.rs +++ b/parachains/runtimes/testing/rococo-parachain/src/lib.rs @@ -179,14 +179,12 @@ impl frame_system::Config for Runtime { type Lookup = AccountIdLookup; /// The index type for storing how many extrinsics an account has signed. type Nonce = Nonce; - /// 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 block type. + type Block = Block; /// The ubiquitous event type. type RuntimeEvent = RuntimeEvent; /// The ubiquitous origin type. @@ -558,30 +556,27 @@ impl pallet_aura::Config for Runtime { } construct_runtime! { - pub enum Runtime where - Block = Block, - NodeBlock = generic::Block, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Runtime { - System: frame_system::{Pallet, Call, Storage, Config, Event}, + System: frame_system::{Pallet, Call, Storage, Config, Event}, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, Sudo: pallet_sudo::{Pallet, Call, Storage, Config, Event}, TransactionPayment: pallet_transaction_payment::{Pallet, Storage, Event}, ParachainSystem: cumulus_pallet_parachain_system::{ - Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, + Pallet, Call, Config, Storage, Inherent, Event, ValidateUnsigned, } = 20, - ParachainInfo: parachain_info::{Pallet, Storage, Config} = 21, + ParachainInfo: parachain_info::{Pallet, Storage, Config} = 21, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event} = 30, Assets: pallet_assets::{Pallet, Call, Storage, Event} = 31, Aura: pallet_aura::{Pallet, Config}, - AuraExt: cumulus_pallet_aura_ext::{Pallet, Config}, + AuraExt: cumulus_pallet_aura_ext::{Pallet, Config}, // XCM helpers. XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event} = 50, - PolkadotXcm: pallet_xcm::{Pallet, Call, Event, Origin, Config} = 51, + PolkadotXcm: pallet_xcm::{Pallet, Call, Event, Origin, Config} = 51, CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event, Origin} = 52, DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event} = 53, diff --git a/polkadot-parachain/Cargo.toml b/polkadot-parachain/Cargo.toml index 9bbbc7c89a8..be08472b57d 100644 --- a/polkadot-parachain/Cargo.toml +++ b/polkadot-parachain/Cargo.toml @@ -11,14 +11,14 @@ name = "polkadot-parachain" path = "src/main.rs" [dependencies] -async-trait = "0.1.68" -clap = { version = "4.3.6", features = ["derive"] } +async-trait = "0.1.71" +clap = { version = "4.3.11", features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.0.0" } futures = "0.3.28" hex-literal = "0.4.1" log = "0.4.19" -serde = { version = "1.0.164", features = ["derive"] } -serde_json = "1.0.97" +serde = { version = "1.0.171", features = ["derive"] } +serde_json = "1.0.102" # Local rococo-parachain-runtime = { path = "../parachains/runtimes/testing/rococo-parachain" } @@ -74,7 +74,8 @@ pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrat substrate-state-trie-migration-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" } # Polkadot -polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master" } +# Use rococo-native as this is currently the default "local" relay chain +polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master", features = ["rococo-native"] } polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "master" } xcm = { git = "https://github.com/paritytech/polkadot", branch = "master" } @@ -97,10 +98,8 @@ substrate-build-script-utils = { git = "https://github.com/paritytech/substrate" assert_cmd = "2.0" nix = { version = "0.26.1", features = ["signal"] } tempfile = "3.6.0" -tokio = { version = "1.28.2", features = ["macros", "time", "parking_lot"] } +tokio = { version = "1.29.1", features = ["macros", "time", "parking_lot"] } wait-timeout = "0.2" -# purge_chain_works works with rococo-local and needs to allow this -polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master", features = ["rococo-native"] } [features] default = [] diff --git a/polkadot-parachain/src/chain_spec/asset_hubs.rs b/polkadot-parachain/src/chain_spec/asset_hubs.rs index 1d6d501277c..0523c3b7e65 100644 --- a/polkadot-parachain/src/chain_spec/asset_hubs.rs +++ b/polkadot-parachain/src/chain_spec/asset_hubs.rs @@ -219,6 +219,7 @@ fn asset_hub_polkadot_genesis( code: asset_hub_polkadot_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), + ..Default::default() }, balances: asset_hub_polkadot_runtime::BalancesConfig { balances: endowed_accounts @@ -227,7 +228,10 @@ fn asset_hub_polkadot_genesis( .map(|k| (k, ASSET_HUB_POLKADOT_ED * 4096)) .collect(), }, - parachain_info: asset_hub_polkadot_runtime::ParachainInfoConfig { parachain_id: id }, + parachain_info: asset_hub_polkadot_runtime::ParachainInfoConfig { + parachain_id: id, + ..Default::default() + }, collator_selection: asset_hub_polkadot_runtime::CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: ASSET_HUB_POLKADOT_ED * 16, @@ -252,6 +256,7 @@ fn asset_hub_polkadot_genesis( parachain_system: Default::default(), polkadot_xcm: asset_hub_polkadot_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), + ..Default::default() }, } } @@ -408,6 +413,7 @@ fn asset_hub_kusama_genesis( code: asset_hub_kusama_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), + ..Default::default() }, balances: asset_hub_kusama_runtime::BalancesConfig { balances: endowed_accounts @@ -416,7 +422,10 @@ fn asset_hub_kusama_genesis( .map(|k| (k, ASSET_HUB_KUSAMA_ED * 524_288)) .collect(), }, - parachain_info: asset_hub_kusama_runtime::ParachainInfoConfig { parachain_id: id }, + parachain_info: asset_hub_kusama_runtime::ParachainInfoConfig { + parachain_id: id, + ..Default::default() + }, collator_selection: asset_hub_kusama_runtime::CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: ASSET_HUB_KUSAMA_ED * 16, @@ -439,6 +448,7 @@ fn asset_hub_kusama_genesis( parachain_system: Default::default(), polkadot_xcm: asset_hub_kusama_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), + ..Default::default() }, } } @@ -592,6 +602,7 @@ fn asset_hub_westend_genesis( code: asset_hub_westend_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), + ..Default::default() }, balances: asset_hub_westend_runtime::BalancesConfig { balances: endowed_accounts @@ -600,7 +611,10 @@ fn asset_hub_westend_genesis( .map(|k| (k, ASSET_HUB_WESTEND_ED * 4096)) .collect(), }, - parachain_info: asset_hub_westend_runtime::ParachainInfoConfig { parachain_id: id }, + parachain_info: asset_hub_westend_runtime::ParachainInfoConfig { + parachain_id: id, + ..Default::default() + }, collator_selection: asset_hub_westend_runtime::CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: ASSET_HUB_WESTEND_ED * 16, @@ -625,6 +639,7 @@ fn asset_hub_westend_genesis( parachain_system: Default::default(), polkadot_xcm: asset_hub_westend_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), + ..Default::default() }, } } diff --git a/polkadot-parachain/src/chain_spec/bridge_hubs.rs b/polkadot-parachain/src/chain_spec/bridge_hubs.rs index 6b04b3d2617..911368073d5 100644 --- a/polkadot-parachain/src/chain_spec/bridge_hubs.rs +++ b/polkadot-parachain/src/chain_spec/bridge_hubs.rs @@ -18,7 +18,6 @@ use crate::chain_spec::{get_account_id_from_seed, get_collator_keys_from_seed}; use cumulus_primitives_core::ParaId; use parachains_common::Balance as BridgeHubBalance; use sc_chain_spec::ChainSpec; -use sc_cli::RuntimeVersion; use sp_core::sr25519; use std::{path::PathBuf, str::FromStr}; @@ -165,26 +164,6 @@ impl BridgeHubRuntimeType { ))), } } - - pub fn runtime_version(&self) -> &'static RuntimeVersion { - match self { - BridgeHubRuntimeType::Polkadot | - BridgeHubRuntimeType::PolkadotLocal | - BridgeHubRuntimeType::PolkadotDevelopment => &bridge_hub_polkadot_runtime::VERSION, - BridgeHubRuntimeType::Kusama | - BridgeHubRuntimeType::KusamaLocal | - BridgeHubRuntimeType::KusamaDevelopment => &bridge_hub_kusama_runtime::VERSION, - BridgeHubRuntimeType::Westend => &bridge_hub_kusama_runtime::VERSION, - BridgeHubRuntimeType::Rococo | - BridgeHubRuntimeType::RococoLocal | - BridgeHubRuntimeType::RococoDevelopment | - BridgeHubRuntimeType::Wococo | - BridgeHubRuntimeType::WococoLocal => { - // this is intentional, for Rococo/Wococo we just want to have one runtime, which is configured for both sides - &bridge_hub_rococo_runtime::VERSION - }, - } - } } /// Check if 'id' satisfy BridgeHub-like format @@ -295,11 +274,15 @@ pub mod rococo { code: bridge_hub_rococo_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), + ..Default::default() }, balances: bridge_hub_rococo_runtime::BalancesConfig { balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(), }, - parachain_info: bridge_hub_rococo_runtime::ParachainInfoConfig { parachain_id: id }, + parachain_info: bridge_hub_rococo_runtime::ParachainInfoConfig { + parachain_id: id, + ..Default::default() + }, collator_selection: bridge_hub_rococo_runtime::CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: BRIDGE_HUB_ROCOCO_ED * 16, @@ -322,6 +305,7 @@ pub mod rococo { parachain_system: Default::default(), polkadot_xcm: bridge_hub_rococo_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), + ..Default::default() }, bridge_wococo_grandpa: bridge_hub_rococo_runtime::BridgeWococoGrandpaConfig { owner: bridges_pallet_owner.clone(), @@ -461,6 +445,7 @@ pub mod kusama { code: bridge_hub_kusama_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), + ..Default::default() }, balances: bridge_hub_kusama_runtime::BalancesConfig { balances: endowed_accounts @@ -469,7 +454,10 @@ pub mod kusama { .map(|k| (k, BRIDGE_HUB_KUSAMA_ED * 524_288)) .collect(), }, - parachain_info: bridge_hub_kusama_runtime::ParachainInfoConfig { parachain_id: id }, + parachain_info: bridge_hub_kusama_runtime::ParachainInfoConfig { + parachain_id: id, + ..Default::default() + }, collator_selection: bridge_hub_kusama_runtime::CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: BRIDGE_HUB_KUSAMA_ED * 16, @@ -492,6 +480,7 @@ pub mod kusama { parachain_system: Default::default(), polkadot_xcm: bridge_hub_kusama_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), + ..Default::default() }, } } @@ -593,6 +582,7 @@ pub mod polkadot { code: bridge_hub_polkadot_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), + ..Default::default() }, balances: bridge_hub_polkadot_runtime::BalancesConfig { balances: endowed_accounts @@ -601,7 +591,10 @@ pub mod polkadot { .map(|k| (k, BRIDGE_HUB_POLKADOT_ED * 4096)) .collect(), }, - parachain_info: bridge_hub_polkadot_runtime::ParachainInfoConfig { parachain_id: id }, + parachain_info: bridge_hub_polkadot_runtime::ParachainInfoConfig { + parachain_id: id, + ..Default::default() + }, collator_selection: bridge_hub_polkadot_runtime::CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: BRIDGE_HUB_POLKADOT_ED * 16, @@ -624,6 +617,7 @@ pub mod polkadot { parachain_system: Default::default(), polkadot_xcm: bridge_hub_polkadot_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), + ..Default::default() }, } } diff --git a/polkadot-parachain/src/chain_spec/collectives.rs b/polkadot-parachain/src/chain_spec/collectives.rs index bc322924c20..82c925c5d49 100644 --- a/polkadot-parachain/src/chain_spec/collectives.rs +++ b/polkadot-parachain/src/chain_spec/collectives.rs @@ -138,6 +138,7 @@ fn collectives_polkadot_genesis( code: collectives_polkadot_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), + ..Default::default() }, balances: collectives_polkadot_runtime::BalancesConfig { balances: endowed_accounts @@ -146,7 +147,10 @@ fn collectives_polkadot_genesis( .map(|k| (k, COLLECTIVES_POLKADOT_ED * 4096)) .collect(), }, - parachain_info: collectives_polkadot_runtime::ParachainInfoConfig { parachain_id: id }, + parachain_info: collectives_polkadot_runtime::ParachainInfoConfig { + parachain_id: id, + ..Default::default() + }, collator_selection: collectives_polkadot_runtime::CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: COLLECTIVES_POLKADOT_ED * 16, @@ -171,6 +175,7 @@ fn collectives_polkadot_genesis( parachain_system: Default::default(), polkadot_xcm: collectives_polkadot_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), + ..Default::default() }, alliance: Default::default(), alliance_motion: Default::default(), diff --git a/polkadot-parachain/src/chain_spec/contracts.rs b/polkadot-parachain/src/chain_spec/contracts.rs index 75d3951824f..b8af83a0d70 100644 --- a/polkadot-parachain/src/chain_spec/contracts.rs +++ b/polkadot-parachain/src/chain_spec/contracts.rs @@ -240,11 +240,15 @@ fn contracts_rococo_genesis( code: contracts_rococo_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), + ..Default::default() }, balances: contracts_rococo_runtime::BalancesConfig { balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(), }, - parachain_info: contracts_rococo_runtime::ParachainInfoConfig { parachain_id: id }, + parachain_info: contracts_rococo_runtime::ParachainInfoConfig { + parachain_id: id, + ..Default::default() + }, collator_selection: contracts_rococo_runtime::CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: CONTRACTS_ROCOCO_ED * 16, @@ -269,6 +273,7 @@ fn contracts_rococo_genesis( parachain_system: Default::default(), polkadot_xcm: contracts_rococo_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), + ..Default::default() }, sudo: contracts_rococo_runtime::SudoConfig { key: Some( diff --git a/polkadot-parachain/src/chain_spec/glutton.rs b/polkadot-parachain/src/chain_spec/glutton.rs index d6fddde0adc..5ea51c3a918 100644 --- a/polkadot-parachain/src/chain_spec/glutton.rs +++ b/polkadot-parachain/src/chain_spec/glutton.rs @@ -84,13 +84,15 @@ fn glutton_genesis(parachain_id: ParaId) -> glutton_runtime::RuntimeGenesisConfi code: glutton_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), + ..Default::default() }, - parachain_info: glutton_runtime::ParachainInfoConfig { parachain_id }, + parachain_info: glutton_runtime::ParachainInfoConfig { parachain_id, ..Default::default() }, parachain_system: Default::default(), glutton: glutton_runtime::GluttonConfig { compute: Default::default(), storage: Default::default(), trash_data_count: Default::default(), + ..Default::default() }, sudo: glutton_runtime::SudoConfig { key: Some(get_account_id_from_seed::("Alice")), diff --git a/polkadot-parachain/src/chain_spec/penpal.rs b/polkadot-parachain/src/chain_spec/penpal.rs index 7373c4d9f6f..264898991eb 100644 --- a/polkadot-parachain/src/chain_spec/penpal.rs +++ b/polkadot-parachain/src/chain_spec/penpal.rs @@ -90,6 +90,7 @@ fn penpal_testnet_genesis( code: penpal_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), + ..Default::default() }, balances: penpal_runtime::BalancesConfig { balances: endowed_accounts @@ -98,7 +99,10 @@ fn penpal_testnet_genesis( .map(|k| (k, penpal_runtime::EXISTENTIAL_DEPOSIT * 4096)) .collect(), }, - parachain_info: penpal_runtime::ParachainInfoConfig { parachain_id: id }, + parachain_info: penpal_runtime::ParachainInfoConfig { + parachain_id: id, + ..Default::default() + }, collator_selection: penpal_runtime::CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: penpal_runtime::EXISTENTIAL_DEPOSIT * 16, @@ -123,6 +127,7 @@ fn penpal_testnet_genesis( parachain_system: Default::default(), polkadot_xcm: penpal_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), + ..Default::default() }, sudo: penpal_runtime::SudoConfig { key: Some(get_account_id_from_seed::("Alice")), diff --git a/polkadot-parachain/src/chain_spec/rococo_parachain.rs b/polkadot-parachain/src/chain_spec/rococo_parachain.rs index 67af1e876cd..1ed1a3e35fb 100644 --- a/polkadot-parachain/src/chain_spec/rococo_parachain.rs +++ b/polkadot-parachain/src/chain_spec/rococo_parachain.rs @@ -105,17 +105,22 @@ pub(crate) fn testnet_genesis( code: rococo_parachain_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), + ..Default::default() }, balances: rococo_parachain_runtime::BalancesConfig { balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(), }, sudo: rococo_parachain_runtime::SudoConfig { key: Some(root_key) }, - parachain_info: rococo_parachain_runtime::ParachainInfoConfig { parachain_id: id }, + parachain_info: rococo_parachain_runtime::ParachainInfoConfig { + parachain_id: id, + ..Default::default() + }, aura: rococo_parachain_runtime::AuraConfig { authorities: initial_authorities }, aura_ext: Default::default(), parachain_system: Default::default(), polkadot_xcm: rococo_parachain_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), + ..Default::default() }, } } diff --git a/polkadot-parachain/src/chain_spec/seedling.rs b/polkadot-parachain/src/chain_spec/seedling.rs index 996ab662b12..4a43b4cf476 100644 --- a/polkadot-parachain/src/chain_spec/seedling.rs +++ b/polkadot-parachain/src/chain_spec/seedling.rs @@ -53,9 +53,13 @@ fn seedling_testnet_genesis( code: seedling_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), + ..Default::default() }, sudo: seedling_runtime::SudoConfig { key: Some(root_key) }, - parachain_info: seedling_runtime::ParachainInfoConfig { parachain_id }, + parachain_info: seedling_runtime::ParachainInfoConfig { + parachain_id, + ..Default::default() + }, parachain_system: Default::default(), } } diff --git a/polkadot-parachain/src/chain_spec/shell.rs b/polkadot-parachain/src/chain_spec/shell.rs index ae2bd6942c0..eca605b10df 100644 --- a/polkadot-parachain/src/chain_spec/shell.rs +++ b/polkadot-parachain/src/chain_spec/shell.rs @@ -43,8 +43,9 @@ fn shell_testnet_genesis(parachain_id: ParaId) -> shell_runtime::RuntimeGenesisC code: shell_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), + ..Default::default() }, - parachain_info: shell_runtime::ParachainInfoConfig { parachain_id }, + parachain_info: shell_runtime::ParachainInfoConfig { parachain_id, ..Default::default() }, parachain_system: Default::default(), } } diff --git a/polkadot-parachain/src/command.rs b/polkadot-parachain/src/command.rs index 8f93167da99..4bc19f86e4a 100644 --- a/polkadot-parachain/src/command.rs +++ b/polkadot-parachain/src/command.rs @@ -17,26 +17,18 @@ use crate::{ chain_spec, cli::{Cli, RelayChainCli, Subcommand}, - service::{ - new_partial, AssetHubKusamaExecutor, AssetHubPolkadotRuntimeExecutor, - AssetHubWestendExecutor, Block, BridgeHubKusamaRuntimeExecutor, - BridgeHubPolkadotRuntimeExecutor, BridgeHubRococoRuntimeExecutor, - CollectivesPolkadotRuntimeExecutor, GluttonRuntimeExecutor, - }, + service::{new_partial, Block}, }; -use codec::Encode; -use cumulus_client_cli::generate_genesis_block; use cumulus_primitives_core::ParaId; use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE}; use log::{info, warn}; use parachains_common::{AssetHubPolkadotAuraId, AuraId}; use sc_cli::{ ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams, - NetworkParams, Result, RuntimeVersion, SharedParams, SubstrateCli, + NetworkParams, Result, SharedParams, SubstrateCli, }; use sc_service::config::{BasePath, PrometheusConfig}; -use sp_core::hexdisplay::HexDisplay; -use sp_runtime::traits::{AccountIdConversion, Block as BlockT}; +use sp_runtime::traits::AccountIdConversion; use std::{net::SocketAddr, path::PathBuf}; /// Helper enum that is used for better distinction of different parachain/runtime configuration @@ -350,24 +342,6 @@ impl SubstrateCli for Cli { fn load_spec(&self, id: &str) -> std::result::Result, String> { load_spec(id) } - - fn native_runtime_version(chain_spec: &Box) -> &'static RuntimeVersion { - match chain_spec.runtime() { - Runtime::AssetHubPolkadot => &asset_hub_polkadot_runtime::VERSION, - Runtime::AssetHubKusama => &asset_hub_kusama_runtime::VERSION, - Runtime::AssetHubWestend => &asset_hub_westend_runtime::VERSION, - Runtime::CollectivesPolkadot | Runtime::CollectivesWestend => - &collectives_polkadot_runtime::VERSION, - Runtime::Shell => &shell_runtime::VERSION, - Runtime::Seedling => &seedling_runtime::VERSION, - Runtime::ContractsRococo => &contracts_rococo_runtime::VERSION, - Runtime::BridgeHub(bridge_hub_runtime_type) => - bridge_hub_runtime_type.runtime_version(), - Runtime::Penpal(_) => &penpal_runtime::VERSION, - Runtime::Glutton => &glutton_runtime::VERSION, - Runtime::Default => &rococo_parachain_runtime::VERSION, - } - } } impl SubstrateCli for RelayChainCli { @@ -404,10 +378,6 @@ impl SubstrateCli for RelayChainCli { fn load_spec(&self, id: &str) -> std::result::Result, String> { polkadot_cli::Cli::from_iter([RelayChainCli::executable_name()].iter()).load_spec(id) } - - fn native_runtime_version(chain_spec: &Box) -> &'static RuntimeVersion { - polkadot_cli::Cli::native_runtime_version(chain_spec) - } } /// Creates partial components for the runtimes that are supported by the benchmarks. @@ -591,7 +561,7 @@ macro_rules! construct_async_run { runner.async_run(|$config| { let $components = new_partial::< rococo_parachain_runtime::RuntimeApi, - _ + _, >( &$config, crate::service::rococo_parachain_build_import_queue, @@ -665,14 +635,10 @@ pub fn run() -> Result<()> { cmd.run(config, polkadot_config) }) }, - Some(Subcommand::ExportGenesisState(cmd)) => { - let runner = cli.create_runner(cmd)?; - runner.sync_run(|_config| { - let spec = cli.load_spec(&cmd.shared_params.chain.clone().unwrap_or_default())?; - let state_version = Cli::native_runtime_version(&spec).state_version(); - cmd.run::(&*spec, state_version) - }) - }, + Some(Subcommand::ExportGenesisState(cmd)) => + construct_async_run!(|components, cli, cmd, config| { + Ok(async move { cmd.run(&*config.chain_spec, &*components.client) }) + }), Some(Subcommand::ExportGenesisWasm(cmd)) => { let runner = cli.create_runner(cmd)?; runner.sync_run(|_config| { @@ -687,44 +653,7 @@ pub fn run() -> Result<()> { match cmd { BenchmarkCmd::Pallet(cmd) => if cfg!(feature = "runtime-benchmarks") { - runner.sync_run(|config| { - match config.chain_spec.runtime() { - Runtime::AssetHubKusama => - cmd.run::(config), - Runtime::AssetHubWestend => cmd.run::(config), - Runtime::AssetHubPolkadot => - cmd.run::(config), - Runtime::CollectivesPolkadot | Runtime::CollectivesWestend => - cmd.run::(config), - Runtime::BridgeHub(bridge_hub_runtime_type) => match bridge_hub_runtime_type { - chain_spec::bridge_hubs::BridgeHubRuntimeType::Polkadot | - chain_spec::bridge_hubs::BridgeHubRuntimeType::PolkadotLocal | - chain_spec::bridge_hubs::BridgeHubRuntimeType::PolkadotDevelopment => - cmd.run::(config), - chain_spec::bridge_hubs::BridgeHubRuntimeType::Kusama | - chain_spec::bridge_hubs::BridgeHubRuntimeType::KusamaLocal | - chain_spec::bridge_hubs::BridgeHubRuntimeType::KusamaDevelopment => - cmd.run::(config), - chain_spec::bridge_hubs::BridgeHubRuntimeType::Rococo | - chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoLocal | - chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoDevelopment => - cmd.run::(config), - _ => Err(format!( - "Chain '{:?}' doesn't support benchmarking for bridge_hub_runtime_type: {:?}", - config.chain_spec.runtime(), - bridge_hub_runtime_type - ) - .into()), - }, - Runtime::Glutton => - cmd.run::(config), - _ => Err(format!( - "Chain '{:?}' doesn't support benchmarking", - config.chain_spec.runtime() - ) - .into()), - } - }) + runner.sync_run(|config| cmd.run::(config)) } else { Err("Benchmarking wasn't enabled when building the node. \ You can enable it with `--features runtime-benchmarks`." @@ -760,7 +689,6 @@ pub fn run() -> Result<()> { }, #[cfg(feature = "try-runtime")] Some(Subcommand::TryRuntime(cmd)) => { - use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch}; use try_runtime_cli::block_building_info::timestamp_with_aura_info; // grab the task manager. @@ -769,99 +697,14 @@ pub fn run() -> Result<()> { let task_manager = sc_service::TaskManager::new(runner.config().tokio_handle.clone(), *registry) .map_err(|e| format!("Error: {:?}", e))?; - type HostFunctionsOf = ExtendedHostFunctions< - sp_io::SubstrateHostFunctions, - ::ExtendHostFunctions, - >; + type HostFunctions = + (sp_io::SubstrateHostFunctions, frame_benchmarking::benchmarking::HostFunctions); let info_provider = timestamp_with_aura_info(6000); - match runner.config().chain_spec.runtime() { - Runtime::AssetHubKusama => runner.async_run(|_| { - Ok(( - cmd.run::, _>(Some( - info_provider, - )), - task_manager, - )) - }), - Runtime::AssetHubWestend => runner.async_run(|_| { - Ok(( - cmd.run::, _>(Some( - info_provider, - )), - task_manager, - )) - }), - Runtime::AssetHubPolkadot => runner.async_run(|_| { - Ok(( - cmd.run::, _>(Some( - info_provider, - )), - task_manager, - )) - }), - Runtime::CollectivesPolkadot | Runtime::CollectivesWestend => - runner.async_run(|_| { - Ok(( - cmd.run::, _>(Some(info_provider)), - task_manager, - )) - }), - Runtime::BridgeHub(bridge_hub_runtime_type) => - match bridge_hub_runtime_type { - chain_spec::bridge_hubs::BridgeHubRuntimeType::Polkadot | - chain_spec::bridge_hubs::BridgeHubRuntimeType::PolkadotLocal | - chain_spec::bridge_hubs::BridgeHubRuntimeType::PolkadotDevelopment => - runner.async_run(|_| { - Ok(( - cmd.run::, _>(Some(info_provider)), - task_manager, - )) - }), - chain_spec::bridge_hubs::BridgeHubRuntimeType::Kusama | - chain_spec::bridge_hubs::BridgeHubRuntimeType::KusamaLocal | - chain_spec::bridge_hubs::BridgeHubRuntimeType::KusamaDevelopment => runner.async_run(|_| { - Ok(( - cmd.run::, _>(Some(info_provider)), - task_manager, - )) - }), - chain_spec::bridge_hubs::BridgeHubRuntimeType::Rococo | - chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoLocal | - chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoDevelopment => runner.async_run(|_| { - Ok(( - cmd.run::, _>(Some(info_provider)), - task_manager, - )) - }), - _ => Err(format!( - "Chain '{:?}' doesn't support try-runtime for bridge_hub_runtime_type: {:?}", - runner.config().chain_spec.runtime(), - bridge_hub_runtime_type - ) - .into()), - }, - Runtime::Shell => runner.async_run(|_| { - Ok(( - cmd.run::, _>(Some(info_provider)), - task_manager, - )) - }), - Runtime::ContractsRococo => runner.async_run(|_| { - Ok(( - cmd.run::, _>(Some(info_provider)), - task_manager, - )) - }), - Runtime::Glutton => runner.async_run(|_| { - Ok(( - cmd.run::, _>(Some(info_provider)), - task_manager, - )) - }), - _ => Err("Chain doesn't support try-runtime".into()), - } + runner.async_run(|_| { + Ok((cmd.run::(Some(info_provider)), task_manager)) + }) }, #[cfg(not(feature = "try-runtime"))] Some(Subcommand::TryRuntime) => Err("Try-runtime was not enabled when building the node. \ @@ -925,13 +768,6 @@ pub fn run() -> Result<()> { let parachain_account = AccountIdConversion::::into_account_truncating(&id); - let state_version = Cli::native_runtime_version(&config.chain_spec).state_version(); - - let block: crate::service::Block = - generate_genesis_block(&*config.chain_spec, state_version) - .map_err(|e| format!("{:?}", e))?; - let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode())); - let tokio_handle = config.tokio_handle.clone(); let polkadot_config = SubstrateCli::create_configuration(&polkadot_cli, &polkadot_cli, tokio_handle) @@ -939,11 +775,14 @@ pub fn run() -> Result<()> { info!("Parachain id: {:?}", id); info!("Parachain Account: {}", parachain_account); - info!("Parachain genesis state: {}", genesis_state); info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" }); if !collator_options.relay_chain_rpc_urls.is_empty() && !cli.relaychain_args.is_empty() { - warn!("Detected relay chain node arguments together with --relay-chain-rpc-url. This command starts a minimal Polkadot node that only uses a network-related subset of all relay chain CLI options."); + warn!( + "Detected relay chain node arguments together with --relay-chain-rpc-url. \ + This command starts a minimal Polkadot node that only uses a \ + network-related subset of all relay chain CLI options." + ); } match config.chain_spec.runtime() { diff --git a/polkadot-parachain/src/service.rs b/polkadot-parachain/src/service.rs index 18518ad7a31..826fa886121 100644 --- a/polkadot-parachain/src/service.rs +++ b/polkadot-parachain/src/service.rs @@ -317,7 +317,7 @@ where &task_manager, )?; - let params = PartialComponents { + Ok(PartialComponents { backend, client, import_queue, @@ -326,9 +326,7 @@ where transaction_pool, select_chain: (), other: (block_import, telemetry, telemetry_worker_handle), - }; - - Ok(params) + }) } /// Start a shell node with the given parachain `Configuration` and relay chain `Configuration`. diff --git a/polkadot-parachain/tests/polkadot_argument_parsing.rs b/polkadot-parachain/tests/polkadot_argument_parsing.rs index ad91ce0e488..0538a47aa93 100644 --- a/polkadot-parachain/tests/polkadot_argument_parsing.rs +++ b/polkadot-parachain/tests/polkadot_argument_parsing.rs @@ -27,7 +27,7 @@ async fn polkadot_argument_parsing() { let args = &[ "--", - "--dev", + "--chain=rococo-local", "--bootnodes", "/ip4/127.0.0.1/tcp/30333/p2p/Qmbx43psh7LVkrYTRXisUpzCubbgYojkejzAgj5mteDnxy", "--bootnodes", diff --git a/polkadot-parachain/tests/polkadot_mdns_issue.rs b/polkadot-parachain/tests/polkadot_mdns_issue.rs index bb492a31d94..c88c81230b0 100644 --- a/polkadot-parachain/tests/polkadot_mdns_issue.rs +++ b/polkadot-parachain/tests/polkadot_mdns_issue.rs @@ -26,7 +26,7 @@ async fn interrupt_polkadot_mdns_issue_test() { let base_dir = tempdir().expect("could not create a temp dir"); - let args = &["--", "--dev"]; + let args = &["--", "--chain=rococo-local"]; common::run_node_for_a_while(base_dir.path(), args, SIGINT).await; common::run_node_for_a_while(base_dir.path(), args, SIGTERM).await; diff --git a/polkadot-parachain/tests/purge_chain_works.rs b/polkadot-parachain/tests/purge_chain_works.rs index 2f4609273da..8a41ee780c5 100644 --- a/polkadot-parachain/tests/purge_chain_works.rs +++ b/polkadot-parachain/tests/purge_chain_works.rs @@ -30,12 +30,12 @@ async fn purge_chain_works() { let base_dir = tempdir().expect("could not create a temp dir"); let base_dir_path = format!("{}/polkadot", base_dir.path().display()); - let args = &["--", "--dev", "-d", &base_dir_path]; + let args = &["--", "-d", &base_dir_path, "--chain=rococo-local"]; common::run_node_for_a_while(base_dir.path(), args, SIGINT).await; assert!(base_dir.path().join("chains/local_testnet/db/full").exists()); - assert!(base_dir.path().join("polkadot/chains/dev/db/full").exists()); + assert!(base_dir.path().join("polkadot/chains/rococo_local_testnet/db/full").exists()); let status = Command::new(cargo_bin("polkadot-parachain")) .args(["purge-chain", "-d"]) @@ -48,6 +48,6 @@ async fn purge_chain_works() { // Make sure that the `parachain_local_testnet` chain folder exists, but the `db` is deleted. assert!(base_dir.path().join("chains/local_testnet").exists()); assert!(!base_dir.path().join("chains/local_testnet/db/full").exists()); - // assert!(base_path.path().join("polkadot/chains/dev").exists()); - // assert!(!base_path.path().join("polkadot/chains/dev/db").exists()); + assert!(base_dir.path().join("polkadot/chains/rococo_local_testnet").exists()); + assert!(!base_dir.path().join("polkadot/chains/rococo_local_testnet/db/full").exists()); } diff --git a/polkadot-parachain/tests/running_the_node_and_interrupt.rs b/polkadot-parachain/tests/running_the_node_and_interrupt.rs index 6ffa39bd872..254602a2184 100644 --- a/polkadot-parachain/tests/running_the_node_and_interrupt.rs +++ b/polkadot-parachain/tests/running_the_node_and_interrupt.rs @@ -26,7 +26,7 @@ async fn running_the_node_works_and_can_be_interrupted() { let base_dir = tempdir().expect("could not create a temp dir"); - let args = &["--", "--dev"]; + let args = &["--", "--chain=rococo-local"]; common::run_node_for_a_while(base_dir.path(), args, SIGINT).await; common::run_node_for_a_while(base_dir.path(), args, SIGTERM).await; diff --git a/primitives/aura/Cargo.toml b/primitives/aura/Cargo.toml new file mode 100644 index 00000000000..ca6eadf25f1 --- /dev/null +++ b/primitives/aura/Cargo.toml @@ -0,0 +1,30 @@ +[package] +name = "cumulus-primitives-aura" +version = "0.1.0" +authors = ["Parity Technologies "] +edition = "2021" + +[dependencies] +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [ "derive" ] } + +# Substrate +sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-consensus-aura = { 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-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } + +# Polkadot +polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } +polkadot-primitives = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } + +[features] +default = [ "std" ] +std = [ + "codec/std", + "sp-api/std", + "sp-consensus-aura/std", + "sp-runtime/std", + "sp-std/std", + "polkadot-core-primitives/std", + "polkadot-primitives/std", +] diff --git a/primitives/aura/src/lib.rs b/primitives/aura/src/lib.rs new file mode 100644 index 00000000000..a0d7a0206a6 --- /dev/null +++ b/primitives/aura/src/lib.rs @@ -0,0 +1,50 @@ +// Copyright 2023 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 . + +//! Core primitives for Aura in Cumulus. +//! +//! In particular, this exposes the [`AuraUnincludedSegmentApi`] which is used to regulate +//! the behavior of Aura within a parachain context. + +#![cfg_attr(not(feature = "std"), no_std)] + +pub use sp_consensus_aura::Slot; + +sp_api::decl_runtime_apis! { + /// This runtime API is used to inform potential block authors whether they will + /// have the right to author at a slot, assuming they have claimed the slot. + /// + /// In particular, this API allows Aura-based parachains to regulate their "unincluded segment", + /// which is the section of the head of the chain which has not yet been made available in the + /// relay chain. + /// + /// When the unincluded segment is short, Aura chains will allow authors to create multiple + /// blocks per slot in order to build a backlog. When it is saturated, this API will limit + /// the amount of blocks that can be created. + pub trait AuraUnincludedSegmentApi { + /// Whether it is legal to extend the chain, assuming the given block is the most + /// recently included one as-of the relay parent that will be built against, and + /// the given slot. + /// + /// This should be consistent with the logic the runtime uses when validating blocks to + /// avoid issues. + /// + /// When the unincluded segment is empty, i.e. `included_hash == at`, where at is the block + /// whose state we are querying against, this must always return `true` as long as the slot + /// is more recent than the included block itself. + fn can_build_upon(included_hash: Block::Hash, slot: Slot) -> bool; + } +} diff --git a/primitives/core/Cargo.toml b/primitives/core/Cargo.toml index b856f61a4c0..7d7ef168bff 100644 --- a/primitives/core/Cargo.toml +++ b/primitives/core/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [ "derive" ] } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } # Substrate sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/primitives/parachain-inherent/Cargo.toml b/primitives/parachain-inherent/Cargo.toml index 9292c7abf74..fff0226f8e5 100644 --- a/primitives/parachain-inherent/Cargo.toml +++ b/primitives/parachain-inherent/Cargo.toml @@ -5,9 +5,9 @@ authors = ["Parity Technologies "] edition = "2021" [dependencies] -async-trait = { version = "0.1.68", optional = true } +async-trait = { version = "0.1.71", optional = true } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [ "derive" ] } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } tracing = { version = "0.1.37", optional = true } # Substrate diff --git a/scripts/benchmarks-ci.sh b/scripts/benchmarks-ci.sh index fcf0cc61984..0456ad4c425 100755 --- a/scripts/benchmarks-ci.sh +++ b/scripts/benchmarks-ci.sh @@ -41,7 +41,6 @@ do $artifactsDir/polkadot-parachain benchmark pallet \ $extra_args \ --chain=$benchmarkRuntimeName \ - --execution=wasm \ --wasm-execution=compiled \ --pallet=$pallet \ --extrinsic='*' \ diff --git a/scripts/bridges_update_subtree.sh b/scripts/bridges_update_subtree.sh index 3928dc23213..5c5c7a322a1 100755 --- a/scripts/bridges_update_subtree.sh +++ b/scripts/bridges_update_subtree.sh @@ -8,7 +8,7 @@ set -e -BRIDGES_BRANCH="${BRANCH:-master}" +BRIDGES_BRANCH="${BRANCH:-polkadot-staging}" BRIDGES_TARGET_DIR="${TARGET_DIR:-bridges}" function fetch() { diff --git a/scripts/ci/changelog/bin/changelog b/scripts/ci/changelog/bin/changelog index a02c4cde6b0..6fe7fcec528 100755 --- a/scripts/ci/changelog/bin/changelog +++ b/scripts/ci/changelog/bin/changelog @@ -84,9 +84,9 @@ end POLKADOT_COLLECTIVES_DIGEST = ENV['COLLECTIVES_POLKADOT_DIGEST'] || 'digests/collectives-polkadot-srtool-digest.json' SHELL_DIGEST = ENV['SHELL_DIGEST'] || 'digests/shell-srtool-digest.json' -ASSET_HUB_WESTEND_DIGEST = ENV['ASSET_HUB_WESTEND_DIGEST'] || 'digests/westmint-srtool-digest.json' -ASSET_HUB_KUSAMA_DIGEST = ENV['ASSET_HUB_KUSAMA_DIGEST'] || 'digests/statemine-srtool-digest.json' -ASSET_HUB_POLKADOT_DIGEST = ENV['ASSET_HUB_POLKADOT_DIGEST'] || 'digests/statemint-srtool-digest.json' +ASSET_HUB_WESTEND_DIGEST = ENV['ASSET_HUB_WESTEND_DIGEST'] || 'digests/asset-hub-westend-srtool-digest.json' +ASSET_HUB_KUSAMA_DIGEST = ENV['ASSET_HUB_KUSAMA_DIGEST'] || 'digests/asset-hub-kusama-srtool-digest.json' +ASSET_HUB_POLKADOT_DIGEST = ENV['ASSET_HUB_POLKADOT_DIGEST'] || 'digests/asset-hub-westend-srtool-digest.json' BRIDGE_HUB_ROCOCO_DIGEST = ENV['BRIDGE_HUB_ROCOCO_DIGEST'] || 'digests/bridge-hub-rococo-srtool-digest.json' BRIDGE_HUB_KUSAMA_DIGEST = ENV['BRIDGE_HUB_KUSAMA_DIGEST'] || 'digests/bridge-hub-kusama-srtool-digest.json' BRIDGE_HUB_POLKADOT_DIGEST = ENV['BRIDGE_HUB_POLKADOT_DIGEST'] || 'digests/bridge-hub-polkadot-srtool-digest.json' @@ -131,16 +131,16 @@ else substrate: $substrate[0], polkadot: $polkadot[0], srtool: [ - { name: "shell", data: $srtool_shell[0] }, - { name: "westmint", data: $srtool_westmint[0] }, - { name: "statemine", data: $srtool_statemine[0] }, - { name: "statemint", data: $srtool_statemint[0] }, - { name: "rococo", data: $srtool_rococo_parachain[0] }, - { name: "contracts", data: $srtool_contracts_rococo[0] }, - { name: "polkadot-collectives", data: $srtool_polkadot_collectives[0] }, - { name: "bridge-hub-rococo", data: $srtool_bridge_hub_rococo[0] }, - { name: "bridge-hub-kusama", data: $srtool_bridge_hub_kusama[0] }, - { name: "bridge-hub-polkadot", data: $srtool_bridge_hub_polkadot[0] } + { order: 10, name: "asset-hub-polkadot", note: " (Former Statemint)", data: $srtool_statemint[0] }, + { order: 11, name: "bridge-hub-polkadot", data: $srtool_bridge_hub_polkadot[0] }, + { order: 20, name: "asset-hub-kusama", note: " (Former Statemine)", data: $srtool_statemine[0] }, + { order: 21, name: "bridge-hub-kusama", data: $srtool_bridge_hub_kusama[0] }, + { order: 30, name: "asset-hub-westend", note: " (Former Westmint)", data: $srtool_westmint[0] }, + { order: 40, name: "rococo", data: $srtool_rococo_parachain[0] }, + { order: 41, name: "bridge-hub-rococo", data: $srtool_bridge_hub_rococo[0] }, + { order: 50, name: "polkadot-collectives", data: $srtool_polkadot_collectives[0] }, + { order: 60, name: "contracts", data: $srtool_contracts_rococo[0] }, + { order: 90, name: "shell", data: $srtool_shell[0] } ] }\' > context.json', cumulus_data, substrate_data, diff --git a/scripts/ci/changelog/templates/runtime.md.tera b/scripts/ci/changelog/templates/runtime.md.tera index 9e7e04b5c63..d2070245838 100644 --- a/scripts/ci/changelog/templates/runtime.md.tera +++ b/scripts/ci/changelog/templates/runtime.md.tera @@ -1,7 +1,7 @@ {# This macro shows one runtime #} {%- macro runtime(runtime) -%} -### {{ runtime.name | capitalize }} +### {{ runtime.name | replace(from="-", to=" ") | title }} {%- if runtime.note -%} {{ runtime.note }} {%- endif -%} {%- if runtime.data.runtimes.compressed.subwasm.compression.compressed %} {%- set compressed = "Yes" %} diff --git a/scripts/ci/changelog/templates/runtimes.md.tera b/scripts/ci/changelog/templates/runtimes.md.tera index 600c5f17dc9..fe2e16aa9c2 100644 --- a/scripts/ci/changelog/templates/runtimes.md.tera +++ b/scripts/ci/changelog/templates/runtimes.md.tera @@ -8,7 +8,7 @@ The information about the runtimes included in this release can be found below. The runtimes have been built using [{{ rtm.data.gen }}](https://github.com/paritytech/srtool) and `{{ rtm.data.rustc }}`. -{%- for runtime in srtool | sort(attribute="name") %} +{%- for runtime in srtool | sort(attribute="order") %} {%- set HIDE_VAR = "HIDE_SRTOOL_" ~ runtime.name | upper %} {%- if not env is containing(HIDE_VAR) %} diff --git a/test/relay-sproof-builder/src/lib.rs b/test/relay-sproof-builder/src/lib.rs index fd98899ed3b..d497025d15a 100644 --- a/test/relay-sproof-builder/src/lib.rs +++ b/test/relay-sproof-builder/src/lib.rs @@ -124,13 +124,15 @@ impl RelayStateSproofBuilder { dmq_mqc_head.encode(), ); } - if let Some(relay_dispatch_queue_size) = self.relay_dispatch_queue_remaining_capacity { + if let Some(relay_dispatch_queue_remaining_capacity) = + self.relay_dispatch_queue_remaining_capacity + { insert( relay_chain::well_known_keys::relay_dispatch_queue_remaining_capacity( self.para_id, ) .key, - relay_dispatch_queue_size.encode(), + relay_dispatch_queue_remaining_capacity.encode(), ); } if let Some(upgrade_go_ahead) = self.upgrade_go_ahead { diff --git a/test/relay-validation-worker-provider/Cargo.toml b/test/relay-validation-worker-provider/Cargo.toml index ea4587b2c7c..30be713c093 100644 --- a/test/relay-validation-worker-provider/Cargo.toml +++ b/test/relay-validation-worker-provider/Cargo.toml @@ -11,4 +11,4 @@ build = "build.rs" polkadot-node-core-pvf = { git = "https://github.com/paritytech/polkadot", branch = "master" } [build-dependencies] -toml = "0.7.4" +toml = "0.7.6" diff --git a/test/runtime/Cargo.toml b/test/runtime/Cargo.toml index 32fb285f1cd..7c3a17d27c2 100644 --- a/test/runtime/Cargo.toml +++ b/test/runtime/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.8.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } # Substrate frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/test/runtime/src/lib.rs b/test/runtime/src/lib.rs index 2273cc4c44a..7e2fd9695fd 100644 --- a/test/runtime/src/lib.rs +++ b/test/runtime/src/lib.rs @@ -186,14 +186,12 @@ impl frame_system::Config for Runtime { type Lookup = IdentityLookup; /// The index type for storing how many extrinsics an account has signed. type Nonce = Nonce; - /// 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 block type. + type Block = Block; /// The ubiquitous event type. type RuntimeEvent = RuntimeEvent; /// The ubiquitous origin type. @@ -294,10 +292,7 @@ parameter_types! { impl test_pallet::Config for Runtime {} construct_runtime! { - pub enum Runtime where - Block = Block, - NodeBlock = NodeBlock, - UncheckedExtrinsic = UncheckedExtrinsic, + pub enum Runtime { System: frame_system, ParachainSystem: cumulus_pallet_parachain_system, diff --git a/test/service/Cargo.toml b/test/service/Cargo.toml index d2317399bd4..406e57a18b4 100644 --- a/test/service/Cargo.toml +++ b/test/service/Cargo.toml @@ -9,14 +9,14 @@ name = "test-parachain" path = "src/main.rs" [dependencies] -async-trait = "0.1.68" -clap = { version = "4.3.6", features = ["derive"] } +async-trait = "0.1.71" +clap = { version = "4.3.11", features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.0.0" } criterion = { version = "0.5.1", features = [ "async_tokio" ] } jsonrpsee = { version = "0.16.2", features = ["server"] } rand = "0.8.5" -serde = { version = "1.0.164", features = ["derive"] } -tokio = { version = "1.28.2", features = ["macros"] } +serde = { version = "1.0.171", features = ["derive"] } +tokio = { version = "1.29.1", features = ["macros"] } tracing = "0.1.37" url = "2.4.0" tempfile = "3.6.0" diff --git a/test/service/benches/validate_block.rs b/test/service/benches/validate_block.rs index 3f4c39e5aa9..f3b4d0b1214 100644 --- a/test/service/benches/validate_block.rs +++ b/test/service/benches/validate_block.rs @@ -79,8 +79,7 @@ fn benchmark_block_validation(c: &mut Criterion) { // Each account should only be included in one transfer. let (src_accounts, dst_accounts, account_ids) = utils::create_benchmark_accounts(); - let mut test_client_builder = TestClientBuilder::with_default_backend() - .set_execution_strategy(sc_client_api::ExecutionStrategy::AlwaysWasm); + let mut test_client_builder = TestClientBuilder::with_default_backend(); let genesis_init = test_client_builder.genesis_init_mut(); *genesis_init = cumulus_test_client::GenesisParameters { endowed_accounts: account_ids }; let client = test_client_builder.build_with_native_executor(None).0; diff --git a/test/service/benches/validate_block_glutton.rs b/test/service/benches/validate_block_glutton.rs index 5f5fda07168..0e049d8665d 100644 --- a/test/service/benches/validate_block_glutton.rs +++ b/test/service/benches/validate_block_glutton.rs @@ -61,8 +61,7 @@ fn benchmark_block_validation(c: &mut Criterion) { let runtime = tokio::runtime::Runtime::new().expect("creating tokio runtime doesn't fail; qed"); let endowed_accounts = vec![AccountId::from(Alice.public())]; - let mut test_client_builder = TestClientBuilder::with_default_backend() - .set_execution_strategy(sc_client_api::ExecutionStrategy::NativeElseWasm); + let mut test_client_builder = TestClientBuilder::with_default_backend(); let genesis_init = test_client_builder.genesis_init_mut(); *genesis_init = cumulus_test_client::GenesisParameters { endowed_accounts }; diff --git a/test/service/src/chain_spec.rs b/test/service/src/chain_spec.rs index 90972aa865f..3d72d0db3ab 100644 --- a/test/service/src/chain_spec.rs +++ b/test/service/src/chain_spec.rs @@ -143,6 +143,7 @@ pub fn testnet_genesis( code: cumulus_test_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), + ..Default::default() }, glutton: Default::default(), parachain_system: Default::default(), diff --git a/test/service/src/cli.rs b/test/service/src/cli.rs index 0b7084e1abd..4c86094f81d 100644 --- a/test/service/src/cli.rs +++ b/test/service/src/cli.rs @@ -19,7 +19,7 @@ use std::{net::SocketAddr, path::PathBuf}; use polkadot_service::{ChainSpec, ParaId, PrometheusConfig}; use sc_cli::{ CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams, NetworkParams, - Result as CliResult, RuntimeVersion, SharedParams, SubstrateCli, + Result as CliResult, SharedParams, SubstrateCli, }; use sc_service::BasePath; @@ -296,10 +296,6 @@ impl SubstrateCli for TestCollatorCli { }, }) } - - fn native_runtime_version(_: &Box) -> &'static RuntimeVersion { - &cumulus_test_service::runtime::VERSION - } } impl SubstrateCli for RelayChainCli { @@ -337,8 +333,4 @@ impl SubstrateCli for RelayChainCli { ::from_iter([RelayChainCli::executable_name()].iter()) .load_spec(id) } - - fn native_runtime_version(chain_spec: &Box) -> &'static RuntimeVersion { - polkadot_cli::Cli::native_runtime_version(chain_spec) - } } diff --git a/test/service/src/lib.rs b/test/service/src/lib.rs index e45ba47f6eb..d597997c276 100644 --- a/test/service/src/lib.rs +++ b/test/service/src/lib.rs @@ -55,7 +55,6 @@ use polkadot_node_subsystem::{errors::RecoveryError, messages::AvailabilityRecov use polkadot_overseer::Handle as OverseerHandle; use polkadot_primitives::{CollatorPair, Hash as PHash, PersistedValidationData}; use polkadot_service::ProvideRuntimeApi; -use sc_client_api::execution_extensions::ExecutionStrategies; use sc_consensus::ImportQueue; use sc_network::{ config::{FullNetworkConfiguration, TransportConfig}, @@ -758,13 +757,6 @@ pub fn node_config( wasm_method: WasmExecutionMethod::Compiled { instantiation_strategy: sc_executor_wasmtime::InstantiationStrategy::PoolingCopyOnWrite, }, - execution_strategies: ExecutionStrategies { - syncing: sc_client_api::ExecutionStrategy::AlwaysWasm, - importing: sc_client_api::ExecutionStrategy::AlwaysWasm, - block_construction: sc_client_api::ExecutionStrategy::AlwaysWasm, - offchain_worker: sc_client_api::ExecutionStrategy::AlwaysWasm, - other: sc_client_api::ExecutionStrategy::AlwaysWasm, - }, rpc_addr: None, rpc_max_connections: Default::default(), rpc_cors: None, diff --git a/test/service/src/main.rs b/test/service/src/main.rs index 760caece1ae..a2b177db251 100644 --- a/test/service/src/main.rs +++ b/test/service/src/main.rs @@ -103,14 +103,6 @@ fn main() -> Result<(), sc_cli::Error> { ¶chain_id, ); - let state_version = - RelayChainCli::native_runtime_version(&config.chain_spec).state_version(); - - let block: parachains_common::Block = - generate_genesis_block(&*config.chain_spec, state_version) - .map_err(|e| format!("{:?}", e))?; - let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode())); - let tokio_handle = config.tokio_handle.clone(); let polkadot_config = SubstrateCli::create_configuration(&polkadot_cli, &polkadot_cli, tokio_handle) @@ -118,7 +110,6 @@ fn main() -> Result<(), sc_cli::Error> { tracing::info!("Parachain id: {:?}", parachain_id); tracing::info!("Parachain Account: {}", parachain_account); - tracing::info!("Parachain genesis state: {}", genesis_state); tracing::info!( "Is collating: {}", if config.role.is_authority() { "yes" } else { "no" } diff --git a/xcm/xcm-emulator/Cargo.toml b/xcm/xcm-emulator/Cargo.toml index 01b9f6d6043..2c8bdb2f3b1 100644 --- a/xcm/xcm-emulator/Cargo.toml +++ b/xcm/xcm-emulator/Cargo.toml @@ -7,11 +7,12 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0" } -paste = "1.0.5" -quote = "1.0.28" +paste = "1.0.13" +quote = "1.0.29" casey = "0.4.0" log = { version = "0.4.19", default-features = false } +# Substrate frame-support = { git = "https://github.com/paritytech/substrate", branch = "master" } frame-system = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-io = { git = "https://github.com/paritytech/substrate", branch = "master" } @@ -22,6 +23,7 @@ sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" } pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master" } pallet-message-queue = { git = "https://github.com/paritytech/substrate", branch = "master" } +# Cumulus cumulus-primitives-core = { path = "../../primitives/core"} cumulus-pallet-xcmp-queue = { path = "../../pallets/xcmp-queue" } cumulus-pallet-dmp-queue = { path = "../../pallets/dmp-queue" } @@ -32,7 +34,7 @@ cumulus-primitives-parachain-inherent = { path = "../../primitives/parachain-inh cumulus-test-relay-sproof-builder = { path = "../../test/relay-sproof-builder" } parachains-common = { path = "../../parachains/common" } +# Polkadot xcm = { git = "https://github.com/paritytech/polkadot", branch = "master" } -xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "master" } diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index 068c99e5a47..170ec1e6fb4 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -14,23 +14,26 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . -pub use casey::pascal; -pub use codec::Encode; +pub use codec::{Decode, Encode}; +pub use log; +pub use paste; +pub use std::{collections::HashMap, error::Error, fmt, thread::LocalKey}; + +// Substrate pub use frame_support::{ - sp_runtime::BuildStorage, + assert_ok, traits::{EnqueueMessage, Get, Hooks, ProcessMessage, ProcessMessageError, ServiceQueues}, weights::{Weight, WeightMeter}, }; pub use frame_system::AccountInfo; -pub use log; pub use pallet_balances::AccountData; -pub use paste; pub use sp_arithmetic::traits::Bounded; -pub use sp_core::storage::Storage; +pub use sp_core::{storage::Storage, H256}; pub use sp_io; -pub use sp_std::{cell::RefCell, collections::vec_deque::VecDeque, marker::PhantomData}; +pub use sp_std::{cell::RefCell, collections::vec_deque::VecDeque, fmt::Debug}; pub use sp_trie::StorageProof; +//Cumulus pub use cumulus_pallet_dmp_queue; pub use cumulus_pallet_parachain_system; pub use cumulus_pallet_xcmp_queue; @@ -44,15 +47,14 @@ pub use cumulus_test_service::get_account_id_from_seed; pub use pallet_message_queue; pub use parachain_info; pub use parachains_common::{AccountId, BlockNumber}; - pub use polkadot_primitives; pub use polkadot_runtime_parachains::{ dmp, inclusion::{AggregateMessageOrigin, UmpQueueId}, }; -pub use std::{collections::HashMap, thread::LocalKey}; -pub use xcm::{v3::prelude::*, VersionedXcm}; -pub use xcm_executor::XcmExecutor; + +// Polkadot +pub use xcm::v3::prelude::*; thread_local! { /// Downward messages, each message is: `(to_para_id, [(relay_block_number, msg)])` @@ -67,8 +69,10 @@ thread_local! { #[allow(clippy::type_complexity)] pub static HORIZONTAL_MESSAGES: RefCell)>)>>> = RefCell::new(HashMap::new()); - /// Upward messages, each message is: `(from_para_id, msg) + /// Upward messages, each message is: `(from_para_id, msg)` pub static UPWARD_MESSAGES: RefCell)>>> = RefCell::new(HashMap::new()); + /// Bridged messages, each message is: `BridgeMessage` + pub static BRIDGED_MESSAGES: RefCell>> = RefCell::new(HashMap::new()); /// Global incremental relay chain block number pub static RELAY_BLOCK_NUMBER: RefCell> = RefCell::new(HashMap::new()); /// Parachains Ids a the Network @@ -85,40 +89,45 @@ pub trait TestExt { fn ext_wrapper(func: impl FnOnce() -> R) -> R; } +impl TestExt for () { + fn build_new_ext(_storage: Storage) -> sp_io::TestExternalities { + sp_io::TestExternalities::default() + } + fn new_ext() -> sp_io::TestExternalities { + sp_io::TestExternalities::default() + } + fn reset_ext() {} + fn execute_with(execute: impl FnOnce() -> R) -> R { + execute() + } + fn ext_wrapper(func: impl FnOnce() -> R) -> R { + func() + } +} + pub trait Network { - fn _init(); - fn _para_ids() -> Vec; - fn _relay_block_number() -> u32; - fn _set_relay_block_number(block_number: u32); - fn _process_messages(); - fn _has_unprocessed_messages() -> bool; - fn _process_downward_messages(); - fn _process_horizontal_messages(); - fn _process_upward_messages(); - fn _hrmp_channel_parachain_inherent_data( + type Bridge: Bridge; + + fn init(); + fn para_ids() -> Vec; + fn relay_block_number() -> u32; + fn set_relay_block_number(block_number: u32); + fn process_messages(); + fn has_unprocessed_messages() -> bool; + fn process_downward_messages(); + fn process_horizontal_messages(); + fn process_upward_messages(); + fn process_bridged_messages(); + fn hrmp_channel_parachain_inherent_data( para_id: u32, relay_parent_number: u32, ) -> ParachainInherentData; } -pub trait NetworkComponent { - fn network_name() -> &'static str; - - fn init() { - N::_init(); - } +pub trait NetworkComponent { + type Network: Network; - fn relay_block_number() -> u32 { - N::_relay_block_number() - } - - fn set_relay_block_number(block_number: u32) { - N::_set_relay_block_number(block_number); - } - - fn para_ids() -> Vec { - N::_para_ids() - } + fn network_name() -> &'static str; fn send_horizontal_messages)>>( to_para_id: u32, @@ -153,15 +162,9 @@ pub trait NetworkComponent { }); } - fn hrmp_channel_parachain_inherent_data( - para_id: u32, - relay_parent_number: u32, - ) -> ParachainInherentData { - N::_hrmp_channel_parachain_inherent_data(para_id, relay_parent_number) - } - - fn process_messages() { - N::_process_messages(); + fn send_bridged_messages(msg: BridgeMessage) { + BRIDGED_MESSAGES + .with(|b| b.borrow_mut().get_mut(Self::network_name()).unwrap().push_back(msg)); } } @@ -190,6 +193,64 @@ pub trait Parachain: XcmpMessageHandler + DmpMessageHandler { type ParachainInfo; } +pub trait Bridge { + type Source: TestExt; + type Target: TestExt; + type Handler: BridgeMessageHandler; + + fn init(); +} + +impl Bridge for () { + type Source = (); + type Target = (); + type Handler = (); + + fn init() {} +} + +#[derive(Clone, Default, Debug)] +pub struct BridgeMessage { + pub id: u32, + pub nonce: u64, + pub payload: Vec, +} + +pub trait BridgeMessageHandler { + fn get_source_outbound_messages() -> Vec; + + fn dispatch_target_inbound_message( + message: BridgeMessage, + ) -> Result<(), BridgeMessageDispatchError>; + + fn notify_source_message_delivery(lane_id: u32); +} + +impl BridgeMessageHandler for () { + fn get_source_outbound_messages() -> Vec { + Default::default() + } + + fn dispatch_target_inbound_message( + _message: BridgeMessage, + ) -> Result<(), BridgeMessageDispatchError> { + Err(BridgeMessageDispatchError(Box::new("Not a bridge"))) + } + + fn notify_source_message_delivery(_lane_id: u32) {} +} + +#[derive(Debug)] +pub struct BridgeMessageDispatchError(pub Box); + +impl Error for BridgeMessageDispatchError {} + +impl fmt::Display for BridgeMessageDispatchError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{:?}", self.0) + } +} + // Relay Chain Implementation #[macro_export] macro_rules! decl_test_relay_chains { @@ -322,9 +383,9 @@ macro_rules! __impl_test_ext_for_relay_chain { } fn execute_with(execute: impl FnOnce() -> R) -> R { - use $crate::{NetworkComponent}; + use $crate::{NetworkComponent, Network}; // Make sure the Network is initialized - <$name>::init(); + <$name as NetworkComponent>::Network::init(); let r = $ext_name.with(|v| v.borrow_mut().execute_with(execute)); @@ -334,7 +395,7 @@ macro_rules! __impl_test_ext_for_relay_chain { use $crate::polkadot_primitives::runtime_api::runtime_decl_for_parachain_host::$api_version; //TODO: mark sent count & filter out sent msg - for para_id in <$name>::para_ids() { + for para_id in<$name as NetworkComponent>::Network::para_ids() { // downward messages let downward_messages = ::Runtime::dmq_contents(para_id.into()) .into_iter() @@ -350,7 +411,7 @@ macro_rules! __impl_test_ext_for_relay_chain { }) }); - <$name>::process_messages(); + <$name as NetworkComponent>::Network::process_messages(); r } @@ -368,10 +429,12 @@ macro_rules! __impl_test_ext_for_relay_chain { #[macro_export] macro_rules! __impl_relay { - ($network_name:ident, $relay_chain:ty) => { - impl $crate::NetworkComponent<$network_name> for $relay_chain { + ($network:ident, $relay_chain:ty) => { + impl $crate::NetworkComponent for $relay_chain { + type Network = $network; + fn network_name() -> &'static str { - stringify!($network_name) + stringify!($network) } } @@ -549,24 +612,24 @@ macro_rules! __impl_test_ext_for_parachain { } fn execute_with(execute: impl FnOnce() -> R) -> R { - use $crate::{Get, Hooks, NetworkComponent}; + use $crate::{Get, Hooks, NetworkComponent, Network, Bridge}; // Make sure the Network is initialized - <$name>::init(); + <$name as NetworkComponent>::Network::init(); - let mut relay_block_number = <$name>::relay_block_number(); + let mut relay_block_number = <$name as NetworkComponent>::Network::relay_block_number(); relay_block_number += 1; - <$name>::set_relay_block_number(relay_block_number); + <$name as NetworkComponent>::Network::set_relay_block_number(relay_block_number); let para_id = <$name>::para_id().into(); $ext_name.with(|v| { v.borrow_mut().execute_with(|| { // Make sure it has been recorded properly - let relay_block_number = <$name>::relay_block_number(); + let relay_block_number = <$name as NetworkComponent>::Network::relay_block_number(); let _ = ::ParachainSystem::set_validation_data( ::RuntimeOrigin::none(), - <$name>::hrmp_channel_parachain_inherent_data(para_id, relay_block_number), + <$name as NetworkComponent>::Network::hrmp_channel_parachain_inherent_data(para_id, relay_block_number), ); }) }); @@ -588,12 +651,12 @@ macro_rules! __impl_test_ext_for_parachain { Default::default(), ); - // get messages + // get xcmp messages ::ParachainSystem::on_finalize(block_number); let collation_info = ::ParachainSystem::collect_collation_info(&mock_header); // send upward messages - let relay_block_number = <$name>::relay_block_number(); + let relay_block_number = <$name as NetworkComponent>::Network::relay_block_number(); for msg in collation_info.upward_messages.clone() { <$name>::send_upward_message(para_id, msg); } @@ -606,12 +669,22 @@ macro_rules! __impl_test_ext_for_parachain { ); } + // get bridge messages + type NetworkBridge = <<$name as NetworkComponent>::Network as Network>::Bridge; + + let bridge_messages = ::Handler::get_source_outbound_messages(); + + // send bridged messages + for msg in bridge_messages { + <$name>::send_bridged_messages(msg); + } + // clean messages ::ParachainSystem::on_initialize(block_number); }) }); - <$name>::process_messages(); + <$name as NetworkComponent>::Network::process_messages(); r } @@ -629,10 +702,12 @@ macro_rules! __impl_test_ext_for_parachain { #[macro_export] macro_rules! __impl_parachain { - ($network_name:ident, $parachain:ty) => { - impl $crate::NetworkComponent<$network_name> for $parachain { + ($network:ident, $parachain:ty) => { + impl $crate::NetworkComponent for $parachain { + type Network = $network; + fn network_name() -> &'static str { - stringify!($network_name) + stringify!($network) } } @@ -645,6 +720,10 @@ macro_rules! __impl_parachain { (Parent).into() } + pub fn sibling_location_of(para_id: $crate::ParaId) -> $crate::MultiLocation { + (Parent, X1(Parachain(para_id.into()))).into() + } + pub fn account_id_of(seed: &str) -> $crate::AccountId { $crate::get_account_id_from_seed::(seed) } @@ -677,7 +756,7 @@ macro_rules! __impl_parachain { } fn prepare_for_xcmp() { - use $crate::NetworkComponent; + use $crate::{Network, NetworkComponent}; let para_id = Self::para_id(); ::ext_wrapper(|| { @@ -687,7 +766,10 @@ macro_rules! __impl_parachain { let _ = ::ParachainSystem::set_validation_data( ::RuntimeOrigin::none(), - Self::hrmp_channel_parachain_inherent_data(para_id.into(), 1), + ::Network::hrmp_channel_parachain_inherent_data( + para_id.into(), + 1, + ), ); // set `AnnouncedHrmpMessagesPerCandidate` ::ParachainSystem::on_initialize(block_number); @@ -705,6 +787,7 @@ macro_rules! decl_test_networks { pub struct $name:ident { relay_chain = $relay_chain:ty, parachains = vec![ $( $parachain:ty, )* ], + bridge = $bridge:ty } ), + @@ -721,16 +804,18 @@ macro_rules! decl_test_networks { $crate::DMP_DONE.with(|b| b.borrow_mut().remove(stringify!($name))); $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().remove(stringify!($name))); $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().remove(stringify!($name))); + $crate::BRIDGED_MESSAGES.with(|b| b.borrow_mut().remove(stringify!($name))); $crate::RELAY_BLOCK_NUMBER.with(|b| b.borrow_mut().remove(stringify!($name))); <$relay_chain>::reset_ext(); $( <$parachain>::reset_ext(); )* - $( <$parachain>::prepare_for_xcmp(); )* } } impl $crate::Network for $name { - fn _init() { + type Bridge = $bridge; + + fn init() { // If Network has not been itialized yet, it gets initialized if $crate::INITIALIZED.with(|b| b.borrow_mut().get(stringify!($name)).is_none()) { $crate::INITIALIZED.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), true)); @@ -738,49 +823,54 @@ macro_rules! decl_test_networks { $crate::DMP_DONE.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), $crate::VecDeque::new())); $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), $crate::VecDeque::new())); $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), $crate::VecDeque::new())); + $crate::BRIDGED_MESSAGES.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), $crate::VecDeque::new())); $crate::RELAY_BLOCK_NUMBER.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), 1)); - $crate::PARA_IDS.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), Self::_para_ids())); + $crate::PARA_IDS.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), Self::para_ids())); $( <$parachain>::prepare_for_xcmp(); )* } } - fn _para_ids() -> Vec { + fn para_ids() -> Vec { vec![$( <$parachain>::para_id().into(), )*] } - fn _relay_block_number() -> u32 { + fn relay_block_number() -> u32 { $crate::RELAY_BLOCK_NUMBER.with(|v| *v.clone().borrow().get(stringify!($name)).unwrap()) } - fn _set_relay_block_number(block_number: u32) { + fn set_relay_block_number(block_number: u32) { $crate::RELAY_BLOCK_NUMBER.with(|v| v.borrow_mut().insert(stringify!($name).to_string(), block_number)); } - fn _process_messages() { - while Self::_has_unprocessed_messages() { - Self::_process_upward_messages(); - Self::_process_horizontal_messages(); - Self::_process_downward_messages(); + fn process_messages() { + while Self::has_unprocessed_messages() { + Self::process_upward_messages(); + Self::process_horizontal_messages(); + Self::process_downward_messages(); + Self::process_bridged_messages(); } } - fn _has_unprocessed_messages() -> bool { + fn has_unprocessed_messages() -> bool { $crate::DOWNWARD_MESSAGES.with(|b| !b.borrow_mut().get_mut(stringify!($name)).unwrap().is_empty()) || $crate::HORIZONTAL_MESSAGES.with(|b| !b.borrow_mut().get_mut(stringify!($name)).unwrap().is_empty()) || $crate::UPWARD_MESSAGES.with(|b| !b.borrow_mut().get_mut(stringify!($name)).unwrap().is_empty()) + || $crate::BRIDGED_MESSAGES.with(|b| !b.borrow_mut().get_mut(stringify!($name)).unwrap().is_empty()) } - fn _process_downward_messages() { + fn process_downward_messages() { use $crate::{DmpMessageHandler, Bounded}; use polkadot_parachain::primitives::RelayChainBlockNumber; while let Some((to_para_id, messages)) = $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().pop_front()) { $( - if $crate::PARA_IDS.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().contains(&to_para_id)) { + let para_id: u32 = <$parachain>::para_id().into(); + + if $crate::PARA_IDS.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().contains(&to_para_id)) && para_id == to_para_id { let mut msg_dedup: Vec<(RelayChainBlockNumber, Vec)> = Vec::new(); for m in &messages { msg_dedup.push((m.0, m.1.clone())); @@ -792,32 +882,34 @@ macro_rules! decl_test_networks { }).collect::)>>(); if msgs.len() != 0 { <$parachain>::handle_dmp_messages(msgs.clone().into_iter(), $crate::Weight::max_value()); + $crate::log::debug!(target: concat!("dmp::", stringify!($name)) , "DMP messages processed {:?} to para_id {:?}", msgs.clone(), &to_para_id); for m in msgs { $crate::DMP_DONE.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().push_back((to_para_id, m.0, m.1))); } } - } else { - unreachable!(); } )* } } - fn _process_horizontal_messages() { + fn process_horizontal_messages() { use $crate::{XcmpMessageHandler, Bounded}; while let Some((to_para_id, messages)) = $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().pop_front()) { let iter = messages.iter().map(|(p, b, m)| (*p, *b, &m[..])).collect::>().into_iter(); $( - if $crate::PARA_IDS.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().contains(&to_para_id)) { + let para_id: u32 = <$parachain>::para_id().into(); + + if $crate::PARA_IDS.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().contains(&to_para_id)) && para_id == to_para_id { <$parachain>::handle_xcmp_messages(iter.clone(), $crate::Weight::max_value()); + $crate::log::debug!(target: concat!("hrmp::", stringify!($name)) , "HRMP messages processed {:?} to para_id {:?}", &messages, &to_para_id); } )* } } - fn _process_upward_messages() { + fn process_upward_messages() { use $crate::{Bounded, ProcessMessage, WeightMeter}; use sp_core::Encode; while let Some((from_para_id, msg)) = $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().pop_front()) { @@ -828,10 +920,33 @@ macro_rules! decl_test_networks { &mut weight_meter, &mut msg.using_encoded(sp_core::blake2_256), ); + $crate::log::debug!(target: concat!("ump::", stringify!($name)) , "Upward message processed {:?} from para_id {:?}", &msg, &from_para_id); } } - fn _hrmp_channel_parachain_inherent_data( + fn process_bridged_messages() { + use $crate::Bridge; + // Make sure both, including the target `Network` are initialized + ::init(); + + while let Some(msg) = $crate::BRIDGED_MESSAGES.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().pop_front()) { + let dispatch_result = <::Target as TestExt>::ext_wrapper(|| { + <::Handler as BridgeMessageHandler>::dispatch_target_inbound_message(msg.clone()) + }); + + match dispatch_result { + Err(e) => panic!("Error {:?} processing bridged message: {:?}", e, msg.clone()), + Ok(()) => { + <::Source as TestExt>::ext_wrapper(|| { + <::Handler as BridgeMessageHandler>::notify_source_message_delivery(msg.id); + }); + $crate::log::debug!(target: concat!("bridge::", stringify!($name)) , "Bridged message processed {:?}", msg.clone()); + } + } + } + } + + fn hrmp_channel_parachain_inherent_data( para_id: u32, relay_parent_number: u32, ) -> $crate::ParachainInherentData { @@ -889,6 +1004,38 @@ macro_rules! decl_test_networks { }; } +#[macro_export] +macro_rules! decl_test_bridges { + ( + $( + pub struct $name:ident { + source = $source:ty, + target = $target:ty, + handler = $handler:ty + } + ), + + + ) => { + $( + #[derive(Debug)] + pub struct $name; + + impl $crate::Bridge for $name { + type Source = $source; + type Target = $target; + type Handler = $handler; + + fn init() { + use $crate::{NetworkComponent, Network}; + // Make sure source and target `Network` has been initialized + <$source as NetworkComponent>::Network::init(); + <$target as NetworkComponent>::Network::init(); + } + } + )+ + }; +} + #[macro_export] macro_rules! assert_expected_events { ( $chain:ident, vec![$( $event_pat:pat => { $($attr:ident : $condition:expr, )* }, )*] ) => { @@ -898,7 +1045,7 @@ macro_rules! assert_expected_events { let mut event_message: Vec = Vec::new(); let event_received = <$chain>::events().iter().any(|event| { - $crate::log::debug!(target: format!("events::{}", stringify!($chain)).to_lowercase().as_str(), "{:?}", event); + $crate::log::debug!(target: concat!("events::", stringify!($chain)), "{:?}", event); match event { $event_pat => { @@ -934,6 +1081,20 @@ macro_rules! bx { }; } +#[macro_export] +macro_rules! decl_test_sender_receiver_accounts_parameter_types { + ( $( $chain:ident { sender: $sender:expr, receiver: $receiver:expr }),+ ) => { + $crate::paste::paste! { + parameter_types! { + $( + pub [<$chain Sender>]: $crate::AccountId = <$chain>::account_id_of($sender); + pub [<$chain Receiver>]: $crate::AccountId = <$chain>::account_id_of($receiver); + )+ + } + } + }; +} + pub mod helpers { use super::Weight;