diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 00000000000..66b28b3485d --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,32 @@ +# +# An auto defined `clippy` feature was introduced, +# but it was found to clash with user defined features, +# so was renamed to `cargo-clippy`. +# +# If you want standard clippy run: +# RUSTFLAGS= cargo clippy +[target.'cfg(feature = "cargo-clippy")'] +rustflags = [ + "-Aclippy::all", + "-Dclippy::correctness", + "-Aclippy::if-same-then-else", + "-Aclippy::clone-double-ref", + "-Dclippy::complexity", + "-Aclippy::zero-prefixed-literal", # 00_1000_000 + "-Aclippy::type_complexity", # raison d'etre + "-Aclippy::nonminimal-bool", # maybe + "-Aclippy::borrowed-box", # Reasonable to fix this one + "-Aclippy::too-many-arguments", # (Turning this on would lead to) + "-Aclippy::unnecessary_cast", # Types may change + "-Aclippy::identity-op", # One case where we do 0 + + "-Aclippy::useless_conversion", # Types may change + "-Aclippy::unit_arg", # styalistic. + "-Aclippy::option-map-unit-fn", # styalistic + "-Aclippy::bind_instead_of_map", # styalistic + "-Aclippy::erasing_op", # E.g. 0 * DOLLARS + "-Aclippy::eq_op", # In tests we test equality. + "-Aclippy::while_immutable_condition", # false positives + "-Aclippy::needless_option_as_deref", # false positives + "-Aclippy::derivable_impls", # false positives + "-Aclippy::stable_sort_primitive", # prefer stable sort +] diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7166ace649f..93471823d26 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,7 +29,7 @@ variables: CI_IMAGE: "paritytech/ci-linux:production" DOCKER_OS: "debian:stretch" ARCH: "x86_64" - ZOMBIENET_IMAGE: "docker.io/paritytech/zombienet:v1.3.43" + ZOMBIENET_IMAGE: "docker.io/paritytech/zombienet:v1.3.50" BUILDAH_IMAGE: "quay.io/buildah/stable:v1.29" BUILDAH_COMMAND: "buildah --storage-driver overlay2" diff --git a/Cargo.lock b/Cargo.lock index 2ee029368c9..49d3ad5b7df 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -263,9 +263,9 @@ checksum = "f52f63c5c1316a16a4b35eaac8b76a98248961a533f061684cb2a7cb0eafb6c6" [[package]] name = "array-bytes" -version = "6.0.0" +version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22f72e9d6fac4bc80778ea470b20197b88d28c292bb7d60c3fb099280003cd19" +checksum = "d9b1c5a481ec30a5abd8dfbd94ab5cf1bb4e9a66be7f1b3b322f2f1170c200fd" [[package]] name = "arrayref" @@ -585,7 +585,7 @@ dependencies = [ [[package]] name = "binary-merkle-tree" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "hash-db", "log", @@ -1334,6 +1334,15 @@ dependencies = [ "thiserror", ] +[[package]] +name = "casey" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fabe85130dda9cf267715582ce6cf1ab581c8dfe3cb33f7065fee0f14e3fea14" +dependencies = [ + "syn 1.0.109", +] + [[package]] name = "cast" version = "0.3.0" @@ -1715,6 +1724,19 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "console" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d79fbe8970a77e3e34151cc13d3b3e248aa0faaecb9f6091fa07ebefe5ad60" +dependencies = [ + "encode_unicode", + "lazy_static", + "libc", + "unicode-width", + "windows-sys 0.42.0", +] + [[package]] name = "const-oid" version = "0.9.2" @@ -2661,7 +2683,7 @@ dependencies = [ name = "cumulus-relay-chain-minimal-node" version = "0.1.0" dependencies = [ - "array-bytes 6.0.0", + "array-bytes 6.1.0", "async-trait", "cumulus-primitives-core", "cumulus-relay-chain-interface", @@ -3375,6 +3397,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "encode_unicode" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" + [[package]] name = "enum-as-inner" version = "0.5.1" @@ -3742,7 +3770,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "parity-scale-codec", ] @@ -3765,7 +3793,7 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "frame-support-procedural", @@ -3790,7 +3818,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "Inflector", "array-bytes 4.2.0", @@ -3837,7 +3865,7 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -3848,7 +3876,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -3865,7 +3893,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "frame-system", @@ -3894,10 +3922,11 @@ dependencies = [ [[package]] name = "frame-remote-externalities" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-recursion", "futures", + "indicatif", "jsonrpsee", "log", "parity-scale-codec", @@ -3905,6 +3934,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", + "spinners", "substrate-rpc-client", "tokio", ] @@ -3912,7 +3942,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "bitflags", "environmental", @@ -3945,7 +3975,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "Inflector", "cfg-expr", @@ -3961,7 +3991,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -3973,7 +4003,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "proc-macro2", "quote", @@ -3983,7 +4013,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "log", @@ -4001,7 +4031,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -4016,7 +4046,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "parity-scale-codec", "sp-api", @@ -4025,7 +4055,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "parity-scale-codec", @@ -4730,6 +4760,18 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" +[[package]] +name = "indicatif" +version = "0.17.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cef509aa9bc73864d6756f0d34d35504af3cf0844373afe9b8669a5b8005a729" +dependencies = [ + "console", + "number_prefix", + "portable-atomic", + "unicode-width", +] + [[package]] name = "instant" version = "0.1.12" @@ -4754,6 +4796,47 @@ dependencies = [ "num-traits", ] +[[package]] +name = "integration-tests-common" +version = "1.0.0" +dependencies = [ + "bridge-hub-kusama-runtime", + "bridge-hub-polkadot-runtime", + "collectives-polkadot-runtime", + "cumulus-primitives-core", + "frame-support", + "frame-system", + "kusama-runtime", + "kusama-runtime-constants", + "pallet-assets", + "pallet-balances", + "pallet-im-online", + "pallet-staking", + "pallet-xcm", + "parachain-info", + "parachains-common", + "parity-scale-codec", + "penpal-runtime", + "polkadot-core-primitives", + "polkadot-parachain", + "polkadot-primitives", + "polkadot-runtime", + "polkadot-runtime-constants", + "polkadot-runtime-parachains", + "polkadot-service", + "sc-consensus-grandpa", + "sp-authority-discovery", + "sp-consensus-babe", + "sp-core", + "sp-runtime", + "sp-weights", + "statemine-runtime", + "statemint-runtime", + "xcm", + "xcm-emulator", + "xcm-executor", +] + [[package]] name = "interceptor" version = "0.8.2" @@ -5030,7 +5113,7 @@ checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" [[package]] name = "kusama-runtime" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bitvec", "frame-benchmarking", @@ -5128,7 +5211,7 @@ dependencies = [ [[package]] name = "kusama-runtime-constants" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "frame-support", "polkadot-primitives", @@ -5982,7 +6065,7 @@ dependencies = [ [[package]] name = "mmr-gadget" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "futures", "log", @@ -6001,7 +6084,7 @@ dependencies = [ [[package]] name = "mmr-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "anyhow", "jsonrpsee", @@ -6349,6 +6432,12 @@ dependencies = [ "libc", ] +[[package]] +name = "number_prefix" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" + [[package]] name = "object" version = "0.29.0" @@ -6500,7 +6589,7 @@ dependencies = [ [[package]] name = "pallet-alliance" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "array-bytes 4.2.0", "frame-benchmarking", @@ -6521,7 +6610,7 @@ dependencies = [ [[package]] name = "pallet-asset-tx-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -6539,7 +6628,7 @@ dependencies = [ [[package]] name = "pallet-assets" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -6554,7 +6643,7 @@ dependencies = [ [[package]] name = "pallet-aura" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "frame-system", @@ -6570,7 +6659,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "frame-system", @@ -6586,7 +6675,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "frame-system", @@ -6600,7 +6689,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -6624,7 +6713,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6644,7 +6733,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -6659,7 +6748,7 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "frame-system", @@ -6678,7 +6767,7 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "array-bytes 4.2.0", "binary-merkle-tree", @@ -6702,7 +6791,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -6808,7 +6897,7 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -6852,7 +6941,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -6869,7 +6958,7 @@ dependencies = [ [[package]] name = "pallet-contracts" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "bitflags", "environmental", @@ -6899,7 +6988,7 @@ dependencies = [ [[package]] name = "pallet-contracts-primitives" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "bitflags", "parity-scale-codec", @@ -6912,7 +7001,7 @@ dependencies = [ [[package]] name = "pallet-contracts-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "proc-macro2", "quote", @@ -6922,7 +7011,7 @@ dependencies = [ [[package]] name = "pallet-conviction-voting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "assert_matches", "frame-benchmarking", @@ -6939,7 +7028,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -6957,7 +7046,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6980,7 +7069,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6993,7 +7082,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7011,7 +7100,7 @@ dependencies = [ [[package]] name = "pallet-fast-unstake" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7029,7 +7118,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7052,7 +7141,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "enumflags2", "frame-benchmarking", @@ -7068,7 +7157,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7088,7 +7177,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7105,7 +7194,7 @@ dependencies = [ [[package]] name = "pallet-insecure-randomness-collective-flip" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "frame-system", @@ -7119,7 +7208,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7136,7 +7225,7 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7153,7 +7242,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7169,7 +7258,7 @@ dependencies = [ [[package]] name = "pallet-nfts" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "enumflags2", "frame-benchmarking", @@ -7187,7 +7276,7 @@ dependencies = [ [[package]] name = "pallet-nfts-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "pallet-nfts", @@ -7198,7 +7287,7 @@ dependencies = [ [[package]] name = "pallet-nis" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7214,7 +7303,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "frame-system", @@ -7231,7 +7320,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-benchmarking" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7251,7 +7340,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-runtime-api" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "pallet-nomination-pools", "parity-scale-codec", @@ -7262,7 +7351,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "frame-system", @@ -7279,7 +7368,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7300,10 +7389,25 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-parachain-template" +version = "0.1.0" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", +] + [[package]] name = "pallet-preimage" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7320,7 +7424,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7335,7 +7439,7 @@ dependencies = [ [[package]] name = "pallet-ranked-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7353,7 +7457,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7368,7 +7472,7 @@ dependencies = [ [[package]] name = "pallet-referenda" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "assert_matches", "frame-benchmarking", @@ -7387,7 +7491,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7404,7 +7508,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "frame-system", @@ -7425,7 +7529,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7441,7 +7545,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "frame-system", @@ -7455,7 +7559,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7478,7 +7582,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7489,7 +7593,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-fn" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "log", "sp-arithmetic", @@ -7498,7 +7602,7 @@ dependencies = [ [[package]] name = "pallet-staking-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "parity-scale-codec", "sp-api", @@ -7507,7 +7611,7 @@ dependencies = [ [[package]] name = "pallet-state-trie-migration" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7524,7 +7628,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "frame-system", @@ -7535,25 +7639,10 @@ dependencies = [ "sp-std", ] -[[package]] -name = "pallet-template" -version = "0.1.0" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "parity-scale-codec", - "scale-info", - "serde", - "sp-core", - "sp-io", - "sp-runtime", -] - [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7571,7 +7660,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7590,7 +7679,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "frame-system", @@ -7606,7 +7695,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -7622,7 +7711,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -7634,7 +7723,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7651,7 +7740,7 @@ dependencies = [ [[package]] name = "pallet-uniques" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7666,7 +7755,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7682,7 +7771,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7697,7 +7786,7 @@ dependencies = [ [[package]] name = "pallet-whitelist" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7712,7 +7801,7 @@ dependencies = [ [[package]] name = "pallet-xcm" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bounded-collections", "frame-benchmarking", @@ -7733,7 +7822,7 @@ dependencies = [ [[package]] name = "pallet-xcm-benchmarks" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "frame-benchmarking", "frame-support", @@ -7840,9 +7929,9 @@ dependencies = [ "pallet-authorship", "pallet-balances", "pallet-collator-selection", + "pallet-parachain-template", "pallet-session", "pallet-sudo", - "pallet-template", "pallet-timestamp", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", @@ -8311,7 +8400,7 @@ dependencies = [ [[package]] name = "polkadot-approval-distribution" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "futures", "polkadot-node-jaeger", @@ -8327,7 +8416,7 @@ dependencies = [ [[package]] name = "polkadot-availability-bitfield-distribution" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "futures", "polkadot-node-network-protocol", @@ -8341,7 +8430,7 @@ dependencies = [ [[package]] name = "polkadot-availability-distribution" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "derive_more", "fatality", @@ -8364,7 +8453,7 @@ dependencies = [ [[package]] name = "polkadot-availability-recovery" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "fatality", "futures", @@ -8385,7 +8474,7 @@ dependencies = [ [[package]] name = "polkadot-cli" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "clap 4.2.7", "frame-benchmarking-cli", @@ -8414,7 +8503,7 @@ dependencies = [ [[package]] name = "polkadot-client" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "async-trait", "frame-benchmarking", @@ -8457,7 +8546,7 @@ dependencies = [ [[package]] name = "polkadot-collator-protocol" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "always-assert", "bitvec", @@ -8479,7 +8568,7 @@ dependencies = [ [[package]] name = "polkadot-core-primitives" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "parity-scale-codec", "scale-info", @@ -8491,7 +8580,7 @@ dependencies = [ [[package]] name = "polkadot-dispute-distribution" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "derive_more", "fatality", @@ -8516,7 +8605,7 @@ dependencies = [ [[package]] name = "polkadot-erasure-coding" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "parity-scale-codec", "polkadot-node-primitives", @@ -8530,7 +8619,7 @@ dependencies = [ [[package]] name = "polkadot-gossip-support" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "futures", "futures-timer", @@ -8550,7 +8639,7 @@ dependencies = [ [[package]] name = "polkadot-network-bridge" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "always-assert", "async-trait", @@ -8573,7 +8662,7 @@ dependencies = [ [[package]] name = "polkadot-node-collation-generation" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "futures", "parity-scale-codec", @@ -8591,7 +8680,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-approval-voting" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bitvec", "derive_more", @@ -8620,7 +8709,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-av-store" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bitvec", "futures", @@ -8641,7 +8730,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-backing" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bitvec", "fatality", @@ -8660,7 +8749,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-bitfield-signing" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "futures", "polkadot-node-subsystem", @@ -8675,7 +8764,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-candidate-validation" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "async-trait", "futures", @@ -8695,7 +8784,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-api" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "futures", "polkadot-node-metrics", @@ -8710,7 +8799,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-selection" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "futures", "futures-timer", @@ -8727,7 +8816,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-dispute-coordinator" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "fatality", "futures", @@ -8746,7 +8835,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-parachains-inherent" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "async-trait", "futures", @@ -8763,7 +8852,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-provisioner" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bitvec", "fatality", @@ -8781,7 +8870,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "always-assert", "futures", @@ -8808,7 +8897,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf-checker" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "futures", "polkadot-node-primitives", @@ -8824,7 +8913,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf-worker" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "assert_matches", "cpu-time", @@ -8853,7 +8942,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-runtime-api" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "futures", "lru 0.9.0", @@ -8868,7 +8957,7 @@ dependencies = [ [[package]] name = "polkadot-node-jaeger" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "lazy_static", "log", @@ -8886,7 +8975,7 @@ dependencies = [ [[package]] name = "polkadot-node-metrics" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bs58", "futures", @@ -8905,7 +8994,7 @@ dependencies = [ [[package]] name = "polkadot-node-network-protocol" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "async-trait", "derive_more", @@ -8927,7 +9016,7 @@ dependencies = [ [[package]] name = "polkadot-node-primitives" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bounded-vec", "futures", @@ -8949,7 +9038,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "polkadot-node-jaeger", "polkadot-node-subsystem-types", @@ -8959,7 +9048,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-test-helpers" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "async-trait", "futures", @@ -8977,7 +9066,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-types" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "async-trait", "derive_more", @@ -9000,7 +9089,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-util" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "async-trait", "derive_more", @@ -9033,7 +9122,7 @@ dependencies = [ [[package]] name = "polkadot-overseer" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "async-trait", "futures", @@ -9056,7 +9145,7 @@ dependencies = [ [[package]] name = "polkadot-parachain" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bounded-collections", "derive_more", @@ -9154,7 +9243,7 @@ dependencies = [ [[package]] name = "polkadot-performance-test" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "env_logger 0.9.0", "kusama-runtime", @@ -9172,7 +9261,7 @@ dependencies = [ [[package]] name = "polkadot-primitives" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bitvec", "hex-literal 0.4.1", @@ -9198,7 +9287,7 @@ dependencies = [ [[package]] name = "polkadot-rpc" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "jsonrpsee", "mmr-rpc", @@ -9230,7 +9319,7 @@ dependencies = [ [[package]] name = "polkadot-runtime" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bitvec", "frame-benchmarking", @@ -9324,7 +9413,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-common" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bitvec", "frame-benchmarking", @@ -9370,7 +9459,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-constants" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "frame-support", "polkadot-primitives", @@ -9384,7 +9473,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-metrics" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bs58", "parity-scale-codec", @@ -9396,7 +9485,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-parachains" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bitflags", "bitvec", @@ -9440,7 +9529,7 @@ dependencies = [ [[package]] name = "polkadot-service" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "async-trait", "frame-benchmarking-cli", @@ -9550,7 +9639,7 @@ dependencies = [ [[package]] name = "polkadot-statement-distribution" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "arrayvec 0.5.2", "fatality", @@ -9571,7 +9660,7 @@ dependencies = [ [[package]] name = "polkadot-statement-table" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "parity-scale-codec", "polkadot-primitives", @@ -9581,7 +9670,7 @@ dependencies = [ [[package]] name = "polkadot-test-client" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "parity-scale-codec", "polkadot-node-subsystem", @@ -9606,7 +9695,7 @@ dependencies = [ [[package]] name = "polkadot-test-runtime" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bitvec", "frame-election-provider-support", @@ -9667,7 +9756,7 @@ dependencies = [ [[package]] name = "polkadot-test-service" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "frame-benchmarking", "frame-system", @@ -9764,6 +9853,12 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "portable-atomic" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26f6a7b87c2e435a3241addceeeff740ff8b7e76b74c13bf9acb17fa454ea00b" + [[package]] name = "portpicker" version = "0.1.1" @@ -10060,9 +10155,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.26" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500" dependencies = [ "proc-macro2", ] @@ -10434,7 +10529,7 @@ dependencies = [ [[package]] name = "rococo-runtime" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "binary-merkle-tree", "frame-benchmarking", @@ -10520,7 +10615,7 @@ dependencies = [ [[package]] name = "rococo-runtime-constants" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "frame-support", "polkadot-primitives", @@ -10767,7 +10862,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "log", "sp-core", @@ -10778,7 +10873,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "futures", @@ -10806,7 +10901,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "futures", "futures-timer", @@ -10829,7 +10924,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -10844,7 +10939,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "memmap2", "sc-chain-spec-derive", @@ -10863,7 +10958,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -10874,7 +10969,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "array-bytes 4.2.0", "chrono", @@ -10914,7 +11009,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "fnv", "futures", @@ -10941,7 +11036,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "hash-db", "kvdb", @@ -10967,7 +11062,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "futures", @@ -10992,7 +11087,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "futures", @@ -11021,7 +11116,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "fork-tree", @@ -11057,7 +11152,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "futures", "jsonrpsee", @@ -11079,7 +11174,7 @@ dependencies = [ [[package]] name = "sc-consensus-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -11114,7 +11209,7 @@ dependencies = [ [[package]] name = "sc-consensus-beefy-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "futures", "jsonrpsee", @@ -11133,7 +11228,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "fork-tree", "parity-scale-codec", @@ -11146,7 +11241,7 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "ahash 0.8.2", "array-bytes 4.2.0", @@ -11186,7 +11281,7 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "finality-grandpa", "futures", @@ -11206,7 +11301,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "futures", @@ -11229,7 +11324,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "lru 0.8.1", "parity-scale-codec", @@ -11253,7 +11348,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "sc-allocator", "sp-maybe-compressed-blob", @@ -11266,7 +11361,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "log", "sc-allocator", @@ -11279,7 +11374,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "anyhow", "cfg-if", @@ -11297,7 +11392,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "ansi_term", "futures", @@ -11313,7 +11408,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -11328,7 +11423,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "array-bytes 4.2.0", "async-channel", @@ -11373,7 +11468,7 @@ dependencies = [ [[package]] name = "sc-network-bitswap" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "cid", "futures", @@ -11393,7 +11488,7 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -11421,7 +11516,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "ahash 0.8.2", "futures", @@ -11440,7 +11535,7 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "array-bytes 4.2.0", "futures", @@ -11462,7 +11557,7 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -11496,7 +11591,7 @@ dependencies = [ [[package]] name = "sc-network-transactions" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "array-bytes 4.2.0", "futures", @@ -11516,7 +11611,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "array-bytes 4.2.0", "bytes", @@ -11547,7 +11642,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "futures", "libp2p", @@ -11560,7 +11655,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -11569,7 +11664,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "futures", "jsonrpsee", @@ -11600,7 +11695,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -11619,7 +11714,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "http", "jsonrpsee", @@ -11634,7 +11729,7 @@ dependencies = [ [[package]] name = "sc-rpc-spec-v2" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "array-bytes 4.2.0", "futures", @@ -11660,7 +11755,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "directories", @@ -11726,7 +11821,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "log", "parity-scale-codec", @@ -11737,7 +11832,7 @@ dependencies = [ [[package]] name = "sc-storage-monitor" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "clap 4.2.7", "fs4", @@ -11753,7 +11848,7 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -11772,7 +11867,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "futures", "libc", @@ -11791,7 +11886,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "chrono", "futures", @@ -11810,7 +11905,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "ansi_term", "atty", @@ -11841,7 +11936,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -11852,7 +11947,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "futures", @@ -11879,7 +11974,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "futures", @@ -11893,7 +11988,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-channel", "futures", @@ -12156,18 +12251,18 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.160" +version = "1.0.162" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c" +checksum = "71b2f6e1ab5c2b98c05f0f35b236b22e8df7ead6ffbf51d7808da7f8817e7ab6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.160" +version = "1.0.162" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df" +checksum = "a2a0814352fd64b58489904a44ea8d90cb1a91dcb6b4f5ebabc32c8318e93cb6" dependencies = [ "proc-macro2", "quote", @@ -12374,7 +12469,7 @@ checksum = "03b634d87b960ab1a38c4fe143b508576f075e7c978bfad18217645ebfdfa2ec" [[package]] name = "slot-range-helper" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "enumn", "parity-scale-codec", @@ -12451,7 +12546,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "hash-db", "log", @@ -12471,7 +12566,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "Inflector", "blake2", @@ -12485,7 +12580,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "parity-scale-codec", "scale-info", @@ -12498,7 +12593,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "integer-sqrt", "num-traits", @@ -12512,7 +12607,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "parity-scale-codec", "scale-info", @@ -12525,7 +12620,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "parity-scale-codec", "sp-api", @@ -12537,7 +12632,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "futures", "log", @@ -12555,7 +12650,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "futures", @@ -12570,7 +12665,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "parity-scale-codec", @@ -12588,7 +12683,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "parity-scale-codec", @@ -12609,7 +12704,7 @@ dependencies = [ [[package]] name = "sp-consensus-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "lazy_static", "parity-scale-codec", @@ -12628,7 +12723,7 @@ dependencies = [ [[package]] name = "sp-consensus-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "finality-grandpa", "log", @@ -12646,7 +12741,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "parity-scale-codec", "scale-info", @@ -12658,7 +12753,7 @@ dependencies = [ [[package]] name = "sp-core" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "array-bytes 4.2.0", "bitflags", @@ -12702,7 +12797,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "blake2b_simd", "byteorder", @@ -12716,7 +12811,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "proc-macro2", "quote", @@ -12727,7 +12822,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -12736,7 +12831,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "proc-macro2", "quote", @@ -12746,7 +12841,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "environmental", "parity-scale-codec", @@ -12757,7 +12852,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -12772,7 +12867,7 @@ dependencies = [ [[package]] name = "sp-io" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "bytes", "ed25519", @@ -12798,7 +12893,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "lazy_static", "sp-core", @@ -12809,7 +12904,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "futures", "parity-scale-codec", @@ -12823,7 +12918,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "thiserror", "zstd 0.12.3+zstd.1.5.2", @@ -12832,7 +12927,7 @@ dependencies = [ [[package]] name = "sp-metadata-ir" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-metadata", "parity-scale-codec", @@ -12843,7 +12938,7 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "ckb-merkle-mountain-range", "log", @@ -12861,7 +12956,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "parity-scale-codec", "scale-info", @@ -12875,7 +12970,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "sp-api", "sp-core", @@ -12885,7 +12980,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "backtrace", "lazy_static", @@ -12895,7 +12990,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "rustc-hash", "serde", @@ -12905,7 +13000,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "either", "hash256-std-hasher", @@ -12927,7 +13022,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -12945,7 +13040,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "Inflector", "proc-macro-crate", @@ -12957,7 +13052,7 @@ dependencies = [ [[package]] name = "sp-serializer" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "serde", "serde_json", @@ -12966,7 +13061,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "parity-scale-codec", "scale-info", @@ -12980,7 +13075,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "parity-scale-codec", "scale-info", @@ -12993,7 +13088,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "hash-db", "log", @@ -13013,7 +13108,7 @@ dependencies = [ [[package]] name = "sp-statement-store" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "log", "parity-scale-codec", @@ -13031,12 +13126,12 @@ dependencies = [ [[package]] name = "sp-std" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" [[package]] name = "sp-storage" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "impl-serde", "parity-scale-codec", @@ -13049,7 +13144,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "futures-timer", @@ -13064,7 +13159,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "parity-scale-codec", "sp-std", @@ -13076,7 +13171,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "sp-api", "sp-runtime", @@ -13085,7 +13180,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "log", @@ -13101,7 +13196,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "ahash 0.8.2", "hash-db", @@ -13124,7 +13219,7 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "impl-serde", "parity-scale-codec", @@ -13141,7 +13236,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -13152,7 +13247,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "anyhow", "impl-trait-for-tuples", @@ -13166,7 +13261,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "parity-scale-codec", "scale-info", @@ -13190,6 +13285,17 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f6002a767bff9e83f8eeecf883ecb8011875a21ae8da43bffb817a57e78cc09" +[[package]] +name = "spinners" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08615eea740067d9899969bc2891c68a19c315cb1f66640af9a9ecb91b13bcab" +dependencies = [ + "lazy_static", + "maplit", + "strum", +] + [[package]] name = "spki" version = "0.6.0" @@ -13301,6 +13407,32 @@ dependencies = [ "xcm-executor", ] +[[package]] +name = "statemint-it" +version = "1.0.0" +dependencies = [ + "frame-support", + "frame-system", + "integration-tests-common", + "pallet-assets", + "pallet-balances", + "pallet-xcm", + "parachains-common", + "parity-scale-codec", + "penpal-runtime", + "polkadot-core-primitives", + "polkadot-parachain", + "polkadot-runtime", + "polkadot-runtime-parachains", + "sp-core", + "sp-runtime", + "sp-weights", + "statemint-runtime", + "xcm", + "xcm-emulator", + "xcm-executor", +] + [[package]] name = "statemint-runtime" version = "1.0.0" @@ -13490,7 +13622,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "platforms 2.0.0", ] @@ -13498,7 +13630,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-system-rpc-runtime-api", "futures", @@ -13517,7 +13649,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "hyper", "log", @@ -13529,7 +13661,7 @@ dependencies = [ [[package]] name = "substrate-rpc-client" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "jsonrpsee", @@ -13542,7 +13674,7 @@ dependencies = [ [[package]] name = "substrate-state-trie-migration-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "jsonrpsee", "log", @@ -13561,7 +13693,7 @@ dependencies = [ [[package]] name = "substrate-test-client" version = "2.0.1" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -13587,7 +13719,7 @@ dependencies = [ [[package]] name = "substrate-test-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "futures", "substrate-test-utils-derive", @@ -13597,7 +13729,7 @@ dependencies = [ [[package]] name = "substrate-test-utils-derive" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -13608,7 +13740,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "ansi_term", "build-helper", @@ -13732,38 +13864,10 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13a4ec180a2de59b57434704ccfad967f789b12737738798fa08798cd5824c16" -[[package]] -name = "test-runtime" -version = "0.1.0" -dependencies = [ - "cumulus-pallet-dmp-queue", - "cumulus-pallet-parachain-system", - "cumulus-pallet-xcm", - "cumulus-pallet-xcmp-queue", - "cumulus-primitives-utility", - "frame-support", - "frame-system", - "pallet-balances", - "pallet-xcm", - "parachain-info", - "parity-scale-codec", - "polkadot-parachain", - "polkadot-runtime-parachains", - "scale-info", - "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "xcm", - "xcm-builder", - "xcm-executor", -] - [[package]] name = "test-runtime-constants" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "frame-support", "polkadot-primitives", @@ -14149,7 +14253,7 @@ dependencies = [ [[package]] name = "tracing-gum" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "polkadot-node-jaeger", "polkadot-primitives", @@ -14160,7 +14264,7 @@ dependencies = [ [[package]] name = "tracing-gum-proc-macro" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "expander 2.0.0", "proc-macro-crate", @@ -14290,7 +14394,7 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "try-runtime-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "clap 4.2.7", @@ -14645,9 +14749,9 @@ dependencies = [ [[package]] name = "wasm-opt" -version = "0.111.0" +version = "0.112.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a303793cbc01fb96551badfc7367db6007396bba6bac97936b3c8b6f7fdb41" +checksum = "87fef6d0d508f08334e0ab0e6877feb4c0ecb3956bcf2cb950699b22fedf3e9c" dependencies = [ "anyhow", "libc", @@ -14661,9 +14765,9 @@ dependencies = [ [[package]] name = "wasm-opt-cxx-sys" -version = "0.111.0" +version = "0.112.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9c9deb56f8a9f2ec177b3bd642a8205621835944ed5da55f2388ef216aca5a4" +checksum = "bc816bbc1596c8f2e8127e137a760c798023ef3d378f2ae51f0f1840e2dfa445" dependencies = [ "anyhow", "cxx", @@ -14673,15 +14777,14 @@ dependencies = [ [[package]] name = "wasm-opt-sys" -version = "0.111.0" +version = "0.112.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4432e28b542738a9776cedf92e8a99d8991c7b4667ee2c7ccddfb479dd2856a7" +checksum = "40199e4f68ef1071b3c6d0bd8026a12b481865d4b9e49c156932ea9a6234dd14" dependencies = [ "anyhow", "cc", "cxx", "cxx-build", - "regex", ] [[package]] @@ -15224,7 +15327,7 @@ dependencies = [ [[package]] name = "westend-runtime" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bitvec", "frame-benchmarking", @@ -15316,7 +15419,7 @@ dependencies = [ [[package]] name = "westend-runtime-constants" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "frame-support", "polkadot-primitives", @@ -15818,7 +15921,7 @@ dependencies = [ [[package]] name = "xcm" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bounded-collections", "derivative", @@ -15834,7 +15937,7 @@ dependencies = [ [[package]] name = "xcm-builder" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "frame-support", "frame-system", @@ -15856,56 +15959,38 @@ dependencies = [ name = "xcm-emulator" version = "0.1.0" dependencies = [ + "casey", "cumulus-pallet-dmp-queue", "cumulus-pallet-parachain-system", "cumulus-pallet-xcmp-queue", "cumulus-primitives-core", "cumulus-primitives-parachain-inherent", "cumulus-test-relay-sproof-builder", + "cumulus-test-service", "frame-support", "frame-system", + "log", + "pallet-balances", "parachain-info", + "parachains-common", "parity-scale-codec", "paste", "polkadot-primitives", "polkadot-runtime-parachains", "quote", "sp-arithmetic", + "sp-core", "sp-io", "sp-std", + "sp-trie", "xcm", "xcm-executor", ] -[[package]] -name = "xcm-emulator-example" -version = "0.1.0" -dependencies = [ - "cumulus-pallet-xcmp-queue", - "cumulus-primitives-core", - "frame-support", - "frame-system", - "kusama-runtime", - "pallet-balances", - "pallet-xcm", - "parachain-info", - "parity-scale-codec", - "polkadot-parachain", - "polkadot-primitives", - "polkadot-runtime-parachains", - "proc-macro2", - "serde", - "sp-io", - "sp-runtime", - "test-runtime", - "xcm", - "xcm-emulator", -] - [[package]] name = "xcm-executor" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "environmental", "frame-benchmarking", @@ -15925,7 +16010,7 @@ dependencies = [ [[package]] name = "xcm-procedural" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "Inflector", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index e8476d04273..6ef1df49d48 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,14 +50,14 @@ members = [ "parachains/runtimes/collectives/collectives-polkadot", "parachains/runtimes/contracts/contracts-rococo", "parachains/runtimes/testing/penpal", + "parachains/integration-tests/emulated/common", + "parachains/integration-tests/emulated/assets/statemint", "test/client", "test/relay-sproof-builder", "test/relay-validation-worker-provider", "test/runtime", "test/service", "xcm/xcm-emulator", - "xcm/xcm-emulator/example", - "xcm/xcm-emulator/example/test-runtime", ] [profile.release] @@ -68,4 +68,3 @@ opt-level = 3 inherits = "release" lto = true codegen-units = 1 - diff --git a/bridges/bin/runtime-common/src/messages_benchmarking.rs b/bridges/bin/runtime-common/src/messages_benchmarking.rs index b067523c305..9d90f12ed5c 100644 --- a/bridges/bin/runtime-common/src/messages_benchmarking.rs +++ b/bridges/bin/runtime-common/src/messages_benchmarking.rs @@ -182,11 +182,7 @@ where // update runtime storage let (_, bridged_header_hash) = insert_header_to_grandpa_pallet::(state_root); - FromBridgedChainMessagesDeliveryProof { - bridged_header_hash: bridged_header_hash.into(), - storage_proof, - lane, - } + FromBridgedChainMessagesDeliveryProof { bridged_header_hash, storage_proof, lane } } /// Prepare proof of messages delivery for the `receive_messages_delivery_proof` call. @@ -211,11 +207,7 @@ where let (_, bridged_header_hash) = insert_header_to_parachains_pallet::>>(state_root); - FromBridgedChainMessagesDeliveryProof { - bridged_header_hash: bridged_header_hash.into(), - storage_proof, - lane, - } + FromBridgedChainMessagesDeliveryProof { bridged_header_hash, storage_proof, lane } } /// Prepare in-memory message delivery proof, without inserting anything to the runtime storage. diff --git a/bridges/bin/runtime-common/src/parachains_benchmarking.rs b/bridges/bin/runtime-common/src/parachains_benchmarking.rs index aad53673c3a..8a9b8547fbf 100644 --- a/bridges/bin/runtime-common/src/parachains_benchmarking.rs +++ b/bridges/bin/runtime-common/src/parachains_benchmarking.rs @@ -60,7 +60,7 @@ where TrieDBMutBuilderV1::::new(&mut mdb, &mut state_root).build(); // insert parachain heads - for (i, parachain) in parachains.into_iter().enumerate() { + for (i, parachain) in parachains.iter().enumerate() { let storage_key = parachain_head_storage_key_at_source(R::ParasPalletName::get(), *parachain); let leaf_data = if i == 0 { diff --git a/bridges/modules/messages/src/benchmarking.rs b/bridges/modules/messages/src/benchmarking.rs index aab8855a729..7db3ae64352 100644 --- a/bridges/modules/messages/src/benchmarking.rs +++ b/bridges/modules/messages/src/benchmarking.rs @@ -139,7 +139,7 @@ benchmarks_instance_pallet! { }: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight) verify { assert_eq!( - crate::InboundLanes::::get(&T::bench_lane_id()).last_delivered_nonce(), + crate::InboundLanes::::get(T::bench_lane_id()).last_delivered_nonce(), 21, ); } @@ -172,7 +172,7 @@ benchmarks_instance_pallet! { }: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 2, dispatch_weight) verify { assert_eq!( - crate::InboundLanes::::get(&T::bench_lane_id()).last_delivered_nonce(), + crate::InboundLanes::::get(T::bench_lane_id()).last_delivered_nonce(), 22, ); } @@ -208,7 +208,7 @@ benchmarks_instance_pallet! { }); }: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight) verify { - let lane_state = crate::InboundLanes::::get(&T::bench_lane_id()); + let lane_state = crate::InboundLanes::::get(T::bench_lane_id()); assert_eq!(lane_state.last_delivered_nonce(), 21); assert_eq!(lane_state.last_confirmed_nonce, 20); } @@ -240,7 +240,7 @@ benchmarks_instance_pallet! { }: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight) verify { assert_eq!( - crate::InboundLanes::::get(&T::bench_lane_id()).last_delivered_nonce(), + crate::InboundLanes::::get(T::bench_lane_id()).last_delivered_nonce(), 21, ); } @@ -274,7 +274,7 @@ benchmarks_instance_pallet! { }: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight) verify { assert_eq!( - crate::InboundLanes::::get(&T::bench_lane_id()).last_delivered_nonce(), + crate::InboundLanes::::get(T::bench_lane_id()).last_delivered_nonce(), 21, ); } @@ -432,7 +432,7 @@ benchmarks_instance_pallet! { }: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight) verify { assert_eq!( - crate::InboundLanes::::get(&T::bench_lane_id()).last_delivered_nonce(), + crate::InboundLanes::::get(T::bench_lane_id()).last_delivered_nonce(), 21, ); assert!(T::is_message_successfully_dispatched(21)); diff --git a/bridges/modules/messages/src/mock.rs b/bridges/modules/messages/src/mock.rs index 2e45d5b601f..7aab79ae4a9 100644 --- a/bridges/modules/messages/src/mock.rs +++ b/bridges/modules/messages/src/mock.rs @@ -185,7 +185,7 @@ impl crate::benchmarking::Config<()> for TestRuntime { // in mock run we only care about benchmarks correctness, not the benchmark results // => ignore size related arguments let (messages, total_dispatch_weight) = - params.message_nonces.into_iter().map(|n| message(n, REGULAR_PAYLOAD)).fold( + params.message_nonces.map(|n| message(n, REGULAR_PAYLOAD)).fold( (Vec::new(), Weight::zero()), |(mut messages, total_dispatch_weight), message| { let weight = REGULAR_PAYLOAD.declared_weight; diff --git a/bridges/modules/relayers/src/benchmarking.rs b/bridges/modules/relayers/src/benchmarking.rs index d66a11ff06d..dfdecad31af 100644 --- a/bridges/modules/relayers/src/benchmarking.rs +++ b/bridges/modules/relayers/src/benchmarking.rs @@ -104,7 +104,7 @@ benchmarks! { // create slash destination account let lane = LaneId([0, 0, 0, 0]); let slash_destination = RewardsAccountParams::new(lane, *b"test", RewardsAccountOwner::ThisChain); - T::prepare_rewards_account(slash_destination.clone(), Zero::zero()); + T::prepare_rewards_account(slash_destination, Zero::zero()); }: { crate::Pallet::::slash_and_deregister(&relayer, slash_destination) } @@ -121,10 +121,10 @@ benchmarks! { let account_params = RewardsAccountParams::new(lane, *b"test", RewardsAccountOwner::ThisChain); }: { - crate::Pallet::::register_relayer_reward(account_params.clone(), &relayer, One::one()); + crate::Pallet::::register_relayer_reward(account_params, &relayer, One::one()); } verify { - assert_eq!(RelayerRewards::::get(relayer, &account_params), Some(One::one())); + assert_eq!(RelayerRewards::::get(relayer, account_params), Some(One::one())); } impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::TestRuntime) diff --git a/client/cli/src/lib.rs b/client/cli/src/lib.rs index a4daa9ee506..d77db6baedf 100644 --- a/client/cli/src/lib.rs +++ b/client/cli/src/lib.rs @@ -93,7 +93,7 @@ impl PurgeChainCmd { io::stdin().read_line(&mut input)?; let input = input.trim(); - match input.chars().nth(0) { + match input.chars().next() { Some('y') | Some('Y') => {}, _ => { println!("Aborted"); @@ -103,7 +103,7 @@ impl PurgeChainCmd { } for db_path in &db_paths { - match fs::remove_dir_all(&db_path) { + match fs::remove_dir_all(db_path) { Ok(_) => { println!("{:?} removed.", &db_path); }, diff --git a/client/collator/src/lib.rs b/client/collator/src/lib.rs index a931201f6cc..9e3b4953c0a 100644 --- a/client/collator/src/lib.rs +++ b/client/collator/src/lib.rs @@ -270,16 +270,14 @@ where let (header, extrinsics) = candidate.block.deconstruct(); - let compact_proof = match candidate - .proof - .into_compact_proof::>(last_head.state_root().clone()) - { - Ok(proof) => proof, - Err(e) => { - tracing::error!(target: "cumulus-collator", "Failed to compact proof: {:?}", e); - return None - }, - }; + let compact_proof = + match candidate.proof.into_compact_proof::>(*last_head.state_root()) { + Ok(proof) => proof, + Err(e) => { + tracing::error!(target: "cumulus-collator", "Failed to compact proof: {:?}", e); + return None + }, + }; // Create the parachain block data for the validators. let b = ParachainBlockData::::new(header, extrinsics, compact_proof); @@ -451,7 +449,7 @@ mod tests { .build() .expect("Builds overseer"); - spawner.spawn("overseer", None, overseer.run().then(|_| async { () }).boxed()); + spawner.spawn("overseer", None, overseer.run().then(|_| async {}).boxed()); let collator_start = start_collator(StartCollatorParams { runtime_api: client.clone(), @@ -461,7 +459,7 @@ mod tests { spawner, para_id, key: CollatorPair::generate().0, - parachain_consensus: Box::new(DummyParachainConsensus { client: client.clone() }), + parachain_consensus: Box::new(DummyParachainConsensus { client }), }); block_on(collator_start); @@ -469,12 +467,10 @@ mod tests { .0 .expect("message should be send by `start_collator` above."); - let config = match msg { - CollationGenerationMessage::Initialize(config) => config, - }; + let CollationGenerationMessage::Initialize(config) = msg; - let mut validation_data = PersistedValidationData::default(); - validation_data.parent_head = header.encode().into(); + let validation_data = + PersistedValidationData { parent_head: header.encode().into(), ..Default::default() }; let relay_parent = Default::default(); let collation = block_on((config.collator)(relay_parent, &validation_data)) diff --git a/client/consensus/aura/src/import_queue.rs b/client/consensus/aura/src/import_queue.rs index 862abfb349a..725e841881c 100644 --- a/client/consensus/aura/src/import_queue.rs +++ b/client/consensus/aura/src/import_queue.rs @@ -51,7 +51,7 @@ pub struct ImportQueueParams<'a, I, C, CIDP, S> { } /// Start an import queue for the Aura consensus algorithm. -pub fn import_queue<'a, P, Block, I, C, S, CIDP>( +pub fn import_queue( ImportQueueParams { block_import, client, @@ -59,7 +59,7 @@ pub fn import_queue<'a, P, Block, I, C, S, CIDP>( spawner, registry, telemetry, - }: ImportQueueParams<'a, I, C, CIDP, S>, + }: ImportQueueParams<'_, I, C, CIDP, S>, ) -> Result, sp_consensus::Error> where Block: BlockT, diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index 3576ced1858..ebdfaaf26ca 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -22,7 +22,7 @@ use std::{ sync::Arc, }; -const LOG_TARGET: &'static str = "level-monitor"; +const LOG_TARGET: &str = "level-monitor"; /// Value good enough to be used with parachains using the current backend implementation /// that ships with Substrate. This value may change in the future. diff --git a/client/consensus/common/src/parachain_consensus.rs b/client/consensus/common/src/parachain_consensus.rs index 734f682d25b..78f4e45cd81 100644 --- a/client/consensus/common/src/parachain_consensus.rs +++ b/client/consensus/common/src/parachain_consensus.rs @@ -325,7 +325,6 @@ async fn handle_new_block_imported( match parachain.block_status(unset_hash) { Ok(BlockStatus::InChainWithState) => { - drop(unset_best_header); let unset_best_header = unset_best_header_opt .take() .expect("We checked above that the value is set; qed"); @@ -433,8 +432,11 @@ async fn handle_new_best_parachain_head( } } -async fn import_block_as_new_best(hash: Block::Hash, header: Block::Header, parachain: &P) -where +async fn import_block_as_new_best( + hash: Block::Hash, + header: Block::Header, + mut parachain: &P, +) where Block: BlockT, P: UsageProvider + Send + Sync + BlockBackend, for<'a> &'a P: BlockImport, @@ -456,7 +458,7 @@ where block_import_params.fork_choice = Some(ForkChoiceStrategy::Custom(true)); block_import_params.import_existing = true; - if let Err(err) = (&*parachain).import_block(block_import_params).await { + if let Err(err) = parachain.import_block(block_import_params).await { tracing::warn!( target: LOG_TARGET, block_hash = ?hash, diff --git a/client/consensus/common/src/tests.rs b/client/consensus/common/src/tests.rs index 23516d96388..f1bc4d42b8a 100644 --- a/client/consensus/common/src/tests.rs +++ b/client/consensus/common/src/tests.rs @@ -337,7 +337,7 @@ fn follow_new_best_with_dummy_recovery_works() { Some(recovery_chan_tx), ); - let block = build_block(&*client.clone(), None, None); + let block = build_block(&*client, None, None); let block_clone = block.clone(); let client_clone = client.clone(); @@ -547,7 +547,6 @@ fn do_not_set_best_block_to_older_block() { let client = Arc::new(TestClientBuilder::with_backend(backend).build()); let blocks = (0..NUM_BLOCKS) - .into_iter() .map(|_| build_and_import_block(client.clone(), true)) .collect::>(); @@ -559,7 +558,6 @@ fn do_not_set_best_block_to_older_block() { let consensus = run_parachain_consensus(100.into(), client.clone(), relay_chain, Arc::new(|_, _| {}), None); - let client2 = client.clone(); let work = async move { new_best_heads_sender .unbounded_send(blocks[NUM_BLOCKS - 2].header().clone()) @@ -579,7 +577,7 @@ fn do_not_set_best_block_to_older_block() { }); // Build and import a new best block. - build_and_import_block(client2.clone(), true); + build_and_import_block(client, true); } #[test] @@ -607,7 +605,6 @@ fn prune_blocks_on_level_overflow() { let id0 = block0.header.hash(); let blocks1 = (0..LEVEL_LIMIT) - .into_iter() .map(|i| { build_and_import_block_ext( &*client, @@ -622,7 +619,6 @@ fn prune_blocks_on_level_overflow() { let id10 = blocks1[0].header.hash(); let blocks2 = (0..2) - .into_iter() .map(|i| { build_and_import_block_ext( &*client, @@ -720,7 +716,6 @@ fn restore_limit_monitor() { let id00 = block00.header.hash(); let blocks1 = (0..LEVEL_LIMIT + 1) - .into_iter() .map(|i| { build_and_import_block_ext( &*client, @@ -735,7 +730,6 @@ fn restore_limit_monitor() { let id10 = blocks1[0].header.hash(); let _ = (0..LEVEL_LIMIT) - .into_iter() .map(|i| { build_and_import_block_ext( &*client, diff --git a/client/consensus/relay-chain/src/lib.rs b/client/consensus/relay-chain/src/lib.rs index a31a9ec8b2a..529b78c1319 100644 --- a/client/consensus/relay-chain/src/lib.rs +++ b/client/consensus/relay-chain/src/lib.rs @@ -161,7 +161,7 @@ where relay_parent: PHash, validation_data: &PersistedValidationData, ) -> Option> { - let proposer_future = self.proposer_factory.lock().init(&parent); + let proposer_future = self.proposer_factory.lock().init(parent); let proposer = proposer_future .await @@ -171,7 +171,7 @@ where .ok()?; let inherent_data = - self.inherent_data(parent.hash(), &validation_data, relay_parent).await?; + self.inherent_data(parent.hash(), validation_data, relay_parent).await?; let Proposal { block, storage_changes, proof } = proposer .propose( diff --git a/client/network/src/tests.rs b/client/network/src/tests.rs index eefb88f2f7b..08127fe390a 100644 --- a/client/network/src/tests.rs +++ b/client/network/src/tests.rs @@ -129,7 +129,7 @@ impl RelayChainInterface for DummyRelayChainInterface { para_id: 0u32.into(), relay_parent: PHash::random(), collator: CollatorPair::generate().0.public(), - persisted_validation_data_hash: PHash::random().into(), + persisted_validation_data_hash: PHash::random(), pov_hash: PHash::random(), erasure_root: PHash::random(), signature: sp_core::sr25519::Signature([0u8; 64]).into(), @@ -293,7 +293,7 @@ async fn make_gossip_message_and_header( para_id: 0u32.into(), relay_parent, collator: CollatorPair::generate().0.public(), - persisted_validation_data_hash: PHash::random().into(), + persisted_validation_data_hash: PHash::random(), pov_hash: PHash::random(), erasure_root: PHash::random(), signature: sp_core::sr25519::Signature([0u8; 64]).into(), @@ -484,7 +484,7 @@ async fn check_statement_seconded() { para_id: 0u32.into(), relay_parent: PHash::random(), collator: CollatorPair::generate().0.public(), - persisted_validation_data_hash: PHash::random().into(), + persisted_validation_data_hash: PHash::random(), pov_hash: PHash::random(), erasure_root: PHash::random(), signature: sp_core::sr25519::Signature([0u8; 64]).into(), diff --git a/client/pov-recovery/src/lib.rs b/client/pov-recovery/src/lib.rs index 7d92934c784..62f31b6c061 100644 --- a/client/pov-recovery/src/lib.rs +++ b/client/pov-recovery/src/lib.rs @@ -40,7 +40,7 @@ //! 4a. After it is recovered, we restore the block and import it. //! //! 4b. Since we are trying to recover pending candidates, availability is not guaranteed. If the block -//! PoV is not yet available, we retry. +//! PoV is not yet available, we retry. //! //! If we need to recover multiple PoV blocks (which should hopefully not happen in real life), we //! make sure that the blocks are imported in the correct order. @@ -190,7 +190,7 @@ impl RecoveryQueue { /// Get the next hash for block recovery. pub async fn next_recovery(&mut self) -> Block::Hash { loop { - if let Some(_) = self.signaling_queue.next().await { + if self.signaling_queue.next().await.is_some() { if let Some(hash) = self.recovery_queue.pop_front() { return hash } else { @@ -309,10 +309,10 @@ where /// Block is no longer waiting for recovery fn clear_waiting_recovery(&mut self, block_hash: &Block::Hash) { - self.candidates.get_mut(block_hash).map(|candidate| { + if let Some(candidate) = self.candidates.get_mut(block_hash) { // Prevents triggering an already enqueued recovery request candidate.waiting_recovery = false; - }); + } } /// Handle a finalized block with the given `block_number`. diff --git a/client/relay-chain-inprocess-interface/src/lib.rs b/client/relay-chain-inprocess-interface/src/lib.rs index f230a23bd25..c1e19bd20b6 100644 --- a/client/relay-chain-inprocess-interface/src/lib.rs +++ b/client/relay-chain-inprocess-interface/src/lib.rs @@ -241,7 +241,7 @@ where self.full_client .import_notification_stream() .filter_map(|notification| async move { - notification.is_new_best.then(|| notification.header) + notification.is_new_best.then_some(notification.header) }); Ok(Box::pin(notifications_stream)) } @@ -428,7 +428,7 @@ mod tests { ( client.clone(), block, - RelayChainInProcessInterface::new(client, backend.clone(), dummy_network, mock_handle), + RelayChainInProcessInterface::new(client, backend, dummy_network, mock_handle), ) } @@ -483,7 +483,7 @@ mod tests { let hash = block.hash(); let ext = construct_transfer_extrinsic( - &*client, + &client, sp_keyring::Sr25519Keyring::Alice, sp_keyring::Sr25519Keyring::Bob, 1000, diff --git a/client/relay-chain-minimal-node/Cargo.toml b/client/relay-chain-minimal-node/Cargo.toml index 17ad78f3c85..e9552e382fb 100644 --- a/client/relay-chain-minimal-node/Cargo.toml +++ b/client/relay-chain-minimal-node/Cargo.toml @@ -37,7 +37,7 @@ cumulus-relay-chain-interface = { path = "../relay-chain-interface" } cumulus-relay-chain-rpc-interface = { path = "../relay-chain-rpc-interface" } cumulus-primitives-core = { path = "../../primitives/core" } -array-bytes = "6.0" +array-bytes = "6.1" lru = "0.9" tracing = "0.1.37" async-trait = "0.1.68" diff --git a/client/relay-chain-minimal-node/src/collator_overseer.rs b/client/relay-chain-minimal-node/src/collator_overseer.rs index a2ad87fa758..b488db962f3 100644 --- a/client/relay-chain-minimal-node/src/collator_overseer.rs +++ b/client/relay-chain-minimal-node/src/collator_overseer.rs @@ -76,7 +76,7 @@ pub(crate) struct CollatorOverseerGenArgs<'a> { pub peer_set_protocol_names: PeerSetProtocolNames, } -fn build_overseer<'a>( +fn build_overseer( connector: OverseerConnector, CollatorOverseerGenArgs { runtime_client, @@ -90,7 +90,7 @@ fn build_overseer<'a>( collator_pair, req_protocol_names, peer_set_protocol_names, - }: CollatorOverseerGenArgs<'a>, + }: CollatorOverseerGenArgs<'_>, ) -> Result< (Overseer, Arc>, OverseerHandle), RelayChainError, diff --git a/client/relay-chain-rpc-interface/Cargo.toml b/client/relay-chain-rpc-interface/Cargo.toml index b23ef658f75..962377874c1 100644 --- a/client/relay-chain-rpc-interface/Cargo.toml +++ b/client/relay-chain-rpc-interface/Cargo.toml @@ -31,5 +31,5 @@ tracing = "0.1.37" async-trait = "0.1.68" url = "2.3.1" serde_json = "1.0.96" -serde = "1.0.160" +serde = "1.0.162" lru = "0.9.0" diff --git a/client/service/src/lib.rs b/client/service/src/lib.rs index 894db91ba8f..ac18cb39fcf 100644 --- a/client/service/src/lib.rs +++ b/client/service/src/lib.rs @@ -441,7 +441,7 @@ where ) .await .map_err(|e| format!("{e:?}"))? - .ok_or_else(|| "Could not find parachain head in relay chain")?; + .ok_or("Could not find parachain head in relay chain")?; let target_block = B::Header::decode(&mut &validation_data.parent_head.0[..]) .map_err(|e| format!("Failed to decode parachain head: {e}"))?; diff --git a/pallets/collator-selection/src/benchmarking.rs b/pallets/collator-selection/src/benchmarking.rs index 8a222511137..6b386f7d697 100644 --- a/pallets/collator-selection/src/benchmarking.rs +++ b/pallets/collator-selection/src/benchmarking.rs @@ -129,7 +129,7 @@ benchmarks! { T::UpdateOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?; }: { assert_ok!( - >::set_desired_candidates(origin, max.clone()) + >::set_desired_candidates(origin, max) ); } verify { @@ -142,7 +142,7 @@ benchmarks! { T::UpdateOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?; }: { assert_ok!( - >::set_candidacy_bond(origin, bond_amount.clone()) + >::set_candidacy_bond(origin, bond_amount) ); } verify { @@ -162,7 +162,7 @@ benchmarks! { let caller: T::AccountId = whitelisted_caller(); let bond: BalanceOf = T::Currency::minimum_balance() * 2u32.into(); - T::Currency::make_free_balance_be(&caller, bond.clone()); + T::Currency::make_free_balance_be(&caller, bond); >::set_keys( RawOrigin::Signed(caller.clone()).into(), diff --git a/pallets/collator-selection/src/lib.rs b/pallets/collator-selection/src/lib.rs index 3dba6846cc3..a727e21f0fd 100644 --- a/pallets/collator-selection/src/lib.rs +++ b/pallets/collator-selection/src/lib.rs @@ -238,8 +238,8 @@ pub mod pallet { "genesis desired_candidates are more than T::MaxCandidates", ); - >::put(&self.desired_candidates); - >::put(&self.candidacy_bond); + >::put(self.desired_candidates); + >::put(self.candidacy_bond); >::put(bounded_invulnerables); } } @@ -326,7 +326,7 @@ pub mod pallet { if max > T::MaxCandidates::get() { log::warn!("max > T::MaxCandidates; you might need to run benchmarks again"); } - >::put(&max); + >::put(max); Self::deposit_event(Event::NewDesiredCandidates { desired_candidates: max }); Ok(().into()) } @@ -339,7 +339,7 @@ pub mod pallet { bond: BalanceOf, ) -> DispatchResultWithPostInfo { T::UpdateOrigin::ensure_origin(origin)?; - >::put(&bond); + >::put(bond); Self::deposit_event(Event::NewCandidacyBond { bond_amount: bond }); Ok(().into()) } diff --git a/pallets/collator-selection/src/mock.rs b/pallets/collator-selection/src/mock.rs index ac776e3d216..5470e4037ec 100644 --- a/pallets/collator-selection/src/mock.rs +++ b/pallets/collator-selection/src/mock.rs @@ -152,12 +152,12 @@ pub struct TestSessionHandler; impl pallet_session::SessionHandler for TestSessionHandler { const KEY_TYPE_IDS: &'static [sp_runtime::KeyTypeId] = &[UintAuthorityId::ID]; fn on_genesis_session(keys: &[(u64, Ks)]) { - SessionHandlerCollators::set(keys.into_iter().map(|(a, _)| *a).collect::>()) + SessionHandlerCollators::set(keys.iter().map(|(a, _)| *a).collect::>()) } fn on_new_session(_: bool, keys: &[(u64, Ks)], _: &[(u64, Ks)]) { SessionChangeBlock::set(System::block_number()); dbg!(keys.len()); - SessionHandlerCollators::set(keys.into_iter().map(|(a, _)| *a).collect::>()) + SessionHandlerCollators::set(keys.iter().map(|(a, _)| *a).collect::>()) } fn on_before_session_ending() {} fn on_disabled(_: u32) {} @@ -195,11 +195,7 @@ parameter_types! { pub struct IsRegistered; impl ValidatorRegistration for IsRegistered { fn is_registered(id: &u64) -> bool { - if *id == 7u64 { - false - } else { - true - } + *id != 7u64 } } diff --git a/pallets/collator-selection/src/tests.rs b/pallets/collator-selection/src/tests.rs index 459b107ecc5..0ae3e3d5a18 100644 --- a/pallets/collator-selection/src/tests.rs +++ b/pallets/collator-selection/src/tests.rs @@ -45,7 +45,7 @@ fn it_should_set_invulnerables() { // cannot set with non-root. assert_noop!( - CollatorSelection::set_invulnerables(RuntimeOrigin::signed(1), new_set.clone()), + CollatorSelection::set_invulnerables(RuntimeOrigin::signed(1), new_set), BadOrigin ); @@ -54,7 +54,7 @@ fn it_should_set_invulnerables() { assert_noop!( CollatorSelection::set_invulnerables( RuntimeOrigin::signed(RootAccount::get()), - invulnerables.clone() + invulnerables ), Error::::ValidatorNotRegistered ); @@ -184,8 +184,8 @@ fn cannot_register_dupe_candidate() { #[test] fn cannot_register_as_candidate_if_poor() { new_test_ext().execute_with(|| { - assert_eq!(Balances::free_balance(&3), 100); - assert_eq!(Balances::free_balance(&33), 0); + assert_eq!(Balances::free_balance(3), 100); + assert_eq!(Balances::free_balance(33), 0); // works assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(3))); @@ -208,14 +208,14 @@ fn register_as_candidate_works() { assert_eq!(CollatorSelection::invulnerables(), vec![1, 2]); // take two endowed, non-invulnerables accounts. - assert_eq!(Balances::free_balance(&3), 100); - assert_eq!(Balances::free_balance(&4), 100); + 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_eq!(Balances::free_balance(3), 90); + assert_eq!(Balances::free_balance(4), 90); assert_eq!(CollatorSelection::candidates().len(), 2); }); diff --git a/pallets/collator-selection/src/weights.rs b/pallets/collator-selection/src/weights.rs index 32e816b5dbe..874cec8ae36 100644 --- a/pallets/collator-selection/src/weights.rs +++ b/pallets/collator-selection/src/weights.rs @@ -39,93 +39,91 @@ pub trait WeightInfo { pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { fn set_invulnerables(b: u32) -> Weight { - Weight::from_parts(18_563_000 as u64, 0) + Weight::from_parts(18_563_000_u64, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(68_000 as u64, 0).saturating_mul(b as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + .saturating_add(Weight::from_parts(68_000_u64, 0).saturating_mul(b as u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } fn set_desired_candidates() -> Weight { - Weight::from_parts(16_363_000 as u64, 0).saturating_add(T::DbWeight::get().writes(1 as u64)) + Weight::from_parts(16_363_000_u64, 0).saturating_add(T::DbWeight::get().writes(1_u64)) } fn set_candidacy_bond() -> Weight { - Weight::from_parts(16_840_000 as u64, 0).saturating_add(T::DbWeight::get().writes(1 as u64)) + Weight::from_parts(16_840_000_u64, 0).saturating_add(T::DbWeight::get().writes(1_u64)) } fn register_as_candidate(c: u32) -> Weight { - Weight::from_parts(71_196_000 as u64, 0) + Weight::from_parts(71_196_000_u64, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(198_000 as u64, 0).saturating_mul(c as u64)) - .saturating_add(T::DbWeight::get().reads(4 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + .saturating_add(Weight::from_parts(198_000_u64, 0).saturating_mul(c as u64)) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } fn leave_intent(c: u32) -> Weight { - Weight::from_parts(55_336_000 as u64, 0) + Weight::from_parts(55_336_000_u64, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(151_000 as u64, 0).saturating_mul(c as u64)) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + .saturating_add(Weight::from_parts(151_000_u64, 0).saturating_mul(c as u64)) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } fn note_author() -> Weight { - Weight::from_parts(71_461_000 as u64, 0) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().writes(4 as u64)) + Weight::from_parts(71_461_000_u64, 0) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) } fn new_session(r: u32, c: u32) -> Weight { - Weight::from_parts(0 as u64, 0) + Weight::from_parts(0_u64, 0) // Standard Error: 1_010_000 - .saturating_add(Weight::from_parts(109_961_000 as u64, 0).saturating_mul(r as u64)) + .saturating_add(Weight::from_parts(109_961_000_u64, 0).saturating_mul(r as u64)) // Standard Error: 1_010_000 - .saturating_add(Weight::from_parts(151_952_000 as u64, 0).saturating_mul(c as u64)) - .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(r as u64))) - .saturating_add(T::DbWeight::get().reads((2 as u64).saturating_mul(c as u64))) - .saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(r as u64))) - .saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(c as u64))) + .saturating_add(Weight::from_parts(151_952_000_u64, 0).saturating_mul(c as u64)) + .saturating_add(T::DbWeight::get().reads(1_u64.saturating_mul(r as u64))) + .saturating_add(T::DbWeight::get().reads(2_u64.saturating_mul(c as u64))) + .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))) } } // For backwards compatibility and tests impl WeightInfo for () { fn set_invulnerables(b: u32) -> Weight { - Weight::from_parts(18_563_000 as u64, 0) + Weight::from_parts(18_563_000_u64, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(68_000 as u64, 0).saturating_mul(b as u64)) - .saturating_add(RocksDbWeight::get().writes(1 as u64)) + .saturating_add(Weight::from_parts(68_000_u64, 0).saturating_mul(b as u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) } fn set_desired_candidates() -> Weight { - Weight::from_parts(16_363_000 as u64, 0) - .saturating_add(RocksDbWeight::get().writes(1 as u64)) + Weight::from_parts(16_363_000_u64, 0).saturating_add(RocksDbWeight::get().writes(1_u64)) } fn set_candidacy_bond() -> Weight { - Weight::from_parts(16_840_000 as u64, 0) - .saturating_add(RocksDbWeight::get().writes(1 as u64)) + Weight::from_parts(16_840_000_u64, 0).saturating_add(RocksDbWeight::get().writes(1_u64)) } fn register_as_candidate(c: u32) -> Weight { - Weight::from_parts(71_196_000 as u64, 0) + Weight::from_parts(71_196_000_u64, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(198_000 as u64, 0).saturating_mul(c as u64)) - .saturating_add(RocksDbWeight::get().reads(4 as u64)) - .saturating_add(RocksDbWeight::get().writes(2 as u64)) + .saturating_add(Weight::from_parts(198_000_u64, 0).saturating_mul(c as u64)) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) } fn leave_intent(c: u32) -> Weight { - Weight::from_parts(55_336_000 as u64, 0) + Weight::from_parts(55_336_000_u64, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(151_000 as u64, 0).saturating_mul(c as u64)) - .saturating_add(RocksDbWeight::get().reads(1 as u64)) - .saturating_add(RocksDbWeight::get().writes(2 as u64)) + .saturating_add(Weight::from_parts(151_000_u64, 0).saturating_mul(c as u64)) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) } fn note_author() -> Weight { - Weight::from_parts(71_461_000 as u64, 0) - .saturating_add(RocksDbWeight::get().reads(3 as u64)) - .saturating_add(RocksDbWeight::get().writes(4 as u64)) + Weight::from_parts(71_461_000_u64, 0) + .saturating_add(RocksDbWeight::get().reads(3_u64)) + .saturating_add(RocksDbWeight::get().writes(4_u64)) } fn new_session(r: u32, c: u32) -> Weight { - Weight::from_parts(0 as u64, 0) + Weight::from_parts(0_u64, 0) // Standard Error: 1_010_000 - .saturating_add(Weight::from_parts(109_961_000 as u64, 0).saturating_mul(r as u64)) + .saturating_add(Weight::from_parts(109_961_000_u64, 0).saturating_mul(r as u64)) // Standard Error: 1_010_000 - .saturating_add(Weight::from_parts(151_952_000 as u64, 0).saturating_mul(c as u64)) - .saturating_add(RocksDbWeight::get().reads((1 as u64).saturating_mul(r as u64))) - .saturating_add(RocksDbWeight::get().reads((2 as u64).saturating_mul(c as u64))) - .saturating_add(RocksDbWeight::get().writes((2 as u64).saturating_mul(r as u64))) - .saturating_add(RocksDbWeight::get().writes((2 as u64).saturating_mul(c as u64))) + .saturating_add(Weight::from_parts(151_952_000_u64, 0).saturating_mul(c as u64)) + .saturating_add(RocksDbWeight::get().reads(1_u64.saturating_mul(r as u64))) + .saturating_add(RocksDbWeight::get().reads(2_u64.saturating_mul(c as u64))) + .saturating_add(RocksDbWeight::get().writes(2_u64.saturating_mul(r as u64))) + .saturating_add(RocksDbWeight::get().writes(2_u64.saturating_mul(c as u64))) } } diff --git a/pallets/dmp-queue/src/lib.rs b/pallets/dmp-queue/src/lib.rs index 3b0d54c7bdb..082fceaf14c 100644 --- a/pallets/dmp-queue/src/lib.rs +++ b/pallets/dmp-queue/src/lib.rs @@ -766,19 +766,19 @@ mod tests { new_test_ext().execute_with(|| { let enqueued = vec![msg(1000), msg(1001)]; enqueue(&enqueued); - let weight_used = handle_messages(&vec![msg(1002)], Weight::from_parts(1500, 1500)); + let weight_used = handle_messages(&[msg(1002)], Weight::from_parts(1500, 1500)); assert_eq!(weight_used, Weight::from_parts(1000, 1000)); assert_eq!(take_trace(), vec![msg_complete(1000), msg_limit_reached(1001),]); assert_eq!(pages_queued(), 2); assert_eq!(PageIndex::::get().begin_used, 0); - let weight_used = handle_messages(&vec![msg(1003)], Weight::from_parts(1500, 1500)); + let weight_used = handle_messages(&[msg(1003)], Weight::from_parts(1500, 1500)); assert_eq!(weight_used, Weight::from_parts(1001, 1001)); assert_eq!(take_trace(), vec![msg_complete(1001), msg_limit_reached(1002),]); assert_eq!(pages_queued(), 2); assert_eq!(PageIndex::::get().begin_used, 1); - let weight_used = handle_messages(&vec![msg(1004)], Weight::from_parts(1500, 1500)); + let weight_used = handle_messages(&[msg(1004)], Weight::from_parts(1500, 1500)); assert_eq!(weight_used, Weight::from_parts(1002, 1002)); assert_eq!(take_trace(), vec![msg_complete(1002), msg_limit_reached(1003),]); assert_eq!(pages_queued(), 2); @@ -877,9 +877,9 @@ mod tests { #[test] fn on_idle_should_service_queue() { new_test_ext().execute_with(|| { - enqueue(&vec![msg(1000), msg(1001)]); - enqueue(&vec![msg(1002), msg(1003)]); - enqueue(&vec![msg(1004), msg(1005)]); + enqueue(&[msg(1000), msg(1001)]); + enqueue(&[msg(1002), msg(1003)]); + enqueue(&[msg(1004), msg(1005)]); let weight_used = DmpQueue::on_idle(1, Weight::from_parts(6000, 6000)); assert_eq!(weight_used, Weight::from_parts(5010, 5010)); @@ -901,20 +901,17 @@ mod tests { #[test] fn handle_max_messages_per_block() { new_test_ext().execute_with(|| { - enqueue(&vec![msg(1000), msg(1001)]); - enqueue(&vec![msg(1002), msg(1003)]); - enqueue(&vec![msg(1004), msg(1005)]); - - let incoming = (0..MAX_MESSAGES_PER_BLOCK) - .into_iter() - .map(|i| msg(1006 + i as u64)) - .collect::>(); + enqueue(&[msg(1000), msg(1001)]); + enqueue(&[msg(1002), msg(1003)]); + enqueue(&[msg(1004), msg(1005)]); + + let incoming = + (0..MAX_MESSAGES_PER_BLOCK).map(|i| msg(1006 + i as u64)).collect::>(); handle_messages(&incoming, Weight::from_parts(25000, 25000)); assert_eq!( take_trace(), (0..MAX_MESSAGES_PER_BLOCK) - .into_iter() .map(|i| msg_complete(1000 + i as u64)) .collect::>(), ); @@ -924,7 +921,6 @@ mod tests { assert_eq!( take_trace(), (MAX_MESSAGES_PER_BLOCK..MAX_MESSAGES_PER_BLOCK + 6) - .into_iter() .map(|i| msg_complete(1000 + i as u64)) .collect::>(), ); diff --git a/pallets/dmp-queue/src/migration.rs b/pallets/dmp-queue/src/migration.rs index b360f5a7bd4..5e1d357e142 100644 --- a/pallets/dmp-queue/src/migration.rs +++ b/pallets/dmp-queue/src/migration.rs @@ -74,7 +74,7 @@ pub fn migrate_to_v1() -> Weight { } }; - if let Err(_) = Configuration::::translate(|pre| pre.map(translate)) { + if Configuration::::translate(|pre| pre.map(translate)).is_err() { log::error!( target: "dmp_queue", "unexpected error when performing translation of the QueueConfig type during storage upgrade to v2" diff --git a/pallets/parachain-system/proc-macro/Cargo.toml b/pallets/parachain-system/proc-macro/Cargo.toml index 2eb35fe4f0b..d32fd096999 100644 --- a/pallets/parachain-system/proc-macro/Cargo.toml +++ b/pallets/parachain-system/proc-macro/Cargo.toml @@ -11,7 +11,7 @@ proc-macro = true [dependencies] syn = "2.0.15" proc-macro2 = "1.0.54" -quote = "1.0.26" +quote = "1.0.27" proc-macro-crate = "1.3.1" [features] diff --git a/pallets/parachain-system/src/lib.rs b/pallets/parachain-system/src/lib.rs index 4025368904b..36ef8d57195 100644 --- a/pallets/parachain-system/src/lib.rs +++ b/pallets/parachain-system/src/lib.rs @@ -473,10 +473,7 @@ pub mod pallet { check_version: bool, ) -> DispatchResult { ensure_root(origin)?; - AuthorizedUpgrade::::put(CodeUpgradeAuthorization { - code_hash: code_hash.clone(), - check_version, - }); + AuthorizedUpgrade::::put(CodeUpgradeAuthorization { code_hash, check_version }); Self::deposit_event(Event::UpgradeAuthorized { code_hash }); Ok(()) @@ -753,7 +750,7 @@ impl Pallet { let authorization = AuthorizedUpgrade::::get().ok_or(Error::::NothingAuthorized)?; // ensure that the actual hash matches the authorized hash - let actual_hash = T::Hashing::hash(&code[..]); + let actual_hash = T::Hashing::hash(code); ensure!(actual_hash == authorization.code_hash, Error::::Unauthorized); // check versions if required as part of the authorization @@ -941,10 +938,10 @@ impl Pallet { // `running_mqc_heads`. Otherwise, in a block where no messages were sent in a channel // it won't get into next block's `last_mqc_heads` and thus will be all zeros, which // would corrupt the message queue chain. - for &(ref sender, ref channel) in ingress_channels { + for (sender, channel) in ingress_channels { let cur_head = running_mqc_heads .entry(sender) - .or_insert_with(|| last_mqc_heads.get(&sender).cloned().unwrap_or_default()) + .or_insert_with(|| last_mqc_heads.get(sender).cloned().unwrap_or_default()) .head(); let target_head = channel.mqc_head.unwrap_or_default(); @@ -1090,22 +1087,20 @@ impl Pallet { // may change so that the message is no longer valid. // // However, changing this setting is expected to be rare. - match Self::host_configuration() { - Some(cfg) => - if message.len() > cfg.max_upward_message_size as usize { - return Err(MessageSendError::TooBig) - }, - None => { - // This storage field should carry over from the previous block. So if it's None - // then it must be that this is an edge-case where a message is attempted to be - // sent at the first block. - // - // Let's pass this message through. I think it's not unreasonable to expect that - // the message is not huge and it comes through, but if it doesn't it can be - // returned back to the sender. - // - // Thus fall through here. - }, + if let Some(cfg) = Self::host_configuration() { + if message.len() > cfg.max_upward_message_size as usize { + return Err(MessageSendError::TooBig) + } + } else { + // This storage field should carry over from the previous block. So if it's None + // then it must be that this is an edge-case where a message is attempted to be + // sent at the first block. + // + // Let's pass this message through. I think it's not unreasonable to expect that + // the message is not huge and it comes through, but if it doesn't it can be + // returned back to the sender. + // + // Thus fall through here. }; >::append(message.clone()); diff --git a/pallets/parachain-system/src/tests.rs b/pallets/parachain-system/src/tests.rs index 70e4c106bf2..a4b1c275b7a 100755 --- a/pallets/parachain-system/src/tests.rs +++ b/pallets/parachain-system/src/tests.rs @@ -304,7 +304,7 @@ impl BlockTests { // begin initialization System::reset_events(); - System::initialize(&n, &Default::default(), &Default::default()); + System::initialize(n, &Default::default(), &Default::default()); // now mess with the storage the way validate_block does let mut sproof_builder = RelayStateSproofBuilder::default(); @@ -357,10 +357,8 @@ impl BlockTests { ParachainSystem::on_finalize(*n); // did block execution set new validation code? - if NewValidationCode::::exists() { - if self.pending_upgrade.is_some() { - panic!("attempted to set validation code while upgrade was pending"); - } + if NewValidationCode::::exists() && self.pending_upgrade.is_some() { + panic!("attempted to set validation code while upgrade was pending"); } // clean up @@ -404,7 +402,7 @@ fn events() { let events = System::events(); assert_eq!( events[0].event, - RuntimeEvent::ParachainSystem(crate::Event::ValidationFunctionStored.into()) + RuntimeEvent::ParachainSystem(crate::Event::ValidationFunctionStored) ); }, ) @@ -415,10 +413,9 @@ fn events() { let events = System::events(); assert_eq!( events[0].event, - RuntimeEvent::ParachainSystem( - crate::Event::ValidationFunctionApplied { relay_chain_block_num: 1234 } - .into() - ) + RuntimeEvent::ParachainSystem(crate::Event::ValidationFunctionApplied { + relay_chain_block_num: 1234 + }) ); }, ); @@ -491,7 +488,7 @@ fn aborted_upgrade() { let events = System::events(); assert_eq!( events[0].event, - RuntimeEvent::ParachainSystem(crate::Event::ValidationFunctionDiscarded.into()) + RuntimeEvent::ParachainSystem(crate::Event::ValidationFunctionDiscarded) ); }, ); diff --git a/pallets/parachain-system/src/validate_block/tests.rs b/pallets/parachain-system/src/validate_block/tests.rs index 2c39188a085..4801b62e7b5 100644 --- a/pallets/parachain-system/src/validate_block/tests.rs +++ b/pallets/parachain-system/src/validate_block/tests.rs @@ -41,7 +41,7 @@ fn call_validate_block_encoded_header( relay_parent_number: 1, relay_parent_storage_root, }, - &WASM_BINARY.expect("You need to build the WASM binaries to run the tests!"), + WASM_BINARY.expect("You need to build the WASM binaries to run the tests!"), ) .map(|v| v.head_data.0) } @@ -191,7 +191,7 @@ fn validate_block_invalid_parent_hash() { .unwrap_err(); } else { let output = Command::new(env::current_exe().unwrap()) - .args(&["validate_block_invalid_parent_hash", "--", "--nocapture"]) + .args(["validate_block_invalid_parent_hash", "--", "--nocapture"]) .env("RUN_TEST", "1") .output() .expect("Runs the test"); @@ -213,7 +213,7 @@ fn validate_block_fails_on_invalid_validation_data() { call_validate_block(parent_head, block, Hash::random()).unwrap_err(); } else { let output = Command::new(env::current_exe().unwrap()) - .args(&["validate_block_fails_on_invalid_validation_data", "--", "--nocapture"]) + .args(["validate_block_fails_on_invalid_validation_data", "--", "--nocapture"]) .env("RUN_TEST", "1") .output() .expect("Runs the test"); @@ -242,7 +242,7 @@ fn check_inherent_fails_on_validate_block_as_expected() { .unwrap_err(); } else { let output = Command::new(env::current_exe().unwrap()) - .args(&["check_inherent_fails_on_validate_block_as_expected", "--", "--nocapture"]) + .args(["check_inherent_fails_on_validate_block_as_expected", "--", "--nocapture"]) .env("RUN_TEST", "1") .output() .expect("Runs the test"); @@ -276,7 +276,7 @@ fn check_inherents_are_unsigned_and_before_all_other_extrinsics() { .unwrap_err(); } else { let output = Command::new(env::current_exe().unwrap()) - .args(&[ + .args([ "check_inherents_are_unsigned_and_before_all_other_extrinsics", "--", "--nocapture", diff --git a/pallets/xcmp-queue/src/lib.rs b/pallets/xcmp-queue/src/lib.rs index df2b78ebc20..0dc76aa80a1 100644 --- a/pallets/xcmp-queue/src/lib.rs +++ b/pallets/xcmp-queue/src/lib.rs @@ -538,7 +538,7 @@ impl Pallet { return false } s.extend_from_slice(&data[..]); - return true + true }); if appended { Ok((details.last_index - details.first_index - 1) as u32) diff --git a/pallets/xcmp-queue/src/migration.rs b/pallets/xcmp-queue/src/migration.rs index f6ece1da1a8..fd1301b9491 100644 --- a/pallets/xcmp-queue/src/migration.rs +++ b/pallets/xcmp-queue/src/migration.rs @@ -94,7 +94,7 @@ pub fn migrate_to_v2() -> Weight { } }; - if let Err(_) = QueueConfig::::translate(|pre| pre.map(translate)) { + if QueueConfig::::translate(|pre| pre.map(translate)).is_err() { log::error!( target: super::LOG_TARGET, "unexpected error when performing translation of the QueueConfig type during storage upgrade to v2" diff --git a/pallets/xcmp-queue/src/mock.rs b/pallets/xcmp-queue/src/mock.rs index 0d7d6eda00b..2e70e65392a 100644 --- a/pallets/xcmp-queue/src/mock.rs +++ b/pallets/xcmp-queue/src/mock.rs @@ -120,7 +120,7 @@ impl cumulus_pallet_parachain_system::Config for Test { parameter_types! { pub const RelayChain: MultiLocation = MultiLocation::parent(); - pub UniversalLocation: InteriorMultiLocation = X1(Parachain(1u32.into())).into(); + pub UniversalLocation: InteriorMultiLocation = X1(Parachain(1u32)); pub UnitWeightCost: Weight = Weight::from_parts(1_000_000, 1024); pub const MaxInstructions: u32 = 100; pub const MaxAssetsIntoHolding: u32 = 64; diff --git a/pallets/xcmp-queue/src/tests.rs b/pallets/xcmp-queue/src/tests.rs index 952a2758f30..ad0fa906da3 100644 --- a/pallets/xcmp-queue/src/tests.rs +++ b/pallets/xcmp-queue/src/tests.rs @@ -23,7 +23,7 @@ use sp_runtime::traits::BadOrigin; fn one_message_does_not_panic() { new_test_ext().execute_with(|| { let message_format = XcmpMessageFormat::ConcatenatedVersionedXcm.encode(); - let messages = vec![(Default::default(), 1u32.into(), message_format.as_slice())]; + let messages = vec![(Default::default(), 1u32, message_format.as_slice())]; // This shouldn't cause a panic XcmpQueue::handle_xcmp_messages(messages.into_iter(), Weight::MAX); @@ -128,7 +128,7 @@ fn suspend_xcm_execution_works() { .encode(); let mut message_format = XcmpMessageFormat::ConcatenatedVersionedXcm.encode(); message_format.extend(xcm.clone()); - let messages = vec![(ParaId::from(999), 1u32.into(), message_format.as_slice())]; + let messages = vec![(ParaId::from(999), 1u32, message_format.as_slice())]; // This should have executed the incoming XCM, because it came from a system parachain XcmpQueue::handle_xcmp_messages(messages.into_iter(), Weight::MAX); @@ -136,7 +136,7 @@ fn suspend_xcm_execution_works() { let queued_xcm = InboundXcmpMessages::::get(ParaId::from(999), 1u32); assert!(queued_xcm.is_empty()); - let messages = vec![(ParaId::from(2000), 1u32.into(), message_format.as_slice())]; + let messages = vec![(ParaId::from(2000), 1u32, message_format.as_slice())]; // This shouldn't have executed the incoming XCM XcmpQueue::handle_xcmp_messages(messages.into_iter(), Weight::MAX); @@ -294,7 +294,7 @@ fn xcmp_queue_does_not_consume_dest_or_msg_on_not_applicable() { // XcmpQueue - check dest is really not applicable let dest = (Parent, Parent, Parent); - let mut dest_wrapper = Some(dest.clone().into()); + let mut dest_wrapper = Some(dest.into()); let mut msg_wrapper = Some(message.clone()); assert_eq!( Err(SendError::NotApplicable), @@ -302,7 +302,7 @@ fn xcmp_queue_does_not_consume_dest_or_msg_on_not_applicable() { ); // check wrapper were not consumed - assert_eq!(Some(dest.clone().into()), dest_wrapper.take()); + assert_eq!(Some(dest.into()), dest_wrapper.take()); assert_eq!(Some(message.clone()), msg_wrapper.take()); // another try with router chain with asserting sender @@ -322,7 +322,7 @@ fn xcmp_queue_consumes_dest_and_msg_on_ok_validate() { // XcmpQueue - check dest/msg is valid let dest = (Parent, X1(Parachain(5555))); - let mut dest_wrapper = Some(dest.clone().into()); + let mut dest_wrapper = Some(dest.into()); let mut msg_wrapper = Some(message.clone()); assert!(::validate(&mut dest_wrapper, &mut msg_wrapper).is_ok()); diff --git a/pallets/xcmp-queue/src/weights.rs b/pallets/xcmp-queue/src/weights.rs index b275982b003..cbb29ac3ae3 100644 --- a/pallets/xcmp-queue/src/weights.rs +++ b/pallets/xcmp-queue/src/weights.rs @@ -18,31 +18,31 @@ pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { // Storage: XcmpQueue QueueConfig (r:1 w:1) fn set_config_with_u32() -> Weight { - Weight::from_parts(2_717_000 as u64, 0) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + Weight::from_parts(2_717_000_u64, 0) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } // Storage: XcmpQueue QueueConfig (r:1 w:1) fn set_config_with_weight() -> Weight { - Weight::from_parts(2_717_000 as u64, 0) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + Weight::from_parts(2_717_000_u64, 0) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } } impl WeightInfo for () { // Storage: XcmpQueue QueueConfig (r:1 w:1) fn set_config_with_u32() -> Weight { - Weight::from_parts(2_717_000 as u64, 0) - .saturating_add(RocksDbWeight::get().reads(1 as u64)) - .saturating_add(RocksDbWeight::get().writes(1 as u64)) + Weight::from_parts(2_717_000_u64, 0) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) } // Storage: XcmpQueue QueueConfig (r:1 w:1) fn set_config_with_weight() -> Weight { - Weight::from_parts(2_717_000 as u64, 0) - .saturating_add(RocksDbWeight::get().reads(1 as u64)) - .saturating_add(RocksDbWeight::get().writes(1 as u64)) + Weight::from_parts(2_717_000_u64, 0) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) } } diff --git a/parachain-template/node/Cargo.toml b/parachain-template/node/Cargo.toml index a1734127c11..3ded5c15bf7 100644 --- a/parachain-template/node/Cargo.toml +++ b/parachain-template/node/Cargo.toml @@ -13,7 +13,7 @@ build = "build.rs" clap = { version = "4.2.7", features = ["derive"] } log = "0.4.17" codec = { package = "parity-scale-codec", version = "3.0.0" } -serde = { version = "1.0.160", features = ["derive"] } +serde = { version = "1.0.162", features = ["derive"] } jsonrpsee = { version = "0.16.2", features = ["server"] } # Local diff --git a/parachain-template/node/src/command.rs b/parachain-template/node/src/command.rs index 20ac62ec4a5..c3e79ebe387 100644 --- a/parachain-template/node/src/command.rs +++ b/parachain-template/node/src/command.rs @@ -268,13 +268,13 @@ pub fn run() -> Result<()> { runner.run_node_until_exit(|config| async move { let hwbench = (!cli.no_hardware_benchmarks).then_some( config.database.path().map(|database_path| { - let _ = std::fs::create_dir_all(&database_path); + let _ = std::fs::create_dir_all(database_path); sc_sysinfo::gather_hwbench(Some(database_path)) })).flatten(); let para_id = chain_spec::Extensions::try_get(&*config.chain_spec) .map(|e| e.para_id) - .ok_or_else(|| "Could not find parachain ID in chain-spec.")?; + .ok_or("Could not find parachain ID in chain-spec.")?; let polkadot_cli = RelayChainCli::new( &config, @@ -301,7 +301,7 @@ pub fn run() -> Result<()> { 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.relay_chain_args.len() > 0 { + 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."); } diff --git a/parachain-template/pallets/template/Cargo.toml b/parachain-template/pallets/template/Cargo.toml index ca574f6c8d5..f47d82c9798 100644 --- a/parachain-template/pallets/template/Cargo.toml +++ b/parachain-template/pallets/template/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "pallet-template" +name = "pallet-parachain-template" authors = ["Anonymous"] description = "FRAME pallet template for defining custom runtime logic." version = "0.1.0" diff --git a/parachain-template/pallets/template/src/benchmarking.rs b/parachain-template/pallets/template/src/benchmarking.rs index fea9e65969b..8bba2a09867 100644 --- a/parachain-template/pallets/template/src/benchmarking.rs +++ b/parachain-template/pallets/template/src/benchmarking.rs @@ -1,4 +1,4 @@ -//! Benchmarking setup for pallet-template +//! Benchmarking setup for pallet-parachain-template use super::*; diff --git a/parachain-template/pallets/template/src/mock.rs b/parachain-template/pallets/template/src/mock.rs index 4a7ebac0fa8..099c0af8acd 100644 --- a/parachain-template/pallets/template/src/mock.rs +++ b/parachain-template/pallets/template/src/mock.rs @@ -1,4 +1,3 @@ -use crate as pallet_template; use frame_support::{parameter_types, traits::Everything}; use frame_system as system; use sp_core::H256; @@ -18,7 +17,7 @@ frame_support::construct_runtime!( UncheckedExtrinsic = UncheckedExtrinsic, { System: frame_system::{Pallet, Call, Config, Storage, Event}, - TemplateModule: pallet_template::{Pallet, Call, Storage, Event}, + TemplateModule: crate::{Pallet, Call, Storage, Event}, } ); @@ -54,7 +53,7 @@ impl system::Config for Test { type MaxConsumers = frame_support::traits::ConstU32<16>; } -impl pallet_template::Config for Test { +impl crate::Config for Test { type RuntimeEvent = RuntimeEvent; } diff --git a/parachain-template/runtime/Cargo.toml b/parachain-template/runtime/Cargo.toml index 81a4cf811a8..fefaffb032c 100644 --- a/parachain-template/runtime/Cargo.toml +++ b/parachain-template/runtime/Cargo.toml @@ -22,7 +22,7 @@ scale-info = { version = "2.6.0", default-features = false, features = ["derive" smallvec = "1.10.0" # Local -pallet-template = { path = "../pallets/template", default-features = false } +pallet-parachain-template = { path = "../pallets/template", default-features = false } # Substrate frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "master" } @@ -99,7 +99,7 @@ std = [ "pallet-collator-selection/std", "pallet-session/std", "pallet-sudo/std", - "pallet-template/std", + "pallet-parachain-template/std", "pallet-timestamp/std", "pallet-transaction-payment-rpc-runtime-api/std", "pallet-transaction-payment/std", @@ -132,7 +132,7 @@ runtime-benchmarks = [ "frame-system/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "pallet-collator-selection/runtime-benchmarks", - "pallet-template/runtime-benchmarks", + "pallet-parachain-template/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", "pallet-xcm/runtime-benchmarks", "sp-runtime/runtime-benchmarks", @@ -156,7 +156,7 @@ try-runtime = [ "pallet-collator-selection/try-runtime", "pallet-session/try-runtime", "pallet-sudo/try-runtime", - "pallet-template/try-runtime", + "pallet-parachain-template/try-runtime", "pallet-timestamp/try-runtime", "pallet-transaction-payment/try-runtime", "pallet-xcm/try-runtime", diff --git a/parachain-template/runtime/src/lib.rs b/parachain-template/runtime/src/lib.rs index 61839e0a621..7a847fc5118 100644 --- a/parachain-template/runtime/src/lib.rs +++ b/parachain-template/runtime/src/lib.rs @@ -58,7 +58,7 @@ use xcm::latest::prelude::BodyId; use xcm_executor::XcmExecutor; /// Import the template pallet. -pub use pallet_template; +pub use pallet_parachain_template; /// Alias to 512-bit hash when used in the context of a transaction signature on the chain. pub type Signature = MultiSignature; @@ -457,7 +457,7 @@ impl pallet_collator_selection::Config for Runtime { } /// Configure the pallet template in pallets/template. -impl pallet_template::Config for Runtime { +impl pallet_parachain_template::Config for Runtime { type RuntimeEvent = RuntimeEvent; } @@ -492,7 +492,7 @@ construct_runtime!( DmpQueue: cumulus_pallet_dmp_queue = 33, // Template - TemplatePallet: pallet_template = 40, + TemplatePallet: pallet_parachain_template = 40, } ); @@ -686,13 +686,13 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig ) -> Result, sp_runtime::RuntimeString> { - use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey}; + use frame_benchmarking::{Benchmarking, BenchmarkBatch}; use frame_system_benchmarking::Pallet as SystemBench; impl frame_system_benchmarking::Config for Runtime {} diff --git a/parachain-template/runtime/src/xcm_config.rs b/parachain-template/runtime/src/xcm_config.rs index bd395c83d38..096359004d6 100644 --- a/parachain-template/runtime/src/xcm_config.rs +++ b/parachain-template/runtime/src/xcm_config.rs @@ -248,6 +248,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/parachains/chain-specs/contracts-rococo.json b/parachains/chain-specs/contracts-rococo.json index a74ab22e05d..09108e9c099 100644 --- a/parachains/chain-specs/contracts-rococo.json +++ b/parachains/chain-specs/contracts-rococo.json @@ -3,11 +3,16 @@ "id": "contracts-rococo", "chainType": "Live", "bootNodes": [ - "/dns/contracts-collator-0.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWKg3Rpxcr9oJ8n6khoxpGKWztCZydtUZk2cojHqnfLrpj", - "/dns/contracts-collator-1.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWPEXYrz8tHU3nDtPoPw4V7ou5dzMEWSTuUj7vaWiYVAVh", - "/dns/contracts-collator-2.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWEVU8AFNary4nP4qEnEcwJaRuy59Wefekzdu9pKbnVEhk", - "/dns/contracts-collator-3.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWP6pV3ZmcXzGDjv8ZMgA6nZxfAKDxSz4VNiLx6vVCQgJX" + "/dns/rococo-contracts-collator-node-0.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWKg3Rpxcr9oJ8n6khoxpGKWztCZydtUZk2cojHqnfLrpj", + "/dns/rococo-contracts-collator-node-1.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWPEXYrz8tHU3nDtPoPw4V7ou5dzMEWSTuUj7vaWiYVAVh", + "/dns/rococo-contracts-collator-node-2.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWEVU8AFNary4nP4qEnEcwJaRuy59Wefekzdu9pKbnVEhk", + "/dns/rococo-contracts-collator-node-3.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWP6pV3ZmcXzGDjv8ZMgA6nZxfAKDxSz4VNiLx6vVCQgJX", + "/dns/rococo-contracts-collator-node-0.polkadot.io/tcp/443/wss/p2p/12D3KooWKg3Rpxcr9oJ8n6khoxpGKWztCZydtUZk2cojHqnfLrpj", + "/dns/rococo-contracts-collator-node-1.polkadot.io/tcp/443/wss/p2p/12D3KooWPEXYrz8tHU3nDtPoPw4V7ou5dzMEWSTuUj7vaWiYVAVh", + "/dns/rococo-contracts-collator-node-2.polkadot.io/tcp/443/wss/p2p/12D3KooWEVU8AFNary4nP4qEnEcwJaRuy59Wefekzdu9pKbnVEhk", + "/dns/rococo-contracts-collator-node-3.polkadot.io/tcp/443/wss/p2p/12D3KooWP6pV3ZmcXzGDjv8ZMgA6nZxfAKDxSz4VNiLx6vVCQgJX" ], + "telemetryEndpoints": null, "protocolId": null, "properties": { @@ -80,4 +85,4 @@ "childrenDefault": {} } } -} \ No newline at end of file +} diff --git a/parachains/chain-specs/westmint.json b/parachains/chain-specs/westmint.json index 3516fbfaa56..a700e5ddd61 100644 --- a/parachains/chain-specs/westmint.json +++ b/parachains/chain-specs/westmint.json @@ -3,10 +3,10 @@ "id": "westmint", "chainType": "Live", "bootNodes": [ - "/ip4/35.204.21.205/tcp/30334/p2p/12D3KooWLjaXWhNTSiRVFbTJCKLRWt9XXHLGVnAFtxvnExKkVPqn", - "/ip4/34.141.171.170/tcp/30334/p2p/12D3KooWBNy2Jdrjv2P7sdfb1mzH1AGzwjip5rW4N2Ft1T3Hdq5c", - "/ip4/34.141.221.252/tcp/30334/p2p/12D3KooWC9YYdjQLwxTNVda6t4nmjAZG37gaRZLNi4Zuhr9xUveW", - "/ip4/34.90.92.174/tcp/30334/p2p/12D3KooWQcXpUyVqwC2zJkwECCC7ttLCUCLTjnbGxTVfhSgmH2sD", + "/dns/westend-westmint-collator-node-0.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWJaAfPyiye7ZQBuHengTJJoMrcaz7Jj1UzHiKdNxA1Nkd", + "/dns/westend-westmint-collator-node-1.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWGL3hpWycWyeqyL9gHNnmmsL474WkPZdqraBHu4L6fQrW", + "/dns/westend-westmint-collator-node-2.parity-testnet.parity.io./tcp/30333/p2p/12D3KooWBkKDWhHzu6Hhe492adEpVV7wzuaWGxUfEnr6g5JCr7Gr", + "/dns/westend-westmint-collator-node-3.parity-testnet.parity.io./tcp/30333/p2p/12D3KooWMGpzCmhD6np6eKqxL7AAunKn1dN86Dr7a9E2xgZ2rt6G", "/dns/boot.stake.plus/tcp/33333/p2p/12D3KooWNiB27rpXX7EYongoWWUeRKzLQxWGms6MQU2B9LX7Ztzo", "/dns/boot.stake.plus/tcp/33334/wss/p2p/12D3KooWNiB27rpXX7EYongoWWUeRKzLQxWGms6MQU2B9LX7Ztzo", "/dns/boot.metaspan.io/tcp/36052/p2p/12D3KooWBCqfNb6Y39DXTr4UBWXyjuS3hcZM1qTbHhDXxF6HkAJJ", @@ -49,4 +49,4 @@ "childrenDefault": {} } } -} \ No newline at end of file +} diff --git a/parachains/common/src/impls.rs b/parachains/common/src/impls.rs index cc89a248e2e..d9998755212 100644 --- a/parachains/common/src/impls.rs +++ b/parachains/common/src/impls.rs @@ -278,7 +278,6 @@ mod tests { } let asset_location = SomeSiblingParachain::get() - .clone() .pushed_with_interior(GeneralIndex(42)) .expect("multilocation will only have 2 junctions; qed"); let asset = MultiAsset { id: Concrete(asset_location), fun: 1_000_000u128.into() }; diff --git a/parachains/integration-tests/statemine/xcm/0_init.yml b/parachains/integration-tests/e2e/assets/statemine/0_xcm/0_init.yml similarity index 100% rename from parachains/integration-tests/statemine/xcm/0_init.yml rename to parachains/integration-tests/e2e/assets/statemine/0_xcm/0_init.yml diff --git a/parachains/integration-tests/statemine/xcm/1_dmp.yml b/parachains/integration-tests/e2e/assets/statemine/0_xcm/1_dmp.yml similarity index 100% rename from parachains/integration-tests/statemine/xcm/1_dmp.yml rename to parachains/integration-tests/e2e/assets/statemine/0_xcm/1_dmp.yml diff --git a/parachains/integration-tests/statemine/xcm/2_ump.yml b/parachains/integration-tests/e2e/assets/statemine/0_xcm/2_ump.yml similarity index 100% rename from parachains/integration-tests/statemine/xcm/2_ump.yml rename to parachains/integration-tests/e2e/assets/statemine/0_xcm/2_ump.yml diff --git a/parachains/integration-tests/statemine/xcm/3_hrmp-open-channels.yml b/parachains/integration-tests/e2e/assets/statemine/0_xcm/3_hrmp-open-channels.yml similarity index 100% rename from parachains/integration-tests/statemine/xcm/3_hrmp-open-channels.yml rename to parachains/integration-tests/e2e/assets/statemine/0_xcm/3_hrmp-open-channels.yml diff --git a/parachains/integration-tests/statemine/xcm/4_hrmp.yml b/parachains/integration-tests/e2e/assets/statemine/0_xcm/4_hrmp.yml similarity index 100% rename from parachains/integration-tests/statemine/xcm/4_hrmp.yml rename to parachains/integration-tests/e2e/assets/statemine/0_xcm/4_hrmp.yml diff --git a/parachains/integration-tests/statemine/config.toml b/parachains/integration-tests/e2e/assets/statemine/config.toml similarity index 100% rename from parachains/integration-tests/statemine/config.toml rename to parachains/integration-tests/e2e/assets/statemine/config.toml diff --git a/parachains/integration-tests/statemint/xcm/0_init.yml b/parachains/integration-tests/e2e/assets/statemint/0_xcm/0_init.yml similarity index 100% rename from parachains/integration-tests/statemint/xcm/0_init.yml rename to parachains/integration-tests/e2e/assets/statemint/0_xcm/0_init.yml diff --git a/parachains/integration-tests/statemint/xcm/1_dmp.yml b/parachains/integration-tests/e2e/assets/statemint/0_xcm/1_dmp.yml similarity index 100% rename from parachains/integration-tests/statemint/xcm/1_dmp.yml rename to parachains/integration-tests/e2e/assets/statemint/0_xcm/1_dmp.yml diff --git a/parachains/integration-tests/statemint/xcm/2_ump.yml b/parachains/integration-tests/e2e/assets/statemint/0_xcm/2_ump.yml similarity index 100% rename from parachains/integration-tests/statemint/xcm/2_ump.yml rename to parachains/integration-tests/e2e/assets/statemint/0_xcm/2_ump.yml diff --git a/parachains/integration-tests/statemint/xcm/3_hrmp-open-channels.yml b/parachains/integration-tests/e2e/assets/statemint/0_xcm/3_hrmp-open-channels.yml similarity index 100% rename from parachains/integration-tests/statemint/xcm/3_hrmp-open-channels.yml rename to parachains/integration-tests/e2e/assets/statemint/0_xcm/3_hrmp-open-channels.yml diff --git a/parachains/integration-tests/statemint/xcm/4_hrmp.yml b/parachains/integration-tests/e2e/assets/statemint/0_xcm/4_hrmp.yml similarity index 100% rename from parachains/integration-tests/statemint/xcm/4_hrmp.yml rename to parachains/integration-tests/e2e/assets/statemint/0_xcm/4_hrmp.yml diff --git a/parachains/integration-tests/statemint/config.toml b/parachains/integration-tests/e2e/assets/statemint/config.toml similarity index 100% rename from parachains/integration-tests/statemint/config.toml rename to parachains/integration-tests/e2e/assets/statemint/config.toml diff --git a/parachains/integration-tests/collectives/0_xcm/0_init.yml b/parachains/integration-tests/e2e/collectives/collectives_polkadot/0_xcm/0_init.yml similarity index 100% rename from parachains/integration-tests/collectives/0_xcm/0_init.yml rename to parachains/integration-tests/e2e/collectives/collectives_polkadot/0_xcm/0_init.yml diff --git a/parachains/integration-tests/collectives/0_xcm/1_teleport.yml b/parachains/integration-tests/e2e/collectives/collectives_polkadot/0_xcm/1_teleport.yml similarity index 100% rename from parachains/integration-tests/collectives/0_xcm/1_teleport.yml rename to parachains/integration-tests/e2e/collectives/collectives_polkadot/0_xcm/1_teleport.yml diff --git a/parachains/integration-tests/collectives/0_xcm/2_reserve.yml b/parachains/integration-tests/e2e/collectives/collectives_polkadot/0_xcm/2_reserve.yml similarity index 100% rename from parachains/integration-tests/collectives/0_xcm/2_reserve.yml rename to parachains/integration-tests/e2e/collectives/collectives_polkadot/0_xcm/2_reserve.yml diff --git a/parachains/integration-tests/collectives/1_alliance/0_join_alliance_fails.yml b/parachains/integration-tests/e2e/collectives/collectives_polkadot/1_alliance/0_join_alliance_fails.yml similarity index 100% rename from parachains/integration-tests/collectives/1_alliance/0_join_alliance_fails.yml rename to parachains/integration-tests/e2e/collectives/collectives_polkadot/1_alliance/0_join_alliance_fails.yml diff --git a/parachains/integration-tests/collectives/1_alliance/1_init_alliance.yml b/parachains/integration-tests/e2e/collectives/collectives_polkadot/1_alliance/1_init_alliance.yml similarity index 100% rename from parachains/integration-tests/collectives/1_alliance/1_init_alliance.yml rename to parachains/integration-tests/e2e/collectives/collectives_polkadot/1_alliance/1_init_alliance.yml diff --git a/parachains/integration-tests/collectives/1_alliance/2_join_alliance_fails.yml b/parachains/integration-tests/e2e/collectives/collectives_polkadot/1_alliance/2_join_alliance_fails.yml similarity index 100% rename from parachains/integration-tests/collectives/1_alliance/2_join_alliance_fails.yml rename to parachains/integration-tests/e2e/collectives/collectives_polkadot/1_alliance/2_join_alliance_fails.yml diff --git a/parachains/integration-tests/collectives/1_alliance/3_kick_member.yml b/parachains/integration-tests/e2e/collectives/collectives_polkadot/1_alliance/3_kick_member.yml similarity index 100% rename from parachains/integration-tests/collectives/1_alliance/3_kick_member.yml rename to parachains/integration-tests/e2e/collectives/collectives_polkadot/1_alliance/3_kick_member.yml diff --git a/parachains/integration-tests/collectives/config.toml b/parachains/integration-tests/e2e/collectives/collectives_polkadot/config.toml similarity index 100% rename from parachains/integration-tests/collectives/config.toml rename to parachains/integration-tests/e2e/collectives/collectives_polkadot/config.toml diff --git a/parachains/integration-tests/emulated/assets/statemint/Cargo.toml b/parachains/integration-tests/emulated/assets/statemint/Cargo.toml new file mode 100644 index 00000000000..8c6077b67e4 --- /dev/null +++ b/parachains/integration-tests/emulated/assets/statemint/Cargo.toml @@ -0,0 +1,36 @@ +[package] +name = "statemint-it" +version = "1.0.0" +authors = ["Parity Technologies "] +edition = "2021" +description = "Statemint parachain 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" } +penpal-runtime = { path = "../../../../runtimes/testing/penpal" } +statemint-runtime = { path = "../../../../runtimes/assets/statemint" } + +# 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/assets/statemint/src/lib.rs b/parachains/integration-tests/emulated/assets/statemint/src/lib.rs new file mode 100644 index 00000000000..f7ca680a800 --- /dev/null +++ b/parachains/integration-tests/emulated/assets/statemint/src/lib.rs @@ -0,0 +1,33 @@ +pub use codec::Encode; +pub use frame_support::{ + assert_ok, instances::Instance1, pallet_prelude::Weight, traits::fungibles::Inspect, +}; +pub use integration_tests_common::{ + constants::{ + accounts::{ALICE, BOB}, + polkadot::ED as POLKADOT_ED, + PROOF_SIZE_THRESHOLD, REF_TIME_THRESHOLD, XCM_V3, + }, + AccountId, 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, Statemine, StateminePallet, StatemineReceiver, + StatemineSender, Statemint, StatemintPallet, StatemintReceiver, StatemintSender, +}; +pub use polkadot_core_primitives::InboundDownwardMessage; +pub use xcm::{ + prelude::*, + v3::{ + Error, + NetworkId::{Kusama as KusamaId, Polkadot as PolkadotId}, + }, +}; +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/assets/statemint/src/tests/mod.rs b/parachains/integration-tests/emulated/assets/statemint/src/tests/mod.rs new file mode 100644 index 00000000000..996f9fd0aae --- /dev/null +++ b/parachains/integration-tests/emulated/assets/statemint/src/tests/mod.rs @@ -0,0 +1,3 @@ +mod reserve_transfer; +mod teleport; +mod transact; diff --git a/parachains/integration-tests/emulated/assets/statemint/src/tests/reserve_transfer.rs b/parachains/integration-tests/emulated/assets/statemint/src/tests/reserve_transfer.rs new file mode 100644 index 00000000000..55d201c5608 --- /dev/null +++ b/parachains/integration-tests/emulated/assets/statemint/src/tests/reserve_transfer.rs @@ -0,0 +1,63 @@ +use crate::*; + +#[test] +fn reserve_transfer_native_asset_from_relay_to_assets() { + // Init tests variables + let amount = POLKADOT_ED * 1000; + let relay_sender_balance_before = Polkadot::account_data_of(PolkadotSender::get()).free; + let para_receiver_balance_before = Statemint::account_data_of(StatemintReceiver::get()).free; + + let origin = ::RuntimeOrigin::signed(PolkadotSender::get()); + let assets_para_destination: VersionedMultiLocation = + Polkadot::child_location_of(Statemint::para_id()).into(); + let beneficiary: VersionedMultiLocation = + AccountId32 { network: None, id: StatemintReceiver::get().into() }.into(); + let native_assets: VersionedMultiAssets = (Here, amount).into(); + let fee_asset_item = 0; + let weight_limit = WeightLimit::Unlimited; + + // Send XCM message from Relay Chain + Polkadot::execute_with(|| { + assert_ok!(::XcmPallet::limited_reserve_transfer_assets( + origin, + bx!(assets_para_destination), + bx!(beneficiary), + bx!(native_assets), + fee_asset_item, + weight_limit, + )); + + type RuntimeEvent = ::RuntimeEvent; + + assert_expected_events!( + Polkadot, + vec![ + RuntimeEvent::XcmPallet(pallet_xcm::Event::Attempted(Outcome::Complete(weight))) => { + weight: weight_within_threshold((REF_TIME_THRESHOLD, PROOF_SIZE_THRESHOLD), Weight::from_parts(2_000_000_000, 0), *weight), + }, + ] + ); + }); + + // Receive XCM message in Assets Parachain + Statemint::execute_with(|| { + type RuntimeEvent = ::RuntimeEvent; + + assert_expected_events!( + Statemint, + vec![ + RuntimeEvent::DmpQueue(cumulus_pallet_dmp_queue::Event::ExecutedDownward { + outcome: Outcome::Incomplete(_, Error::UntrustedReserveLocation), + .. + }) => {}, + ] + ); + }); + + // Check if balances are updated accordingly in Relay Chain and Assets Parachain + let relay_sender_balance_after = Polkadot::account_data_of(PolkadotSender::get()).free; + let para_sender_balance_after = Statemint::account_data_of(StatemintReceiver::get()).free; + + assert_eq!(relay_sender_balance_before - amount, relay_sender_balance_after); + assert_eq!(para_sender_balance_after, para_receiver_balance_before); +} diff --git a/parachains/integration-tests/emulated/assets/statemint/src/tests/teleport.rs b/parachains/integration-tests/emulated/assets/statemint/src/tests/teleport.rs new file mode 100644 index 00000000000..163db77ddfd --- /dev/null +++ b/parachains/integration-tests/emulated/assets/statemint/src/tests/teleport.rs @@ -0,0 +1,60 @@ +use crate::*; + +#[test] +fn teleport_native_assets_from_relay_to_assets_para() { + // Init tests variables + let amount = POLKADOT_ED * 1000; + let relay_sender_balance_before = Polkadot::account_data_of(PolkadotSender::get()).free; + let para_receiver_balance_before = Statemint::account_data_of(StatemintReceiver::get()).free; + + let origin = ::RuntimeOrigin::signed(PolkadotSender::get()); + let assets_para_destination: VersionedMultiLocation = + Polkadot::child_location_of(Statemint::para_id()).into(); + let beneficiary: VersionedMultiLocation = + AccountId32 { network: None, id: StatemintReceiver::get().into() }.into(); + let native_assets: VersionedMultiAssets = (Here, amount).into(); + let fee_asset_item = 0; + let weight_limit = WeightLimit::Unlimited; + + // Send XCM message from Relay Chain + Polkadot::execute_with(|| { + assert_ok!(::XcmPallet::limited_teleport_assets( + origin, + bx!(assets_para_destination), + bx!(beneficiary), + bx!(native_assets), + fee_asset_item, + weight_limit, + )); + + type RuntimeEvent = ::RuntimeEvent; + + assert_expected_events!( + Polkadot, + vec![ + RuntimeEvent::XcmPallet(pallet_xcm::Event::Attempted(Outcome::Complete { .. })) => {}, + ] + ); + }); + + // Receive XCM message in Assets Parachain + Statemint::execute_with(|| { + type RuntimeEvent = ::RuntimeEvent; + + assert_expected_events!( + Statemint, + vec![ + RuntimeEvent::Balances(pallet_balances::Event::Deposit { who, .. }) => { + who: *who == StatemineReceiver::get().into(), + }, + ] + ); + }); + + // Check if balances are updated accordingly in Relay Chain and Assets Parachain + let relay_sender_balance_after = Polkadot::account_data_of(PolkadotSender::get()).free; + let para_sender_balance_after = Statemint::account_data_of(StatemintReceiver::get()).free; + + assert_eq!(relay_sender_balance_before - amount, relay_sender_balance_after); + assert!(para_sender_balance_after > para_receiver_balance_before); +} diff --git a/parachains/integration-tests/emulated/assets/statemint/src/tests/transact.rs b/parachains/integration-tests/emulated/assets/statemint/src/tests/transact.rs new file mode 100644 index 00000000000..9220d914e47 --- /dev/null +++ b/parachains/integration-tests/emulated/assets/statemint/src/tests/transact.rs @@ -0,0 +1,58 @@ +use crate::*; + +#[test] +fn transact_sudo_from_relay_to_assets_para() { + // Init tests variables + // Call to be executed in Assets Parachain + const ASSET_ID: u32 = 1; + + let call = ::RuntimeCall::Assets(pallet_assets::Call::< + ::Runtime, + Instance1, + >::force_create { + id: ASSET_ID.into(), + is_sufficient: true, + min_balance: 1000, + owner: StatemintSender::get().into(), + }) + .encode() + .into(); + + // XcmPallet send arguments + let sudo_origin = ::RuntimeOrigin::root(); + let assets_para_destination: VersionedMultiLocation = + Polkadot::child_location_of(Statemint::para_id()).into(); + + let weight_limit = WeightLimit::Unlimited; + let require_weight_at_most = Weight::from_parts(1000000000, 200000); + let origin_kind = OriginKind::Superuser; + let check_origin = None; + + let xcm = VersionedXcm::from(Xcm(vec![ + UnpaidExecution { weight_limit, check_origin }, + Transact { require_weight_at_most, origin_kind, call }, + ])); + + // Send XCM message from Relay Chain + Polkadot::execute_with(|| { + assert_ok!(::XcmPallet::send( + sudo_origin, + bx!(assets_para_destination), + bx!(xcm), + )); + + type RuntimeEvent = ::RuntimeEvent; + + assert_expected_events!( + Polkadot, + vec![ + RuntimeEvent::XcmPallet(pallet_xcm::Event::Sent { .. }) => {}, + ] + ); + }); + + // Receive XCM message in Assets Parachain + Statemint::execute_with(|| { + assert!(::Assets::asset_exists(ASSET_ID)); + }); +} diff --git a/parachains/integration-tests/emulated/common/Cargo.toml b/parachains/integration-tests/emulated/common/Cargo.toml new file mode 100644 index 00000000000..8ea8c1d0f8a --- /dev/null +++ b/parachains/integration-tests/emulated/common/Cargo.toml @@ -0,0 +1,49 @@ +[package] +name = "integration-tests-common" +version = "1.0.0" +authors = ["Parity Technologies "] +edition = "2021" +description = "Common resources for integration testing with xcm-emulator" + +[dependencies] +codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false } + +# Substrate +grandpa = { package = "sc-consensus-grandpa", git = "https://github.com/paritytech/substrate", branch = "master" } +sp-authority-discovery = { 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" } +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" } +sp-consensus-babe = { 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" } +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" } + +# 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-service = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-primitives = { 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" } +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" } +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" } +parachain-info = { path = "../../../pallets/parachain-info" } +cumulus-primitives-core = { path = "../../../../primitives/core" } +penpal-runtime = { path = "../../../runtimes/testing/penpal" } +statemint-runtime = { path = "../../../runtimes/assets/statemint" } +statemine-runtime = { path = "../../../runtimes/assets/statemine" } +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" } +xcm-emulator = { default-features = false, path = "../../../../xcm/xcm-emulator" } diff --git a/parachains/integration-tests/emulated/common/src/constants.rs b/parachains/integration-tests/emulated/common/src/constants.rs new file mode 100644 index 00000000000..b9720db4cf0 --- /dev/null +++ b/parachains/integration-tests/emulated/common/src/constants.rs @@ -0,0 +1,672 @@ +use grandpa::AuthorityId as GrandpaId; +use pallet_im_online::sr25519::AuthorityId as ImOnlineId; +pub use parachains_common::{AccountId, AuraId, Balance, BlockNumber, StatemintAuraId}; +use polkadot_primitives::{AssignmentId, ValidatorId}; +pub 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; +use sp_core::{sr25519, storage::Storage, Pair, Public}; +use sp_runtime::{ + traits::{IdentifyAccount, Verify}, + BuildStorage, MultiSignature, Perbill, +}; +pub use xcm; + +pub const XCM_V2: u32 = 3; +pub const XCM_V3: u32 = 2; +pub const REF_TIME_THRESHOLD: u64 = 33; +pub const PROOF_SIZE_THRESHOLD: u64 = 33; + +type AccountPublic = ::Signer; + +/// Helper function to generate a crypto pair from seed +fn get_from_seed(seed: &str) -> ::Public { + TPublic::Pair::from_string(&format!("//{}", seed), None) + .expect("static values are valid; qed") + .public() +} + +/// Helper function to generate an account ID from seed. +fn get_account_id_from_seed(seed: &str) -> AccountId +where + AccountPublic: From<::Public>, +{ + AccountPublic::from(get_from_seed::(seed)).into_account() +} + +pub mod accounts { + use super::*; + pub const ALICE: &str = "Alice"; + pub const BOB: &str = "Bob"; + pub const CHARLIE: &str = "Charlie"; + pub const DAVE: &str = "Dave"; + pub const EVE: &str = "Eve"; + pub const FERDIE: &str = "Ferdei"; + pub const ALICE_STASH: &str = "Alice//stash"; + pub const BOB_STASH: &str = "Bob//stash"; + pub const CHARLIE_STASH: &str = "Charlie//stash"; + pub const DAVE_STASH: &str = "Dave//stash"; + pub const EVE_STASH: &str = "Eve//stash"; + pub const FERDIE_STASH: &str = "Ferdie//stash"; + + pub fn init_balances() -> Vec { + vec![ + get_account_id_from_seed::(ALICE), + get_account_id_from_seed::(BOB), + get_account_id_from_seed::(CHARLIE), + get_account_id_from_seed::(DAVE), + get_account_id_from_seed::(EVE), + get_account_id_from_seed::(FERDIE), + get_account_id_from_seed::(ALICE_STASH), + get_account_id_from_seed::(BOB_STASH), + get_account_id_from_seed::(CHARLIE_STASH), + get_account_id_from_seed::(DAVE_STASH), + get_account_id_from_seed::(EVE_STASH), + get_account_id_from_seed::(FERDIE_STASH), + ] + } +} + +pub mod collators { + use super::*; + + pub fn invulnerables_statemint() -> Vec<(AccountId, StatemintAuraId)> { + vec![ + ( + get_account_id_from_seed::("Alice"), + get_from_seed::("Alice"), + ), + ( + get_account_id_from_seed::("Bob"), + get_from_seed::("Bob"), + ), + ] + } + + pub fn invulnerables() -> Vec<(AccountId, AuraId)> { + vec![ + ( + get_account_id_from_seed::("Alice"), + get_from_seed::("Alice"), + ), + (get_account_id_from_seed::("Bob"), get_from_seed::("Bob")), + ] + } +} + +pub mod validators { + use super::*; + + pub fn initial_authorities() -> Vec<( + AccountId, + AccountId, + BabeId, + GrandpaId, + ImOnlineId, + ValidatorId, + AssignmentId, + AuthorityDiscoveryId, + )> { + vec![get_authority_keys_from_seed_no_beefy("Alice")] + } +} + +/// The default XCM version to set in genesis config. +const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION; +// Polkadot +pub mod polkadot { + use super::*; + pub const ED: Balance = polkadot_runtime_constants::currency::EXISTENTIAL_DEPOSIT; + const STASH: u128 = 100 * polkadot_runtime_constants::currency::UNITS; + + pub fn get_host_config() -> HostConfiguration { + HostConfiguration { + max_upward_queue_count: 10, + 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, + ) -> polkadot_runtime::SessionKeys { + polkadot_runtime::SessionKeys { + babe, + grandpa, + im_online, + para_validator, + para_assignment, + authority_discovery, + } + } + + pub fn genesis() -> Storage { + let genesis_config = polkadot_runtime::GenesisConfig { + system: polkadot_runtime::SystemConfig { + code: polkadot_runtime::WASM_BINARY.unwrap().to_vec(), + }, + balances: polkadot_runtime::BalancesConfig { + balances: accounts::init_balances() + .iter() + .cloned() + .map(|k| (k, ED * 4096)) + .collect(), + }, + indices: polkadot_runtime::IndicesConfig { indices: vec![] }, + session: polkadot_runtime::SessionConfig { + keys: validators::initial_authorities() + .iter() + .map(|x| { + ( + x.0.clone(), + x.0.clone(), + polkadot::session_keys( + x.2.clone(), + x.3.clone(), + x.4.clone(), + x.5.clone(), + x.6.clone(), + x.7.clone(), + ), + ) + }) + .collect::>(), + }, + staking: polkadot_runtime::StakingConfig { + validator_count: validators::initial_authorities().len() as u32, + minimum_validator_count: 1, + stakers: validators::initial_authorities() + .iter() + .map(|x| { + (x.0.clone(), x.1.clone(), STASH, polkadot_runtime::StakerStatus::Validator) + }) + .collect(), + invulnerables: validators::initial_authorities() + .iter() + .map(|x| x.0.clone()) + .collect(), + force_era: pallet_staking::Forcing::ForceNone, + slash_reward_fraction: Perbill::from_percent(10), + ..Default::default() + }, + phragmen_election: Default::default(), + democracy: Default::default(), + council: polkadot_runtime::CouncilConfig { + members: vec![], + phantom: Default::default(), + }, + technical_committee: polkadot_runtime::TechnicalCommitteeConfig { + members: vec![], + phantom: Default::default(), + }, + technical_membership: Default::default(), + babe: polkadot_runtime::BabeConfig { + authorities: Default::default(), + epoch_config: Some(polkadot_runtime::BABE_GENESIS_EPOCH_CONFIG), + }, + grandpa: Default::default(), + im_online: Default::default(), + authority_discovery: polkadot_runtime::AuthorityDiscoveryConfig { keys: vec![] }, + claims: polkadot_runtime::ClaimsConfig { claims: vec![], vesting: vec![] }, + vesting: polkadot_runtime::VestingConfig { vesting: vec![] }, + treasury: Default::default(), + hrmp: Default::default(), + configuration: polkadot_runtime::ConfigurationConfig { config: get_host_config() }, + paras: Default::default(), + xcm_pallet: Default::default(), + nomination_pools: Default::default(), + }; + + genesis_config.build_storage().unwrap() + } +} + +// Kusama +pub mod kusama { + use super::*; + pub const ED: Balance = kusama_runtime_constants::currency::EXISTENTIAL_DEPOSIT; + const STASH: u128 = 100 * kusama_runtime_constants::currency::UNITS; + + pub fn get_host_config() -> HostConfiguration { + HostConfiguration { + max_upward_queue_count: 10, + 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, + ) -> kusama_runtime::SessionKeys { + kusama_runtime::SessionKeys { + babe, + grandpa, + im_online, + para_validator, + para_assignment, + authority_discovery, + } + } + + pub fn genesis() -> Storage { + let genesis_config = kusama_runtime::GenesisConfig { + system: kusama_runtime::SystemConfig { + code: kusama_runtime::WASM_BINARY.unwrap().to_vec(), + }, + balances: kusama_runtime::BalancesConfig { + balances: accounts::init_balances() + .iter() + .cloned() + .map(|k| (k, ED * 4096)) + .collect(), + }, + indices: kusama_runtime::IndicesConfig { indices: vec![] }, + session: kusama_runtime::SessionConfig { + keys: validators::initial_authorities() + .iter() + .map(|x| { + ( + x.0.clone(), + x.0.clone(), + kusama::session_keys( + x.2.clone(), + x.3.clone(), + x.4.clone(), + x.5.clone(), + x.6.clone(), + x.7.clone(), + ), + ) + }) + .collect::>(), + }, + staking: kusama_runtime::StakingConfig { + minimum_validator_count: 1, + validator_count: validators::initial_authorities().len() as u32, + stakers: validators::initial_authorities() + .iter() + .map(|x| { + (x.0.clone(), x.1.clone(), STASH, kusama_runtime::StakerStatus::Validator) + }) + .collect(), + invulnerables: validators::initial_authorities() + .iter() + .map(|x| x.0.clone()) + .collect(), + force_era: pallet_staking::Forcing::NotForcing, + slash_reward_fraction: Perbill::from_percent(10), + ..Default::default() + }, + babe: kusama_runtime::BabeConfig { + authorities: Default::default(), + epoch_config: Some(kusama_runtime::BABE_GENESIS_EPOCH_CONFIG), + }, + grandpa: Default::default(), + im_online: Default::default(), + authority_discovery: kusama_runtime::AuthorityDiscoveryConfig { keys: vec![] }, + claims: kusama_runtime::ClaimsConfig { claims: vec![], vesting: vec![] }, + vesting: kusama_runtime::VestingConfig { vesting: vec![] }, + treasury: Default::default(), + hrmp: Default::default(), + configuration: kusama_runtime::ConfigurationConfig { config: get_host_config() }, + paras: Default::default(), + xcm_pallet: Default::default(), + nomination_pools: Default::default(), + nis_counterpart_balances: Default::default(), + }; + + genesis_config.build_storage().unwrap() + } +} + +// Statemint +pub mod statemint { + use super::*; + pub const PARA_ID: u32 = 1000; + pub const ED: Balance = statemint_runtime::constants::currency::EXISTENTIAL_DEPOSIT; + + pub fn genesis() -> Storage { + let genesis_config = statemint_runtime::GenesisConfig { + system: statemint_runtime::SystemConfig { + code: statemint_runtime::WASM_BINARY + .expect("WASM binary was not build, please build it!") + .to_vec(), + }, + balances: statemint_runtime::BalancesConfig { + balances: accounts::init_balances() + .iter() + .cloned() + .map(|k| (k, ED * 4096)) + .collect(), + }, + parachain_info: statemint_runtime::ParachainInfoConfig { parachain_id: PARA_ID.into() }, + collator_selection: statemint_runtime::CollatorSelectionConfig { + invulnerables: collators::invulnerables_statemint() + .iter() + .cloned() + .map(|(acc, _)| acc) + .collect(), + candidacy_bond: ED * 16, + ..Default::default() + }, + session: statemint_runtime::SessionConfig { + keys: collators::invulnerables_statemint() + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + statemint_runtime::SessionKeys { aura }, // session keys + ) + }) + .collect(), + }, + aura: Default::default(), + aura_ext: Default::default(), + parachain_system: Default::default(), + polkadot_xcm: statemint_runtime::PolkadotXcmConfig { + safe_xcm_version: Some(SAFE_XCM_VERSION), + }, + }; + + genesis_config.build_storage().unwrap() + } +} + +// Statemint +pub mod statemine { + use super::*; + pub const PARA_ID: u32 = 1000; + pub const ED: Balance = statemine_runtime::constants::currency::EXISTENTIAL_DEPOSIT; + + pub fn genesis() -> Storage { + let genesis_config = statemine_runtime::GenesisConfig { + system: statemine_runtime::SystemConfig { + code: statemine_runtime::WASM_BINARY + .expect("WASM binary was not build, please build it!") + .to_vec(), + }, + balances: statemine_runtime::BalancesConfig { + balances: accounts::init_balances() + .iter() + .cloned() + .map(|k| (k, ED * 4096)) + .collect(), + }, + parachain_info: statemine_runtime::ParachainInfoConfig { parachain_id: PARA_ID.into() }, + collator_selection: statemine_runtime::CollatorSelectionConfig { + invulnerables: collators::invulnerables() + .iter() + .cloned() + .map(|(acc, _)| acc) + .collect(), + candidacy_bond: ED * 16, + ..Default::default() + }, + session: statemine_runtime::SessionConfig { + keys: collators::invulnerables() + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + statemine_runtime::SessionKeys { aura }, // session keys + ) + }) + .collect(), + }, + aura: Default::default(), + aura_ext: Default::default(), + parachain_system: Default::default(), + polkadot_xcm: statemine_runtime::PolkadotXcmConfig { + safe_xcm_version: Some(SAFE_XCM_VERSION), + }, + }; + + genesis_config.build_storage().unwrap() + } +} + +// Penpal +pub mod penpal { + use super::*; + pub const PARA_ID: u32 = 2000; + pub const ED: Balance = penpal_runtime::EXISTENTIAL_DEPOSIT; + + pub fn genesis(para_id: u32) -> Storage { + let genesis_config = penpal_runtime::GenesisConfig { + system: penpal_runtime::SystemConfig { + code: penpal_runtime::WASM_BINARY + .expect("WASM binary was not build, please build it!") + .to_vec(), + }, + balances: penpal_runtime::BalancesConfig { + balances: accounts::init_balances() + .iter() + .cloned() + .map(|k| (k, ED * 4096)) + .collect(), + }, + parachain_info: penpal_runtime::ParachainInfoConfig { parachain_id: para_id.into() }, + collator_selection: penpal_runtime::CollatorSelectionConfig { + invulnerables: collators::invulnerables() + .iter() + .cloned() + .map(|(acc, _)| acc) + .collect(), + candidacy_bond: ED * 16, + ..Default::default() + }, + session: penpal_runtime::SessionConfig { + keys: collators::invulnerables() + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + penpal_runtime::SessionKeys { aura }, // session keys + ) + }) + .collect(), + }, + aura: Default::default(), + aura_ext: Default::default(), + parachain_system: Default::default(), + polkadot_xcm: penpal_runtime::PolkadotXcmConfig { + safe_xcm_version: Some(SAFE_XCM_VERSION), + }, + sudo: penpal_runtime::SudoConfig { + key: Some(get_account_id_from_seed::("Alice")), + }, + }; + + genesis_config.build_storage().unwrap() + } +} + +// Collectives +pub mod collectives { + use super::*; + pub const PARA_ID: u32 = 1001; + pub const ED: Balance = collectives_polkadot_runtime::constants::currency::EXISTENTIAL_DEPOSIT; + + pub fn genesis() -> Storage { + let genesis_config = collectives_polkadot_runtime::GenesisConfig { + system: collectives_polkadot_runtime::SystemConfig { + code: collectives_polkadot_runtime::WASM_BINARY + .expect("WASM binary was not build, please build it!") + .to_vec(), + }, + balances: collectives_polkadot_runtime::BalancesConfig { + balances: accounts::init_balances() + .iter() + .cloned() + .map(|k| (k, ED * 4096)) + .collect(), + }, + parachain_info: collectives_polkadot_runtime::ParachainInfoConfig { + parachain_id: PARA_ID.into(), + }, + collator_selection: collectives_polkadot_runtime::CollatorSelectionConfig { + invulnerables: collators::invulnerables() + .iter() + .cloned() + .map(|(acc, _)| acc) + .collect(), + candidacy_bond: ED * 16, + ..Default::default() + }, + session: collectives_polkadot_runtime::SessionConfig { + keys: collators::invulnerables() + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + collectives_polkadot_runtime::SessionKeys { aura }, // session keys + ) + }) + .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), + }, + alliance: Default::default(), + alliance_motion: Default::default(), + }; + + genesis_config.build_storage().unwrap() + } +} + +pub mod bridge_hub_kusama { + use super::*; + pub const PARA_ID: u32 = 1002; + pub const ED: Balance = bridge_hub_kusama_runtime::constants::currency::EXISTENTIAL_DEPOSIT; + + pub fn genesis() -> Storage { + let genesis_config = bridge_hub_kusama_runtime::GenesisConfig { + system: bridge_hub_kusama_runtime::SystemConfig { + code: bridge_hub_kusama_runtime::WASM_BINARY + .expect("WASM binary was not build, please build it!") + .to_vec(), + }, + balances: bridge_hub_kusama_runtime::BalancesConfig { + balances: accounts::init_balances() + .iter() + .cloned() + .map(|k| (k, ED * 4096)) + .collect(), + }, + parachain_info: bridge_hub_kusama_runtime::ParachainInfoConfig { + parachain_id: PARA_ID.into(), + }, + collator_selection: bridge_hub_kusama_runtime::CollatorSelectionConfig { + invulnerables: collators::invulnerables() + .iter() + .cloned() + .map(|(acc, _)| acc) + .collect(), + candidacy_bond: ED * 16, + ..Default::default() + }, + session: bridge_hub_kusama_runtime::SessionConfig { + keys: collators::invulnerables() + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + bridge_hub_kusama_runtime::SessionKeys { aura }, // session keys + ) + }) + .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), + }, + }; + + genesis_config.build_storage().unwrap() + } +} + +pub mod bridge_hub_polkadot { + use super::*; + pub const PARA_ID: u32 = 1002; + pub const ED: Balance = bridge_hub_polkadot_runtime::constants::currency::EXISTENTIAL_DEPOSIT; + + pub fn genesis() -> Storage { + let genesis_config = bridge_hub_polkadot_runtime::GenesisConfig { + system: bridge_hub_polkadot_runtime::SystemConfig { + code: bridge_hub_polkadot_runtime::WASM_BINARY + .expect("WASM binary was not build, please build it!") + .to_vec(), + }, + balances: bridge_hub_polkadot_runtime::BalancesConfig { + balances: accounts::init_balances() + .iter() + .cloned() + .map(|k| (k, ED * 4096)) + .collect(), + }, + parachain_info: bridge_hub_polkadot_runtime::ParachainInfoConfig { + parachain_id: PARA_ID.into(), + }, + collator_selection: bridge_hub_polkadot_runtime::CollatorSelectionConfig { + invulnerables: collators::invulnerables() + .iter() + .cloned() + .map(|(acc, _)| acc) + .collect(), + candidacy_bond: ED * 16, + ..Default::default() + }, + session: bridge_hub_polkadot_runtime::SessionConfig { + keys: collators::invulnerables() + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + bridge_hub_polkadot_runtime::SessionKeys { aura }, // session keys + ) + }) + .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), + }, + }; + + genesis_config.build_storage().unwrap() + } +} diff --git a/parachains/integration-tests/emulated/common/src/lib.rs b/parachains/integration-tests/emulated/common/src/lib.rs new file mode 100644 index 00000000000..0d0928998a0 --- /dev/null +++ b/parachains/integration-tests/emulated/common/src/lib.rs @@ -0,0 +1,253 @@ +pub mod constants; + +pub use constants::{ + accounts::{ALICE, BOB}, + bridge_hub_kusama, bridge_hub_polkadot, collectives, kusama, penpal, polkadot, statemine, + statemint, +}; +use frame_support::{parameter_types, sp_io, sp_tracing}; +pub use parachains_common::{AccountId, AuraId, Balance, BlockNumber, StatemintAuraId}; +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, +}; +use xcm_executor::traits::Convert; + +decl_test_relay_chains! { + pub struct Polkadot { + genesis = polkadot::genesis(), + on_init = (), + runtime = { + Runtime: polkadot_runtime::Runtime, + RuntimeOrigin: polkadot_runtime::RuntimeOrigin, + RuntimeCall: polkadot_runtime::RuntimeCall, + RuntimeEvent: polkadot_runtime::RuntimeEvent, + XcmConfig: polkadot_runtime::xcm_config::XcmConfig, + SovereignAccountOf: polkadot_runtime::xcm_config::SovereignAccountOf, + System: polkadot_runtime::System, + Balances: polkadot_runtime::Balances, + }, + pallets_extra = { + XcmPallet: polkadot_runtime::XcmPallet, + } + }, + pub struct Kusama { + genesis = kusama::genesis(), + on_init = (), + runtime = { + Runtime: kusama_runtime::Runtime, + RuntimeOrigin: kusama_runtime::RuntimeOrigin, + RuntimeCall: polkadot_runtime::RuntimeCall, + RuntimeEvent: kusama_runtime::RuntimeEvent, + XcmConfig: kusama_runtime::xcm_config::XcmConfig, + SovereignAccountOf: kusama_runtime::xcm_config::SovereignAccountOf, + System: kusama_runtime::System, + Balances: kusama_runtime::Balances, + }, + pallets_extra = { + XcmPallet: kusama_runtime::XcmPallet, + } + } +} + +decl_test_parachains! { + // Polkadot + pub struct Statemint { + genesis = statemint::genesis(), + on_init = (), + runtime = { + Runtime: statemint_runtime::Runtime, + RuntimeOrigin: statemint_runtime::RuntimeOrigin, + RuntimeCall: statemint_runtime::RuntimeCall, + RuntimeEvent: statemint_runtime::RuntimeEvent, + XcmpMessageHandler: statemint_runtime::XcmpQueue, + DmpMessageHandler: statemint_runtime::DmpQueue, + LocationToAccountId: statemint_runtime::xcm_config::LocationToAccountId, + System: statemint_runtime::System, + Balances: statemint_runtime::Balances, + ParachainSystem: statemint_runtime::ParachainSystem, + ParachainInfo: statemint_runtime::ParachainInfo, + }, + pallets_extra = { + PolkadotXcm: statemint_runtime::PolkadotXcm, + Assets: statemint_runtime::Assets, + } + }, + pub struct PenpalPolkadot { + genesis = penpal::genesis(penpal::PARA_ID), + on_init = (), + runtime = { + Runtime: penpal_runtime::Runtime, + RuntimeOrigin: penpal_runtime::RuntimeOrigin, + RuntimeCall: penpal_runtime::RuntimeEvent, + 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: penpal_runtime::PolkadotXcm, + Assets: penpal_runtime::Assets, + } + }, + // Kusama + pub struct Statemine { + genesis = statemine::genesis(), + on_init = (), + runtime = { + Runtime: statemine_runtime::Runtime, + RuntimeOrigin: statemine_runtime::RuntimeOrigin, + RuntimeCall: statemine_runtime::RuntimeEvent, + RuntimeEvent: statemine_runtime::RuntimeEvent, + XcmpMessageHandler: statemine_runtime::XcmpQueue, + DmpMessageHandler: statemine_runtime::DmpQueue, + LocationToAccountId: statemine_runtime::xcm_config::LocationToAccountId, + System: statemine_runtime::System, + Balances: statemine_runtime::Balances, + ParachainSystem: statemine_runtime::ParachainSystem, + ParachainInfo: statemine_runtime::ParachainInfo, + }, + pallets_extra = { + PolkadotXcm: statemine_runtime::PolkadotXcm, + Assets: statemine_runtime::Assets, + ForeignAssets: statemine_runtime::Assets, + } + }, + pub struct PenpalKusama { + genesis = penpal::genesis(penpal::PARA_ID), + on_init = (), + runtime = { + Runtime: penpal_runtime::Runtime, + RuntimeOrigin: penpal_runtime::RuntimeOrigin, + RuntimeCall: penpal_runtime::RuntimeEvent, + 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: penpal_runtime::PolkadotXcm, + Assets: penpal_runtime::Assets, + } + }, + pub struct Collectives { + genesis = collectives::genesis(), + on_init = (), + runtime = { + Runtime: collectives_polkadot_runtime::Runtime, + RuntimeOrigin: collectives_polkadot_runtime::RuntimeOrigin, + RuntimeCall: collectives_polkadot_runtime::RuntimeEvent, + 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: collectives_polkadot_runtime::PolkadotXcm, + } + }, + pub struct BHKusama { + 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::RuntimeEvent, + 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 BHPolkadot { + 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::RuntimeEvent, + 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, + } + } +} + +decl_test_networks! { + pub struct PolkadotMockNet { + relay_chain = Polkadot, + parachains = vec![ + Statemint, + PenpalPolkadot, + Collectives, + BHPolkadot, + ], + }, + pub struct KusamaMockNet { + relay_chain = Kusama, + parachains = vec![ + Statemine, + PenpalKusama, + BHKusama, + ], + } +} + +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); + // Statemint + pub StatemintSender: AccountId = Statemint::account_id_of(ALICE); + pub StatemintReceiver: AccountId = Statemint::account_id_of(BOB); + // Statemine + pub StatemineSender: AccountId = Statemine::account_id_of(ALICE); + pub StatemineReceiver: AccountId = Statemine::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); + // 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); +} diff --git a/parachains/pallets/parachain-info/src/lib.rs b/parachains/pallets/parachain-info/src/lib.rs index d61387aaeb6..93ef5bfcfeb 100644 --- a/parachains/pallets/parachain-info/src/lib.rs +++ b/parachains/pallets/parachain-info/src/lib.rs @@ -53,7 +53,7 @@ pub mod pallet { #[pallet::genesis_build] impl GenesisBuild for GenesisConfig { fn build(&self) { - >::put(&self.parachain_id); + >::put(self.parachain_id); } } diff --git a/parachains/runtimes/assets/common/src/foreign_creators.rs b/parachains/runtimes/assets/common/src/foreign_creators.rs index 3d7567409f6..dbdf4301d66 100644 --- a/parachains/runtimes/assets/common/src/foreign_creators.rs +++ b/parachains/runtimes/assets/common/src/foreign_creators.rs @@ -43,7 +43,7 @@ where asset_location: &MultiLocation, ) -> sp_std::result::Result { let origin_location = EnsureXcm::::try_origin(origin.clone())?; - if !IsForeign::contains(&asset_location, &origin_location) { + if !IsForeign::contains(asset_location, &origin_location) { return Err(origin) } AccountOf::convert(origin_location).map_err(|_| origin) @@ -51,6 +51,6 @@ where #[cfg(feature = "runtime-benchmarks")] fn try_successful_origin(a: &MultiLocation) -> Result { - Ok(pallet_xcm::Origin::Xcm(a.clone()).into()) + Ok(pallet_xcm::Origin::Xcm(*a).into()) } } diff --git a/parachains/runtimes/assets/common/src/matching.rs b/parachains/runtimes/assets/common/src/matching.rs index a5e030412b9..964f25cda35 100644 --- a/parachains/runtimes/assets/common/src/matching.rs +++ b/parachains/runtimes/assets/common/src/matching.rs @@ -42,10 +42,7 @@ impl> Contains for StartsWithExplicitGlobalConsensus { fn contains(t: &MultiLocation) -> bool { - match t.interior.global_consensus() { - Ok(requested_network) if requested_network.eq(&Network::get()) => true, - _ => false, - } + matches!(t.interior.global_consensus(), Ok(requested_network) if requested_network.eq(&Network::get())) } } @@ -61,7 +58,7 @@ impl> ContainsPair bool { log::trace!(target: "xcm::contains", "IsForeignConcreteAsset asset: {:?}, origin: {:?}", asset, origin); - matches!(asset.id, Concrete(ref id) if IsForeign::contains(id, &origin)) + matches!(asset.id, Concrete(ref id) if IsForeign::contains(id, origin)) } } @@ -73,18 +70,14 @@ impl> ContainsPair { fn contains(&a: &MultiLocation, b: &MultiLocation) -> bool { // `a` needs to be from `b` at least - if !a.starts_with(&b) { + if !a.starts_with(b) { return false } // here we check if sibling match a { - MultiLocation { parents: 1, interior } => match interior.first() { - Some(Parachain(sibling_para_id)) - if sibling_para_id.ne(&u32::from(SelfParaId::get())) => - true, - _ => false, - }, + MultiLocation { parents: 1, interior } => + matches!(interior.first(), Some(Parachain(sibling_para_id)) if sibling_para_id.ne(&u32::from(SelfParaId::get()))), _ => false, } } diff --git a/parachains/runtimes/assets/statemine/src/lib.rs b/parachains/runtimes/assets/statemine/src/lib.rs index 961a9300a56..eacd865200b 100644 --- a/parachains/runtimes/assets/statemine/src/lib.rs +++ b/parachains/runtimes/assets/statemine/src/lib.rs @@ -213,7 +213,7 @@ impl pallet_balances::Config for Runtime { parameter_types! { /// Relay Chain `TransactionByteFee` / 10 - pub const TransactionByteFee: Balance = 1 * MILLICENTS; + pub const TransactionByteFee: Balance = MILLICENTS; } impl pallet_transaction_payment::Config for Runtime { @@ -1026,7 +1026,7 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( @@ -1062,7 +1062,6 @@ impl_runtime_apis! { id: Concrete(GeneralIndex(i as u128).into()), fun: Fungible(fungibles_amount * i as u128), } - .into() }) .chain(core::iter::once(MultiAsset { id: Concrete(Here.into()), fun: Fungible(u128::MAX) })) .chain((0..holding_non_fungibles).map(|i| MultiAsset { @@ -1082,7 +1081,7 @@ impl_runtime_apis! { parameter_types! { pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some(( KsmLocation::get(), - MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(KsmLocation::get()) }, + MultiAsset { fun: Fungible(UNITS), id: Concrete(KsmLocation::get()) }, )); pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None; @@ -1097,7 +1096,7 @@ impl_runtime_apis! { fn get_multi_asset() -> MultiAsset { MultiAsset { id: Concrete(KsmLocation::get()), - fun: Fungible(1 * UNITS), + fun: Fungible(UNITS), } } } @@ -1201,7 +1200,7 @@ cumulus_pallet_parachain_system::register_validate_block! { #[cfg(feature = "state-trie-version-1")] parameter_types! { // The deposit configuration for the singed migration. Specially if you want to allow any signed account to do the migration (see `SignedFilter`, these deposits should be high) - pub const MigrationSignedDepositPerItem: Balance = 1 * CENTS; + pub const MigrationSignedDepositPerItem: Balance = CENTS; pub const MigrationSignedDepositBase: Balance = 2_000 * CENTS; pub const MigrationMaxKeyLen: u32 = 512; } diff --git a/parachains/runtimes/assets/statemine/src/weights/pallet_assets.rs b/parachains/runtimes/assets/statemine/src/weights/pallet_assets.rs index 94957ff84fa..29a01e5bb9a 100644 --- a/parachains/runtimes/assets/statemine/src/weights/pallet_assets.rs +++ b/parachains/runtimes/assets/statemine/src/weights/pallet_assets.rs @@ -441,4 +441,73 @@ impl pallet_assets::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn touch() -> Weight { + // Proof Size summary in bytes: + // Measured: `453` + // Estimated: `3675` + // Minimum execution time: 37_468_000 picoseconds. + Weight::from_parts(37_957_000, 3675) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + fn touch_other() -> Weight { + // Proof Size summary in bytes: + // Measured: `351` + // Estimated: `3675` + // Minimum execution time: 383_408_000 picoseconds. + Weight::from_parts(392_036_000, 3675) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn refund() -> Weight { + // Proof Size summary in bytes: + // Measured: `579` + // Estimated: `3675` + // Minimum execution time: 34_066_000 picoseconds. + Weight::from_parts(34_347_000, 3675) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + fn refund_other() -> Weight { + // Proof Size summary in bytes: + // Measured: `510` + // Estimated: `3675` + // Minimum execution time: 32_060_000 picoseconds. + Weight::from_parts(32_519_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: Assets Asset (r:1 w:0) + /// 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) + fn block() -> Weight { + // Proof Size summary in bytes: + // Measured: `459` + // Estimated: `3675` + // Minimum execution time: 115_000_000 picoseconds. + Weight::from_parts(163_000_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } } diff --git a/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs b/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs index 877a54ba848..23322418d2a 100644 --- a/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs +++ b/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs @@ -33,8 +33,7 @@ const MAX_ASSETS: u64 = 100; impl WeighMultiAssets for MultiAssetFilter { fn weigh_multi_assets(&self, weight: Weight) -> Weight { match self { - Self::Definite(assets) => - weight.saturating_mul(assets.inner().into_iter().count() as u64), + Self::Definite(assets) => weight.saturating_mul(assets.inner().iter().count() as u64), Self::Wild(asset) => match asset { All => weight.saturating_mul(MAX_ASSETS), AllOf { fun, .. } => match fun { @@ -53,7 +52,7 @@ impl WeighMultiAssets for MultiAssetFilter { impl WeighMultiAssets for MultiAssets { fn weigh_multi_assets(&self, weight: Weight) -> Weight { - weight.saturating_mul(self.inner().into_iter().count() as u64) + weight.saturating_mul(self.inner().iter().count() as u64) } } @@ -65,7 +64,7 @@ impl XcmWeightInfo for StatemineXcmWeight { // Currently there is no trusted reserve fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight { // TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974 - Weight::from_parts(1_000_000_000 as u64, 0) + Weight::from_parts(1_000_000_000_u64, 0) } fn receive_teleported_asset(assets: &MultiAssets) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::receive_teleported_asset()) @@ -123,7 +122,7 @@ impl XcmWeightInfo for StatemineXcmWeight { fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_parts(1_000_000_000 as u64, 0); + let hardcoded_weight = Weight::from_parts(1_000_000_000_u64, 0); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::deposit_asset()); hardcoded_weight.min(weight) } diff --git a/parachains/runtimes/assets/statemine/src/xcm_config.rs b/parachains/runtimes/assets/statemine/src/xcm_config.rs index 45f95ee07d4..76bc685fd9c 100644 --- a/parachains/runtimes/assets/statemine/src/xcm_config.rs +++ b/parachains/runtimes/assets/statemine/src/xcm_config.rs @@ -197,151 +197,147 @@ impl Contains for SafeCallFilter { } } - match call { + matches!( + call, RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) | - RuntimeCall::System( - frame_system::Call::set_heap_pages { .. } | - frame_system::Call::set_code { .. } | - frame_system::Call::set_code_without_checks { .. } | - frame_system::Call::kill_prefix { .. }, - ) | - RuntimeCall::ParachainSystem(..) | - RuntimeCall::Timestamp(..) | - RuntimeCall::Balances(..) | - RuntimeCall::CollatorSelection( - pallet_collator_selection::Call::set_desired_candidates { .. } | - pallet_collator_selection::Call::set_candidacy_bond { .. } | - pallet_collator_selection::Call::register_as_candidate { .. } | - pallet_collator_selection::Call::leave_intent { .. }, - ) | - RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | - RuntimeCall::XcmpQueue(..) | - RuntimeCall::DmpQueue(..) | - RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) | - RuntimeCall::Assets( + RuntimeCall::System( + frame_system::Call::set_heap_pages { .. } | + frame_system::Call::set_code { .. } | + frame_system::Call::set_code_without_checks { .. } | + frame_system::Call::kill_prefix { .. }, + ) | RuntimeCall::ParachainSystem(..) | + RuntimeCall::Timestamp(..) | + RuntimeCall::Balances(..) | + RuntimeCall::CollatorSelection( + pallet_collator_selection::Call::set_desired_candidates { .. } | + pallet_collator_selection::Call::set_candidacy_bond { .. } | + pallet_collator_selection::Call::register_as_candidate { .. } | + pallet_collator_selection::Call::leave_intent { .. } | + pallet_collator_selection::Call::set_invulnerables { .. }, + ) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | + RuntimeCall::XcmpQueue(..) | + RuntimeCall::DmpQueue(..) | + RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) | + RuntimeCall::Assets( + pallet_assets::Call::create { .. } | + pallet_assets::Call::force_create { .. } | + pallet_assets::Call::start_destroy { .. } | + pallet_assets::Call::destroy_accounts { .. } | + pallet_assets::Call::destroy_approvals { .. } | + pallet_assets::Call::finish_destroy { .. } | + pallet_assets::Call::mint { .. } | + pallet_assets::Call::burn { .. } | + pallet_assets::Call::transfer { .. } | + pallet_assets::Call::transfer_keep_alive { .. } | + pallet_assets::Call::force_transfer { .. } | + pallet_assets::Call::freeze { .. } | + pallet_assets::Call::thaw { .. } | + pallet_assets::Call::freeze_asset { .. } | + pallet_assets::Call::thaw_asset { .. } | + pallet_assets::Call::transfer_ownership { .. } | + pallet_assets::Call::set_team { .. } | + pallet_assets::Call::clear_metadata { .. } | + pallet_assets::Call::force_clear_metadata { .. } | + pallet_assets::Call::force_asset_status { .. } | + pallet_assets::Call::approve_transfer { .. } | + pallet_assets::Call::cancel_approval { .. } | + pallet_assets::Call::force_cancel_approval { .. } | + pallet_assets::Call::transfer_approved { .. } | + pallet_assets::Call::touch { .. } | + pallet_assets::Call::refund { .. }, + ) | RuntimeCall::ForeignAssets( pallet_assets::Call::create { .. } | - pallet_assets::Call::force_create { .. } | - pallet_assets::Call::start_destroy { .. } | - pallet_assets::Call::destroy_accounts { .. } | - pallet_assets::Call::destroy_approvals { .. } | - pallet_assets::Call::finish_destroy { .. } | - pallet_assets::Call::mint { .. } | - pallet_assets::Call::burn { .. } | - pallet_assets::Call::transfer { .. } | - pallet_assets::Call::transfer_keep_alive { .. } | - pallet_assets::Call::force_transfer { .. } | - pallet_assets::Call::freeze { .. } | - pallet_assets::Call::thaw { .. } | - pallet_assets::Call::freeze_asset { .. } | - pallet_assets::Call::thaw_asset { .. } | - pallet_assets::Call::transfer_ownership { .. } | - pallet_assets::Call::set_team { .. } | - pallet_assets::Call::clear_metadata { .. } | - pallet_assets::Call::force_clear_metadata { .. } | - pallet_assets::Call::force_asset_status { .. } | - pallet_assets::Call::approve_transfer { .. } | - pallet_assets::Call::cancel_approval { .. } | - pallet_assets::Call::force_cancel_approval { .. } | - pallet_assets::Call::transfer_approved { .. } | - pallet_assets::Call::touch { .. } | - pallet_assets::Call::refund { .. }, - ) | - RuntimeCall::ForeignAssets( - pallet_assets::Call::create { .. } | - pallet_assets::Call::force_create { .. } | - pallet_assets::Call::start_destroy { .. } | - pallet_assets::Call::destroy_accounts { .. } | - pallet_assets::Call::destroy_approvals { .. } | - pallet_assets::Call::finish_destroy { .. } | - pallet_assets::Call::mint { .. } | - pallet_assets::Call::burn { .. } | - pallet_assets::Call::transfer { .. } | - pallet_assets::Call::transfer_keep_alive { .. } | - pallet_assets::Call::force_transfer { .. } | - pallet_assets::Call::freeze { .. } | - pallet_assets::Call::thaw { .. } | - pallet_assets::Call::freeze_asset { .. } | - pallet_assets::Call::thaw_asset { .. } | - pallet_assets::Call::transfer_ownership { .. } | - pallet_assets::Call::set_team { .. } | - pallet_assets::Call::set_metadata { .. } | - pallet_assets::Call::clear_metadata { .. } | - pallet_assets::Call::force_clear_metadata { .. } | - pallet_assets::Call::force_asset_status { .. } | - pallet_assets::Call::approve_transfer { .. } | - pallet_assets::Call::cancel_approval { .. } | - pallet_assets::Call::force_cancel_approval { .. } | - pallet_assets::Call::transfer_approved { .. } | - pallet_assets::Call::touch { .. } | - pallet_assets::Call::refund { .. }, - ) | - RuntimeCall::Nfts( + pallet_assets::Call::force_create { .. } | + pallet_assets::Call::start_destroy { .. } | + pallet_assets::Call::destroy_accounts { .. } | + pallet_assets::Call::destroy_approvals { .. } | + pallet_assets::Call::finish_destroy { .. } | + pallet_assets::Call::mint { .. } | + pallet_assets::Call::burn { .. } | + pallet_assets::Call::transfer { .. } | + pallet_assets::Call::transfer_keep_alive { .. } | + pallet_assets::Call::force_transfer { .. } | + pallet_assets::Call::freeze { .. } | + pallet_assets::Call::thaw { .. } | + pallet_assets::Call::freeze_asset { .. } | + pallet_assets::Call::thaw_asset { .. } | + pallet_assets::Call::transfer_ownership { .. } | + pallet_assets::Call::set_team { .. } | + pallet_assets::Call::set_metadata { .. } | + pallet_assets::Call::clear_metadata { .. } | + pallet_assets::Call::force_clear_metadata { .. } | + pallet_assets::Call::force_asset_status { .. } | + pallet_assets::Call::approve_transfer { .. } | + pallet_assets::Call::cancel_approval { .. } | + pallet_assets::Call::force_cancel_approval { .. } | + pallet_assets::Call::transfer_approved { .. } | + pallet_assets::Call::touch { .. } | + pallet_assets::Call::refund { .. }, + ) | RuntimeCall::Nfts( pallet_nfts::Call::create { .. } | - pallet_nfts::Call::force_create { .. } | - pallet_nfts::Call::destroy { .. } | - pallet_nfts::Call::mint { .. } | - pallet_nfts::Call::force_mint { .. } | - pallet_nfts::Call::burn { .. } | - pallet_nfts::Call::transfer { .. } | - pallet_nfts::Call::lock_item_transfer { .. } | - pallet_nfts::Call::unlock_item_transfer { .. } | - pallet_nfts::Call::lock_collection { .. } | - pallet_nfts::Call::transfer_ownership { .. } | - pallet_nfts::Call::set_team { .. } | - pallet_nfts::Call::force_collection_owner { .. } | - pallet_nfts::Call::force_collection_config { .. } | - pallet_nfts::Call::approve_transfer { .. } | - pallet_nfts::Call::cancel_approval { .. } | - pallet_nfts::Call::clear_all_transfer_approvals { .. } | - pallet_nfts::Call::lock_item_properties { .. } | - pallet_nfts::Call::set_attribute { .. } | - pallet_nfts::Call::force_set_attribute { .. } | - pallet_nfts::Call::clear_attribute { .. } | - pallet_nfts::Call::approve_item_attributes { .. } | - pallet_nfts::Call::cancel_item_attributes_approval { .. } | - pallet_nfts::Call::set_metadata { .. } | - pallet_nfts::Call::clear_metadata { .. } | - pallet_nfts::Call::set_collection_metadata { .. } | - pallet_nfts::Call::clear_collection_metadata { .. } | - pallet_nfts::Call::set_accept_ownership { .. } | - pallet_nfts::Call::set_collection_max_supply { .. } | - pallet_nfts::Call::update_mint_settings { .. } | - pallet_nfts::Call::set_price { .. } | - pallet_nfts::Call::buy_item { .. } | - pallet_nfts::Call::pay_tips { .. } | - pallet_nfts::Call::create_swap { .. } | - pallet_nfts::Call::cancel_swap { .. } | - pallet_nfts::Call::claim_swap { .. }, - ) | - RuntimeCall::Uniques( + pallet_nfts::Call::force_create { .. } | + pallet_nfts::Call::destroy { .. } | + pallet_nfts::Call::mint { .. } | + pallet_nfts::Call::force_mint { .. } | + pallet_nfts::Call::burn { .. } | + pallet_nfts::Call::transfer { .. } | + pallet_nfts::Call::lock_item_transfer { .. } | + pallet_nfts::Call::unlock_item_transfer { .. } | + pallet_nfts::Call::lock_collection { .. } | + pallet_nfts::Call::transfer_ownership { .. } | + pallet_nfts::Call::set_team { .. } | + pallet_nfts::Call::force_collection_owner { .. } | + pallet_nfts::Call::force_collection_config { .. } | + pallet_nfts::Call::approve_transfer { .. } | + pallet_nfts::Call::cancel_approval { .. } | + pallet_nfts::Call::clear_all_transfer_approvals { .. } | + pallet_nfts::Call::lock_item_properties { .. } | + pallet_nfts::Call::set_attribute { .. } | + pallet_nfts::Call::force_set_attribute { .. } | + pallet_nfts::Call::clear_attribute { .. } | + pallet_nfts::Call::approve_item_attributes { .. } | + pallet_nfts::Call::cancel_item_attributes_approval { .. } | + pallet_nfts::Call::set_metadata { .. } | + pallet_nfts::Call::clear_metadata { .. } | + pallet_nfts::Call::set_collection_metadata { .. } | + pallet_nfts::Call::clear_collection_metadata { .. } | + pallet_nfts::Call::set_accept_ownership { .. } | + pallet_nfts::Call::set_collection_max_supply { .. } | + pallet_nfts::Call::update_mint_settings { .. } | + pallet_nfts::Call::set_price { .. } | + pallet_nfts::Call::buy_item { .. } | + pallet_nfts::Call::pay_tips { .. } | + pallet_nfts::Call::create_swap { .. } | + pallet_nfts::Call::cancel_swap { .. } | + pallet_nfts::Call::claim_swap { .. }, + ) | RuntimeCall::Uniques( pallet_uniques::Call::create { .. } | - pallet_uniques::Call::force_create { .. } | - pallet_uniques::Call::destroy { .. } | - pallet_uniques::Call::mint { .. } | - pallet_uniques::Call::burn { .. } | - pallet_uniques::Call::transfer { .. } | - pallet_uniques::Call::freeze { .. } | - pallet_uniques::Call::thaw { .. } | - pallet_uniques::Call::freeze_collection { .. } | - pallet_uniques::Call::thaw_collection { .. } | - pallet_uniques::Call::transfer_ownership { .. } | - pallet_uniques::Call::set_team { .. } | - pallet_uniques::Call::approve_transfer { .. } | - pallet_uniques::Call::cancel_approval { .. } | - pallet_uniques::Call::force_item_status { .. } | - pallet_uniques::Call::set_attribute { .. } | - pallet_uniques::Call::clear_attribute { .. } | - pallet_uniques::Call::set_metadata { .. } | - pallet_uniques::Call::clear_metadata { .. } | - pallet_uniques::Call::set_collection_metadata { .. } | - pallet_uniques::Call::clear_collection_metadata { .. } | - pallet_uniques::Call::set_accept_ownership { .. } | - pallet_uniques::Call::set_collection_max_supply { .. } | - pallet_uniques::Call::set_price { .. } | - pallet_uniques::Call::buy_item { .. }, - ) => true, - _ => false, - } + pallet_uniques::Call::force_create { .. } | + pallet_uniques::Call::destroy { .. } | + pallet_uniques::Call::mint { .. } | + pallet_uniques::Call::burn { .. } | + pallet_uniques::Call::transfer { .. } | + pallet_uniques::Call::freeze { .. } | + pallet_uniques::Call::thaw { .. } | + pallet_uniques::Call::freeze_collection { .. } | + pallet_uniques::Call::thaw_collection { .. } | + pallet_uniques::Call::transfer_ownership { .. } | + pallet_uniques::Call::set_team { .. } | + pallet_uniques::Call::approve_transfer { .. } | + pallet_uniques::Call::cancel_approval { .. } | + pallet_uniques::Call::force_item_status { .. } | + pallet_uniques::Call::set_attribute { .. } | + pallet_uniques::Call::clear_attribute { .. } | + pallet_uniques::Call::set_metadata { .. } | + pallet_uniques::Call::clear_metadata { .. } | + pallet_uniques::Call::set_collection_metadata { .. } | + pallet_uniques::Call::clear_collection_metadata { .. } | + pallet_uniques::Call::set_accept_ownership { .. } | + pallet_uniques::Call::set_collection_max_supply { .. } | + pallet_uniques::Call::set_price { .. } | + pallet_uniques::Call::buy_item { .. } + ) + ) } } @@ -477,6 +473,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/parachains/runtimes/assets/statemine/tests/tests.rs b/parachains/runtimes/assets/statemine/tests/tests.rs index b9001a35a99..57cd502857c 100644 --- a/parachains/runtimes/assets/statemine/tests/tests.rs +++ b/parachains/runtimes/assets/statemine/tests/tests.rs @@ -77,19 +77,16 @@ fn test_asset_xcm_trader() { // Lets pay with: asset_amount_needed + asset_amount_extra let asset_amount_extra = 100_u128; let asset: MultiAsset = - (asset_multilocation.clone(), asset_amount_needed + asset_amount_extra).into(); + (asset_multilocation, asset_amount_needed + asset_amount_extra).into(); let mut trader = ::Trader::new(); // Lets buy_weight and make sure buy_weight does not return an error - match trader.buy_weight(bought, asset.into()) { - Ok(unused_assets) => { - // Check whether a correct amount of unused assets is returned - assert_ok!(unused_assets - .ensure_contains(&(asset_multilocation, asset_amount_extra).into())); - }, - Err(e) => assert!(false, "Expected Ok(_). Got {:#?}", e), - } + let unused_assets = trader.buy_weight(bought, asset.into()).expect("Expected Ok"); + // Check whether a correct amount of unused assets is returned + assert_ok!( + unused_assets.ensure_contains(&(asset_multilocation, asset_amount_extra).into()) + ); // Drop trader drop(trader); @@ -150,7 +147,7 @@ fn test_asset_xcm_trader_with_refund() { // lets calculate amount needed let amount_bought = WeightToFee::weight_to_fee(&bought); - let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into(); + let asset: MultiAsset = (asset_multilocation, amount_bought).into(); // Make sure buy_weight does not return an error assert_ok!(trader.buy_weight(bought, asset.clone().into())); @@ -224,7 +221,7 @@ fn test_asset_xcm_trader_refund_not_possible_since_amount_less_than_ed() { "we are testing what happens when the amount does not exceed ED" ); - let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into(); + let asset: MultiAsset = (asset_multilocation, amount_bought).into(); // Buy weight should return an error assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive); @@ -277,11 +274,11 @@ fn test_that_buying_ed_refund_does_not_refund() { // We know we will have to buy at least ED, so lets make sure first it will // fail with a payment of less than ED - let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into(); + let asset: MultiAsset = (asset_multilocation, amount_bought).into(); assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive); // Now lets buy ED at least - let asset: MultiAsset = (asset_multilocation.clone(), ExistentialDeposit::get()).into(); + let asset: MultiAsset = (asset_multilocation, ExistentialDeposit::get()).into(); // Buy weight should work assert_ok!(trader.buy_weight(bought, asset.into())); @@ -416,7 +413,7 @@ fn test_assets_balances_api_works() { let foreign_asset_minimum_asset_balance = 3333333_u128; assert_ok!(ForeignAssets::force_create( RuntimeHelper::::root_origin(), - foreign_asset_id_multilocation.clone().into(), + foreign_asset_id_multilocation, AccountId::from(SOME_ASSET_ADMIN).into(), false, foreign_asset_minimum_asset_balance @@ -425,7 +422,7 @@ fn test_assets_balances_api_works() { // We first mint enough asset for the account to exist for assets assert_ok!(ForeignAssets::mint( RuntimeHelper::::origin_of(AccountId::from(SOME_ASSET_ADMIN)), - foreign_asset_id_multilocation.clone().into(), + foreign_asset_id_multilocation, AccountId::from(ALICE).into(), 6 * foreign_asset_minimum_asset_balance )); diff --git a/parachains/runtimes/assets/statemint/src/lib.rs b/parachains/runtimes/assets/statemint/src/lib.rs index aa90ca7a157..b697a7902a7 100644 --- a/parachains/runtimes/assets/statemint/src/lib.rs +++ b/parachains/runtimes/assets/statemint/src/lib.rs @@ -223,7 +223,7 @@ impl pallet_balances::Config for Runtime { parameter_types! { /// Relay Chain `TransactionByteFee` / 10 - pub const TransactionByteFee: Balance = 1 * MILLICENTS; + pub const TransactionByteFee: Balance = MILLICENTS; } impl pallet_transaction_payment::Config for Runtime { @@ -925,7 +925,7 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( @@ -960,7 +960,6 @@ impl_runtime_apis! { id: Concrete(GeneralIndex(i as u128).into()), fun: Fungible(fungibles_amount * i as u128), } - .into() }) .chain(core::iter::once(MultiAsset { id: Concrete(Here.into()), fun: Fungible(u128::MAX) })) .chain((0..holding_non_fungibles).map(|i| MultiAsset { @@ -980,7 +979,7 @@ impl_runtime_apis! { parameter_types! { pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some(( DotLocation::get(), - MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(DotLocation::get()) }, + MultiAsset { fun: Fungible(UNITS), id: Concrete(DotLocation::get()) }, )); pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None; } @@ -994,7 +993,7 @@ impl_runtime_apis! { fn get_multi_asset() -> MultiAsset { MultiAsset { id: Concrete(DotLocation::get()), - fun: Fungible(1 * UNITS), + fun: Fungible(UNITS), } } } diff --git a/parachains/runtimes/assets/statemint/src/weights/pallet_assets.rs b/parachains/runtimes/assets/statemint/src/weights/pallet_assets.rs index 933dcb4d3af..d7f390194af 100644 --- a/parachains/runtimes/assets/statemint/src/weights/pallet_assets.rs +++ b/parachains/runtimes/assets/statemint/src/weights/pallet_assets.rs @@ -447,4 +447,73 @@ impl pallet_assets::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn touch() -> Weight { + // Proof Size summary in bytes: + // Measured: `453` + // Estimated: `3675` + // Minimum execution time: 37_468_000 picoseconds. + Weight::from_parts(37_957_000, 3675) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + fn touch_other() -> Weight { + // Proof Size summary in bytes: + // Measured: `351` + // Estimated: `3675` + // Minimum execution time: 383_408_000 picoseconds. + Weight::from_parts(392_036_000, 3675) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn refund() -> Weight { + // Proof Size summary in bytes: + // Measured: `579` + // Estimated: `3675` + // Minimum execution time: 34_066_000 picoseconds. + Weight::from_parts(34_347_000, 3675) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + fn refund_other() -> Weight { + // Proof Size summary in bytes: + // Measured: `510` + // Estimated: `3675` + // Minimum execution time: 32_060_000 picoseconds. + Weight::from_parts(32_519_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: Assets Asset (r:1 w:0) + /// 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) + fn block() -> Weight { + // Proof Size summary in bytes: + // Measured: `459` + // Estimated: `3675` + // Minimum execution time: 115_000_000 picoseconds. + Weight::from_parts(163_000_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } } diff --git a/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs b/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs index 1b4a2bcfdd7..768f2b152cd 100644 --- a/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs +++ b/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs @@ -33,8 +33,7 @@ const MAX_ASSETS: u64 = 100; impl WeighMultiAssets for MultiAssetFilter { fn weigh_multi_assets(&self, weight: Weight) -> Weight { match self { - Self::Definite(assets) => - weight.saturating_mul(assets.inner().into_iter().count() as u64), + Self::Definite(assets) => weight.saturating_mul(assets.inner().iter().count() as u64), Self::Wild(asset) => match asset { All => weight.saturating_mul(MAX_ASSETS), AllOf { fun, .. } => match fun { @@ -53,7 +52,7 @@ impl WeighMultiAssets for MultiAssetFilter { impl WeighMultiAssets for MultiAssets { fn weigh_multi_assets(&self, weight: Weight) -> Weight { - weight.saturating_mul(self.inner().into_iter().count() as u64) + weight.saturating_mul(self.inner().iter().count() as u64) } } @@ -65,7 +64,7 @@ impl XcmWeightInfo for StatemintXcmWeight { // Currently there is no trusted reserve fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight { // TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974 - Weight::from_parts(1_000_000_000 as u64, 0) + Weight::from_parts(1_000_000_000_u64, 0) } fn receive_teleported_asset(assets: &MultiAssets) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::receive_teleported_asset()) @@ -123,7 +122,7 @@ impl XcmWeightInfo for StatemintXcmWeight { fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_parts(1_000_000_000 as u64, 0); + let hardcoded_weight = Weight::from_parts(1_000_000_000_u64, 0); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::deposit_asset()); hardcoded_weight.min(weight) } diff --git a/parachains/runtimes/assets/statemint/src/xcm_config.rs b/parachains/runtimes/assets/statemint/src/xcm_config.rs index 9d31bc0da60..c12631dd414 100644 --- a/parachains/runtimes/assets/statemint/src/xcm_config.rs +++ b/parachains/runtimes/assets/statemint/src/xcm_config.rs @@ -166,85 +166,82 @@ impl Contains for SafeCallFilter { } } - match call { + matches!( + call, RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) | - RuntimeCall::System( - frame_system::Call::set_heap_pages { .. } | - frame_system::Call::set_code { .. } | - frame_system::Call::set_code_without_checks { .. } | - frame_system::Call::kill_prefix { .. }, - ) | - RuntimeCall::ParachainSystem(..) | - RuntimeCall::Timestamp(..) | - RuntimeCall::Balances(..) | - RuntimeCall::CollatorSelection( - pallet_collator_selection::Call::set_desired_candidates { .. } | - pallet_collator_selection::Call::set_candidacy_bond { .. } | - pallet_collator_selection::Call::register_as_candidate { .. } | - pallet_collator_selection::Call::leave_intent { .. } | - pallet_collator_selection::Call::set_invulnerables { .. }, - ) | - RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | - RuntimeCall::XcmpQueue(..) | - RuntimeCall::DmpQueue(..) | - RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) | - RuntimeCall::Assets( - pallet_assets::Call::create { .. } | - pallet_assets::Call::force_create { .. } | - pallet_assets::Call::start_destroy { .. } | - pallet_assets::Call::destroy_accounts { .. } | - pallet_assets::Call::destroy_approvals { .. } | - pallet_assets::Call::finish_destroy { .. } | - pallet_assets::Call::mint { .. } | - pallet_assets::Call::burn { .. } | - pallet_assets::Call::transfer { .. } | - pallet_assets::Call::transfer_keep_alive { .. } | - pallet_assets::Call::force_transfer { .. } | - pallet_assets::Call::freeze { .. } | - pallet_assets::Call::thaw { .. } | - pallet_assets::Call::freeze_asset { .. } | - pallet_assets::Call::thaw_asset { .. } | - pallet_assets::Call::transfer_ownership { .. } | - pallet_assets::Call::set_team { .. } | - pallet_assets::Call::clear_metadata { .. } | - pallet_assets::Call::force_clear_metadata { .. } | - pallet_assets::Call::force_asset_status { .. } | - pallet_assets::Call::approve_transfer { .. } | - pallet_assets::Call::cancel_approval { .. } | - pallet_assets::Call::force_cancel_approval { .. } | - pallet_assets::Call::transfer_approved { .. } | - pallet_assets::Call::touch { .. } | - pallet_assets::Call::refund { .. }, - ) | - RuntimeCall::Uniques( + RuntimeCall::System( + frame_system::Call::set_heap_pages { .. } | + frame_system::Call::set_code { .. } | + frame_system::Call::set_code_without_checks { .. } | + frame_system::Call::kill_prefix { .. }, + ) | RuntimeCall::ParachainSystem(..) | + RuntimeCall::Timestamp(..) | + RuntimeCall::Balances(..) | + RuntimeCall::CollatorSelection( + pallet_collator_selection::Call::set_desired_candidates { .. } | + pallet_collator_selection::Call::set_candidacy_bond { .. } | + pallet_collator_selection::Call::register_as_candidate { .. } | + pallet_collator_selection::Call::leave_intent { .. } | + pallet_collator_selection::Call::set_invulnerables { .. }, + ) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | + RuntimeCall::XcmpQueue(..) | + RuntimeCall::DmpQueue(..) | + RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) | + RuntimeCall::Assets( + pallet_assets::Call::create { .. } | + pallet_assets::Call::force_create { .. } | + pallet_assets::Call::start_destroy { .. } | + pallet_assets::Call::destroy_accounts { .. } | + pallet_assets::Call::destroy_approvals { .. } | + pallet_assets::Call::finish_destroy { .. } | + pallet_assets::Call::mint { .. } | + pallet_assets::Call::burn { .. } | + pallet_assets::Call::transfer { .. } | + pallet_assets::Call::transfer_keep_alive { .. } | + pallet_assets::Call::force_transfer { .. } | + pallet_assets::Call::freeze { .. } | + pallet_assets::Call::thaw { .. } | + pallet_assets::Call::freeze_asset { .. } | + pallet_assets::Call::thaw_asset { .. } | + pallet_assets::Call::transfer_ownership { .. } | + pallet_assets::Call::set_team { .. } | + pallet_assets::Call::clear_metadata { .. } | + pallet_assets::Call::force_clear_metadata { .. } | + pallet_assets::Call::force_asset_status { .. } | + pallet_assets::Call::approve_transfer { .. } | + pallet_assets::Call::cancel_approval { .. } | + pallet_assets::Call::force_cancel_approval { .. } | + pallet_assets::Call::transfer_approved { .. } | + pallet_assets::Call::touch { .. } | + pallet_assets::Call::refund { .. }, + ) | RuntimeCall::Uniques( pallet_uniques::Call::create { .. } | - pallet_uniques::Call::force_create { .. } | - pallet_uniques::Call::destroy { .. } | - pallet_uniques::Call::mint { .. } | - pallet_uniques::Call::burn { .. } | - pallet_uniques::Call::transfer { .. } | - pallet_uniques::Call::freeze { .. } | - pallet_uniques::Call::thaw { .. } | - pallet_uniques::Call::freeze_collection { .. } | - pallet_uniques::Call::thaw_collection { .. } | - pallet_uniques::Call::transfer_ownership { .. } | - pallet_uniques::Call::set_team { .. } | - pallet_uniques::Call::approve_transfer { .. } | - pallet_uniques::Call::cancel_approval { .. } | - pallet_uniques::Call::force_item_status { .. } | - pallet_uniques::Call::set_attribute { .. } | - pallet_uniques::Call::clear_attribute { .. } | - pallet_uniques::Call::set_metadata { .. } | - pallet_uniques::Call::clear_metadata { .. } | - pallet_uniques::Call::set_collection_metadata { .. } | - pallet_uniques::Call::clear_collection_metadata { .. } | - pallet_uniques::Call::set_accept_ownership { .. } | - pallet_uniques::Call::set_collection_max_supply { .. } | - pallet_uniques::Call::set_price { .. } | - pallet_uniques::Call::buy_item { .. }, - ) => true, - _ => false, - } + pallet_uniques::Call::force_create { .. } | + pallet_uniques::Call::destroy { .. } | + pallet_uniques::Call::mint { .. } | + pallet_uniques::Call::burn { .. } | + pallet_uniques::Call::transfer { .. } | + pallet_uniques::Call::freeze { .. } | + pallet_uniques::Call::thaw { .. } | + pallet_uniques::Call::freeze_collection { .. } | + pallet_uniques::Call::thaw_collection { .. } | + pallet_uniques::Call::transfer_ownership { .. } | + pallet_uniques::Call::set_team { .. } | + pallet_uniques::Call::approve_transfer { .. } | + pallet_uniques::Call::cancel_approval { .. } | + pallet_uniques::Call::force_item_status { .. } | + pallet_uniques::Call::set_attribute { .. } | + pallet_uniques::Call::clear_attribute { .. } | + pallet_uniques::Call::set_metadata { .. } | + pallet_uniques::Call::clear_metadata { .. } | + pallet_uniques::Call::set_collection_metadata { .. } | + pallet_uniques::Call::clear_collection_metadata { .. } | + pallet_uniques::Call::set_accept_ownership { .. } | + pallet_uniques::Call::set_collection_max_supply { .. } | + pallet_uniques::Call::set_price { .. } | + pallet_uniques::Call::buy_item { .. }, + ) + ) } } @@ -373,6 +370,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/parachains/runtimes/assets/statemint/tests/tests.rs b/parachains/runtimes/assets/statemint/tests/tests.rs index 7bbed6bb54a..87242682b15 100644 --- a/parachains/runtimes/assets/statemint/tests/tests.rs +++ b/parachains/runtimes/assets/statemint/tests/tests.rs @@ -80,19 +80,16 @@ fn test_asset_xcm_trader() { // Lets pay with: asset_amount_needed + asset_amount_extra let asset_amount_extra = 100_u128; let asset: MultiAsset = - (asset_multilocation.clone(), asset_amount_needed + asset_amount_extra).into(); + (asset_multilocation, asset_amount_needed + asset_amount_extra).into(); let mut trader = ::Trader::new(); // Lets buy_weight and make sure buy_weight does not return an error - match trader.buy_weight(bought, asset.into()) { - Ok(unused_assets) => { - // Check whether a correct amount of unused assets is returned - assert_ok!(unused_assets - .ensure_contains(&(asset_multilocation, asset_amount_extra).into())); - }, - Err(e) => assert!(false, "Expected Ok(_). Got {:#?}", e), - } + let unused_assets = trader.buy_weight(bought, asset.into()).expect("Expected Ok"); + // Check whether a correct amount of unused assets is returned + assert_ok!( + unused_assets.ensure_contains(&(asset_multilocation, asset_amount_extra).into()) + ); // Drop trader drop(trader); @@ -156,7 +153,7 @@ fn test_asset_xcm_trader_with_refund() { // lets calculate amount needed let amount_bought = WeightToFee::weight_to_fee(&bought); - let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into(); + let asset: MultiAsset = (asset_multilocation, amount_bought).into(); // Make sure buy_weight does not return an error assert_ok!(trader.buy_weight(bought, asset.clone().into())); @@ -233,7 +230,7 @@ fn test_asset_xcm_trader_refund_not_possible_since_amount_less_than_ed() { "we are testing what happens when the amount does not exceed ED" ); - let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into(); + let asset: MultiAsset = (asset_multilocation, amount_bought).into(); // Buy weight should return an error assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive); @@ -286,11 +283,11 @@ fn test_that_buying_ed_refund_does_not_refund() { // We know we will have to buy at least ED, so lets make sure first it will // fail with a payment of less than ED - let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into(); + let asset: MultiAsset = (asset_multilocation, amount_bought).into(); assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive); // Now lets buy ED at least - let asset: MultiAsset = (asset_multilocation.clone(), ExistentialDeposit::get()).into(); + let asset: MultiAsset = (asset_multilocation, ExistentialDeposit::get()).into(); // Buy weight should work assert_ok!(trader.buy_weight(bought, asset.into())); diff --git a/parachains/runtimes/assets/test-utils/src/lib.rs b/parachains/runtimes/assets/test-utils/src/lib.rs index 1e0b31f18a3..4a67e661322 100644 --- a/parachains/runtimes/assets/test-utils/src/lib.rs +++ b/parachains/runtimes/assets/test-utils/src/lib.rs @@ -134,12 +134,12 @@ impl< .unwrap(); } - pallet_balances::GenesisConfig:: { balances: self.balances.into() } + pallet_balances::GenesisConfig:: { balances: self.balances } .assimilate_storage(&mut t) .unwrap(); pallet_collator_selection::GenesisConfig:: { - invulnerables: self.collators.clone().into(), + invulnerables: self.collators.clone(), candidacy_bond: Default::default(), desired_candidates: Default::default(), } @@ -303,11 +303,10 @@ impl RuntimeHelper .find_map(|e| match e { pallet_xcm::Event::Attempted(outcome) => Some(outcome), _ => None, - }); - match outcome { - Some(outcome) => assert_outcome(outcome), - None => assert!(false, "No `pallet_xcm::Event::Attempted(outcome)` event found!"), - } + }) + .expect("No `pallet_xcm::Event::Attempted(outcome)` event found!"); + + assert_outcome(outcome); } } @@ -362,8 +361,11 @@ pub fn mock_open_hrmp_channel< recipient: ParaId, ) { let n = 1_u32; - let mut sproof_builder = RelayStateSproofBuilder::default(); - sproof_builder.para_id = sender; + let mut sproof_builder = RelayStateSproofBuilder { + para_id: sender, + hrmp_egress_channel_index: Some(vec![recipient]), + ..Default::default() + }; sproof_builder.hrmp_channels.insert( HrmpChannelId { sender, recipient }, AbridgedHrmpChannel { @@ -375,7 +377,6 @@ pub fn mock_open_hrmp_channel< mqc_head: None, }, ); - sproof_builder.hrmp_egress_channel_index = Some(vec![recipient]); let (relay_parent_storage_root, relay_chain_state) = sproof_builder.into_state_root_and_proof(); let vfp = PersistedValidationData { @@ -388,7 +389,7 @@ pub fn mock_open_hrmp_channel< let inherent_data = { let mut inherent_data = InherentData::default(); let system_inherent_data = ParachainInherentData { - validation_data: vfp.clone(), + validation_data: vfp, relay_chain_state, downward_messages: Default::default(), horizontal_messages: Default::default(), diff --git a/parachains/runtimes/assets/test-utils/src/test_cases.rs b/parachains/runtimes/assets/test-utils/src/test_cases.rs index 954ff0d7589..a599db82713 100644 --- a/parachains/runtimes/assets/test-utils/src/test_cases.rs +++ b/parachains/runtimes/assets/test-utils/src/test_cases.rs @@ -134,7 +134,7 @@ pub fn teleports_for_native_asset_works< BuyExecution { fees: MultiAsset { id: Concrete(native_asset_id), - fun: Fungible(buy_execution_fee_amount_eta.into()), + fun: Fungible(buy_execution_fee_amount_eta), }, weight_limit: Limited(Weight::from_parts(303531000, 65536)), }, @@ -190,7 +190,7 @@ pub fn teleports_for_native_asset_works< RuntimeHelper::::origin_of(target_account.clone()), dest, dest_beneficiary, - (native_asset_id, native_asset_to_teleport_away.clone().into()), + (native_asset_id, native_asset_to_teleport_away.into()), None, )); // check balances @@ -235,7 +235,7 @@ pub fn teleports_for_native_asset_works< RuntimeHelper::::origin_of(target_account.clone()), dest, dest_beneficiary, - (native_asset_id, native_asset_to_teleport_away.clone().into()), + (native_asset_id, native_asset_to_teleport_away.into()), Some((runtime_para_id, other_para_id)), )); @@ -366,7 +366,7 @@ pub fn teleports_for_foreign_assets_works< WeightToFee::weight_to_fee(&Weight::from_parts(90_000_000_000, 0)); let buy_execution_fee = MultiAsset { id: Concrete(MultiLocation::parent()), - fun: Fungible(buy_execution_fee_amount.into()), + fun: Fungible(buy_execution_fee_amount), }; let teleported_foreign_asset_amount = 10000000000000; @@ -376,7 +376,7 @@ pub fn teleports_for_foreign_assets_works< .with_session_keys(collator_session_keys.session_keys()) .with_balances(vec![ ( - foreign_creator_as_account_id.clone(), + foreign_creator_as_account_id, existential_deposit + (buy_execution_fee_amount * 2).into(), ), (target_account.clone(), existential_deposit), @@ -441,7 +441,7 @@ pub fn teleports_for_foreign_assets_works< BuyExecution { fees: MultiAsset { id: Concrete(MultiLocation::parent()), - fun: Fungible(buy_execution_fee_amount.into()), + fun: Fungible(buy_execution_fee_amount), }, weight_limit: Limited(Weight::from_parts(403531000, 65536)), }, @@ -536,7 +536,7 @@ pub fn teleports_for_foreign_assets_works< RuntimeHelper::::origin_of(target_account.clone()), dest, dest_beneficiary, - (foreign_asset_id_multilocation, asset_to_teleport_away.clone().into()), + (foreign_asset_id_multilocation, asset_to_teleport_away), Some((runtime_para_id, foreign_para_id)), )); @@ -788,7 +788,7 @@ pub fn asset_transactor_transfer_with_pallet_assets_instance_works< .execute_with(|| { // create some asset class let asset_minimum_asset_balance = 3333333_u128; - let asset_id_as_multilocation = AssetIdConverter::reverse_ref(&asset_id).unwrap(); + let asset_id_as_multilocation = AssetIdConverter::reverse_ref(asset_id).unwrap(); assert_ok!(>::force_create( RuntimeHelper::::root_origin(), asset_id.into(), @@ -869,7 +869,7 @@ pub fn asset_transactor_transfer_with_pallet_assets_instance_works< id: charlie_account.clone().into() }), }, - (asset_id_as_multilocation, 1 * asset_minimum_asset_balance), + (asset_id_as_multilocation, asset_minimum_asset_balance), ), XcmError::FailedToTransactAsset(Into::<&str>::into( sp_runtime::TokenError::CannotCreate @@ -890,7 +890,7 @@ pub fn asset_transactor_transfer_with_pallet_assets_instance_works< parents: 0, interior: X1(AccountId32 { network: None, id: bob_account.clone().into() }), }, - (asset_id_as_multilocation, 1 * asset_minimum_asset_balance), + (asset_id_as_multilocation, asset_minimum_asset_balance), ), Ok(_) )); @@ -908,7 +908,7 @@ pub fn asset_transactor_transfer_with_pallet_assets_instance_works< asset_id.into(), &bob_account ), - (1 * asset_minimum_asset_balance).into() + asset_minimum_asset_balance.into() ); assert_eq!( >::balance( @@ -1130,7 +1130,7 @@ pub fn create_and_manage_foreign_assets_for_local_consensus_parachain_assets_wor // lets simulate this was triggered by relay chain from local consensus sibling parachain let xcm = Xcm(vec![ WithdrawAsset(buy_execution_fee.clone().into()), - BuyExecution { fees: buy_execution_fee.clone().into(), weight_limit: Unlimited }, + BuyExecution { fees: buy_execution_fee.clone(), weight_limit: Unlimited }, Transact { origin_kind: OriginKind::Xcm, require_weight_at_most: Weight::from_parts(40_000_000_000, 8000), @@ -1247,7 +1247,7 @@ pub fn create_and_manage_foreign_assets_for_local_consensus_parachain_assets_wor }); let xcm = Xcm(vec![ WithdrawAsset(buy_execution_fee.clone().into()), - BuyExecution { fees: buy_execution_fee.clone().into(), weight_limit: Unlimited }, + BuyExecution { fees: buy_execution_fee.clone(), weight_limit: Unlimited }, Transact { origin_kind: OriginKind::Xcm, require_weight_at_most: Weight::from_parts(20_000_000_000, 8000), diff --git a/parachains/runtimes/assets/westmint/src/lib.rs b/parachains/runtimes/assets/westmint/src/lib.rs index c237c8dc5cf..d5ac6103d97 100644 --- a/parachains/runtimes/assets/westmint/src/lib.rs +++ b/parachains/runtimes/assets/westmint/src/lib.rs @@ -199,7 +199,7 @@ impl pallet_balances::Config for Runtime { parameter_types! { /// Relay Chain `TransactionByteFee` / 10 - pub const TransactionByteFee: Balance = 1 * MILLICENTS; + pub const TransactionByteFee: Balance = MILLICENTS; } impl pallet_transaction_payment::Config for Runtime { @@ -1038,7 +1038,7 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( @@ -1073,7 +1073,6 @@ impl_runtime_apis! { id: Concrete(GeneralIndex(i as u128).into()), fun: Fungible(fungibles_amount * i as u128), } - .into() }) .chain(core::iter::once(MultiAsset { id: Concrete(Here.into()), fun: Fungible(u128::MAX) })) .chain((0..holding_non_fungibles).map(|i| MultiAsset { @@ -1093,7 +1092,7 @@ impl_runtime_apis! { parameter_types! { pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some(( WestendLocation::get(), - MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(WestendLocation::get()) }, + MultiAsset { fun: Fungible(UNITS), id: Concrete(WestendLocation::get()) }, )); pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None; @@ -1108,7 +1107,7 @@ impl_runtime_apis! { fn get_multi_asset() -> MultiAsset { MultiAsset { id: Concrete(WestendLocation::get()), - fun: Fungible(1 * UNITS), + fun: Fungible(UNITS), } } } diff --git a/parachains/runtimes/assets/westmint/src/weights/pallet_assets.rs b/parachains/runtimes/assets/westmint/src/weights/pallet_assets.rs index f08633cd2ba..75518b3ef41 100644 --- a/parachains/runtimes/assets/westmint/src/weights/pallet_assets.rs +++ b/parachains/runtimes/assets/westmint/src/weights/pallet_assets.rs @@ -443,4 +443,73 @@ impl pallet_assets::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn touch() -> Weight { + // Proof Size summary in bytes: + // Measured: `453` + // Estimated: `3675` + // Minimum execution time: 37_468_000 picoseconds. + Weight::from_parts(37_957_000, 3675) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + fn touch_other() -> Weight { + // Proof Size summary in bytes: + // Measured: `351` + // Estimated: `3675` + // Minimum execution time: 383_408_000 picoseconds. + Weight::from_parts(392_036_000, 3675) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn refund() -> Weight { + // Proof Size summary in bytes: + // Measured: `579` + // Estimated: `3675` + // Minimum execution time: 34_066_000 picoseconds. + Weight::from_parts(34_347_000, 3675) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + fn refund_other() -> Weight { + // Proof Size summary in bytes: + // Measured: `510` + // Estimated: `3675` + // Minimum execution time: 32_060_000 picoseconds. + Weight::from_parts(32_519_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: Assets Asset (r:1 w:0) + /// 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) + fn block() -> Weight { + // Proof Size summary in bytes: + // Measured: `459` + // Estimated: `3675` + // Minimum execution time: 115_000_000 picoseconds. + Weight::from_parts(163_000_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } } diff --git a/parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs b/parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs index 5daa3acbcce..8247f75d5dd 100644 --- a/parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs +++ b/parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs @@ -33,8 +33,7 @@ const MAX_ASSETS: u64 = 100; impl WeighMultiAssets for MultiAssetFilter { fn weigh_multi_assets(&self, weight: Weight) -> Weight { match self { - Self::Definite(assets) => - weight.saturating_mul(assets.inner().into_iter().count() as u64), + Self::Definite(assets) => weight.saturating_mul(assets.inner().iter().count() as u64), Self::Wild(asset) => match asset { All => weight.saturating_mul(MAX_ASSETS), AllOf { fun, .. } => match fun { @@ -53,7 +52,7 @@ impl WeighMultiAssets for MultiAssetFilter { impl WeighMultiAssets for MultiAssets { fn weigh_multi_assets(&self, weight: Weight) -> Weight { - weight.saturating_mul(self.inner().into_iter().count() as u64) + weight.saturating_mul(self.inner().iter().count() as u64) } } @@ -65,7 +64,7 @@ impl XcmWeightInfo for WestmintXcmWeight { // Currently there is no trusted reserve fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight { // TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974 - Weight::from_parts(1_000_000_000 as u64, 0) + Weight::from_parts(1_000_000_000_u64, 0) } fn receive_teleported_asset(assets: &MultiAssets) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::receive_teleported_asset()) @@ -123,7 +122,7 @@ impl XcmWeightInfo for WestmintXcmWeight { fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_parts(1_000_000_000 as u64, 0); + let hardcoded_weight = Weight::from_parts(1_000_000_000_u64, 0); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::deposit_asset()); hardcoded_weight.min(weight) } diff --git a/parachains/runtimes/assets/westmint/src/xcm_config.rs b/parachains/runtimes/assets/westmint/src/xcm_config.rs index d9987a627ae..4b626fb8f30 100644 --- a/parachains/runtimes/assets/westmint/src/xcm_config.rs +++ b/parachains/runtimes/assets/westmint/src/xcm_config.rs @@ -191,155 +191,150 @@ impl Contains for SafeCallFilter { } } - match call { + matches!( + call, RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) | - RuntimeCall::System( - frame_system::Call::set_heap_pages { .. } | - frame_system::Call::set_code { .. } | - frame_system::Call::set_code_without_checks { .. } | - frame_system::Call::kill_prefix { .. }, - ) | - RuntimeCall::ParachainSystem(..) | - RuntimeCall::Timestamp(..) | - RuntimeCall::Balances(..) | - RuntimeCall::CollatorSelection( - pallet_collator_selection::Call::set_desired_candidates { .. } | - pallet_collator_selection::Call::set_candidacy_bond { .. } | - pallet_collator_selection::Call::register_as_candidate { .. } | - pallet_collator_selection::Call::leave_intent { .. }, - ) | - RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | - RuntimeCall::XcmpQueue(..) | - RuntimeCall::DmpQueue(..) | - RuntimeCall::Utility( - pallet_utility::Call::as_derivative { .. } | - pallet_utility::Call::batch { .. } | - pallet_utility::Call::batch_all { .. }, - ) | - RuntimeCall::Assets( + RuntimeCall::System( + frame_system::Call::set_heap_pages { .. } | + frame_system::Call::set_code { .. } | + frame_system::Call::set_code_without_checks { .. } | + frame_system::Call::kill_prefix { .. }, + ) | RuntimeCall::ParachainSystem(..) | + RuntimeCall::Timestamp(..) | + RuntimeCall::Balances(..) | + RuntimeCall::CollatorSelection( + pallet_collator_selection::Call::set_desired_candidates { .. } | + pallet_collator_selection::Call::set_candidacy_bond { .. } | + pallet_collator_selection::Call::register_as_candidate { .. } | + pallet_collator_selection::Call::leave_intent { .. } | + pallet_collator_selection::Call::set_invulnerables { .. }, + ) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | + RuntimeCall::XcmpQueue(..) | + RuntimeCall::DmpQueue(..) | + RuntimeCall::Utility( + pallet_utility::Call::as_derivative { .. } | + pallet_utility::Call::batch { .. } | + pallet_utility::Call::batch_all { .. }, + ) | RuntimeCall::Assets( pallet_assets::Call::create { .. } | - pallet_assets::Call::force_create { .. } | - pallet_assets::Call::start_destroy { .. } | - pallet_assets::Call::destroy_accounts { .. } | - pallet_assets::Call::destroy_approvals { .. } | - pallet_assets::Call::finish_destroy { .. } | - pallet_assets::Call::mint { .. } | - pallet_assets::Call::burn { .. } | - pallet_assets::Call::transfer { .. } | - pallet_assets::Call::transfer_keep_alive { .. } | - pallet_assets::Call::force_transfer { .. } | - pallet_assets::Call::freeze { .. } | - pallet_assets::Call::thaw { .. } | - pallet_assets::Call::freeze_asset { .. } | - pallet_assets::Call::thaw_asset { .. } | - pallet_assets::Call::transfer_ownership { .. } | - pallet_assets::Call::set_team { .. } | - pallet_assets::Call::clear_metadata { .. } | - pallet_assets::Call::force_clear_metadata { .. } | - pallet_assets::Call::force_asset_status { .. } | - pallet_assets::Call::approve_transfer { .. } | - pallet_assets::Call::cancel_approval { .. } | - pallet_assets::Call::force_cancel_approval { .. } | - pallet_assets::Call::transfer_approved { .. } | - pallet_assets::Call::touch { .. } | - pallet_assets::Call::refund { .. }, - ) | - RuntimeCall::ForeignAssets( + pallet_assets::Call::force_create { .. } | + pallet_assets::Call::start_destroy { .. } | + pallet_assets::Call::destroy_accounts { .. } | + pallet_assets::Call::destroy_approvals { .. } | + pallet_assets::Call::finish_destroy { .. } | + pallet_assets::Call::mint { .. } | + pallet_assets::Call::burn { .. } | + pallet_assets::Call::transfer { .. } | + pallet_assets::Call::transfer_keep_alive { .. } | + pallet_assets::Call::force_transfer { .. } | + pallet_assets::Call::freeze { .. } | + pallet_assets::Call::thaw { .. } | + pallet_assets::Call::freeze_asset { .. } | + pallet_assets::Call::thaw_asset { .. } | + pallet_assets::Call::transfer_ownership { .. } | + pallet_assets::Call::set_team { .. } | + pallet_assets::Call::clear_metadata { .. } | + pallet_assets::Call::force_clear_metadata { .. } | + pallet_assets::Call::force_asset_status { .. } | + pallet_assets::Call::approve_transfer { .. } | + pallet_assets::Call::cancel_approval { .. } | + pallet_assets::Call::force_cancel_approval { .. } | + pallet_assets::Call::transfer_approved { .. } | + pallet_assets::Call::touch { .. } | + pallet_assets::Call::refund { .. }, + ) | RuntimeCall::ForeignAssets( pallet_assets::Call::create { .. } | - pallet_assets::Call::force_create { .. } | - pallet_assets::Call::start_destroy { .. } | - pallet_assets::Call::destroy_accounts { .. } | - pallet_assets::Call::destroy_approvals { .. } | - pallet_assets::Call::finish_destroy { .. } | - pallet_assets::Call::mint { .. } | - pallet_assets::Call::burn { .. } | - pallet_assets::Call::transfer { .. } | - pallet_assets::Call::transfer_keep_alive { .. } | - pallet_assets::Call::force_transfer { .. } | - pallet_assets::Call::freeze { .. } | - pallet_assets::Call::thaw { .. } | - pallet_assets::Call::freeze_asset { .. } | - pallet_assets::Call::thaw_asset { .. } | - pallet_assets::Call::transfer_ownership { .. } | - pallet_assets::Call::set_team { .. } | - pallet_assets::Call::set_metadata { .. } | - pallet_assets::Call::clear_metadata { .. } | - pallet_assets::Call::force_clear_metadata { .. } | - pallet_assets::Call::force_asset_status { .. } | - pallet_assets::Call::approve_transfer { .. } | - pallet_assets::Call::cancel_approval { .. } | - pallet_assets::Call::force_cancel_approval { .. } | - pallet_assets::Call::transfer_approved { .. } | - pallet_assets::Call::touch { .. } | - pallet_assets::Call::refund { .. }, - ) | - RuntimeCall::Nfts( + pallet_assets::Call::force_create { .. } | + pallet_assets::Call::start_destroy { .. } | + pallet_assets::Call::destroy_accounts { .. } | + pallet_assets::Call::destroy_approvals { .. } | + pallet_assets::Call::finish_destroy { .. } | + pallet_assets::Call::mint { .. } | + pallet_assets::Call::burn { .. } | + pallet_assets::Call::transfer { .. } | + pallet_assets::Call::transfer_keep_alive { .. } | + pallet_assets::Call::force_transfer { .. } | + pallet_assets::Call::freeze { .. } | + pallet_assets::Call::thaw { .. } | + pallet_assets::Call::freeze_asset { .. } | + pallet_assets::Call::thaw_asset { .. } | + pallet_assets::Call::transfer_ownership { .. } | + pallet_assets::Call::set_team { .. } | + pallet_assets::Call::set_metadata { .. } | + pallet_assets::Call::clear_metadata { .. } | + pallet_assets::Call::force_clear_metadata { .. } | + pallet_assets::Call::force_asset_status { .. } | + pallet_assets::Call::approve_transfer { .. } | + pallet_assets::Call::cancel_approval { .. } | + pallet_assets::Call::force_cancel_approval { .. } | + pallet_assets::Call::transfer_approved { .. } | + pallet_assets::Call::touch { .. } | + pallet_assets::Call::refund { .. }, + ) | RuntimeCall::Nfts( pallet_nfts::Call::create { .. } | - pallet_nfts::Call::force_create { .. } | - pallet_nfts::Call::destroy { .. } | - pallet_nfts::Call::mint { .. } | - pallet_nfts::Call::force_mint { .. } | - pallet_nfts::Call::burn { .. } | - pallet_nfts::Call::transfer { .. } | - pallet_nfts::Call::lock_item_transfer { .. } | - pallet_nfts::Call::unlock_item_transfer { .. } | - pallet_nfts::Call::lock_collection { .. } | - pallet_nfts::Call::transfer_ownership { .. } | - pallet_nfts::Call::set_team { .. } | - pallet_nfts::Call::force_collection_owner { .. } | - pallet_nfts::Call::force_collection_config { .. } | - pallet_nfts::Call::approve_transfer { .. } | - pallet_nfts::Call::cancel_approval { .. } | - pallet_nfts::Call::clear_all_transfer_approvals { .. } | - pallet_nfts::Call::lock_item_properties { .. } | - pallet_nfts::Call::set_attribute { .. } | - pallet_nfts::Call::force_set_attribute { .. } | - pallet_nfts::Call::clear_attribute { .. } | - pallet_nfts::Call::approve_item_attributes { .. } | - pallet_nfts::Call::cancel_item_attributes_approval { .. } | - pallet_nfts::Call::set_metadata { .. } | - pallet_nfts::Call::clear_metadata { .. } | - pallet_nfts::Call::set_collection_metadata { .. } | - pallet_nfts::Call::clear_collection_metadata { .. } | - pallet_nfts::Call::set_accept_ownership { .. } | - pallet_nfts::Call::set_collection_max_supply { .. } | - pallet_nfts::Call::update_mint_settings { .. } | - pallet_nfts::Call::set_price { .. } | - pallet_nfts::Call::buy_item { .. } | - pallet_nfts::Call::pay_tips { .. } | - pallet_nfts::Call::create_swap { .. } | - pallet_nfts::Call::cancel_swap { .. } | - pallet_nfts::Call::claim_swap { .. }, - ) | - RuntimeCall::Uniques( + pallet_nfts::Call::force_create { .. } | + pallet_nfts::Call::destroy { .. } | + pallet_nfts::Call::mint { .. } | + pallet_nfts::Call::force_mint { .. } | + pallet_nfts::Call::burn { .. } | + pallet_nfts::Call::transfer { .. } | + pallet_nfts::Call::lock_item_transfer { .. } | + pallet_nfts::Call::unlock_item_transfer { .. } | + pallet_nfts::Call::lock_collection { .. } | + pallet_nfts::Call::transfer_ownership { .. } | + pallet_nfts::Call::set_team { .. } | + pallet_nfts::Call::force_collection_owner { .. } | + pallet_nfts::Call::force_collection_config { .. } | + pallet_nfts::Call::approve_transfer { .. } | + pallet_nfts::Call::cancel_approval { .. } | + pallet_nfts::Call::clear_all_transfer_approvals { .. } | + pallet_nfts::Call::lock_item_properties { .. } | + pallet_nfts::Call::set_attribute { .. } | + pallet_nfts::Call::force_set_attribute { .. } | + pallet_nfts::Call::clear_attribute { .. } | + pallet_nfts::Call::approve_item_attributes { .. } | + pallet_nfts::Call::cancel_item_attributes_approval { .. } | + pallet_nfts::Call::set_metadata { .. } | + pallet_nfts::Call::clear_metadata { .. } | + pallet_nfts::Call::set_collection_metadata { .. } | + pallet_nfts::Call::clear_collection_metadata { .. } | + pallet_nfts::Call::set_accept_ownership { .. } | + pallet_nfts::Call::set_collection_max_supply { .. } | + pallet_nfts::Call::update_mint_settings { .. } | + pallet_nfts::Call::set_price { .. } | + pallet_nfts::Call::buy_item { .. } | + pallet_nfts::Call::pay_tips { .. } | + pallet_nfts::Call::create_swap { .. } | + pallet_nfts::Call::cancel_swap { .. } | + pallet_nfts::Call::claim_swap { .. }, + ) | RuntimeCall::Uniques( pallet_uniques::Call::create { .. } | - pallet_uniques::Call::force_create { .. } | - pallet_uniques::Call::destroy { .. } | - pallet_uniques::Call::mint { .. } | - pallet_uniques::Call::burn { .. } | - pallet_uniques::Call::transfer { .. } | - pallet_uniques::Call::freeze { .. } | - pallet_uniques::Call::thaw { .. } | - pallet_uniques::Call::freeze_collection { .. } | - pallet_uniques::Call::thaw_collection { .. } | - pallet_uniques::Call::transfer_ownership { .. } | - pallet_uniques::Call::set_team { .. } | - pallet_uniques::Call::approve_transfer { .. } | - pallet_uniques::Call::cancel_approval { .. } | - pallet_uniques::Call::force_item_status { .. } | - pallet_uniques::Call::set_attribute { .. } | - pallet_uniques::Call::clear_attribute { .. } | - pallet_uniques::Call::set_metadata { .. } | - pallet_uniques::Call::clear_metadata { .. } | - pallet_uniques::Call::set_collection_metadata { .. } | - pallet_uniques::Call::clear_collection_metadata { .. } | - pallet_uniques::Call::set_accept_ownership { .. } | - pallet_uniques::Call::set_collection_max_supply { .. } | - pallet_uniques::Call::set_price { .. } | - pallet_uniques::Call::buy_item { .. }, - ) => true, - _ => false, - } + pallet_uniques::Call::force_create { .. } | + pallet_uniques::Call::destroy { .. } | + pallet_uniques::Call::mint { .. } | + pallet_uniques::Call::burn { .. } | + pallet_uniques::Call::transfer { .. } | + pallet_uniques::Call::freeze { .. } | + pallet_uniques::Call::thaw { .. } | + pallet_uniques::Call::freeze_collection { .. } | + pallet_uniques::Call::thaw_collection { .. } | + pallet_uniques::Call::transfer_ownership { .. } | + pallet_uniques::Call::set_team { .. } | + pallet_uniques::Call::approve_transfer { .. } | + pallet_uniques::Call::cancel_approval { .. } | + pallet_uniques::Call::force_item_status { .. } | + pallet_uniques::Call::set_attribute { .. } | + pallet_uniques::Call::clear_attribute { .. } | + pallet_uniques::Call::set_metadata { .. } | + pallet_uniques::Call::clear_metadata { .. } | + pallet_uniques::Call::set_collection_metadata { .. } | + pallet_uniques::Call::clear_collection_metadata { .. } | + pallet_uniques::Call::set_accept_ownership { .. } | + pallet_uniques::Call::set_collection_max_supply { .. } | + pallet_uniques::Call::set_price { .. } | + pallet_uniques::Call::buy_item { .. }, + ) + ) } } @@ -470,6 +465,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/parachains/runtimes/assets/westmint/tests/tests.rs b/parachains/runtimes/assets/westmint/tests/tests.rs index 3ef09d14e52..740edc0c20b 100644 --- a/parachains/runtimes/assets/westmint/tests/tests.rs +++ b/parachains/runtimes/assets/westmint/tests/tests.rs @@ -84,19 +84,16 @@ fn test_asset_xcm_trader() { // Lets pay with: asset_amount_needed + asset_amount_extra let asset_amount_extra = 100_u128; let asset: MultiAsset = - (asset_multilocation.clone(), asset_amount_needed + asset_amount_extra).into(); + (asset_multilocation, asset_amount_needed + asset_amount_extra).into(); let mut trader = ::Trader::new(); // Lets buy_weight and make sure buy_weight does not return an error - match trader.buy_weight(bought, asset.into()) { - Ok(unused_assets) => { - // Check whether a correct amount of unused assets is returned - assert_ok!(unused_assets - .ensure_contains(&(asset_multilocation, asset_amount_extra).into())); - }, - Err(e) => assert!(false, "Expected Ok(_). Got {:#?}", e), - } + let unused_assets = trader.buy_weight(bought, asset.into()).expect("Expected Ok"); + // Check whether a correct amount of unused assets is returned + assert_ok!( + unused_assets.ensure_contains(&(asset_multilocation, asset_amount_extra).into()) + ); // Drop trader drop(trader); @@ -156,7 +153,7 @@ fn test_asset_xcm_trader_with_refund() { // lets calculate amount needed let amount_bought = WeightToFee::weight_to_fee(&bought); - let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into(); + let asset: MultiAsset = (asset_multilocation, amount_bought).into(); // Make sure buy_weight does not return an error assert_ok!(trader.buy_weight(bought, asset.clone().into())); @@ -230,7 +227,7 @@ fn test_asset_xcm_trader_refund_not_possible_since_amount_less_than_ed() { "we are testing what happens when the amount does not exceed ED" ); - let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into(); + let asset: MultiAsset = (asset_multilocation, amount_bought).into(); // Buy weight should return an error assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive); @@ -282,11 +279,11 @@ fn test_that_buying_ed_refund_does_not_refund() { // We know we will have to buy at least ED, so lets make sure first it will // fail with a payment of less than ED - let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into(); + let asset: MultiAsset = (asset_multilocation, amount_bought).into(); assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive); // Now lets buy ED at least - let asset: MultiAsset = (asset_multilocation.clone(), ExistentialDeposit::get()).into(); + let asset: MultiAsset = (asset_multilocation, ExistentialDeposit::get()).into(); // Buy weight should work assert_ok!(trader.buy_weight(bought, asset.into())); @@ -421,7 +418,7 @@ fn test_assets_balances_api_works() { let foreign_asset_minimum_asset_balance = 3333333_u128; assert_ok!(ForeignAssets::force_create( RuntimeHelper::::root_origin(), - foreign_asset_id_multilocation.clone().into(), + foreign_asset_id_multilocation, AccountId::from(SOME_ASSET_ADMIN).into(), false, foreign_asset_minimum_asset_balance @@ -430,7 +427,7 @@ fn test_assets_balances_api_works() { // We first mint enough asset for the account to exist for assets assert_ok!(ForeignAssets::mint( RuntimeHelper::::origin_of(AccountId::from(SOME_ASSET_ADMIN)), - foreign_asset_id_multilocation.clone().into(), + foreign_asset_id_multilocation, AccountId::from(ALICE).into(), 6 * foreign_asset_minimum_asset_balance )); diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/Cargo.toml b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/Cargo.toml index 4f7338a8e81..d8cce46eadd 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/Cargo.toml +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/Cargo.toml @@ -13,7 +13,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features = hex-literal = { version = "0.4.1" } log = { version = "0.4.17", default-features = false } scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.160", optional = true, features = ["derive"] } +serde = { version = "1.0.162", optional = true, features = ["derive"] } smallvec = "1.8.1" # Substrate 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 952c3147306..ec9d9f09e41 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs @@ -254,7 +254,7 @@ impl pallet_balances::Config for Runtime { parameter_types! { /// Relay Chain `TransactionByteFee` / 10 - pub const TransactionByteFee: Balance = 1 * MILLICENTS; + pub const TransactionByteFee: Balance = MILLICENTS; } impl pallet_transaction_payment::Config for Runtime { @@ -615,7 +615,7 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( @@ -653,7 +653,7 @@ impl_runtime_apis! { parameter_types! { pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some(( KsmRelayLocation::get(), - MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(KsmRelayLocation::get()) }, + MultiAsset { fun: Fungible(UNITS), id: Concrete(KsmRelayLocation::get()) }, )); pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None; } @@ -667,7 +667,7 @@ impl_runtime_apis! { fn get_multi_asset() -> MultiAsset { MultiAsset { id: Concrete(KsmRelayLocation::get()), - fun: Fungible(1 * UNITS), + fun: Fungible(UNITS), } } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs index 7cf23e0610b..9d11b07e54e 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs @@ -33,8 +33,7 @@ const MAX_ASSETS: u64 = 100; impl WeighMultiAssets for MultiAssetFilter { fn weigh_multi_assets(&self, weight: Weight) -> Weight { match self { - Self::Definite(assets) => - weight.saturating_mul(assets.inner().into_iter().count() as u64), + Self::Definite(assets) => weight.saturating_mul(assets.inner().iter().count() as u64), Self::Wild(asset) => match asset { All => weight.saturating_mul(MAX_ASSETS), AllOf { fun, .. } => match fun { @@ -53,7 +52,7 @@ impl WeighMultiAssets for MultiAssetFilter { impl WeighMultiAssets for MultiAssets { fn weigh_multi_assets(&self, weight: Weight) -> Weight { - weight.saturating_mul(self.inner().into_iter().count() as u64) + weight.saturating_mul(self.inner().iter().count() as u64) } } @@ -65,7 +64,7 @@ impl XcmWeightInfo for BridgeHubKusamaXcmWeight { // Currently there is no trusted reserve fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight { // TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974 - Weight::from_parts(1_000_000_000 as u64, 0) + Weight::from_parts(1_000_000_000_u64, 0) } fn receive_teleported_asset(assets: &MultiAssets) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::receive_teleported_asset()) @@ -123,7 +122,7 @@ impl XcmWeightInfo for BridgeHubKusamaXcmWeight { fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_parts(1_000_000_000 as u64, 0); + let hardcoded_weight = Weight::from_parts(1_000_000_000_u64, 0); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::deposit_asset()); hardcoded_weight.min(weight) } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs index 7b395a4d4e3..5957b2ebbae 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs @@ -129,29 +129,28 @@ impl Contains for SafeCallFilter { } } - match call { + matches!( + call, RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) | - RuntimeCall::System( - frame_system::Call::set_heap_pages { .. } | - frame_system::Call::set_code { .. } | - frame_system::Call::set_code_without_checks { .. } | - frame_system::Call::kill_prefix { .. }, - ) | - RuntimeCall::ParachainSystem(..) | - RuntimeCall::Timestamp(..) | - RuntimeCall::Balances(..) | - RuntimeCall::CollatorSelection( - pallet_collator_selection::Call::set_desired_candidates { .. } | - pallet_collator_selection::Call::set_candidacy_bond { .. } | - pallet_collator_selection::Call::register_as_candidate { .. } | - pallet_collator_selection::Call::leave_intent { .. }, - ) | - RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | - RuntimeCall::XcmpQueue(..) | - RuntimeCall::DmpQueue(..) | - RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) => true, - _ => false, - } + RuntimeCall::System( + frame_system::Call::set_heap_pages { .. } | + frame_system::Call::set_code { .. } | + frame_system::Call::set_code_without_checks { .. } | + frame_system::Call::kill_prefix { .. }, + ) | RuntimeCall::ParachainSystem(..) | + RuntimeCall::Timestamp(..) | + RuntimeCall::Balances(..) | + RuntimeCall::CollatorSelection( + pallet_collator_selection::Call::set_desired_candidates { .. } | + pallet_collator_selection::Call::set_candidacy_bond { .. } | + pallet_collator_selection::Call::register_as_candidate { .. } | + pallet_collator_selection::Call::leave_intent { .. } | + pallet_collator_selection::Call::set_invulnerables { .. }, + ) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | + RuntimeCall::XcmpQueue(..) | + RuntimeCall::DmpQueue(..) | + RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) + ) } } @@ -261,6 +260,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/Cargo.toml b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/Cargo.toml index 3b42507b1da..0412e56112c 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/Cargo.toml +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/Cargo.toml @@ -13,7 +13,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features = hex-literal = { version = "0.4.1" } log = { version = "0.4.17", default-features = false } scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.160", optional = true, features = ["derive"] } +serde = { version = "1.0.162", optional = true, features = ["derive"] } smallvec = "1.8.1" # Substrate 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 dfc08b4c184..b701645ed17 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs @@ -254,7 +254,7 @@ impl pallet_balances::Config for Runtime { parameter_types! { /// Relay Chain `TransactionByteFee` / 10 - pub const TransactionByteFee: Balance = 1 * MILLICENTS; + pub const TransactionByteFee: Balance = MILLICENTS; } impl pallet_transaction_payment::Config for Runtime { @@ -615,7 +615,7 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( @@ -653,7 +653,7 @@ impl_runtime_apis! { parameter_types! { pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some(( DotRelayLocation::get(), - MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(DotRelayLocation::get()) }, + MultiAsset { fun: Fungible(UNITS), id: Concrete(DotRelayLocation::get()) }, )); pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None; } @@ -667,7 +667,7 @@ impl_runtime_apis! { fn get_multi_asset() -> MultiAsset { MultiAsset { id: Concrete(DotRelayLocation::get()), - fun: Fungible(1 * UNITS), + fun: Fungible(UNITS), } } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/mod.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/mod.rs index e9b1c70bf6a..27bdb510ba0 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/mod.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/mod.rs @@ -33,8 +33,7 @@ const MAX_ASSETS: u64 = 100; impl WeighMultiAssets for MultiAssetFilter { fn weigh_multi_assets(&self, weight: Weight) -> Weight { match self { - Self::Definite(assets) => - weight.saturating_mul(assets.inner().into_iter().count() as u64), + Self::Definite(assets) => weight.saturating_mul(assets.inner().iter().count() as u64), Self::Wild(asset) => match asset { All => weight.saturating_mul(MAX_ASSETS), AllOf { fun, .. } => match fun { @@ -53,7 +52,7 @@ impl WeighMultiAssets for MultiAssetFilter { impl WeighMultiAssets for MultiAssets { fn weigh_multi_assets(&self, weight: Weight) -> Weight { - weight.saturating_mul(self.inner().into_iter().count() as u64) + weight.saturating_mul(self.inner().iter().count() as u64) } } @@ -65,7 +64,7 @@ impl XcmWeightInfo for BridgeHubPolkadotXcmWeight { // Currently there is no trusted reserve fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight { // TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974 - Weight::from_parts(1_000_000_000 as u64, 0) + Weight::from_parts(1_000_000_000_u64, 0) } fn receive_teleported_asset(assets: &MultiAssets) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::receive_teleported_asset()) @@ -123,7 +122,7 @@ impl XcmWeightInfo for BridgeHubPolkadotXcmWeight { fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_parts(1_000_000_000 as u64, 0); + let hardcoded_weight = Weight::from_parts(1_000_000_000_u64, 0); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::deposit_asset()); hardcoded_weight.min(weight) } @@ -150,7 +149,7 @@ impl XcmWeightInfo for BridgeHubPolkadotXcmWeight { _xcm: &Xcm<()>, ) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_parts(200_000_000 as u64, 0); + let hardcoded_weight = Weight::from_parts(200_000_000_u64, 0); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::initiate_teleport()); hardcoded_weight.min(weight) } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs index d063fda2c13..7b34b5e135b 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs @@ -132,29 +132,28 @@ impl Contains for SafeCallFilter { } } - match call { + matches!( + call, RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) | - RuntimeCall::System( - frame_system::Call::set_heap_pages { .. } | - frame_system::Call::set_code { .. } | - frame_system::Call::set_code_without_checks { .. } | - frame_system::Call::kill_prefix { .. }, - ) | - RuntimeCall::ParachainSystem(..) | - RuntimeCall::Timestamp(..) | - RuntimeCall::Balances(..) | - RuntimeCall::CollatorSelection( - pallet_collator_selection::Call::set_desired_candidates { .. } | - pallet_collator_selection::Call::set_candidacy_bond { .. } | - pallet_collator_selection::Call::register_as_candidate { .. } | - pallet_collator_selection::Call::leave_intent { .. }, - ) | - RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | - RuntimeCall::XcmpQueue(..) | - RuntimeCall::DmpQueue(..) | - RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) => true, - _ => false, - } + RuntimeCall::System( + frame_system::Call::set_heap_pages { .. } | + frame_system::Call::set_code { .. } | + frame_system::Call::set_code_without_checks { .. } | + frame_system::Call::kill_prefix { .. }, + ) | RuntimeCall::ParachainSystem(..) | + RuntimeCall::Timestamp(..) | + RuntimeCall::Balances(..) | + RuntimeCall::CollatorSelection( + pallet_collator_selection::Call::set_desired_candidates { .. } | + pallet_collator_selection::Call::set_candidacy_bond { .. } | + pallet_collator_selection::Call::register_as_candidate { .. } | + pallet_collator_selection::Call::leave_intent { .. } | + pallet_collator_selection::Call::set_invulnerables { .. }, + ) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | + RuntimeCall::XcmpQueue(..) | + RuntimeCall::DmpQueue(..) | + RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) + ) } } @@ -264,6 +263,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml index 5722136abb0..adcc2c02813 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml @@ -13,7 +13,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features = hex-literal = { version = "0.4.1" } log = { version = "0.4.17", default-features = false } scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.160", optional = true, features = ["derive"] } +serde = { version = "1.0.162", optional = true, features = ["derive"] } smallvec = "1.8.1" # Substrate 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 21f02ce4765..15e34472fc6 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -274,7 +274,7 @@ impl pallet_balances::Config for Runtime { parameter_types! { /// Relay Chain `TransactionByteFee` / 10 - pub const TransactionByteFee: Balance = 1 * MILLICENTS; + pub const TransactionByteFee: Balance = MILLICENTS; } impl pallet_transaction_payment::Config for Runtime { @@ -888,7 +888,7 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( @@ -926,7 +926,7 @@ impl_runtime_apis! { parameter_types! { pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some(( RelayLocation::get(), - MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(RelayLocation::get()) }, + MultiAsset { fun: Fungible(UNITS), id: Concrete(RelayLocation::get()) }, )); pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None; } @@ -940,7 +940,7 @@ impl_runtime_apis! { fn get_multi_asset() -> MultiAsset { MultiAsset { id: Concrete(RelayLocation::get()), - fun: Fungible(1 * UNITS), + fun: Fungible(UNITS), } } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs index a0aaac56f5a..9efbef18363 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs @@ -34,8 +34,7 @@ const MAX_ASSETS: u64 = 100; impl WeighMultiAssets for MultiAssetFilter { fn weigh_multi_assets(&self, weight: Weight) -> Weight { match self { - Self::Definite(assets) => - weight.saturating_mul(assets.inner().into_iter().count() as u64), + Self::Definite(assets) => weight.saturating_mul(assets.inner().iter().count() as u64), Self::Wild(asset) => match asset { All => weight.saturating_mul(MAX_ASSETS), AllOf { fun, .. } => match fun { @@ -54,7 +53,7 @@ impl WeighMultiAssets for MultiAssetFilter { impl WeighMultiAssets for MultiAssets { fn weigh_multi_assets(&self, weight: Weight) -> Weight { - weight.saturating_mul(self.inner().into_iter().count() as u64) + weight.saturating_mul(self.inner().iter().count() as u64) } } @@ -66,7 +65,7 @@ impl XcmWeightInfo for BridgeHubRococoXcmWeight { // Currently there is no trusted reserve fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight { // TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974 - Weight::from_parts(1_000_000_000 as u64, 0) + Weight::from_parts(1_000_000_000_u64, 0) } fn receive_teleported_asset(assets: &MultiAssets) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::receive_teleported_asset()) @@ -124,7 +123,7 @@ impl XcmWeightInfo for BridgeHubRococoXcmWeight { fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_parts(1_000_000_000 as u64, 0); + let hardcoded_weight = Weight::from_parts(1_000_000_000_u64, 0); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::deposit_asset()); hardcoded_weight.min(weight) } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs index 0773dca274e..fe5873f7e11 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs @@ -347,11 +347,11 @@ impl WeightInfo { // Storage: BridgeWococoMessages OutboundMessages (r:0 w:1) // Proof: BridgeWococoMessages OutboundMessages (max_values: None, max_size: Some(2621472), added: 2623947, mode: MaxEncodedLen) pub(crate) fn export_message(x: u32, ) -> Weight { - Weight::from_parts(31_677_716 as u64, 0) + Weight::from_parts(31_677_716_u64, 0) // Standard Error: 4_158 .saturating_add(Weight::from_parts(123_901, 0).saturating_mul(x as u64)) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } pub fn unpaid_execution() -> Weight { // Proof Size summary in bytes: diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs index 91fd15136bb..c8a4c42af0e 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs @@ -152,41 +152,36 @@ impl Contains for SafeCallFilter { } } - match call { + matches!( + call, RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) | - RuntimeCall::System( - frame_system::Call::set_heap_pages { .. } | - frame_system::Call::set_code { .. } | - frame_system::Call::set_code_without_checks { .. } | - frame_system::Call::kill_prefix { .. }, - ) | - RuntimeCall::ParachainSystem(..) | - RuntimeCall::Timestamp(..) | - RuntimeCall::Balances(..) | - RuntimeCall::CollatorSelection( - pallet_collator_selection::Call::set_desired_candidates { .. } | - pallet_collator_selection::Call::set_candidacy_bond { .. } | - pallet_collator_selection::Call::register_as_candidate { .. } | - pallet_collator_selection::Call::leave_intent { .. }, - ) | - RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | - RuntimeCall::XcmpQueue(..) | - RuntimeCall::DmpQueue(..) | - RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) | - RuntimeCall::BridgeRococoGrandpa(pallet_bridge_grandpa::Call::< - Runtime, - BridgeGrandpaRococoInstance, - >::initialize { - .. - }) | - RuntimeCall::BridgeWococoGrandpa(pallet_bridge_grandpa::Call::< - Runtime, - BridgeGrandpaWococoInstance, - >::initialize { - .. - }) => true, - _ => false, - } + RuntimeCall::System( + frame_system::Call::set_heap_pages { .. } | + frame_system::Call::set_code { .. } | + frame_system::Call::set_code_without_checks { .. } | + frame_system::Call::kill_prefix { .. }, + ) | RuntimeCall::ParachainSystem(..) | + RuntimeCall::Timestamp(..) | + RuntimeCall::Balances(..) | + RuntimeCall::CollatorSelection( + pallet_collator_selection::Call::set_desired_candidates { .. } | + pallet_collator_selection::Call::set_candidacy_bond { .. } | + pallet_collator_selection::Call::register_as_candidate { .. } | + pallet_collator_selection::Call::leave_intent { .. } | + pallet_collator_selection::Call::set_invulnerables { .. }, + ) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | + RuntimeCall::XcmpQueue(..) | + RuntimeCall::DmpQueue(..) | + RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) | + RuntimeCall::BridgeRococoGrandpa(pallet_bridge_grandpa::Call::< + Runtime, + BridgeGrandpaRococoInstance, + >::initialize { .. }) | + RuntimeCall::BridgeWococoGrandpa(pallet_bridge_grandpa::Call::< + Runtime, + BridgeGrandpaWococoInstance, + >::initialize { .. }) + ) } } @@ -298,6 +293,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { 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 5cdc2af9968..5f419fe789f 100644 --- a/parachains/runtimes/bridge-hubs/test-utils/src/test_cases.rs +++ b/parachains/runtimes/bridge-hubs/test-utils/src/test_cases.rs @@ -166,7 +166,7 @@ pub fn handle_export_message_from_system_parachain_to_outbound_queue_works< // check queue before assert_eq!( pallet_bridge_messages::OutboundLanes::::try_get( - &expected_lane_id + expected_lane_id ), Err(()) ); @@ -190,7 +190,7 @@ pub fn handle_export_message_from_system_parachain_to_outbound_queue_works< // check queue after assert_eq!( pallet_bridge_messages::OutboundLanes::::try_get( - &expected_lane_id + expected_lane_id ), Ok(OutboundLaneData { oldest_unpruned_nonce: 1, @@ -243,8 +243,8 @@ macro_rules! include_handle_export_message_from_system_parachain_to_outbound_que /// Test-case makes sure that Runtime can route XCM messages received in inbound queue, /// We just test here `MessageDispatch` configuration. /// We expect that runtime can route messages: -/// 1. to Parent (relay chain) -/// 2. to Sibling parachain +/// 1. to Parent (relay chain) +/// 2. to Sibling parachain pub fn message_dispatch_routing_works< Runtime, XcmConfig, diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/migration.rs b/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/migration.rs index 5056abb2e22..71ad62f70b3 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/migration.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/migration.rs @@ -27,7 +27,7 @@ pub(crate) mod import_kusama_fellowship { #[cfg(feature = "try-runtime")] use sp_std::vec::Vec; - const TARGET: &'static str = "runtime::migration::import_fellowship"; + const TARGET: &str = "runtime::migration::import_fellowship"; parameter_types! { // The Fellowship addresses from Kusama state. @@ -250,7 +250,7 @@ pub mod tests { assert!(IdToIndex::::get(0, &who).is_some()); assert!(IdToIndex::::get(rank + 1, &who).is_none()); let index = IdToIndex::::get(rank, &who).unwrap(); - assert_eq!(IndexToId::::get(rank, &index).unwrap(), who); + assert_eq!(IndexToId::::get(rank, index).unwrap(), who); assert_eq!( Members::::get(&who).unwrap(), MemberRecord::new(rank) diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/tracks.rs b/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/tracks.rs index 5d75bde9e18..1f728279485 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/tracks.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/tracks.rs @@ -54,7 +54,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -76,7 +76,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -98,7 +98,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -120,7 +120,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -142,7 +142,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -160,11 +160,11 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "experts", max_deciding: 10, - decision_deposit: 1 * DOLLARS, + decision_deposit: DOLLARS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -182,11 +182,11 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "senior experts", max_deciding: 10, - decision_deposit: 1 * DOLLARS, + decision_deposit: DOLLARS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -204,11 +204,11 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "masters", max_deciding: 10, - decision_deposit: 1 * DOLLARS, + decision_deposit: DOLLARS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -226,11 +226,11 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "senior masters", max_deciding: 10, - decision_deposit: 1 * DOLLARS, + decision_deposit: DOLLARS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -248,11 +248,11 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "grand masters", max_deciding: 10, - decision_deposit: 1 * DOLLARS, + decision_deposit: DOLLARS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/impls.rs b/parachains/runtimes/collectives/collectives-polkadot/src/impls.rs index f70fb30bff7..3b45d2824d9 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/impls.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/impls.rs @@ -59,7 +59,7 @@ where let pallet_acc: AccountIdOf = PalletAccount::get(); let treasury_acc: AccountIdOf = TreasuryAccount::get(); - >::resolve_creating(&pallet_acc.clone(), amount); + >::resolve_creating(&pallet_acc, amount); let result = >::teleport_assets( <::RuntimeOrigin>::signed(pallet_acc.into()), @@ -73,10 +73,9 @@ where 0, ); - match result { - Err(err) => log::warn!("Failed to teleport slashed assets: {:?}", err), - _ => (), - }; + if let Err(err) = result { + log::warn!("Failed to teleport slashed assets: {:?}", err); + } } } diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs b/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs index e0f95cb052b..b902e694a15 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs @@ -216,7 +216,7 @@ impl pallet_balances::Config for Runtime { parameter_types! { /// Relay Chain `TransactionByteFee` / 10 - pub const TransactionByteFee: Balance = 1 * MILLICENTS; + pub const TransactionByteFee: Balance = MILLICENTS; } impl pallet_transaction_payment::Config for Runtime { @@ -843,7 +843,7 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( @@ -899,7 +899,7 @@ impl cumulus_pallet_parachain_system::CheckInherents for CheckInherents { .create_inherent_data() .expect("Could not create the timestamp inherent data"); - inherent_data.check_extrinsics(&block) + inherent_data.check_extrinsics(block) } } diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/xcm_config.rs b/parachains/runtimes/collectives/collectives-polkadot/src/xcm_config.rs index b2b93d88ffe..5bc781c6aae 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/xcm_config.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/xcm_config.rs @@ -137,58 +137,55 @@ impl Contains for SafeCallFilter { } } - match call { + matches!( + call, RuntimeCall::System( frame_system::Call::set_heap_pages { .. } | - frame_system::Call::set_code { .. } | - frame_system::Call::set_code_without_checks { .. } | - frame_system::Call::kill_prefix { .. }, - ) | - RuntimeCall::ParachainSystem(..) | - RuntimeCall::Timestamp(..) | - RuntimeCall::Balances(..) | - RuntimeCall::CollatorSelection( - pallet_collator_selection::Call::set_desired_candidates { .. } | - pallet_collator_selection::Call::set_candidacy_bond { .. } | - pallet_collator_selection::Call::register_as_candidate { .. } | - pallet_collator_selection::Call::leave_intent { .. }, - ) | - RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | - RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) | - RuntimeCall::XcmpQueue(..) | - RuntimeCall::DmpQueue(..) | - RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) | - RuntimeCall::Alliance( - // `init_members` accepts unbounded vecs as arguments, - // but the call can be initiated only by root origin. - pallet_alliance::Call::init_members { .. } | - pallet_alliance::Call::vote { .. } | - pallet_alliance::Call::disband { .. } | - pallet_alliance::Call::set_rule { .. } | - pallet_alliance::Call::announce { .. } | - pallet_alliance::Call::remove_announcement { .. } | - pallet_alliance::Call::join_alliance { .. } | - pallet_alliance::Call::nominate_ally { .. } | - pallet_alliance::Call::elevate_ally { .. } | - pallet_alliance::Call::give_retirement_notice { .. } | - pallet_alliance::Call::retire { .. } | - pallet_alliance::Call::kick_member { .. } | - pallet_alliance::Call::close { .. } | - pallet_alliance::Call::abdicate_fellow_status { .. }, - ) | - RuntimeCall::AllianceMotion( + frame_system::Call::set_code { .. } | + frame_system::Call::set_code_without_checks { .. } | + frame_system::Call::kill_prefix { .. }, + ) | RuntimeCall::ParachainSystem(..) | + RuntimeCall::Timestamp(..) | + RuntimeCall::Balances(..) | + RuntimeCall::CollatorSelection( + pallet_collator_selection::Call::set_desired_candidates { .. } | + pallet_collator_selection::Call::set_candidacy_bond { .. } | + pallet_collator_selection::Call::register_as_candidate { .. } | + pallet_collator_selection::Call::leave_intent { .. } | + pallet_collator_selection::Call::set_invulnerables { .. }, + ) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | + RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) | + RuntimeCall::XcmpQueue(..) | + RuntimeCall::DmpQueue(..) | + RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) | + RuntimeCall::Alliance( + // `init_members` accepts unbounded vecs as arguments, + // but the call can be initiated only by root origin. + pallet_alliance::Call::init_members { .. } | + pallet_alliance::Call::vote { .. } | + pallet_alliance::Call::disband { .. } | + pallet_alliance::Call::set_rule { .. } | + pallet_alliance::Call::announce { .. } | + pallet_alliance::Call::remove_announcement { .. } | + pallet_alliance::Call::join_alliance { .. } | + pallet_alliance::Call::nominate_ally { .. } | + pallet_alliance::Call::elevate_ally { .. } | + pallet_alliance::Call::give_retirement_notice { .. } | + pallet_alliance::Call::retire { .. } | + pallet_alliance::Call::kick_member { .. } | + pallet_alliance::Call::close { .. } | + pallet_alliance::Call::abdicate_fellow_status { .. }, + ) | RuntimeCall::AllianceMotion( pallet_collective::Call::vote { .. } | - pallet_collective::Call::disapprove_proposal { .. } | - pallet_collective::Call::close { .. }, - ) | - RuntimeCall::FellowshipCollective( + pallet_collective::Call::disapprove_proposal { .. } | + pallet_collective::Call::close { .. }, + ) | RuntimeCall::FellowshipCollective( pallet_ranked_collective::Call::add_member { .. } | - pallet_ranked_collective::Call::promote_member { .. } | - pallet_ranked_collective::Call::demote_member { .. } | - pallet_ranked_collective::Call::remove_member { .. }, - ) => true, - _ => false, - } + pallet_ranked_collective::Call::promote_member { .. } | + pallet_ranked_collective::Call::demote_member { .. } | + pallet_ranked_collective::Call::remove_member { .. }, + ) + ) } } @@ -294,6 +291,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/parachains/runtimes/contracts/contracts-rococo/src/lib.rs b/parachains/runtimes/contracts/contracts-rococo/src/lib.rs index adeee2b5229..2718484fed6 100644 --- a/parachains/runtimes/contracts/contracts-rococo/src/lib.rs +++ b/parachains/runtimes/contracts/contracts-rococo/src/lib.rs @@ -639,7 +639,7 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( diff --git a/parachains/runtimes/contracts/contracts-rococo/src/xcm_config.rs b/parachains/runtimes/contracts/contracts-rococo/src/xcm_config.rs index 1b42819b423..e79d06b1aa1 100644 --- a/parachains/runtimes/contracts/contracts-rococo/src/xcm_config.rs +++ b/parachains/runtimes/contracts/contracts-rococo/src/xcm_config.rs @@ -213,6 +213,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/parachains/runtimes/starters/shell/src/lib.rs b/parachains/runtimes/starters/shell/src/lib.rs index a05a78863c4..fc87a26f8ee 100644 --- a/parachains/runtimes/starters/shell/src/lib.rs +++ b/parachains/runtimes/starters/shell/src/lib.rs @@ -222,7 +222,7 @@ impl sp_runtime::traits::SignedExtension for DisallowSigned { info: &DispatchInfoOf, len: usize, ) -> Result { - Ok(self.validate(who, call, info, len).map(|_| ())?) + self.validate(who, call, info, len).map(|_| ()) } fn validate( &self, diff --git a/parachains/runtimes/testing/penpal/src/lib.rs b/parachains/runtimes/testing/penpal/src/lib.rs index 7ade3bd2f63..5a5cb423d43 100644 --- a/parachains/runtimes/testing/penpal/src/lib.rs +++ b/parachains/runtimes/testing/penpal/src/lib.rs @@ -783,7 +783,7 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( diff --git a/parachains/runtimes/testing/penpal/src/xcm_config.rs b/parachains/runtimes/testing/penpal/src/xcm_config.rs index 89cfc2ced65..849b0a690a9 100644 --- a/parachains/runtimes/testing/penpal/src/xcm_config.rs +++ b/parachains/runtimes/testing/penpal/src/xcm_config.rs @@ -225,12 +225,12 @@ pub trait Reserve { // Takes the chain part of a MultiAsset impl Reserve for MultiAsset { fn reserve(&self) -> Option { - if let AssetId::Concrete(location) = self.id.clone() { + if let AssetId::Concrete(location) = self.id { let first_interior = location.first_interior(); let parents = location.parent_count(); - match (parents, first_interior.clone()) { - (0, Some(Parachain(id))) => Some(MultiLocation::new(0, X1(Parachain(id.clone())))), - (1, Some(Parachain(id))) => Some(MultiLocation::new(1, X1(Parachain(id.clone())))), + match (parents, first_interior) { + (0, Some(Parachain(id))) => Some(MultiLocation::new(0, X1(Parachain(*id)))), + (1, Some(Parachain(id))) => Some(MultiLocation::new(1, X1(Parachain(*id)))), (1, _) => Some(MultiLocation::parent()), _ => None, } @@ -339,6 +339,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/parachains/runtimes/testing/rococo-parachain/src/lib.rs b/parachains/runtimes/testing/rococo-parachain/src/lib.rs index 1a26290f2a3..4d539f050e1 100644 --- a/parachains/runtimes/testing/rococo-parachain/src/lib.rs +++ b/parachains/runtimes/testing/rococo-parachain/src/lib.rs @@ -219,10 +219,10 @@ impl pallet_timestamp::Config for Runtime { } parameter_types! { - pub const ExistentialDeposit: u128 = 1 * MILLIROC; - pub const TransferFee: u128 = 1 * MILLIROC; - pub const CreationFee: u128 = 1 * MILLIROC; - pub const TransactionByteFee: u128 = 1 * MICROROC; + pub const ExistentialDeposit: u128 = MILLIROC; + pub const TransferFee: u128 = MILLIROC; + pub const CreationFee: u128 = MILLIROC; + pub const TransactionByteFee: u128 = MICROROC; } impl pallet_balances::Config for Runtime { @@ -470,6 +470,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { @@ -503,11 +505,11 @@ impl cumulus_ping::Config for Runtime { } parameter_types! { - pub const AssetDeposit: Balance = 1 * ROC; - pub const AssetAccountDeposit: Balance = 1 * ROC; + pub const AssetDeposit: Balance = ROC; + pub const AssetAccountDeposit: Balance = ROC; pub const ApprovalDeposit: Balance = 100 * MILLIROC; pub const AssetsStringLimit: u32 = 50; - pub const MetadataDepositBase: Balance = 1 * ROC; + pub const MetadataDepositBase: Balance = ROC; pub const MetadataDepositPerByte: Balance = 10 * MILLIROC; pub const UnitBody: BodyId = BodyId::Unit; } diff --git a/polkadot-parachain/Cargo.toml b/polkadot-parachain/Cargo.toml index 7dc9d6e27f0..78f5fc83dab 100644 --- a/polkadot-parachain/Cargo.toml +++ b/polkadot-parachain/Cargo.toml @@ -17,7 +17,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0" } futures = "0.3.28" hex-literal = "0.4.1" log = "0.4.17" -serde = { version = "1.0.160", features = ["derive"] } +serde = { version = "1.0.162", features = ["derive"] } # Local rococo-parachain-runtime = { path = "../parachains/runtimes/testing/rococo-parachain" } diff --git a/polkadot-parachain/src/chain_spec/bridge_hubs.rs b/polkadot-parachain/src/chain_spec/bridge_hubs.rs index e11f7f6e53f..e8f7d9d065d 100644 --- a/polkadot-parachain/src/chain_spec/bridge_hubs.rs +++ b/polkadot-parachain/src/chain_spec/bridge_hubs.rs @@ -272,7 +272,7 @@ pub mod rococo { para_id, bridges_pallet_owner_seed .as_ref() - .map(|seed| get_account_id_from_seed::(&seed)), + .map(|seed| get_account_id_from_seed::(seed)), ) }, Vec::new(), diff --git a/polkadot-parachain/src/command.rs b/polkadot-parachain/src/command.rs index 52a742f1527..32986b522ca 100644 --- a/polkadot-parachain/src/command.rs +++ b/polkadot-parachain/src/command.rs @@ -85,7 +85,7 @@ impl RuntimeResolver for PathBuf { } fn runtime(id: &str) -> Runtime { - let id = id.replace("_", "-"); + let id = id.replace('_', "-"); let (_, id, para_id) = extract_parachain_id(&id); if id.starts_with("shell") { @@ -240,7 +240,7 @@ fn load_spec(id: &str) -> std::result::Result, String> { Runtime::ContractsRococo => Box::new(chain_spec::contracts::ContractsRococoChainSpec::from_json_file(path)?), Runtime::BridgeHub(bridge_hub_runtime_type) => - bridge_hub_runtime_type.chain_spec_from_json_file(path.into())?, + bridge_hub_runtime_type.chain_spec_from_json_file(path)?, Runtime::Penpal(_para_id) => Box::new(chain_spec::penpal::PenpalChainSpec::from_json_file(path)?), Runtime::Default => Box::new( @@ -258,12 +258,10 @@ fn extract_parachain_id(id: &str) -> (&str, &str, Option) { const KUSAMA_TEST_PARA_PREFIX: &str = "penpal-kusama-"; const POLKADOT_TEST_PARA_PREFIX: &str = "penpal-polkadot-"; - let (norm_id, orig_id, para) = if id.starts_with(KUSAMA_TEST_PARA_PREFIX) { - let suffix = &id[KUSAMA_TEST_PARA_PREFIX.len()..]; + let (norm_id, orig_id, para) = if let Some(suffix) = id.strip_prefix(KUSAMA_TEST_PARA_PREFIX) { let para_id: u32 = suffix.parse().expect("Invalid parachain-id suffix"); (&id[..KUSAMA_TEST_PARA_PREFIX.len() - 1], id, Some(para_id)) - } else if id.starts_with(POLKADOT_TEST_PARA_PREFIX) { - let suffix = &id[POLKADOT_TEST_PARA_PREFIX.len()..]; + } else if let Some(suffix) = id.strip_prefix(POLKADOT_TEST_PARA_PREFIX) { let para_id: u32 = suffix.parse().expect("Invalid parachain-id suffix"); (&id[..POLKADOT_TEST_PARA_PREFIX.len() - 1], id, Some(para_id)) } else { @@ -813,13 +811,13 @@ pub fn run() -> Result<()> { runner.run_node_until_exit(|config| async move { let hwbench = (!cli.no_hardware_benchmarks).then_some( config.database.path().map(|database_path| { - let _ = std::fs::create_dir_all(&database_path); + let _ = std::fs::create_dir_all(database_path); sc_sysinfo::gather_hwbench(Some(database_path)) })).flatten(); let para_id = chain_spec::Extensions::try_get(&*config.chain_spec) .map(|e| e.para_id) - .ok_or_else(|| "Could not find parachain extension in chain-spec.")?; + .ok_or("Could not find parachain extension in chain-spec.")?; let polkadot_cli = RelayChainCli::new( &config, @@ -848,7 +846,7 @@ pub fn run() -> Result<()> { 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.len() > 0 { + 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."); } diff --git a/polkadot-parachain/src/rpc.rs b/polkadot-parachain/src/rpc.rs index 43752fd8d12..c2eeaf38608 100644 --- a/polkadot-parachain/src/rpc.rs +++ b/polkadot-parachain/src/rpc.rs @@ -70,7 +70,7 @@ where module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?; module.merge(TransactionPayment::new(client.clone()).into_rpc())?; - module.merge(StateMigration::new(client.clone(), backend, deny_unsafe).into_rpc())?; + module.merge(StateMigration::new(client, backend, deny_unsafe).into_rpc())?; Ok(module) } diff --git a/polkadot-parachain/src/service.rs b/polkadot-parachain/src/service.rs index 803d0987844..c8370d070a6 100644 --- a/polkadot-parachain/src/service.rs +++ b/polkadot-parachain/src/service.rs @@ -858,7 +858,7 @@ where sc_client_api::StateBackendFor: sp_api::StateBackend, { cumulus_client_consensus_relay_chain::import_queue( - client.clone(), + client, block_import, |_, _| async { Ok(()) }, &task_manager.spawn_essential_handle(), @@ -1103,7 +1103,7 @@ where Box::new(RelayChainVerifier::new(client.clone(), |_, _| async { Ok(()) })) as Box<_>; let verifier = Verifier { - client: client.clone(), + client, relay_chain_verifier, aura_verifier: BuildOnAccess::Uninitialized(Some(Box::new(aura_verifier))), _phantom: PhantomData, diff --git a/polkadot-parachain/tests/benchmark_storage_works.rs b/polkadot-parachain/tests/benchmark_storage_works.rs index 916d65c0a1b..b1c05609217 100644 --- a/polkadot-parachain/tests/benchmark_storage_works.rs +++ b/polkadot-parachain/tests/benchmark_storage_works.rs @@ -8,7 +8,7 @@ use std::{ use tempfile::tempdir; /// The runtimes that this command supports. -static RUNTIMES: [&'static str; 3] = ["westmint", "statemine", "statemint"]; +static RUNTIMES: [&str; 3] = ["westmint", "statemine", "statemint"]; /// The `benchmark storage` command works for the dev runtimes. #[test] @@ -31,7 +31,7 @@ fn benchmark_storage_works() { /// Invoke the `benchmark storage` sub-command for the given database and runtime. fn benchmark_storage(db: &str, runtime: &str, base_path: &Path) -> ExitStatus { Command::new(cargo_bin("polkadot-parachain")) - .args(&["benchmark", "storage", "--chain", runtime]) + .args(["benchmark", "storage", "--chain", runtime]) .arg("--db") .arg(db) .arg("--weight-path") diff --git a/polkadot-parachain/tests/common.rs b/polkadot-parachain/tests/common.rs index 71b7fb42cd2..d8ecfe9bcbe 100644 --- a/polkadot-parachain/tests/common.rs +++ b/polkadot-parachain/tests/common.rs @@ -117,12 +117,12 @@ pub fn find_ws_url_from_output(read: impl Read + Send) -> (String, String) { line.expect("failed to obtain next line from stdout for WS address discovery"); data.push_str(&line); - data.push_str("\n"); + data.push('\n'); // does the line contain our port (we expect this specific output from substrate). let sock_addr = match line.split_once("Running JSON-RPC server: addr=") { None => return None, - Some((_, after)) => after.split_once(",").unwrap().0, + Some((_, after)) => after.split_once(',').unwrap().0, }; Some(format!("ws://{}", sock_addr)) diff --git a/polkadot-parachain/tests/purge_chain_works.rs b/polkadot-parachain/tests/purge_chain_works.rs index 34a51dcff84..2f4609273da 100644 --- a/polkadot-parachain/tests/purge_chain_works.rs +++ b/polkadot-parachain/tests/purge_chain_works.rs @@ -38,7 +38,7 @@ async fn purge_chain_works() { assert!(base_dir.path().join("polkadot/chains/dev/db/full").exists()); let status = Command::new(cargo_bin("polkadot-parachain")) - .args(&["purge-chain", "-d"]) + .args(["purge-chain", "-d"]) .arg(base_dir.path()) .arg("-y") .status() diff --git a/primitives/parachain-inherent/src/client_side.rs b/primitives/parachain-inherent/src/client_side.rs index 6f2cd5eb504..1a1506dcbbd 100644 --- a/primitives/parachain-inherent/src/client_side.rs +++ b/primitives/parachain-inherent/src/client_side.rs @@ -92,18 +92,19 @@ async fn collect_relay_storage_proof( .ok()? .unwrap_or_default(); - let mut relevant_keys = Vec::new(); - relevant_keys.push(relay_well_known_keys::CURRENT_BLOCK_RANDOMNESS.to_vec()); - relevant_keys.push(relay_well_known_keys::ONE_EPOCH_AGO_RANDOMNESS.to_vec()); - relevant_keys.push(relay_well_known_keys::TWO_EPOCHS_AGO_RANDOMNESS.to_vec()); - relevant_keys.push(relay_well_known_keys::CURRENT_SLOT.to_vec()); - relevant_keys.push(relay_well_known_keys::ACTIVE_CONFIG.to_vec()); - relevant_keys.push(relay_well_known_keys::dmq_mqc_head(para_id)); - relevant_keys.push(relay_well_known_keys::relay_dispatch_queue_size(para_id)); - relevant_keys.push(relay_well_known_keys::hrmp_ingress_channel_index(para_id)); - relevant_keys.push(relay_well_known_keys::hrmp_egress_channel_index(para_id)); - relevant_keys.push(relay_well_known_keys::upgrade_go_ahead_signal(para_id)); - relevant_keys.push(relay_well_known_keys::upgrade_restriction_signal(para_id)); + let mut relevant_keys = vec![ + relay_well_known_keys::CURRENT_BLOCK_RANDOMNESS.to_vec(), + relay_well_known_keys::ONE_EPOCH_AGO_RANDOMNESS.to_vec(), + relay_well_known_keys::TWO_EPOCHS_AGO_RANDOMNESS.to_vec(), + relay_well_known_keys::CURRENT_SLOT.to_vec(), + relay_well_known_keys::ACTIVE_CONFIG.to_vec(), + relay_well_known_keys::dmq_mqc_head(para_id), + relay_well_known_keys::relay_dispatch_queue_size(para_id), + relay_well_known_keys::hrmp_ingress_channel_index(para_id), + relay_well_known_keys::hrmp_egress_channel_index(para_id), + relay_well_known_keys::upgrade_go_ahead_signal(para_id), + relay_well_known_keys::upgrade_restriction_signal(para_id), + ]; relevant_keys.extend(ingress_channels.into_iter().map(|sender| { relay_well_known_keys::hrmp_channels(HrmpChannelId { sender, recipient: para_id }) })); diff --git a/primitives/parachain-inherent/src/mock.rs b/primitives/parachain-inherent/src/mock.rs index a26ee114ef7..00dff40800f 100644 --- a/primitives/parachain-inherent/src/mock.rs +++ b/primitives/parachain-inherent/src/mock.rs @@ -160,8 +160,8 @@ impl> InherentDataProvider self.relay_offset + self.relay_blocks_per_para_block * self.current_para_block; // Use the "sproof" (spoof proof) builder to build valid mock state root and proof. - let mut sproof_builder = RelayStateSproofBuilder::default(); - sproof_builder.para_id = self.xcm_config.para_id; + let mut sproof_builder = + RelayStateSproofBuilder { para_id: self.xcm_config.para_id, ..Default::default() }; // Process the downward messages and set up the correct head let mut downward_messages = Vec::new(); diff --git a/primitives/timestamp/src/lib.rs b/primitives/timestamp/src/lib.rs index ddc2fe340dd..932656d9b0f 100644 --- a/primitives/timestamp/src/lib.rs +++ b/primitives/timestamp/src/lib.rs @@ -99,7 +99,7 @@ mod tests { relay_parent_number: 1, relay_parent_storage_root, }, - &WASM_BINARY.expect("You need to build the WASM binaries to run the tests!"), + WASM_BINARY.expect("You need to build the WASM binaries to run the tests!"), ) .map(|v| Header::decode(&mut &v.head_data.0[..]).expect("Decodes `Header`.")) } @@ -175,7 +175,7 @@ mod tests { (slot_timestamp * 10, false), ] { let output = Command::new(env::current_exe().unwrap()) - .args(&["check_timestamp_inherent_works", "--", "--nocapture"]) + .args(["check_timestamp_inherent_works", "--", "--nocapture"]) .env("RUN_TEST", "1") .env("TIMESTAMP", timestamp.to_string()) .output() diff --git a/primitives/utility/src/lib.rs b/primitives/utility/src/lib.rs index d3a7c77aed2..e71eab178a8 100644 --- a/primitives/utility/src/lib.rs +++ b/primitives/utility/src/lib.rs @@ -163,7 +163,7 @@ impl< // Get the local asset id in which we can pay for fees let (local_asset_id, _) = - Matcher::matches_fungibles(&first).map_err(|_| XcmError::AssetNotFound)?; + Matcher::matches_fungibles(first).map_err(|_| XcmError::AssetNotFound)?; // Calculate how much we should charge in the asset_id for such amount of weight // Require at least a payment of minimum_balance @@ -181,7 +181,7 @@ impl< .map_err(|_| XcmError::Overflow)?; // Convert to the same kind of multiasset, with the required fungible balance - let required = first.id.clone().into_multiasset(asset_balance.into()); + let required = first.id.into_multiasset(asset_balance.into()); // Substract payment let unused = payment.checked_sub(required.clone()).map_err(|_| XcmError::TooExpensive)?; @@ -204,7 +204,7 @@ impl< { // Get the local asset id in which we can refund fees let (local_asset_id, outstanding_balance) = - Matcher::matches_fungibles(&(id.clone(), fun).into()).ok()?; + Matcher::matches_fungibles(&(id, fun).into()).ok()?; let minimum_balance = ConcreteAssets::minimum_balance(local_asset_id); @@ -233,8 +233,7 @@ impl< let asset_balance: u128 = asset_balance.saturated_into(); // Construct outstanding_concrete_asset with the same location id and substracted balance - let outstanding_concrete_asset: MultiAsset = - (id.clone(), outstanding_minus_substracted).into(); + let outstanding_concrete_asset: MultiAsset = (id, outstanding_minus_substracted).into(); // Substract from existing weight and balance weight_outstanding = weight_outstanding.saturating_sub(weight); @@ -365,7 +364,7 @@ mod tests { // ParentAsUmp - check dest is really not applicable let dest = (Parent, Parent, Parent); - let mut dest_wrapper = Some(dest.clone().into()); + let mut dest_wrapper = Some(dest.into()); let mut msg_wrapper = Some(message.clone()); assert_eq!( Err(SendError::NotApplicable), @@ -373,7 +372,7 @@ mod tests { ); // check wrapper were not consumed - assert_eq!(Some(dest.clone().into()), dest_wrapper.take()); + assert_eq!(Some(dest.into()), dest_wrapper.take()); assert_eq!(Some(message.clone()), msg_wrapper.take()); // another try with router chain with asserting sender @@ -393,7 +392,7 @@ mod tests { // ParentAsUmp - check dest/msg is valid let dest = (Parent, Here); - let mut dest_wrapper = Some(dest.clone().into()); + let mut dest_wrapper = Some(dest.into()); let mut msg_wrapper = Some(message.clone()); assert!( as SendXcm>::validate( &mut dest_wrapper, @@ -529,16 +528,13 @@ mod tests { // prepare test data let asset: MultiAsset = (Here, AMOUNT).into(); - let payment = Assets::from(asset.clone()); + let payment = Assets::from(asset); let weight_to_buy = Weight::from_parts(1_000, 1_000); // lets do first call (success) assert_ok!(trader.buy_weight(weight_to_buy, payment.clone())); // lets do second call (error) - assert_eq!( - trader.buy_weight(weight_to_buy, payment.clone()), - Err(XcmError::NotWithdrawable) - ); + assert_eq!(trader.buy_weight(weight_to_buy, payment), Err(XcmError::NotWithdrawable)); } } diff --git a/scripts/ci/gitlab/pipeline/test.yml b/scripts/ci/gitlab/pipeline/test.yml index 0ef51ae2e6d..a67c15eec6b 100644 --- a/scripts/ci/gitlab/pipeline/test.yml +++ b/scripts/ci/gitlab/pipeline/test.yml @@ -97,3 +97,11 @@ cargo-check-benches: artifacts: false script: - time cargo check --all --benches + +cargo-clippy: + stage: test + extends: + - .docker-env + - .common-refs + script: + - SKIP_WASM_BUILD=1 env -u RUSTFLAGS cargo clippy --locked --all-targets diff --git a/scripts/ci/gitlab/pipeline/zombienet.yml b/scripts/ci/gitlab/pipeline/zombienet.yml index d76531b19e7..d5ab3e13d42 100644 --- a/scripts/ci/gitlab/pipeline/zombienet.yml +++ b/scripts/ci/gitlab/pipeline/zombienet.yml @@ -35,7 +35,7 @@ expire_in: 2 days paths: - ./zombienet-logs - allow_failure: true + allow_failure: false retry: 2 tags: - zombienet-polkadot-integration-test diff --git a/test/client/src/block_builder.rs b/test/client/src/block_builder.rs index 13b20df6be6..0c0c5c4e9c7 100644 --- a/test/client/src/block_builder.rs +++ b/test/client/src/block_builder.rs @@ -64,13 +64,13 @@ pub trait InitBlockBuilder { ) -> sc_block_builder::BlockBuilder; } -fn init_block_builder<'a>( - client: &'a Client, +fn init_block_builder( + client: &Client, at: Hash, validation_data: Option>, relay_sproof_builder: RelayStateSproofBuilder, timestamp: u64, -) -> BlockBuilder<'a, Block, Client, Backend> { +) -> BlockBuilder<'_, Block, Client, Backend> { let mut block_builder = client .new_block_at(at, Default::default(), true) .expect("Creates new block builder for test runtime"); diff --git a/test/client/src/lib.rs b/test/client/src/lib.rs index 4008dca350d..4027a056d55 100644 --- a/test/client/src/lib.rs +++ b/test/client/src/lib.rs @@ -199,5 +199,4 @@ pub fn validate_block( &validation_params.encode(), ) .map(|v| ValidationResult::decode(&mut &v[..]).expect("Decode `ValidationResult`.")) - .map_err(|err| err.into()) } diff --git a/test/relay-sproof-builder/src/lib.rs b/test/relay-sproof-builder/src/lib.rs index decc6ee3aa0..b5fc0c7f08f 100644 --- a/test/relay-sproof-builder/src/lib.rs +++ b/test/relay-sproof-builder/src/lib.rs @@ -171,7 +171,7 @@ impl RelayStateSproofBuilder { } } - let root = backend.root().clone(); + let root = *backend.root(); let proof = sp_state_machine::prove_read(backend, relevant_keys).expect("prove read"); (root, proof) } diff --git a/test/service/Cargo.toml b/test/service/Cargo.toml index d36ae55688d..4f0fc627bad 100644 --- a/test/service/Cargo.toml +++ b/test/service/Cargo.toml @@ -15,7 +15,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0" } criterion = { version = "0.4.0", features = [ "async_tokio" ] } jsonrpsee = { version = "0.16.2", features = ["server"] } rand = "0.8.5" -serde = { version = "1.0.160", features = ["derive"] } +serde = { version = "1.0.162", features = ["derive"] } tokio = { version = "1.28.0", features = ["macros"] } tracing = "0.1.37" url = "2.3.1" diff --git a/test/service/benches/transaction_throughput.rs b/test/service/benches/transaction_throughput.rs index 1c3f841fe23..48bf49487e6 100644 --- a/test/service/benches/transaction_throughput.rs +++ b/test/service/benches/transaction_throughput.rs @@ -46,7 +46,7 @@ fn create_account_extrinsics(client: &Client, accounts: &[sr25519::Pair]) -> Vec accounts .iter() .enumerate() - .map(|(i, a)| { + .flat_map(|(i, a)| { vec![ // Reset the nonce by removing any funds construct_extrinsic( @@ -54,7 +54,7 @@ fn create_account_extrinsics(client: &Client, accounts: &[sr25519::Pair]) -> Vec SudoCall::sudo { call: Box::new( BalancesCall::force_set_balance { - who: AccountId::from(a.public()).into(), + who: AccountId::from(a.public()), new_free: 0, } .into(), @@ -69,7 +69,7 @@ fn create_account_extrinsics(client: &Client, accounts: &[sr25519::Pair]) -> Vec SudoCall::sudo { call: Box::new( BalancesCall::force_set_balance { - who: AccountId::from(a.public()).into(), + who: AccountId::from(a.public()), new_free: 1_000_000_000_000 * ExistentialDeposit::get(), } .into(), @@ -80,7 +80,6 @@ fn create_account_extrinsics(client: &Client, accounts: &[sr25519::Pair]) -> Vec ), ] }) - .flatten() .map(OpaqueExtrinsic::from) .collect() } @@ -92,20 +91,19 @@ fn create_benchmark_extrinsics( ) -> Vec { accounts .iter() - .map(|account| { + .flat_map(|account| { (0..extrinsics_per_account).map(move |nonce| { construct_extrinsic( client, BalancesCall::transfer_allow_death { - dest: Bob.to_account_id().into(), - value: 1 * ExistentialDeposit::get(), + dest: Bob.to_account_id(), + value: ExistentialDeposit::get(), }, account.clone(), Some(nonce as u32), ) }) }) - .flatten() .map(OpaqueExtrinsic::from) .collect() } @@ -208,27 +206,27 @@ fn transaction_throughput_benchmarks(c: &mut Criterion) { |b| { b.iter_batched( || { - let prepare_extrinsics = create_account_extrinsics(&*dave.client, &accounts); + let prepare_extrinsics = create_account_extrinsics(&dave.client, &accounts); benchmark_handle.block_on(future::join_all( prepare_extrinsics.into_iter().map(|tx| { submit_tx_and_wait_for_inclusion( &dave.transaction_pool, tx, - &*dave.client, + &dave.client, true, ) }), )); - create_benchmark_extrinsics(&*dave.client, &accounts, extrinsics_per_account) + create_benchmark_extrinsics(&dave.client, &accounts, extrinsics_per_account) }, |extrinsics| { benchmark_handle.block_on(future::join_all(extrinsics.into_iter().map(|tx| { submit_tx_and_wait_for_inclusion( &dave.transaction_pool, tx, - &*dave.client, + &dave.client, false, ) }))); diff --git a/test/service/src/chain_spec.rs b/test/service/src/chain_spec.rs index e1399e97a36..5ae77084b6c 100644 --- a/test/service/src/chain_spec.rs +++ b/test/service/src/chain_spec.rs @@ -39,7 +39,7 @@ pub struct GenesisExt { impl sp_runtime::BuildStorage for GenesisExt { fn assimilate_storage(&self, storage: &mut sp_core::storage::Storage) -> Result<(), String> { sp_state_machine::BasicExternalities::execute_with_storage(storage, || { - sp_io::storage::set(cumulus_test_runtime::TEST_RUNTIME_UPGRADE_KEY, &vec![1, 2, 3, 4]); + sp_io::storage::set(cumulus_test_runtime::TEST_RUNTIME_UPGRADE_KEY, &[1, 2, 3, 4]); cumulus_test_runtime::ParachainId::set(&self.para_id); }); @@ -125,7 +125,6 @@ fn testnet_genesis( code: cumulus_test_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), - ..Default::default() }, parachain_system: Default::default(), balances: cumulus_test_runtime::BalancesConfig { diff --git a/test/service/src/lib.rs b/test/service/src/lib.rs index 662f04487aa..5138a58bd80 100644 --- a/test/service/src/lib.rs +++ b/test/service/src/lib.rs @@ -630,7 +630,7 @@ impl TestNodeBuilder { let parachain_config = node_config( self.storage_update_func_parachain.unwrap_or_else(|| Box::new(|| ())), self.tokio_handle.clone(), - self.key.clone(), + self.key, self.parachain_nodes, self.parachain_nodes_exclusive, self.para_id, @@ -667,7 +667,7 @@ impl TestNodeBuilder { .await .expect("could not create Cumulus test service"); - let peer_id = network.local_peer_id().clone(); + let peer_id = network.local_peer_id(); let addr = MultiaddrWithPeerId { multiaddr, peer_id }; TestNode { task_manager, client, network, addr, rpc_handlers, transaction_pool } @@ -690,7 +690,7 @@ pub fn node_config( is_collator: bool, ) -> Result { let base_path = BasePath::new_temp_dir()?; - let root = base_path.path().join(format!("cumulus_test_service_{}", key.to_string())); + let root = base_path.path().join(format!("cumulus_test_service_{}", key)); let role = if is_collator { Role::Authority } else { Role::Full }; let key_seed = key.to_seed(); let mut spec = Box::new(chain_spec::get_chain_spec(para_id)); @@ -753,6 +753,7 @@ pub fn node_config( rpc_max_response_size: Default::default(), rpc_id_provider: None, rpc_max_subs_per_conn: Default::default(), + rpc_port: 9945, prometheus_config: None, telemetry_endpoints: None, default_heap_pages: None, @@ -786,7 +787,7 @@ impl TestNode { function: impl Into, caller: Sr25519Keyring, ) -> Result { - let extrinsic = construct_extrinsic(&*self.client, function, caller.pair(), Some(0)); + let extrinsic = construct_extrinsic(&self.client, function, caller.pair(), Some(0)); self.rpc_handlers.send_transaction(extrinsic.into()).await } diff --git a/xcm/xcm-emulator/Cargo.toml b/xcm/xcm-emulator/Cargo.toml index 819de0199c8..8da28d0283f 100644 --- a/xcm/xcm-emulator/Cargo.toml +++ b/xcm/xcm-emulator/Cargo.toml @@ -9,20 +9,27 @@ edition = "2021" codec = { package = "parity-scale-codec", version = "3.0.0" } paste = "1.0.5" quote = "1.0.23" +casey = "0.3.3" +log = { version = "0.4.17", default-features = false } frame-support = { git = "https://github.com/paritytech/substrate", branch = "master" } frame-system = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-io = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-std = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master" } cumulus-primitives-core = { path = "../../primitives/core"} cumulus-pallet-xcmp-queue = { path = "../../pallets/xcmp-queue" } cumulus-pallet-dmp-queue = { path = "../../pallets/dmp-queue" } cumulus-pallet-parachain-system = { path = "../../pallets/parachain-system" } +cumulus-test-service = { path = "../../test/service" } parachain-info = { path = "../../parachains/pallets/parachain-info" } cumulus-primitives-parachain-inherent = { path = "../../primitives/parachain-inherent" } cumulus-test-relay-sproof-builder = { path = "../../test/relay-sproof-builder" } +parachains-common = { path = "../../parachains/common" } xcm = { git = "https://github.com/paritytech/polkadot", branch = "master" } xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "master" } diff --git a/xcm/xcm-emulator/README.md b/xcm/xcm-emulator/README.md index 384a781fab4..267258d758b 100644 --- a/xcm/xcm-emulator/README.md +++ b/xcm/xcm-emulator/README.md @@ -9,8 +9,9 @@ a zombienet and as all the chains are in one process debugging using Clion is ea ## Limitations -As the channels are mocked, using xcm-emulator tests to test -channel setup would not be appropriate. +As the messages do not physically go through the same messaging infrastructure +there is some code that is not being tested compared to using slower E2E tests. +In future it may be possible to run these XCM emulated tests as E2E tests (without changes). ## Alternatives @@ -20,7 +21,7 @@ repo) is the perfect tool for this. ## How to use -1. Set up a relay chain: + diff --git a/xcm/xcm-emulator/example/Cargo.toml b/xcm/xcm-emulator/example/Cargo.toml deleted file mode 100644 index e5bacd89909..00000000000 --- a/xcm/xcm-emulator/example/Cargo.toml +++ /dev/null @@ -1,37 +0,0 @@ -[package] -name = "xcm-emulator-example" -version = "0.1.0" -authors = ["Parity Technologies "] -edition = "2021" - -[dependencies] -serde = { version = "1.0.137", optional = true } -codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false } -proc-macro2 = "1.0.40" - -frame-system = { git = "https://github.com/paritytech/substrate", branch = "master" } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "master" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "master" } - -cumulus-primitives-core = { path = "../../../primitives/core" } -cumulus-pallet-xcmp-queue = { path = "../../../pallets/xcmp-queue" } -parachain-info = { path = "../../../parachains/pallets/parachain-info" } - -xcm = { git = "https://github.com/paritytech/polkadot", branch = "master" } -polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" } -polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "master" } -polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "master" } -kusama-runtime = { git = "https://github.com/paritytech/polkadot", branch = "master" } -pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "master" } - - -xcm-emulator = { path = ".." } -test-runtime = { path = "test-runtime" } - -[features] -runtime-benchmarks = [ - "kusama-runtime/runtime-benchmarks", - "test-runtime/runtime-benchmarks", -] diff --git a/xcm/xcm-emulator/example/src/lib.rs b/xcm/xcm-emulator/example/src/lib.rs deleted file mode 100644 index e8626db930c..00000000000 --- a/xcm/xcm-emulator/example/src/lib.rs +++ /dev/null @@ -1,448 +0,0 @@ -// Copyright 2023 Parity Technologies (UK) Ltd. -// This file is part of Polkadot. - -// Polkadot 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. - -// Polkadot 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 Polkadot. If not, see . - -use frame_support::{pallet_prelude::Weight, traits::GenesisBuild}; -use sp_runtime::AccountId32; - -use xcm_emulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain}; - -// Set up relay chain. -decl_test_relay_chain! { - pub struct KusamaRelay { - Runtime = kusama_runtime::Runtime, - XcmConfig = kusama_runtime::xcm_config::XcmConfig, - new_ext = kusama_ext(), - } -} - -// Set up ParachainA. -decl_test_parachain! { - pub struct ParachainA { - Runtime = test_runtime::Runtime, - RuntimeOrigin = test_runtime::RuntimeOrigin, - XcmpMessageHandler = test_runtime::XcmpQueue, - DmpMessageHandler = test_runtime::DmpQueue, - new_ext = parachain_ext(1), - } -} - -// Set up ParachainB. -decl_test_parachain! { - pub struct ParachainB { - Runtime = test_runtime::Runtime, - RuntimeOrigin = test_runtime::RuntimeOrigin, - XcmpMessageHandler = test_runtime::XcmpQueue, - DmpMessageHandler = test_runtime::DmpQueue, - new_ext = parachain_ext(2), - } -} - -// Set up ParachainC. -decl_test_parachain! { - pub struct ParachainC { - Runtime = test_runtime::Runtime, - RuntimeOrigin = test_runtime::RuntimeOrigin, - XcmpMessageHandler = test_runtime::XcmpQueue, - DmpMessageHandler = test_runtime::DmpQueue, - new_ext = parachain_ext(3), - } -} - -// Set up a network with all the declared parachains and a relay chain. -decl_test_network! { - pub struct Network { - relay_chain = KusamaRelay, - parachains = vec![ - (1, ParachainA), - (2, ParachainB), - (3, ParachainC), - ], - } -} - -pub const ALICE: AccountId32 = AccountId32::new([0u8; 32]); -pub const INITIAL_BALANCE: u128 = 1_000_000_000_000; - -// Parachain TextExternalities setup. -pub fn parachain_ext(para_id: u32) -> sp_io::TestExternalities { - use test_runtime::{Runtime, System}; - - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - - let parachain_info_config = parachain_info::GenesisConfig { parachain_id: para_id.into() }; - - >::assimilate_storage( - ¶chain_info_config, - &mut t, - ) - .unwrap(); - - pallet_balances::GenesisConfig:: { balances: vec![(ALICE, INITIAL_BALANCE)] } - .assimilate_storage(&mut t) - .unwrap(); - - let mut ext = sp_io::TestExternalities::new(t); - ext.execute_with(|| System::set_block_number(1)); - ext -} - -fn default_parachains_host_configuration( -) -> polkadot_runtime_parachains::configuration::HostConfiguration< - polkadot_primitives::v4::BlockNumber, -> { - use polkadot_primitives::v4::{MAX_CODE_SIZE, MAX_POV_SIZE}; - - polkadot_runtime_parachains::configuration::HostConfiguration { - minimum_validation_upgrade_delay: 5, - validation_upgrade_cooldown: 10u32, - validation_upgrade_delay: 10, - code_retention_period: 1200, - max_code_size: MAX_CODE_SIZE, - max_pov_size: MAX_POV_SIZE, - max_head_data_size: 32 * 1024, - group_rotation_frequency: 20, - chain_availability_period: 4, - thread_availability_period: 4, - max_upward_queue_count: 8, - max_upward_queue_size: 1024 * 1024, - max_downward_message_size: 1024, - ump_service_total_weight: Weight::from_parts(4 * 1_000_000_000, 0), - max_upward_message_size: 50 * 1024, - max_upward_message_num_per_candidate: 5, - hrmp_sender_deposit: 0, - hrmp_recipient_deposit: 0, - hrmp_channel_max_capacity: 8, - hrmp_channel_max_total_size: 8 * 1024, - hrmp_max_parachain_inbound_channels: 4, - hrmp_max_parathread_inbound_channels: 4, - hrmp_channel_max_message_size: 1024 * 1024, - hrmp_max_parachain_outbound_channels: 4, - hrmp_max_parathread_outbound_channels: 4, - hrmp_max_message_num_per_candidate: 5, - dispute_period: 6, - no_show_slots: 2, - n_delay_tranches: 25, - needed_approvals: 2, - relay_vrf_modulo_samples: 2, - zeroth_delay_tranche_width: 0, - ..Default::default() - } -} - -// Relay chain TestExternalities setup. -pub fn kusama_ext() -> sp_io::TestExternalities { - use kusama_runtime::{Runtime, System}; - - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - - pallet_balances::GenesisConfig:: { balances: vec![(ALICE, INITIAL_BALANCE)] } - .assimilate_storage(&mut t) - .unwrap(); - - polkadot_runtime_parachains::configuration::GenesisConfig:: { - config: default_parachains_host_configuration(), - } - .assimilate_storage(&mut t) - .unwrap(); - - let mut ext = sp_io::TestExternalities::new(t); - ext.execute_with(|| System::set_block_number(1)); - ext -} - -#[cfg(test)] -mod tests { - use super::*; - use codec::Encode; - - use cumulus_primitives_core::ParaId; - use frame_support::{assert_ok, dispatch::GetDispatchInfo, traits::Currency}; - use sp_runtime::traits::AccountIdConversion; - use xcm::{latest::Error::BadOrigin, v3::prelude::*, VersionedMultiLocation, VersionedXcm}; - use xcm_emulator::TestExt; - - #[test] - fn dmp() { - Network::reset(); - - let remark = test_runtime::RuntimeCall::System( - frame_system::Call::::remark_with_event { - remark: "Hello from Kusama!".as_bytes().to_vec(), - }, - ); - KusamaRelay::execute_with(|| { - assert_ok!(kusama_runtime::XcmPallet::force_default_xcm_version( - kusama_runtime::RuntimeOrigin::root(), - Some(3) - )); - assert_ok!(kusama_runtime::XcmPallet::send_xcm( - Here, - Parachain(1), - Xcm(vec![Transact { - origin_kind: OriginKind::SovereignAccount, - require_weight_at_most: Weight::from_parts(INITIAL_BALANCE as u64, 1024 * 1024), - call: remark.encode().into(), - }]), - )); - }); - - ParachainA::execute_with(|| { - use test_runtime::{RuntimeEvent, System}; - System::events().iter().for_each(|r| println!(">>> {:?}", r.event)); - - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::System(frame_system::Event::Remarked { sender: _, hash: _ }) - ))); - }); - } - - #[test] - fn ump() { - Network::reset(); - - KusamaRelay::execute_with(|| { - assert_ok!(kusama_runtime::XcmPallet::force_default_xcm_version( - kusama_runtime::RuntimeOrigin::root(), - Some(3) - )); - let _ = kusama_runtime::Balances::deposit_creating( - &ParaId::from(1).into_account_truncating(), - 1_000_000_000_000, - ); - }); - - let remark = kusama_runtime::RuntimeCall::System(frame_system::Call::< - kusama_runtime::Runtime, - >::remark_with_event { - remark: "Hello from ParachainA!".as_bytes().to_vec(), - }); - ParachainA::execute_with(|| { - assert_ok!(test_runtime::PolkadotXcm::force_default_xcm_version( - test_runtime::RuntimeOrigin::root(), - Some(3) - )); - assert_ok!(test_runtime::PolkadotXcm::send_xcm( - Here, - Parent, - Xcm(vec![ - UnpaidExecution { weight_limit: Unlimited, check_origin: None }, - Transact { - origin_kind: OriginKind::SovereignAccount, - require_weight_at_most: Weight::from_parts( - INITIAL_BALANCE as u64, - 1024 * 1024 - ), - call: remark.encode().into(), - } - ]), - )); - }); - - KusamaRelay::execute_with(|| { - use kusama_runtime::{RuntimeEvent, System}; - // TODO: https://github.com/paritytech/polkadot/pull/6824 or change this call to - // force_create_assets like we do in cumulus integration tests. - // assert!(System::events().iter().any(|r| matches!( - // r.event, - // RuntimeEvent::System(frame_system::Event::Remarked { sender: _, hash: _ }) - // ))); - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::Ump(polkadot_runtime_parachains::ump::Event::ExecutedUpward( - _, - Outcome::Incomplete(_, XcmError::NoPermission) - )) - ))); - }); - } - - #[test] - fn para_to_para() { - Network::reset(); - - let remark = test_runtime::RuntimeCall::System( - frame_system::Call::::remark_with_event { - remark: "Hello from ParachainA!".as_bytes().to_vec(), - }, - ); - ParachainA::execute_with(|| { - assert_ok!(test_runtime::PolkadotXcm::send_xcm( - Here, - MultiLocation::new(1, X1(Parachain(2))), - Xcm(vec![Transact { - origin_kind: OriginKind::SovereignAccount, - require_weight_at_most: Weight::from_parts(9_000_000, 0), - call: remark.encode().into(), - }]), - )); - }); - - ParachainB::execute_with(|| { - use test_runtime::{RuntimeEvent, System}; - System::events().iter().for_each(|r| println!(">>> {:?}", r.event)); - - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::System(frame_system::Event::Remarked { sender: _, hash: _ }) - ))); - }); - } - - #[test] - fn xcmp_through_a_parachain() { - use test_runtime::{PolkadotXcm, Runtime, RuntimeCall}; - - Network::reset(); - - // The message goes through: ParachainA --> ParachainB --> ParachainC - let remark = RuntimeCall::System(frame_system::Call::::remark_with_event { - remark: "Hello from ParachainA!".as_bytes().to_vec(), - }); - let send_xcm_to_parachain_c = RuntimeCall::PolkadotXcm(pallet_xcm::Call::::send { - dest: Box::new(VersionedMultiLocation::V3(MultiLocation::new(1, X1(Parachain(3))))), - message: Box::new(VersionedXcm::V3(Xcm(vec![Transact { - origin_kind: OriginKind::SovereignAccount, - // The weight here does not matter, as this is going to fail with BadOrigin once it - // reaches ParachainC, as it's not going to satisfy AccountId32Aliases conversion - // rules. - require_weight_at_most: Weight::from_parts(0, 0), - call: remark.encode().into(), - }]))), - }); - assert_eq!( - send_xcm_to_parachain_c.get_dispatch_info().weight, - Weight::from_parts(100000010, 10) - ); - ParachainA::execute_with(|| { - assert_ok!(PolkadotXcm::send_xcm( - Here, - MultiLocation::new(1, X1(Parachain(2))), - Xcm(vec![Transact { - origin_kind: OriginKind::SovereignAccount, - require_weight_at_most: Weight::from_parts(110_000_010, 20_000), - call: send_xcm_to_parachain_c.encode().into(), - }]), - )); - }); - - ParachainB::execute_with(|| { - use test_runtime::{RuntimeEvent, System}; - System::events().iter().for_each(|r| println!(">>> {:?}", r.event)); - - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::PolkadotXcm(pallet_xcm::Event::Sent(_, _, _)) - ))); - }); - - // ParachainC: The origin should not satisfy AccountId32Aliases conversion rules and thus fail. - ParachainC::execute_with(|| { - use test_runtime::{RuntimeEvent, System}; - System::events().iter().for_each(|r| println!(">>> {:?}", r.event)); - - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::Fail { error, .. }) if error == BadOrigin - ))); - }); - } - - #[test] - fn deduplicate_dmp() { - Network::reset(); - KusamaRelay::execute_with(|| { - assert_ok!(kusama_runtime::XcmPallet::force_default_xcm_version( - kusama_runtime::RuntimeOrigin::root(), - Some(3) - )); - }); - - send_remark_with_event_to_child_parachain_a("Kusama", 2); - parachain_a_verify_remark_event_and_reset_all_events(true); - - // a different dmp message in same relay-parent-block allow execution. - send_remark_with_event_to_child_parachain_a("Polkadot", 1); - parachain_a_verify_remark_event_and_reset_all_events(true); - - // same dmp message with same relay-parent-block wouldn't execution - send_remark_with_event_to_child_parachain_a("Kusama", 1); - parachain_a_verify_remark_event_and_reset_all_events(false); - - // different relay-parent-block allow dmp message execution - KusamaRelay::execute_with(|| kusama_runtime::System::set_block_number(2)); - - send_remark_with_event_to_child_parachain_a("Kusama", 1); - parachain_a_verify_remark_event_and_reset_all_events(true); - - // reset can send same dmp message again - Network::reset(); - KusamaRelay::execute_with(|| { - assert_ok!(kusama_runtime::XcmPallet::force_default_xcm_version( - kusama_runtime::RuntimeOrigin::root(), - Some(3) - )); - }); - - send_remark_with_event_to_child_parachain_a("Kusama", 1); - parachain_a_verify_remark_event_and_reset_all_events(true); - } - - fn send_remark_with_event_to_child_parachain_a(msg: &str, count: u32) { - let remark = test_runtime::RuntimeCall::System( - frame_system::Call::::remark_with_event { - remark: msg.as_bytes().to_vec(), - }, - ); - KusamaRelay::execute_with(|| { - for _ in 0..count { - assert_ok!(kusama_runtime::XcmPallet::send_xcm( - Here, - Parachain(1), - Xcm(vec![Transact { - origin_kind: OriginKind::SovereignAccount, - require_weight_at_most: Weight::from_parts( - INITIAL_BALANCE as u64, - 1024 * 1024 - ), - call: remark.encode().into(), - }]), - )); - } - }); - } - - fn parachain_a_verify_remark_event_and_reset_all_events(received: bool) { - ParachainA::execute_with(|| { - use test_runtime::{RuntimeEvent, System}; - System::events().iter().for_each(|r| println!(">>> {:?}", r.event)); - - if received { - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::System(frame_system::Event::Remarked { sender: _, hash: _ }) - ))); - - System::reset_events(); - } else { - assert!(System::events().iter().all(|r| !matches!( - r.event, - RuntimeEvent::System(frame_system::Event::Remarked { sender: _, hash: _ }) - ))); - } - }); - } -} diff --git a/xcm/xcm-emulator/example/test-runtime/Cargo.toml b/xcm/xcm-emulator/example/test-runtime/Cargo.toml deleted file mode 100644 index 945d9e54751..00000000000 --- a/xcm/xcm-emulator/example/test-runtime/Cargo.toml +++ /dev/null @@ -1,71 +0,0 @@ -[package] -name = "test-runtime" -description = "A simple runtime for cross-chain message tests." -license = "Apache-2.0" -version = "0.1.0" -authors = ["Parity Technologies "] -edition = "2021" - -[dependencies] -serde = { version = "1.0.137", optional = true } -codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false } -scale-info = { version = "2.1", default-features = false, features = ["derive"] } - -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" } -pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" } - -cumulus-pallet-dmp-queue = { path = "../../../../pallets/dmp-queue", default-features = false } -cumulus-pallet-xcmp-queue = { path = "../../../../pallets/xcmp-queue", default-features = false } -parachain-info = { path = "../../../../parachains/pallets/parachain-info", default-features = false } -cumulus-pallet-xcm = { path = "../../../../pallets/xcm", default-features = false } -cumulus-pallet-parachain-system = { path = "../../../../pallets/parachain-system", default-features = false } -cumulus-primitives-utility = { path = "../../../../primitives/utility", default-features = false } - -xcm = { git = "https://github.com/paritytech/polkadot", branch = "master" } -xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "master" } -polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "master" } -xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "master" } -pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "master" } -polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "master" } - - -[features] -default = ["std"] -no_std = [] -std = [ - "serde/std", - "codec/std", - "scale-info/std", - - "sp-runtime/std", - "sp-io/std", - "sp-std/std", - "sp-core/std", - "pallet-balances/std", - "frame-support/std", - "frame-system/std", - - "cumulus-pallet-dmp-queue/std", - "cumulus-pallet-xcmp-queue/std", - "cumulus-pallet-xcm/std", - "cumulus-pallet-parachain-system/std", - "parachain-info/std", - "cumulus-primitives-utility/std", - - "xcm/std", - "xcm-executor/std", - "polkadot-parachain/std", - "xcm-builder/std", - "pallet-xcm/std", - "polkadot-runtime-parachains/std", -] - -runtime-benchmarks = [ - "pallet-xcm/runtime-benchmarks", - "xcm-builder/runtime-benchmarks", -] diff --git a/xcm/xcm-emulator/example/test-runtime/src/lib.rs b/xcm/xcm-emulator/example/test-runtime/src/lib.rs deleted file mode 100644 index 9010936892c..00000000000 --- a/xcm/xcm-emulator/example/test-runtime/src/lib.rs +++ /dev/null @@ -1,278 +0,0 @@ -// Copyright 2023 Parity Technologies (UK) Ltd. -// This file is part of Polkadot. - -// Polkadot 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. - -// Polkadot 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 Polkadot. If not, see . - -use frame_support::{ - construct_runtime, parameter_types, - traits::{ConstU32, Everything, Nothing}, - weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight}, -}; -use frame_system::EnsureRoot; -use pallet_xcm::XcmPassthrough; -use polkadot_parachain::primitives::Sibling; -use sp_core::H256; -use sp_runtime::{ - testing::Header, - traits::{Convert, IdentityLookup}, - AccountId32, -}; -use xcm::v3::prelude::*; -use xcm_builder::{ - AccountId32Aliases, AllowUnpaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin, - FixedWeightBounds, IsConcrete, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, - SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, - SovereignSignedViaLocation, -}; - -use xcm_executor::{Config, XcmExecutor}; - -pub type AccountId = AccountId32; -pub type Balance = u128; -pub type Amount = i128; - -parameter_types! { - pub const BlockHashCount: u64 = 250; -} - -impl frame_system::Config for Runtime { - type RuntimeOrigin = RuntimeOrigin; - type RuntimeCall = RuntimeCall; - type Index = u64; - type BlockNumber = u64; - type Hash = H256; - type Hashing = ::sp_runtime::traits::BlakeTwo256; - type AccountId = AccountId; - type Lookup = IdentityLookup; - type Header = Header; - type RuntimeEvent = RuntimeEvent; - type BlockHashCount = BlockHashCount; - type BlockWeights = (); - type BlockLength = (); - type Version = (); - type PalletInfo = PalletInfo; - type AccountData = pallet_balances::AccountData; - type OnNewAccount = (); - type OnKilledAccount = (); - type DbWeight = (); - type BaseCallFilter = Everything; - type SystemWeightInfo = (); - type SS58Prefix = (); - type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; - type MaxConsumers = ConstU32<16>; -} - -parameter_types! { - pub ExistentialDeposit: Balance = 1; - pub const MaxLocks: u32 = 50; - pub const MaxReserves: u32 = 50; -} - -impl pallet_balances::Config for Runtime { - type MaxLocks = MaxLocks; - type Balance = Balance; - type RuntimeEvent = RuntimeEvent; - type DustRemoval = (); - type ExistentialDeposit = ExistentialDeposit; - type AccountStore = System; - type WeightInfo = (); - type MaxReserves = MaxReserves; - type ReserveIdentifier = [u8; 8]; - type HoldIdentifier = (); - type FreezeIdentifier = (); - type MaxHolds = (); - type MaxFreezes = (); -} - -impl parachain_info::Config for Runtime {} - -parameter_types! { - pub const RelayLocation: MultiLocation = MultiLocation::parent(); - pub const RelayNetwork: NetworkId = NetworkId::Kusama; - pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); - pub UniversalLocation: InteriorMultiLocation = X2(GlobalConsensus(RelayNetwork::get()), Parachain(ParachainInfo::parachain_id().into())); -} - -pub type LocationToAccountId = ( - ParentIsPreset, - SiblingParachainConvertsVia, - AccountId32Aliases, -); - -pub type XcmOriginToCallOrigin = ( - SovereignSignedViaLocation, - RelayChainAsNative, - SiblingParachainAsNative, - SignedAccountId32AsNative, - XcmPassthrough, -); - -parameter_types! { - pub const UnitWeightCost: u64 = 10; - pub const MaxInstructions: u32 = 100; - pub const MaxAssetsIntoHolding: u32 = 64; - pub const RelayChain: MultiLocation = MultiLocation::parent(); -} - -/// Means for transacting assets on this chain. -pub type LocalAssetTransactor = CurrencyAdapter< - // Use this currency: - Balances, - // Use this currency when it is a fungible asset matching the given location or name: - IsConcrete, - // Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID: - LocationToAccountId, - // Our chain's account ID type (we can't get away without mentioning it explicitly): - AccountId, - // We don't track any teleports. - (), ->; - -/// The means for routing XCM messages which are not for local execution into -/// the right message queues. -pub type XcmRouter = ( - // Two routers - use UMP to communicate with the relay chain: - cumulus_primitives_utility::ParentAsUmp, - // ..and XCMP to communicate with the sibling chains. - XcmpQueue, -); - -pub type Barrier = AllowUnpaidExecutionFrom; - -pub struct XcmConfig; -impl Config for XcmConfig { - type RuntimeCall = RuntimeCall; - type XcmSender = XcmRouter; - type AssetTransactor = LocalAssetTransactor; - type OriginConverter = XcmOriginToCallOrigin; - type IsReserve = (); - type IsTeleporter = (); - type UniversalLocation = UniversalLocation; - type Barrier = Barrier; - type Weigher = FixedWeightBounds; - type Trader = (); - type ResponseHandler = (); - type AssetTrap = (); - type AssetClaims = (); - type SubscriptionService = (); - type AssetLocker = PolkadotXcm; - type AssetExchanger = (); - type PalletInstancesInfo = (); - type MaxAssetsIntoHolding = MaxAssetsIntoHolding; - type FeeManager = (); - type MessageExporter = (); - type UniversalAliases = Nothing; - type CallDispatcher = RuntimeCall; - type SafeCallFilter = Everything; -} - -parameter_types! { - pub const ReservedXcmpWeight: Weight = Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND.saturating_div(4), 0); - pub const ReservedDmpWeight: Weight = Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND.saturating_div(4), 0); -} - -impl cumulus_pallet_parachain_system::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type OnSystemEvent = (); - type SelfParaId = ParachainInfo; - type DmpMessageHandler = DmpQueue; - type ReservedDmpWeight = ReservedDmpWeight; - type OutboundXcmpMessageSource = XcmpQueue; - type XcmpMessageHandler = XcmpQueue; - type ReservedXcmpWeight = ReservedXcmpWeight; - type CheckAssociatedRelayNumber = cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; -} - -impl cumulus_pallet_xcmp_queue::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type XcmExecutor = XcmExecutor; - type ChannelInfo = ParachainSystem; - type VersionWrapper = (); - type ExecuteOverweightOrigin = EnsureRoot; - type ControllerOrigin = EnsureRoot; - type ControllerOriginConverter = XcmOriginToCallOrigin; - type WeightInfo = (); - type PriceForSiblingDelivery = (); -} - -impl cumulus_pallet_dmp_queue::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type XcmExecutor = XcmExecutor; - type ExecuteOverweightOrigin = EnsureRoot; -} - -impl cumulus_pallet_xcm::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type XcmExecutor = XcmExecutor; -} - -#[cfg(feature = "runtime-benchmarks")] -parameter_types! { - pub ReachableDest: Option = Some(Parent.into()); -} - -pub type LocalOriginToLocation = SignedToAccountId32; - -impl pallet_xcm::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type SendXcmOrigin = EnsureXcmOrigin; - type XcmRouter = XcmRouter; - type ExecuteXcmOrigin = EnsureXcmOrigin; - type XcmExecuteFilter = Everything; - type XcmExecutor = XcmExecutor; - type XcmTeleportFilter = Nothing; - type XcmReserveTransferFilter = Everything; - type Weigher = FixedWeightBounds; - type UniversalLocation = UniversalLocation; - type RuntimeOrigin = RuntimeOrigin; - type RuntimeCall = RuntimeCall; - const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; - type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; - type Currency = Balances; - type CurrencyMatcher = (); - type TrustedLockers = (); - type SovereignAccountOf = (); - type MaxLockers = ConstU32<8>; - type WeightInfo = pallet_xcm::TestWeightInfo; - type AdminOrigin = EnsureRoot; - #[cfg(feature = "runtime-benchmarks")] - type ReachableDest = ReachableDest; -} - -pub struct AccountIdToMultiLocation; -impl Convert for AccountIdToMultiLocation { - fn convert(account: AccountId) -> MultiLocation { - X1(Junction::AccountId32 { network: None, id: account.into() }).into() - } -} - -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; -type Block = frame_system::mocking::MockBlock; - -construct_runtime!( - pub enum Runtime where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, - { - System: frame_system::{Pallet, Call, Storage, Config, Event}, - Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, - ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Storage, Inherent, Config, Event}, - ParachainInfo: parachain_info::{Pallet, Storage, Config}, - XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event}, - DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event}, - CumulusXcm: cumulus_pallet_xcm::{Pallet, Event, Origin}, - PolkadotXcm: pallet_xcm::{Pallet, Call, Event, Origin}, - } -); diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index a8bebd6fb02..ad9cb2873f4 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -14,17 +14,22 @@ // 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 paste; - pub use frame_support::{ + sp_runtime::BuildStorage, traits::{Get, Hooks}, weights::Weight, }; -pub use frame_system; +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_io::TestExternalities; pub use sp_std::{cell::RefCell, collections::vec_deque::VecDeque, marker::PhantomData}; +pub use sp_trie::StorageProof; pub use cumulus_pallet_dmp_queue; pub use cumulus_pallet_parachain_system; @@ -35,91 +40,230 @@ pub use cumulus_primitives_core::{ }; pub use cumulus_primitives_parachain_inherent::ParachainInherentData; pub use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder; +pub use cumulus_test_service::get_account_id_from_seed; pub use parachain_info; +pub use parachains_common::{AccountId, BlockNumber}; pub use polkadot_primitives; pub use polkadot_runtime_parachains::{ dmp, ump::{MessageId, UmpSink, XcmSink}, }; +pub use std::{collections::HashMap, thread::LocalKey}; pub use xcm::{v3::prelude::*, VersionedXcm}; pub use xcm_executor::XcmExecutor; +thread_local! { + /// Downward messages, each message is: `(to_para_id, [(relay_block_number, msg)])` + #[allow(clippy::type_complexity)] + pub static DOWNWARD_MESSAGES: RefCell)>)>>> + = RefCell::new(HashMap::new()); + /// Downward messages that already processed by parachains, each message is: `(to_para_id, relay_block_number, Vec)` + #[allow(clippy::type_complexity)] + pub static DMP_DONE: RefCell)>>> + = RefCell::new(HashMap::new()); + /// Horizontal messages, each message is: `(to_para_id, [(from_para_id, relay_block_number, msg)])` + #[allow(clippy::type_complexity)] + pub static HORIZONTAL_MESSAGES: RefCell)>)>>> + = RefCell::new(HashMap::new()); + /// Upward messages, each message is: `(from_para_id, msg) + pub static UPWARD_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 + pub static PARA_IDS: RefCell>> = RefCell::new(HashMap::new()); + /// Flag indicating if global variables have been initialized for a certain Network + pub static INITIALIZED: RefCell> = RefCell::new(HashMap::new()); +} + pub trait TestExt { + fn build_new_ext(storage: Storage) -> sp_io::TestExternalities; fn new_ext() -> sp_io::TestExternalities; fn reset_ext(); fn execute_with(execute: impl FnOnce() -> R) -> R; + fn ext_wrapper(func: impl FnOnce() -> R) -> R; } -#[macro_export] -macro_rules! decl_test_relay_chain { - ( - pub struct $name:ident { - Runtime = $runtime:path, - XcmConfig = $xcm_config:path, - new_ext = $new_ext:expr, - } - ) => { - pub struct $name; +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( + para_id: u32, + relay_parent_number: u32, + ) -> ParachainInherentData; +} - $crate::__impl_ext_for_relay_chain!($name, $runtime, $new_ext); +pub trait NetworkComponent { + fn network_name() -> &'static str; + + fn init() { + N::_init(); + } + + 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 send_horizontal_messages)>>( + to_para_id: u32, + iter: I, + ) { + HORIZONTAL_MESSAGES.with(|b| { + b.borrow_mut() + .get_mut(Self::network_name()) + .unwrap() + .push_back((to_para_id, iter.collect())) + }); + } + + fn send_upward_message(from_para_id: u32, msg: Vec) { + UPWARD_MESSAGES.with(|b| { + b.borrow_mut() + .get_mut(Self::network_name()) + .unwrap() + .push_back((from_para_id, msg)) + }); + } + + fn send_downward_messages( + to_para_id: u32, + iter: impl Iterator)>, + ) { + DOWNWARD_MESSAGES.with(|b| { + b.borrow_mut() + .get_mut(Self::network_name()) + .unwrap() + .push_back((to_para_id, iter.collect())) + }); + } + + 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(); + } +} - impl $crate::UmpSink for $name { - fn process_upward_message( - origin: $crate::ParaId, - msg: &[u8], - max_weight: $crate::Weight, - ) -> Result<$crate::Weight, ($crate::MessageId, $crate::Weight)> { - use $crate::{TestExt, UmpSink}; +pub trait RelayChain: UmpSink { + type Runtime; + type RuntimeOrigin; + type RuntimeCall; + type RuntimeEvent; + type XcmConfig; + type SovereignAccountOf; + type System; + type Balances; +} - Self::execute_with(|| { - $crate::XcmSink::<$crate::XcmExecutor<$xcm_config>, $runtime>::process_upward_message(origin, msg, max_weight) - }) - } - } - }; +pub trait Parachain: XcmpMessageHandler + DmpMessageHandler { + type Runtime; + type RuntimeOrigin; + type RuntimeCall; + type RuntimeEvent; + type XcmpMessageHandler; + type DmpMessageHandler; + type LocationToAccountId; + type System; + type Balances; + type ParachainSystem; + type ParachainInfo; } +// Relay Chain Implementation #[macro_export] -macro_rules! decl_test_parachain { +macro_rules! decl_test_relay_chains { ( - pub struct $name:ident { - Runtime = $runtime:path, - RuntimeOrigin = $origin:path, - XcmpMessageHandler = $xcmp_message_handler:path, - DmpMessageHandler = $dmp_message_handler:path, - new_ext = $new_ext:expr, - } + $( + pub struct $name:ident { + genesis = $genesis:expr, + on_init = $on_init:expr, + runtime = { + Runtime: $($runtime:tt)::*, + RuntimeOrigin: $($runtime_origin:tt)::*, + RuntimeCall: $($runtime_call:tt)::*, + RuntimeEvent: $($runtime_event:tt)::*, + XcmConfig: $($xcm_config:tt)::*, + SovereignAccountOf: $($sovereign_acc_of:tt)::*, + System: $($system:tt)::*, + Balances: $($balances:tt)::*, + }, + pallets_extra = { + $($pallet_name:ident: $pallet_path:path,)* + } + } + ), + + ) => { - pub struct $name; - - $crate::__impl_ext_for_parachain!($name, $runtime, $origin, $new_ext); + $( + pub struct $name; + + impl RelayChain for $name { + type Runtime = $($runtime)::*; + type RuntimeOrigin = $($runtime_origin)::*; + type RuntimeCall = $($runtime_call)::*; + type RuntimeEvent = $($runtime_event)::*; + type XcmConfig = $($xcm_config)::*; + type SovereignAccountOf = $($sovereign_acc_of)::*; + type System = $($system)::*; + type Balances = $($balances)::*; + } - impl $crate::XcmpMessageHandler for $name { - fn handle_xcmp_messages< - 'a, - I: Iterator, - >( - iter: I, - max_weight: $crate::Weight, - ) -> $crate::Weight { - use $crate::{TestExt, XcmpMessageHandler}; + $crate::paste::paste! { + pub trait [<$name Pallet>] { + $( + type $pallet_name; + )? + } - $name::execute_with(|| { - <$xcmp_message_handler>::handle_xcmp_messages(iter, max_weight) - }) + impl [<$name Pallet>] for $name { + $( + type $pallet_name = $pallet_path; + )? + } } - } - impl $crate::DmpMessageHandler for $name { - fn handle_dmp_messages( - iter: impl Iterator)>, + $crate::__impl_xcm_handlers_for_relay_chain!($name); + $crate::__impl_test_ext_for_relay_chain!($name, $genesis, $on_init); + )+ + }; +} + +#[macro_export] +macro_rules! __impl_xcm_handlers_for_relay_chain { + ($name:ident) => { + impl $crate::UmpSink for $name { + fn process_upward_message( + origin: $crate::ParaId, + msg: &[u8], max_weight: $crate::Weight, - ) -> $crate::Weight { - use $crate::{DmpMessageHandler, TestExt}; + ) -> Result<$crate::Weight, ($crate::MessageId, $crate::Weight)> { + use $crate::{TestExt, UmpSink}; - $name::execute_with(|| { - <$dmp_message_handler>::handle_dmp_messages(iter, max_weight) + Self::execute_with(|| { + $crate::XcmSink::< + $crate::XcmExecutor<::XcmConfig>, + ::Runtime, + >::process_upward_message(origin, msg, max_weight) }) } } @@ -127,30 +271,44 @@ macro_rules! decl_test_parachain { } #[macro_export] -macro_rules! __impl_ext_for_relay_chain { +macro_rules! __impl_test_ext_for_relay_chain { // entry point: generate ext name - ($name:ident, $runtime:path, $new_ext:expr) => { + ($name:ident, $genesis:expr, $on_init:expr) => { $crate::paste::paste! { - $crate::__impl_ext_for_relay_chain!(@impl $name, $runtime, $new_ext, []); + $crate::__impl_test_ext_for_relay_chain!(@impl $name, $genesis, $on_init, []); } }; // impl - (@impl $name:ident, $runtime:path, $new_ext:expr, $ext_name:ident) => { + (@impl $name:ident, $genesis:expr, $on_init:expr, $ext_name:ident) => { thread_local! { pub static $ext_name: $crate::RefCell<$crate::TestExternalities> - = $crate::RefCell::new($new_ext); + = $crate::RefCell::new(<$name>::build_new_ext($genesis)); } - impl $crate::TestExt for $name { + impl TestExt for $name { + fn build_new_ext(storage: $crate::Storage) -> $crate::TestExternalities { + let mut ext = sp_io::TestExternalities::new(storage); + ext.execute_with(|| { + $on_init; + sp_tracing::try_init_simple(); + ::System::set_block_number(1); + }); + ext + } + fn new_ext() -> $crate::TestExternalities { - $new_ext + <$name>::build_new_ext($genesis) } fn reset_ext() { - $ext_name.with(|v| *v.borrow_mut() = $new_ext); + $ext_name.with(|v| *v.borrow_mut() = <$name>::build_new_ext($genesis)); } fn execute_with(execute: impl FnOnce() -> R) -> R { + use $crate::{NetworkComponent}; + // Make sure the Network is initialized + <$name>::init(); + let r = $ext_name.with(|v| v.borrow_mut().execute_with(execute)); // send messages if needed @@ -159,15 +317,15 @@ macro_rules! __impl_ext_for_relay_chain { use $crate::polkadot_primitives::runtime_api::runtime_decl_for_parachain_host::ParachainHostV4; //TODO: mark sent count & filter out sent msg - for para_id in _para_ids() { + for para_id in <$name>::para_ids() { // downward messages - let downward_messages = <$runtime>::dmq_contents(para_id.into()) + let downward_messages = ::Runtime::dmq_contents(para_id.into()) .into_iter() .map(|inbound| (inbound.sent_at, inbound.msg)); if downward_messages.len() == 0 { continue; } - _Messenger::send_downward_messages(para_id, downward_messages.into_iter()); + <$name>::send_downward_messages(para_id, downward_messages.into_iter()); // Note: no need to handle horizontal messages, as the // simulator directly sends them to dest (not relayed). @@ -175,80 +333,227 @@ macro_rules! __impl_ext_for_relay_chain { }) }); - _process_messages(); + <$name>::process_messages(); r } + + fn ext_wrapper(func: impl FnOnce() -> R) -> R { + $ext_name.with(|v| { + v.borrow_mut().execute_with(|| { + func() + }) + }) + } + } + }; +} + +#[macro_export] +macro_rules! __impl_relay { + ($network_name:ident, $relay_chain:ty) => { + impl $crate::NetworkComponent<$network_name> for $relay_chain { + fn network_name() -> &'static str { + stringify!($network_name) + } + } + + impl $relay_chain { + pub fn child_location_of(id: $crate::ParaId) -> MultiLocation { + (Ancestor(0), Parachain(id.into())).into() + } + + pub fn account_id_of(seed: &str) -> $crate::AccountId { + $crate::get_account_id_from_seed::(seed) + } + + pub fn account_data_of(account: AccountId) -> $crate::AccountData { + Self::ext_wrapper(|| ::System::account(account).data) + } + + pub fn sovereign_account_id_of(location: $crate::MultiLocation) -> $crate::AccountId { + ::SovereignAccountOf::convert(location.into()).unwrap() + } + + pub fn fund_accounts(accounts: Vec<(AccountId, Balance)>) { + Self::ext_wrapper(|| { + for account in accounts { + let _ = ::Balances::force_set_balance( + ::RuntimeOrigin::root(), + account.0.into(), + account.1.into(), + ); + } + }); + } + + pub fn events() -> Vec<::RuntimeEvent> { + ::System::events() + .iter() + .map(|record| record.event.clone()) + .collect() + } + } + }; +} + +// Parachain Implementation +#[macro_export] +macro_rules! decl_test_parachains { + ( + $( + pub struct $name:ident { + genesis = $genesis:expr, + on_init = $on_init:expr, + runtime = { + Runtime: $runtime:path, + RuntimeOrigin: $runtime_origin:path, + RuntimeCall: $runtime_call:path, + RuntimeEvent: $runtime_event:path, + XcmpMessageHandler: $xcmp_message_handler:path, + DmpMessageHandler: $dmp_message_handler:path, + LocationToAccountId: $location_to_account:path, + System: $system:path, + Balances: $balances_pallet:path, + ParachainSystem: $parachain_system:path, + ParachainInfo: $parachain_info:path, + }, + pallets_extra = { + $($pallet_name:ident: $pallet_path:path,)* + } + } + ), + + + ) => { + $( + pub struct $name; + + impl Parachain for $name { + type Runtime = $runtime; + type RuntimeOrigin = $runtime_origin; + type RuntimeCall = $runtime_call; + type RuntimeEvent = $runtime_event; + type XcmpMessageHandler = $xcmp_message_handler; + type DmpMessageHandler = $dmp_message_handler; + type LocationToAccountId = $location_to_account; + type System = $system; + type Balances = $balances_pallet; + type ParachainSystem = $parachain_system; + type ParachainInfo = $parachain_info; + } + + $crate::paste::paste! { + pub trait [<$name Pallet>] { + $( + type $pallet_name; + )* + } + + impl [<$name Pallet>] for $name { + $( + type $pallet_name = $pallet_path; + )* + } + } + + $crate::__impl_xcm_handlers_for_parachain!($name); + $crate::__impl_test_ext_for_parachain!($name, $genesis, $on_init); + )+ + }; +} + +#[macro_export] +macro_rules! __impl_xcm_handlers_for_parachain { + ($name:ident) => { + impl $crate::XcmpMessageHandler for $name { + fn handle_xcmp_messages< + 'a, + I: Iterator, + >( + iter: I, + max_weight: $crate::Weight, + ) -> $crate::Weight { + use $crate::{TestExt, XcmpMessageHandler}; + + $name::execute_with(|| { + ::XcmpMessageHandler::handle_xcmp_messages(iter, max_weight) + }) + } + } + + impl $crate::DmpMessageHandler for $name { + fn handle_dmp_messages( + iter: impl Iterator)>, + max_weight: $crate::Weight, + ) -> $crate::Weight { + use $crate::{DmpMessageHandler, TestExt}; + + $name::execute_with(|| { + ::DmpMessageHandler::handle_dmp_messages(iter, max_weight) + }) + } } }; } #[macro_export] -macro_rules! __impl_ext_for_parachain { +macro_rules! __impl_test_ext_for_parachain { // entry point: generate ext name - ($name:ident, $runtime:path, $origin:path, $new_ext:expr) => { + ($name:ident, $genesis:expr, $on_init:expr) => { $crate::paste::paste! { - $crate::__impl_ext_for_parachain!(@impl $name, $runtime, $origin, $new_ext, []); + $crate::__impl_test_ext_for_parachain!(@impl $name, $genesis, $on_init, []); } }; // impl - (@impl $name:ident, $runtime:path, $origin:path, $new_ext:expr, $ext_name:ident) => { + (@impl $name:ident, $genesis:expr, $on_init:expr, $ext_name:ident) => { thread_local! { pub static $ext_name: $crate::RefCell<$crate::TestExternalities> - = $crate::RefCell::new($new_ext); + = $crate::RefCell::new(<$name>::build_new_ext($genesis)); } - impl $name { - fn prepare_for_xcmp() { - $ext_name.with(|v| { - v.borrow_mut().execute_with(|| { - use $crate::{Get, Hooks}; - type ParachainSystem = $crate::cumulus_pallet_parachain_system::Pallet<$runtime>; - - let block_number = $crate::frame_system::Pallet::<$runtime>::block_number(); - let para_id = $crate::parachain_info::Pallet::<$runtime>::get(); - - let _ = ParachainSystem::set_validation_data( - <$origin>::none(), - _hrmp_channel_parachain_inherent_data(para_id.into(), 1), - ); - // set `AnnouncedHrmpMessagesPerCandidate` - ParachainSystem::on_initialize(block_number); - }) + impl TestExt for $name { + fn build_new_ext(storage: $crate::Storage) -> $crate::TestExternalities { + let mut ext = sp_io::TestExternalities::new(storage); + ext.execute_with(|| { + $on_init; + sp_tracing::try_init_simple(); + ::System::set_block_number(1); }); + ext } - } - impl $crate::TestExt for $name { fn new_ext() -> $crate::TestExternalities { - $new_ext + <$name>::build_new_ext($genesis) } fn reset_ext() { - $ext_name.with(|v| *v.borrow_mut() = $new_ext); + $ext_name.with(|v| *v.borrow_mut() = <$name>::build_new_ext($genesis)); } fn execute_with(execute: impl FnOnce() -> R) -> R { - use $crate::{Get, Hooks}; - type ParachainSystem = $crate::cumulus_pallet_parachain_system::Pallet<$runtime>; + use $crate::{Get, Hooks, NetworkComponent}; - $crate::GLOBAL_RELAY.with(|v| { - *v.borrow_mut() += 1; - }); + // Make sure the Network is initialized + <$name>::init(); + + let mut relay_block_number = <$name>::relay_block_number(); + relay_block_number += 1; + <$name>::set_relay_block_number(relay_block_number); + + let para_id = <$name>::para_id().into(); $ext_name.with(|v| { v.borrow_mut().execute_with(|| { - let para_id = $crate::parachain_info::Pallet::<$runtime>::get(); - $crate::GLOBAL_RELAY.with(|v| { - let relay_block = *v.borrow(); - let _ = ParachainSystem::set_validation_data( - <$origin>::none(), - _hrmp_channel_parachain_inherent_data(para_id.into(), relay_block), - ); - }); + // Make sure it has been recorded properly + let relay_block_number = <$name>::relay_block_number(); + let _ = ::ParachainSystem::set_validation_data( + ::RuntimeOrigin::none(), + <$name>::hrmp_channel_parachain_inherent_data(para_id, relay_block_number), + ); }) }); + let r = $ext_name.with(|v| v.borrow_mut().execute_with(execute)); // send messages if needed @@ -256,7 +561,7 @@ macro_rules! __impl_ext_for_parachain { v.borrow_mut().execute_with(|| { use sp_runtime::traits::Header as HeaderT; - let block_number = $crate::frame_system::Pallet::<$runtime>::block_number(); + let block_number = ::System::block_number(); let mock_header = HeaderT::new( 0, Default::default(), @@ -266,222 +571,367 @@ macro_rules! __impl_ext_for_parachain { ); // get messages - ParachainSystem::on_finalize(block_number); - let collation_info = ParachainSystem::collect_collation_info(&mock_header); + ::ParachainSystem::on_finalize(block_number); + let collation_info = ::ParachainSystem::collect_collation_info(&mock_header); // send upward messages - let para_id = $crate::parachain_info::Pallet::<$runtime>::get(); + let relay_block_number = <$name>::relay_block_number(); for msg in collation_info.upward_messages.clone() { - _Messenger::send_upward_message(para_id.into(), msg); + <$name>::send_upward_message(para_id, msg); } // send horizontal messages for msg in collation_info.horizontal_messages { - $crate::GLOBAL_RELAY.with(|v| { - let relay_block = *v.borrow(); - _Messenger::send_horizontal_messages( - msg.recipient.into(), - vec![(para_id.into(), relay_block, msg.data)].into_iter(), - ); - }); + <$name>::send_horizontal_messages( + msg.recipient.into(), + vec![(para_id.into(), relay_block_number, msg.data)].into_iter(), + ); } // clean messages - ParachainSystem::on_initialize(block_number); + ::ParachainSystem::on_initialize(block_number); }) }); - _process_messages(); + <$name>::process_messages(); r } + + fn ext_wrapper(func: impl FnOnce() -> R) -> R { + $ext_name.with(|v| { + v.borrow_mut().execute_with(|| { + func() + }) + }) + } } }; } -thread_local! { - /// Downward messages, each message is: `(to_para_id, [(relay_block_number, msg)])` - #[allow(clippy::type_complexity)] - pub static DOWNWARD_MESSAGES: RefCell)>)>> - = RefCell::new(VecDeque::new()); - #[allow(clippy::type_complexity)] - /// Downward messages that already processed by parachains, each message is: `(to_para_id, relay_block_number, Vec)` - pub static DMP_DONE: RefCell)>> - = RefCell::new(VecDeque::new()); - /// Horizontal messages, each message is: `(to_para_id, [(from_para_id, relay_block_number, msg)])` - #[allow(clippy::type_complexity)] - pub static HORIZONTAL_MESSAGES: RefCell)>)>> - = RefCell::new(VecDeque::new()); - /// Upward messages, each message is: `(from_para_id, msg) - pub static UPWARD_MESSAGES: RefCell)>> = RefCell::new(VecDeque::new()); - /// Global incremental relay chain block number - pub static GLOBAL_RELAY: RefCell = RefCell::new(1); -} - #[macro_export] -macro_rules! decl_test_network { - ( - pub struct $name:ident { - relay_chain = $relay_chain:ty, - parachains = vec![ $( ($para_id:expr, $parachain:ty), )* ], +macro_rules! __impl_parachain { + ($network_name:ident, $parachain:ty) => { + impl $crate::NetworkComponent<$network_name> for $parachain { + fn network_name() -> &'static str { + stringify!($network_name) + } } - ) => { - pub struct $name; - impl $name { - pub fn reset() { - use $crate::{TestExt, VecDeque}; + impl $parachain { + pub fn para_id() -> $crate::ParaId { + Self::ext_wrapper(|| ::ParachainInfo::get()) + } - <$relay_chain>::reset_ext(); - $( <$parachain>::reset_ext(); )* + pub fn parent_location() -> $crate::MultiLocation { + (Parent).into() + } - $( <$parachain>::prepare_for_xcmp(); )* + pub fn account_id_of(seed: &str) -> $crate::AccountId { + $crate::get_account_id_from_seed::(seed) + } - $crate::DOWNWARD_MESSAGES.with(|b| b.replace(VecDeque::new())); - $crate::DMP_DONE.with(|b| b.replace(VecDeque::new())); + pub fn account_data_of(account: AccountId) -> $crate::AccountData { + Self::ext_wrapper(|| ::System::account(account).data) } - } - fn _para_ids() -> Vec { - vec![$( $para_id, )*] - } + pub fn sovereign_account_id_of(location: $crate::MultiLocation) -> $crate::AccountId { + ::LocationToAccountId::convert(location.into()).unwrap() + } - fn _process_messages() { - while _has_unprocessed_messages() { - _process_upward_messages(); - _process_horizontal_messages(); - _process_downward_messages(); + pub fn fund_accounts(accounts: Vec<(AccountId, Balance)>) { + Self::ext_wrapper(|| { + for account in accounts { + let _ = ::Balances::force_set_balance( + ::RuntimeOrigin::root(), + account.0.into(), + account.1.into(), + ); + } + }); } - } - fn _has_unprocessed_messages() -> bool { - $crate::DOWNWARD_MESSAGES.with(|b| !b.borrow_mut().is_empty()) - || $crate::HORIZONTAL_MESSAGES.with(|b| !b.borrow_mut().is_empty()) - || $crate::UPWARD_MESSAGES.with(|b| !b.borrow_mut().is_empty()) + pub fn events() -> Vec<::RuntimeEvent> { + ::System::events() + .iter() + .map(|record| record.event.clone()) + .collect() + } + + fn prepare_for_xcmp() { + use $crate::NetworkComponent; + let para_id = Self::para_id(); + + ::ext_wrapper(|| { + use $crate::{Get, Hooks}; + + let block_number = ::System::block_number(); + + let _ = ::ParachainSystem::set_validation_data( + ::RuntimeOrigin::none(), + Self::hrmp_channel_parachain_inherent_data(para_id.into(), 1), + ); + // set `AnnouncedHrmpMessagesPerCandidate` + ::ParachainSystem::on_initialize(block_number); + }); + } } + }; +} - fn _process_downward_messages() { - use $crate::{DmpMessageHandler, Bounded}; - use polkadot_parachain::primitives::RelayChainBlockNumber; +// Network Implementation +#[macro_export] +macro_rules! decl_test_networks { + ( + $( + pub struct $name:ident { + relay_chain = $relay_chain:ty, + parachains = vec![ $( $parachain:ty, )* ], + } + ), + + + ) => { + $( + pub struct $name; + + impl $name { + pub fn reset() { + use $crate::{TestExt, VecDeque}; + + $crate::INITIALIZED.with(|b| b.borrow_mut().remove(stringify!($name))); + $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().remove(stringify!($name))); + $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::RELAY_BLOCK_NUMBER.with(|b| b.borrow_mut().remove(stringify!($name))); + + <$relay_chain>::reset_ext(); + $( <$parachain>::reset_ext(); )* + $( <$parachain>::prepare_for_xcmp(); )* + } + } - while let Some((to_para_id, messages)) - = $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().pop_front()) { - match to_para_id { - $( - $para_id => { - let mut msg_dedup: Vec<(RelayChainBlockNumber, Vec)> = Vec::new(); - for m in messages { - msg_dedup.push((m.0, m.1.clone())); - } - msg_dedup.dedup(); - - let msgs = msg_dedup.clone().into_iter().filter(|m| { - !$crate::DMP_DONE.with(|b| b.borrow_mut().contains(&(to_para_id, m.0, m.1.clone()))) - }).collect::)>>(); - if msgs.len() != 0 { - <$parachain>::handle_dmp_messages(msgs.clone().into_iter(), $crate::Weight::max_value()); - for m in msgs { - $crate::DMP_DONE.with(|b| b.borrow_mut().push_back((to_para_id, m.0, m.1))); + impl $crate::Network for $name { + 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)); + $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), $crate::VecDeque::new())); + $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::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())); + } + } + + fn _para_ids() -> Vec { + vec![$( + <$parachain>::para_id().into(), + )*] + } + + 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) { + $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 _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()) + } + + 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 mut msg_dedup: Vec<(RelayChainBlockNumber, Vec)> = Vec::new(); + for m in &messages { + msg_dedup.push((m.0, m.1.clone())); } + msg_dedup.dedup(); + + let msgs = msg_dedup.clone().into_iter().filter(|m| { + !$crate::DMP_DONE.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap_or(&mut $crate::VecDeque::new()).contains(&(to_para_id, m.0, m.1.clone()))) + }).collect::)>>(); + if msgs.len() != 0 { + <$parachain>::handle_dmp_messages(msgs.clone().into_iter(), $crate::Weight::max_value()); + 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!(); } - }, - )* - _ => unreachable!(), + )* + } } - } - } - fn _process_horizontal_messages() { - use $crate::{XcmpMessageHandler, Bounded}; + fn _process_horizontal_messages() { + use $crate::{XcmpMessageHandler, Bounded}; - while let Some((to_para_id, messages)) - = $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().pop_front()) { - let iter = messages.iter().map(|(p, b, m)| (*p, *b, &m[..])).collect::>().into_iter(); - match to_para_id { - $( - $para_id => { - <$parachain>::handle_xcmp_messages(iter, $crate::Weight::max_value()); - }, - )* - _ => unreachable!(), + 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)) { + <$parachain>::handle_xcmp_messages(iter.clone(), $crate::Weight::max_value()); + } + )* + } } - } - } - fn _process_upward_messages() { - use $crate::{UmpSink, Bounded}; - while let Some((from_para_id, msg)) = $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().pop_front()) { - let _ = <$relay_chain>::process_upward_message( - from_para_id.into(), - &msg[..], - $crate::Weight::max_value(), - ); - } - } + fn _process_upward_messages() { + use $crate::{UmpSink, Bounded}; + while let Some((from_para_id, msg)) = $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().pop_front()) { + let _ = <$relay_chain>::process_upward_message( + from_para_id.into(), + &msg[..], + $crate::Weight::max_value(), + ); + } + } - pub struct _Messenger; - impl _Messenger { - fn send_downward_messages(to_para_id: u32, iter: impl Iterator)>) { - $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().push_back((to_para_id, iter.collect()))); - } + fn _hrmp_channel_parachain_inherent_data( + para_id: u32, + relay_parent_number: u32, + ) -> $crate::ParachainInherentData { + use $crate::cumulus_primitives_core::{relay_chain::HrmpChannelId, AbridgedHrmpChannel}; + + let mut sproof = $crate::RelayStateSproofBuilder::default(); + sproof.para_id = para_id.into(); + + // egress channel + let e_index = sproof.hrmp_egress_channel_index.get_or_insert_with(Vec::new); + for recipient_para_id in $crate::PARA_IDS.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().clone()) { + let recipient_para_id = $crate::ParaId::from(recipient_para_id); + if let Err(idx) = e_index.binary_search(&recipient_para_id) { + e_index.insert(idx, recipient_para_id); + } - fn send_horizontal_messages< - I: Iterator)>, - >(to_para_id: u32, iter: I) { - $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().push_back((to_para_id, iter.collect()))); - } + sproof + .hrmp_channels + .entry(HrmpChannelId { + sender: sproof.para_id, + recipient: recipient_para_id, + }) + .or_insert_with(|| AbridgedHrmpChannel { + max_capacity: 1024, + max_total_size: 1024 * 1024, + max_message_size: 1024 * 1024, + msg_count: 0, + total_size: 0, + mqc_head: Option::None, + }); + } - fn send_upward_message(from_para_id: u32, msg: Vec) { - $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().push_back((from_para_id, msg))); + let (relay_storage_root, proof) = sproof.into_state_root_and_proof(); + + $crate::ParachainInherentData { + validation_data: $crate::PersistedValidationData { + parent_head: Default::default(), + relay_parent_number, + relay_parent_storage_root: relay_storage_root, + max_pov_size: Default::default(), + }, + relay_chain_state: proof, + downward_messages: Default::default(), + horizontal_messages: Default::default(), + } + } } - } - fn _hrmp_channel_parachain_inherent_data( - para_id: u32, - relay_parent_number: u32, - ) -> $crate::ParachainInherentData { - use $crate::cumulus_primitives_core::{relay_chain::HrmpChannelId, AbridgedHrmpChannel}; - - let mut sproof = $crate::RelayStateSproofBuilder::default(); - sproof.para_id = para_id.into(); - - // egress channel - let e_index = sproof.hrmp_egress_channel_index.get_or_insert_with(Vec::new); - for recipient_para_id in &[ $( $para_id, )* ] { - let recipient_para_id = $crate::ParaId::from(*recipient_para_id); - if let Err(idx) = e_index.binary_search(&recipient_para_id) { - e_index.insert(idx, recipient_para_id); + $crate::__impl_relay!($name, $relay_chain); + + $( + $crate::__impl_parachain!($name, $parachain); + )* + )+ + }; +} + +#[macro_export] +macro_rules! assert_expected_events { + ( $chain:ident, vec![$( $event_pat:pat => { $($attr:ident : $condition:expr, )* }, )*] ) => { + let mut message: Vec = Vec::new(); + $( + let mut meet_conditions = true; + 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); + + match event { + $event_pat => { + $( + if !$condition { + event_message.push(format!(" - The attribute {:?} = {:?} did not met the condition {:?}\n", stringify!($attr), $attr, stringify!($condition))); + meet_conditions &= $condition + } + )* + true + }, + _ => false } + }); - sproof - .hrmp_channels - .entry(HrmpChannelId { - sender: sproof.para_id, - recipient: recipient_para_id, - }) - .or_insert_with(|| AbridgedHrmpChannel { - max_capacity: 1024, - max_total_size: 1024 * 1024, - max_message_size: 1024 * 1024, - msg_count: 0, - total_size: 0, - mqc_head: Option::None, - }); - } - - let (relay_storage_root, proof) = sproof.into_state_root_and_proof(); - - $crate::ParachainInherentData { - validation_data: $crate::PersistedValidationData { - parent_head: Default::default(), - relay_parent_number, - relay_parent_storage_root: relay_storage_root, - max_pov_size: Default::default(), - }, - relay_chain_state: proof, - downward_messages: Default::default(), - horizontal_messages: Default::default(), + if event_received && !meet_conditions { + message.push(format!("\n\nEvent \x1b[31m{}\x1b[0m was received but some of its attributes did not meet the conditions:\n{}", stringify!($event_pat), event_message.concat())); + } else if !event_received { + message.push(format!("\n\nEvent \x1b[31m{}\x1b[0m was never received", stringify!($event_pat))); } + )* + if !message.is_empty() { + panic!("{}", message.concat()) } + } + +} + +#[macro_export] +macro_rules! bx { + ($e:expr) => { + Box::new($e) }; } + +pub mod helpers { + use super::Weight; + + pub fn within_threshold(threshold: u64, expected_value: u64, current_value: u64) -> bool { + let margin = (current_value * threshold) / 100; + let lower_limit = expected_value - margin; + let upper_limit = expected_value + margin; + + current_value >= lower_limit && current_value <= upper_limit + } + + pub fn weight_within_threshold( + (threshold_time, threshold_size): (u64, u64), + expected_weight: Weight, + weight: Weight, + ) -> bool { + let ref_time_within = + within_threshold(threshold_time, expected_weight.ref_time(), weight.ref_time()); + let proof_size_within = + within_threshold(threshold_size, expected_weight.proof_size(), weight.proof_size()); + + ref_time_within && proof_size_within + } +} diff --git a/zombienet/tests/register-para.js b/zombienet/tests/register-para.js index c080904aefe..a8fbab94673 100644 --- a/zombienet/tests/register-para.js +++ b/zombienet/tests/register-para.js @@ -3,7 +3,18 @@ async function run(nodeName, networkInfo, args) { const para = networkInfo.paras[paraIdStr]; const relayNode = networkInfo.relay[0]; - await zombie.registerParachain(parseInt(paraIdStr,10),para.wasmPath, para.statePath, relayNode.wsUri, "//Alice", true); + const registerParachainOptions = { + id: parseInt(paraIdStr,10), + wasmPath: para.wasmPath, + statePath: para.statePath, + apiUrl: relayNode.wsUri, + onboardAsParachain: true, + seed: "//Alice", + finalization: true + }; + + + await zombie.registerParachain(registerParachainOptions); } module.exports = { run }