diff --git a/Cargo.lock b/Cargo.lock index db165b1d1e9..767147d5b3a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -462,7 +462,7 @@ dependencies = [ [[package]] name = "beefy-gadget" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -496,7 +496,7 @@ dependencies = [ [[package]] name = "beefy-gadget-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "beefy-gadget", "futures", @@ -515,7 +515,7 @@ dependencies = [ [[package]] name = "beefy-merkle-tree" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "sp-api", "sp-beefy", @@ -1953,6 +1953,7 @@ dependencies = [ "sp-tracing", "sp-trie", "sp-version", + "xcm", ] [[package]] @@ -2020,6 +2021,7 @@ dependencies = [ "log", "pallet-balances", "parity-scale-codec", + "polkadot-runtime-common", "rand_chacha 0.3.1", "scale-info", "sp-core", @@ -2058,6 +2060,7 @@ dependencies = [ "sp-runtime", "sp-std", "sp-trie", + "xcm", ] [[package]] @@ -2107,6 +2110,8 @@ dependencies = [ "frame-support", "log", "parity-scale-codec", + "polkadot-runtime-common", + "sp-io", "sp-runtime", "sp-std", "xcm", @@ -3116,7 +3121,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "parity-scale-codec", ] @@ -3139,7 +3144,7 @@ checksum = "85dcb89d2b10c5f6133de2efd8c11959ce9dbb46a2f7a4cab208c4eeda6ce1ab" [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-support", "frame-system", @@ -3162,7 +3167,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "Inflector", "array-bytes 4.2.0", @@ -3209,7 +3214,7 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -3220,7 +3225,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -3237,7 +3242,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-support", "frame-system", @@ -3266,7 +3271,7 @@ dependencies = [ [[package]] name = "frame-remote-externalities" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "futures", "log", @@ -3282,7 +3287,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "bitflags", "frame-metadata", @@ -3314,7 +3319,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "Inflector", "cfg-expr", @@ -3328,7 +3333,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -3340,7 +3345,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "proc-macro2", "quote", @@ -3350,7 +3355,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-support", "log", @@ -3368,7 +3373,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -3383,7 +3388,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "parity-scale-codec", "sp-api", @@ -3392,7 +3397,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-support", "parity-scale-codec", @@ -4322,7 +4327,7 @@ checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" [[package]] name = "kusama-runtime" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "bitvec", "frame-benchmarking", @@ -4419,7 +4424,7 @@ dependencies = [ [[package]] name = "kusama-runtime-constants" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "frame-support", "polkadot-primitives", @@ -5245,7 +5250,7 @@ dependencies = [ [[package]] name = "mmr-gadget" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "futures", "log", @@ -5264,7 +5269,7 @@ dependencies = [ [[package]] name = "mmr-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "anyhow", "jsonrpsee", @@ -5756,7 +5761,7 @@ dependencies = [ [[package]] name = "pallet-alliance" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "array-bytes 4.2.0", "frame-benchmarking", @@ -5777,7 +5782,7 @@ dependencies = [ [[package]] name = "pallet-asset-tx-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -5795,7 +5800,7 @@ dependencies = [ [[package]] name = "pallet-assets" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -5810,7 +5815,7 @@ dependencies = [ [[package]] name = "pallet-aura" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-support", "frame-system", @@ -5826,7 +5831,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-support", "frame-system", @@ -5842,7 +5847,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-support", "frame-system", @@ -5857,7 +5862,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -5881,7 +5886,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5901,7 +5906,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -5916,7 +5921,7 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-support", "frame-system", @@ -5932,7 +5937,7 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "array-bytes 4.2.0", "beefy-merkle-tree", @@ -5955,7 +5960,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -5973,7 +5978,7 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -6017,7 +6022,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -6034,7 +6039,7 @@ dependencies = [ [[package]] name = "pallet-contracts" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "bitflags", "frame-benchmarking", @@ -6063,7 +6068,7 @@ dependencies = [ [[package]] name = "pallet-contracts-primitives" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "bitflags", "parity-scale-codec", @@ -6075,7 +6080,7 @@ dependencies = [ [[package]] name = "pallet-contracts-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "proc-macro2", "quote", @@ -6085,7 +6090,7 @@ dependencies = [ [[package]] name = "pallet-conviction-voting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "assert_matches", "frame-benchmarking", @@ -6102,7 +6107,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -6120,7 +6125,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6143,7 +6148,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6156,7 +6161,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -6174,7 +6179,7 @@ dependencies = [ [[package]] name = "pallet-fast-unstake" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6192,7 +6197,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -6215,7 +6220,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "enumflags2", "frame-benchmarking", @@ -6231,7 +6236,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -6251,7 +6256,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -6268,7 +6273,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -6285,7 +6290,7 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -6302,7 +6307,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -6318,7 +6323,7 @@ dependencies = [ [[package]] name = "pallet-nfts" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "enumflags2", "frame-benchmarking", @@ -6335,7 +6340,7 @@ dependencies = [ [[package]] name = "pallet-nis" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -6351,7 +6356,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-support", "frame-system", @@ -6368,7 +6373,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-benchmarking" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6388,7 +6393,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-runtime-api" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "parity-scale-codec", "sp-api", @@ -6398,7 +6403,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-support", "frame-system", @@ -6415,12 +6420,13 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-election-provider-support", "frame-support", "frame-system", + "log", "pallet-babe", "pallet-balances", "pallet-grandpa", @@ -6438,7 +6444,7 @@ dependencies = [ [[package]] name = "pallet-preimage" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -6455,7 +6461,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -6470,7 +6476,7 @@ dependencies = [ [[package]] name = "pallet-randomness-collective-flip" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-support", "frame-system", @@ -6484,7 +6490,7 @@ dependencies = [ [[package]] name = "pallet-ranked-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -6502,7 +6508,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -6517,7 +6523,7 @@ dependencies = [ [[package]] name = "pallet-referenda" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "assert_matches", "frame-benchmarking", @@ -6536,7 +6542,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -6553,7 +6559,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-support", "frame-system", @@ -6574,7 +6580,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -6590,7 +6596,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-support", "frame-system", @@ -6604,7 +6610,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6627,7 +6633,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -6638,7 +6644,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-fn" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "log", "sp-arithmetic", @@ -6647,7 +6653,7 @@ dependencies = [ [[package]] name = "pallet-state-trie-migration" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -6664,7 +6670,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-support", "frame-system", @@ -6693,7 +6699,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -6711,7 +6717,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -6730,7 +6736,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-support", "frame-system", @@ -6746,7 +6752,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -6762,7 +6768,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -6774,7 +6780,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -6791,7 +6797,7 @@ dependencies = [ [[package]] name = "pallet-uniques" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -6806,7 +6812,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -6822,7 +6828,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -6837,7 +6843,7 @@ dependencies = [ [[package]] name = "pallet-whitelist" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-benchmarking", "frame-support", @@ -6852,8 +6858,9 @@ dependencies = [ [[package]] name = "pallet-xcm" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ + "frame-benchmarking", "frame-support", "frame-system", "log", @@ -6861,6 +6868,7 @@ dependencies = [ "scale-info", "serde", "sp-core", + "sp-io", "sp-runtime", "sp-std", "xcm", @@ -6870,7 +6878,7 @@ dependencies = [ [[package]] name = "pallet-xcm-benchmarks" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "frame-benchmarking", "frame-support", @@ -6878,9 +6886,11 @@ dependencies = [ "log", "parity-scale-codec", "scale-info", + "sp-io", "sp-runtime", "sp-std", "xcm", + "xcm-builder", "xcm-executor", ] @@ -7031,6 +7041,7 @@ dependencies = [ "sp-std", "substrate-wasm-builder", "xcm", + "xcm-builder", "xcm-executor", ] @@ -7403,7 +7414,7 @@ dependencies = [ [[package]] name = "polkadot-approval-distribution" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "futures", "polkadot-node-metrics", @@ -7418,7 +7429,7 @@ dependencies = [ [[package]] name = "polkadot-availability-bitfield-distribution" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "futures", "polkadot-node-network-protocol", @@ -7432,7 +7443,7 @@ dependencies = [ [[package]] name = "polkadot-availability-distribution" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "derive_more", "fatality", @@ -7455,7 +7466,7 @@ dependencies = [ [[package]] name = "polkadot-availability-recovery" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "fatality", "futures", @@ -7476,7 +7487,7 @@ dependencies = [ [[package]] name = "polkadot-cli" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "clap 4.0.32", "frame-benchmarking-cli", @@ -7503,7 +7514,7 @@ dependencies = [ [[package]] name = "polkadot-client" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "async-trait", "frame-benchmarking", @@ -7546,7 +7557,7 @@ dependencies = [ [[package]] name = "polkadot-collator-protocol" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "always-assert", "bitvec", @@ -7568,7 +7579,7 @@ dependencies = [ [[package]] name = "polkadot-core-primitives" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "parity-scale-codec", "scale-info", @@ -7580,7 +7591,7 @@ dependencies = [ [[package]] name = "polkadot-dispute-distribution" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "derive_more", "fatality", @@ -7605,7 +7616,7 @@ dependencies = [ [[package]] name = "polkadot-erasure-coding" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "parity-scale-codec", "polkadot-node-primitives", @@ -7619,7 +7630,7 @@ dependencies = [ [[package]] name = "polkadot-gossip-support" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "futures", "futures-timer", @@ -7639,7 +7650,7 @@ dependencies = [ [[package]] name = "polkadot-network-bridge" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "always-assert", "async-trait", @@ -7663,7 +7674,7 @@ dependencies = [ [[package]] name = "polkadot-node-collation-generation" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "futures", "parity-scale-codec", @@ -7681,7 +7692,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-approval-voting" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "bitvec", "derive_more", @@ -7710,7 +7721,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-av-store" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "bitvec", "futures", @@ -7730,7 +7741,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-backing" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "bitvec", "fatality", @@ -7749,7 +7760,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-bitfield-signing" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "futures", "polkadot-node-subsystem", @@ -7764,7 +7775,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-candidate-validation" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "async-trait", "futures", @@ -7783,7 +7794,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-api" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "futures", "polkadot-node-metrics", @@ -7798,7 +7809,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-selection" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "futures", "futures-timer", @@ -7815,7 +7826,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-dispute-coordinator" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "fatality", "futures", @@ -7834,7 +7845,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-parachains-inherent" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "async-trait", "futures", @@ -7851,7 +7862,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-provisioner" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "bitvec", "fatality", @@ -7869,7 +7880,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "always-assert", "assert_matches", @@ -7901,7 +7912,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf-checker" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "futures", "polkadot-node-primitives", @@ -7917,7 +7928,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-runtime-api" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "futures", "lru", @@ -7932,7 +7943,7 @@ dependencies = [ [[package]] name = "polkadot-node-jaeger" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "lazy_static", "log", @@ -7950,7 +7961,7 @@ dependencies = [ [[package]] name = "polkadot-node-metrics" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "bs58", "futures", @@ -7969,7 +7980,7 @@ dependencies = [ [[package]] name = "polkadot-node-network-protocol" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "async-trait", "derive_more", @@ -7992,7 +8003,7 @@ dependencies = [ [[package]] name = "polkadot-node-primitives" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "bounded-vec", "futures", @@ -8014,7 +8025,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "polkadot-node-jaeger", "polkadot-node-subsystem-types", @@ -8024,7 +8035,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-test-helpers" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "async-trait", "futures", @@ -8042,7 +8053,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-types" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "async-trait", "derive_more", @@ -8065,7 +8076,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-util" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "async-trait", "derive_more", @@ -8098,7 +8109,7 @@ dependencies = [ [[package]] name = "polkadot-overseer" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "async-trait", "futures", @@ -8121,7 +8132,7 @@ dependencies = [ [[package]] name = "polkadot-parachain" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "derive_more", "frame-support", @@ -8218,7 +8229,7 @@ dependencies = [ [[package]] name = "polkadot-performance-test" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "env_logger 0.9.0", "kusama-runtime", @@ -8233,7 +8244,7 @@ dependencies = [ [[package]] name = "polkadot-primitives" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "bitvec", "hex-literal", @@ -8259,7 +8270,7 @@ dependencies = [ [[package]] name = "polkadot-rpc" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "beefy-gadget", "beefy-gadget-rpc", @@ -8291,7 +8302,7 @@ dependencies = [ [[package]] name = "polkadot-runtime" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "bitvec", "frame-benchmarking", @@ -8380,7 +8391,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-common" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "bitvec", "frame-benchmarking", @@ -8428,7 +8439,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-constants" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "frame-support", "polkadot-primitives", @@ -8442,7 +8453,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-metrics" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "bs58", "parity-scale-codec", @@ -8454,7 +8465,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-parachains" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "bitflags", "bitvec", @@ -8497,7 +8508,7 @@ dependencies = [ [[package]] name = "polkadot-service" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "async-trait", "beefy-gadget", @@ -8604,7 +8615,7 @@ dependencies = [ [[package]] name = "polkadot-statement-distribution" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "arrayvec 0.5.2", "fatality", @@ -8625,7 +8636,7 @@ dependencies = [ [[package]] name = "polkadot-statement-table" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "parity-scale-codec", "polkadot-primitives", @@ -8635,7 +8646,7 @@ dependencies = [ [[package]] name = "polkadot-test-client" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "parity-scale-codec", "polkadot-node-subsystem", @@ -8660,7 +8671,7 @@ dependencies = [ [[package]] name = "polkadot-test-runtime" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "bitvec", "frame-election-provider-support", @@ -8721,7 +8732,7 @@ dependencies = [ [[package]] name = "polkadot-test-service" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "frame-benchmarking", "frame-system", @@ -9447,7 +9458,7 @@ dependencies = [ [[package]] name = "rococo-runtime" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "beefy-merkle-tree", "frame-benchmarking", @@ -9533,7 +9544,7 @@ dependencies = [ [[package]] name = "rococo-runtime-constants" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "frame-support", "polkadot-primitives", @@ -9757,7 +9768,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "log", "sp-core", @@ -9768,7 +9779,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "async-trait", "futures", @@ -9795,7 +9806,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "futures", "futures-timer", @@ -9818,7 +9829,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -9834,7 +9845,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "memmap2", "sc-chain-spec-derive", @@ -9849,7 +9860,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -9860,7 +9871,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "array-bytes 4.2.0", "chrono", @@ -9900,7 +9911,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "fnv", "futures", @@ -9926,7 +9937,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "hash-db", "kvdb", @@ -9951,7 +9962,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "async-trait", "futures", @@ -9976,7 +9987,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "async-trait", "futures", @@ -10005,7 +10016,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "async-trait", "fork-tree", @@ -10043,7 +10054,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "futures", "jsonrpsee", @@ -10065,7 +10076,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "fork-tree", "parity-scale-codec", @@ -10078,7 +10089,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "async-trait", "futures", @@ -10101,7 +10112,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "lru", "parity-scale-codec", @@ -10125,7 +10136,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "sc-allocator", "sp-maybe-compressed-blob", @@ -10138,7 +10149,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "log", "sc-allocator", @@ -10151,7 +10162,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "cfg-if", "libc", @@ -10168,7 +10179,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "ahash", "array-bytes 4.2.0", @@ -10208,7 +10219,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "finality-grandpa", "futures", @@ -10228,7 +10239,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "ansi_term", "futures", @@ -10243,7 +10254,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -10258,7 +10269,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -10300,7 +10311,7 @@ dependencies = [ [[package]] name = "sc-network-bitswap" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "cid", "futures", @@ -10319,7 +10330,7 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "async-trait", "bitflags", @@ -10345,7 +10356,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "ahash", "futures", @@ -10363,7 +10374,7 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "array-bytes 4.2.0", "futures", @@ -10384,7 +10395,7 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -10416,7 +10427,7 @@ dependencies = [ [[package]] name = "sc-network-transactions" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "array-bytes 4.2.0", "futures", @@ -10435,7 +10446,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "array-bytes 4.2.0", "bytes", @@ -10465,7 +10476,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "futures", "libp2p", @@ -10478,7 +10489,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -10487,7 +10498,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "futures", "jsonrpsee", @@ -10516,7 +10527,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -10535,7 +10546,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "http", "jsonrpsee", @@ -10550,7 +10561,7 @@ dependencies = [ [[package]] name = "sc-rpc-spec-v2" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "array-bytes 4.2.0", "futures", @@ -10576,7 +10587,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "async-trait", "directories", @@ -10641,7 +10652,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "log", "parity-scale-codec", @@ -10652,7 +10663,7 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -10671,7 +10682,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "futures", "libc", @@ -10690,7 +10701,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "chrono", "futures", @@ -10709,7 +10720,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "ansi_term", "atty", @@ -10740,7 +10751,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -10751,13 +10762,14 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "async-trait", "futures", "futures-timer", "linked-hash-map", "log", + "num-traits", "parity-scale-codec", "parking_lot 0.12.1", "sc-client-api", @@ -10777,7 +10789,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "async-trait", "futures", @@ -10791,7 +10803,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "backtrace", "futures", @@ -11220,7 +11232,7 @@ checksum = "03b634d87b960ab1a38c4fe143b508576f075e7c978bfad18217645ebfdfa2ec" [[package]] name = "slot-range-helper" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "enumn", "parity-scale-codec", @@ -11297,7 +11309,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "hash-db", "log", @@ -11315,7 +11327,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "blake2", "proc-macro-crate", @@ -11327,7 +11339,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "parity-scale-codec", "scale-info", @@ -11340,7 +11352,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "integer-sqrt", "num-traits", @@ -11354,7 +11366,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "parity-scale-codec", "scale-info", @@ -11367,7 +11379,7 @@ dependencies = [ [[package]] name = "sp-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "async-trait", "parity-scale-codec", @@ -11379,7 +11391,7 @@ dependencies = [ [[package]] name = "sp-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "parity-scale-codec", "scale-info", @@ -11396,7 +11408,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "parity-scale-codec", "sp-api", @@ -11408,7 +11420,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "futures", "log", @@ -11426,7 +11438,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "async-trait", "futures", @@ -11444,7 +11456,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "async-trait", "parity-scale-codec", @@ -11462,7 +11474,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "async-trait", "merlin", @@ -11485,7 +11497,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "parity-scale-codec", "scale-info", @@ -11497,7 +11509,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "parity-scale-codec", "scale-info", @@ -11510,7 +11522,7 @@ dependencies = [ [[package]] name = "sp-core" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "array-bytes 4.2.0", "base58", @@ -11552,7 +11564,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "blake2", "byteorder", @@ -11566,7 +11578,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "proc-macro2", "quote", @@ -11577,7 +11589,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -11586,7 +11598,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "proc-macro2", "quote", @@ -11596,7 +11608,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "environmental", "parity-scale-codec", @@ -11607,7 +11619,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "finality-grandpa", "log", @@ -11625,7 +11637,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -11639,7 +11651,7 @@ dependencies = [ [[package]] name = "sp-io" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "bytes", "ed25519", @@ -11664,7 +11676,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "lazy_static", "sp-core", @@ -11675,7 +11687,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "async-trait", "futures", @@ -11692,7 +11704,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "thiserror", "zstd", @@ -11701,7 +11713,7 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "ckb-merkle-mountain-range", "log", @@ -11719,7 +11731,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "parity-scale-codec", "scale-info", @@ -11733,7 +11745,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "sp-api", "sp-core", @@ -11743,7 +11755,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "backtrace", "lazy_static", @@ -11753,7 +11765,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "rustc-hash", "serde", @@ -11763,7 +11775,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "either", "hash256-std-hasher", @@ -11785,7 +11797,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -11803,7 +11815,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "Inflector", "proc-macro-crate", @@ -11815,7 +11827,7 @@ dependencies = [ [[package]] name = "sp-serializer" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "serde", "serde_json", @@ -11824,7 +11836,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "parity-scale-codec", "scale-info", @@ -11838,7 +11850,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "parity-scale-codec", "scale-info", @@ -11850,7 +11862,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "hash-db", "log", @@ -11870,12 +11882,12 @@ dependencies = [ [[package]] name = "sp-std" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" [[package]] name = "sp-storage" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "impl-serde", "parity-scale-codec", @@ -11888,7 +11900,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "async-trait", "futures-timer", @@ -11903,7 +11915,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "parity-scale-codec", "sp-std", @@ -11915,7 +11927,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "sp-api", "sp-runtime", @@ -11924,7 +11936,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "async-trait", "log", @@ -11940,7 +11952,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "ahash", "hash-db", @@ -11963,7 +11975,7 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "impl-serde", "parity-scale-codec", @@ -11980,7 +11992,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -11991,7 +12003,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "impl-trait-for-tuples", "log", @@ -12004,7 +12016,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "parity-scale-codec", "scale-info", @@ -12325,7 +12337,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "platforms", ] @@ -12333,7 +12345,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "frame-system-rpc-runtime-api", "futures", @@ -12352,7 +12364,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "hyper", "log", @@ -12364,7 +12376,7 @@ dependencies = [ [[package]] name = "substrate-rpc-client" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "async-trait", "jsonrpsee", @@ -12377,7 +12389,7 @@ dependencies = [ [[package]] name = "substrate-state-trie-migration-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "jsonrpsee", "log", @@ -12396,7 +12408,7 @@ dependencies = [ [[package]] name = "substrate-test-client" version = "2.0.1" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -12422,7 +12434,7 @@ dependencies = [ [[package]] name = "substrate-test-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "futures", "substrate-test-utils-derive", @@ -12432,7 +12444,7 @@ dependencies = [ [[package]] name = "substrate-test-utils-derive" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -12443,7 +12455,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "ansi_term", "build-helper", @@ -12560,7 +12572,7 @@ checksum = "13a4ec180a2de59b57434704ccfad967f789b12737738798fa08798cd5824c16" [[package]] name = "test-runtime-constants" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "frame-support", "polkadot-primitives", @@ -12917,7 +12929,7 @@ dependencies = [ [[package]] name = "tracing-gum" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "polkadot-node-jaeger", "polkadot-primitives", @@ -12928,7 +12940,7 @@ dependencies = [ [[package]] name = "tracing-gum-proc-macro" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "expander 0.0.6", "proc-macro-crate", @@ -13058,7 +13070,7 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "try-runtime-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#7ff6fa2bfa47f288216fdc6e1585f69756c5ec75" dependencies = [ "clap 4.0.32", "frame-remote-externalities", @@ -13968,7 +13980,7 @@ dependencies = [ [[package]] name = "westend-runtime" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "bitvec", "frame-benchmarking", @@ -14012,6 +14024,7 @@ dependencies = [ "pallet-society", "pallet-staking", "pallet-staking-reward-curve", + "pallet-state-trie-migration", "pallet-sudo", "pallet-timestamp", "pallet-transaction-payment", @@ -14058,7 +14071,7 @@ dependencies = [ [[package]] name = "westend-runtime-constants" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "frame-support", "polkadot-primitives", @@ -14449,24 +14462,27 @@ dependencies = [ [[package]] name = "xcm" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "derivative", "impl-trait-for-tuples", "log", "parity-scale-codec", "scale-info", - "sp-runtime", + "serde", + "sp-core", + "sp-weights", "xcm-procedural", ] [[package]] name = "xcm-builder" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "frame-support", "frame-system", + "impl-trait-for-tuples", "log", "pallet-transaction-payment", "parity-scale-codec", @@ -14483,8 +14499,9 @@ dependencies = [ [[package]] name = "xcm-executor" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ + "environmental", "frame-benchmarking", "frame-support", "impl-trait-for-tuples", @@ -14495,13 +14512,14 @@ dependencies = [ "sp-io", "sp-runtime", "sp-std", + "sp-weights", "xcm", ] [[package]] name = "xcm-procedural" version = "0.9.33" -source = "git+https://github.com/paritytech/polkadot?branch=master#dfa8c5ae321e0523f88fdc43afc6d743812ee49e" +source = "git+https://github.com/paritytech/polkadot?branch=master#2ac18997ab3289cc8f0261f56cd43021fb405ebd" dependencies = [ "Inflector", "proc-macro2", diff --git a/pallets/dmp-queue/src/lib.rs b/pallets/dmp-queue/src/lib.rs index f2a5b2a305a..9bdf786ba63 100644 --- a/pallets/dmp-queue/src/lib.rs +++ b/pallets/dmp-queue/src/lib.rs @@ -33,13 +33,16 @@ pub use pallet::*; use scale_info::TypeInfo; use sp_runtime::RuntimeDebug; use sp_std::{convert::TryFrom, prelude::*}; -use xcm::{ - latest::{prelude::*, Weight as XcmWeight}, - VersionedXcm, MAX_XCM_DECODE_DEPTH, -}; +use xcm::{latest::prelude::*, VersionedXcm, MAX_XCM_DECODE_DEPTH}; const DEFAULT_POV_SIZE: u64 = 64 * 1024; // 64 KB +// Maximum amount of messages to process per block. This is a temporary measure until we properly +// account for proof size weights. +const MAX_MESSAGES_PER_BLOCK: u8 = 10; +// Maximum amount of messages that can exist in the overweight queue at any given time. +const MAX_OVERWEIGHT_MESSAGES: u32 = 1000; + #[derive(Copy, Clone, Eq, PartialEq, Encode, Decode, RuntimeDebug, TypeInfo)] pub struct ConfigData { /// The maximum amount of weight any individual message may consume. Messages above this weight @@ -119,8 +122,13 @@ pub mod pallet { /// The overweight messages. #[pallet::storage] - pub(super) type Overweight = - StorageMap<_, Blake2_128Concat, OverweightIndex, (RelayBlockNumber, Vec), OptionQuery>; + pub(super) type Overweight = CountedStorageMap< + _, + Blake2_128Concat, + OverweightIndex, + (RelayBlockNumber, Vec), + OptionQuery, + >; #[pallet::error] pub enum Error { @@ -145,30 +153,18 @@ pub mod pallet { #[pallet::call] impl Pallet { /// Service a single overweight message. - /// - /// - `origin`: Must pass `ExecuteOverweightOrigin`. - /// - `index`: The index of the overweight message to service. - /// - `weight_limit`: The amount of weight that message execution may take. - /// - /// Errors: - /// - `Unknown`: Message of `index` is unknown. - /// - `OverLimit`: Message execution may use greater than `weight_limit`. - /// - /// Events: - /// - `OverweightServiced`: On success. #[pallet::call_index(0)] - #[pallet::weight(Weight::from_ref_time(weight_limit.saturating_add(1_000_000)))] + #[pallet::weight(weight_limit.saturating_add(Weight::from_ref_time(1_000_000)))] pub fn service_overweight( origin: OriginFor, index: OverweightIndex, - weight_limit: XcmWeight, + weight_limit: Weight, ) -> DispatchResultWithPostInfo { T::ExecuteOverweightOrigin::ensure_origin(origin)?; let (sent_at, data) = Overweight::::get(index).ok_or(Error::::Unknown)?; - let weight_used = - Self::try_service_message(Weight::from_ref_time(weight_limit), sent_at, &data[..]) - .map_err(|_| Error::::OverLimit)?; + let weight_used = Self::try_service_message(weight_limit, sent_at, &data[..]) + .map_err(|_| Error::::OverLimit)?; Overweight::::remove(index); Self::deposit_event(Event::OverweightServiced { overweight_index: index, weight_used }); Ok(Some(weight_used.saturating_add(Weight::from_ref_time(1_000_000))).into()) @@ -201,16 +197,29 @@ pub mod pallet { /// /// Returns the weight consumed by executing messages in the queue. fn service_queue(limit: Weight) -> Weight { - PageIndex::::mutate(|page_index| Self::do_service_queue(limit, page_index)) + let mut messages_processed = 0; + PageIndex::::mutate(|page_index| { + Self::do_service_queue(limit, page_index, &mut messages_processed) + }) } /// Exactly equivalent to `service_queue` but expects a mutable `page_index` to be passed /// in and any changes stored. - fn do_service_queue(limit: Weight, page_index: &mut PageIndexData) -> Weight { + fn do_service_queue( + limit: Weight, + page_index: &mut PageIndexData, + messages_processed: &mut u8, + ) -> Weight { let mut used = Weight::zero(); while page_index.begin_used < page_index.end_used { let page = Pages::::take(page_index.begin_used); for (i, &(sent_at, ref data)) in page.iter().enumerate() { + if *messages_processed >= MAX_MESSAGES_PER_BLOCK { + // Exceeded block message limit - put the remaining messages back and bail + Pages::::insert(page_index.begin_used, &page[i..]); + return used + } + *messages_processed += 1; match Self::try_service_message(limit.saturating_sub(used), sent_at, &data[..]) { Ok(w) => used += w, @@ -257,12 +266,12 @@ pub mod pallet { Ok(Weight::zero()) }, Ok(Ok(x)) => { - let outcome = T::XcmExecutor::execute_xcm(Parent, x, limit.ref_time()); + let outcome = T::XcmExecutor::execute_xcm(Parent, x, message_id, limit); match outcome { Outcome::Error(XcmError::WeightLimitReached(required)) => - Err((message_id, Weight::from_ref_time(required))), + Err((message_id, required)), outcome => { - let weight_used = Weight::from_ref_time(outcome.weight_used()); + let weight_used = outcome.weight_used(); Self::deposit_event(Event::ExecutedDownward { message_id, outcome }); Ok(weight_used) }, @@ -280,11 +289,12 @@ pub mod pallet { iter: impl Iterator)>, limit: Weight, ) -> Weight { + let mut messages_processed = 0; let mut page_index = PageIndex::::get(); let config = Configuration::::get(); // First try to use `max_weight` to service the current queue. - let mut used = Self::do_service_queue(limit, &mut page_index); + let mut used = Self::do_service_queue(limit, &mut page_index, &mut messages_processed); // Then if the queue is empty, use the weight remaining to service the incoming messages // and once we run out of weight, place them in the queue. @@ -297,15 +307,21 @@ pub mod pallet { }; for (i, (sent_at, data)) in iter.enumerate() { + if messages_processed >= MAX_MESSAGES_PER_BLOCK { + break + } if maybe_enqueue_page.is_none() { // We're not currently enqueuing - try to execute inline. let remaining_weight = limit.saturating_sub(used); + messages_processed += 1; match Self::try_service_message(remaining_weight, sent_at, &data[..]) { Ok(consumed) => used += consumed, Err((message_id, required_weight)) => // Too much weight required right now. { - if required_weight.any_gt(config.max_individual) { + let is_under_limit = Overweight::::count() < MAX_OVERWEIGHT_MESSAGES; + used.saturating_accrue(T::DbWeight::get().reads(1)); + if required_weight.any_gt(config.max_individual) && is_under_limit { // overweight - add to overweight queue and continue with // message execution. let overweight_index = page_index.overweight_count; @@ -367,7 +383,7 @@ mod tests { }; use sp_version::RuntimeVersion; use std::cell::RefCell; - use xcm::latest::{MultiLocation, OriginKind, Weight as XCMWeight}; + use xcm::latest::{MultiLocation, OriginKind}; type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; @@ -442,28 +458,58 @@ mod tests { }) } + pub enum Weightless {} + impl PreparedMessage for Weightless { + fn weight_of(&self) -> Weight { + unreachable!() + } + } + pub struct MockExec; impl ExecuteXcm for MockExec { + type Prepared = Weightless; + + fn prepare(_message: Xcm) -> Result { + unreachable!() + } + + fn execute( + _origin: impl Into, + _pre: Weightless, + _hash: XcmHash, + _weight_credit: Weight, + ) -> Outcome { + unreachable!() + } + fn execute_xcm_in_credit( _origin: impl Into, message: Xcm, - weight_limit: XCMWeight, - _credit: XCMWeight, + _hash: XcmHash, + weight_limit: Weight, + _weight_credit: Weight, ) -> Outcome { let o = match (message.0.len(), &message.0.first()) { (1, Some(Transact { require_weight_at_most, .. })) => { - if *require_weight_at_most <= weight_limit { + if require_weight_at_most.all_lte(weight_limit) { Outcome::Complete(*require_weight_at_most) } else { Outcome::Error(XcmError::WeightLimitReached(*require_weight_at_most)) } }, // use 1000 to decide that it's not supported. - _ => Outcome::Incomplete(1000.min(weight_limit), XcmError::Unimplemented), + _ => Outcome::Incomplete( + Weight::from_parts(1000, 1000).min(weight_limit), + XcmError::Unimplemented, + ), }; TRACE.with(|q| q.borrow_mut().push((message, o.clone()))); o } + + fn charge_fees(_location: impl Into, _fees: MultiAssets) -> XcmResult { + Err(XcmError::Unimplemented) + } } impl Config for Test { @@ -498,20 +544,23 @@ mod tests { DmpQueue::handle_dmp_messages(iter, limit) } - fn msg(weight: XCMWeight) -> Xcm { + fn msg(weight: u64) -> Xcm { Xcm(vec![Transact { - origin_type: OriginKind::Native, - require_weight_at_most: weight, + origin_kind: OriginKind::Native, + require_weight_at_most: Weight::from_parts(weight, weight), call: Vec::new().into(), }]) } - fn msg_complete(weight: XCMWeight) -> (Xcm, Outcome) { - (msg(weight), Outcome::Complete(weight)) + fn msg_complete(weight: u64) -> (Xcm, Outcome) { + (msg(weight), Outcome::Complete(Weight::from_parts(weight, weight))) } - fn msg_limit_reached(weight: XCMWeight) -> (Xcm, Outcome) { - (msg(weight), Outcome::Error(XcmError::WeightLimitReached(weight))) + fn msg_limit_reached(weight: u64) -> (Xcm, Outcome) { + ( + msg(weight), + Outcome::Error(XcmError::WeightLimitReached(Weight::from_parts(weight, weight))), + ) } fn pages_queued() -> PageCounter { @@ -531,7 +580,7 @@ mod tests { #[test] fn basic_setup_works() { new_test_ext().execute_with(|| { - let weight_used = handle_messages(&[], Weight::from_ref_time(1000)); + let weight_used = handle_messages(&[], Weight::from_parts(1000, 1000)); assert_eq!(weight_used, Weight::zero()); assert_eq!(take_trace(), Vec::new()); assert!(queue_is_empty()); @@ -542,8 +591,8 @@ mod tests { fn service_inline_complete_works() { new_test_ext().execute_with(|| { let incoming = vec![msg(1000), msg(1001)]; - let weight_used = handle_messages(&incoming, Weight::from_ref_time(2500)); - assert_eq!(weight_used, Weight::from_ref_time(2001)); + let weight_used = handle_messages(&incoming, Weight::from_parts(2500, 2500)); + assert_eq!(weight_used, Weight::from_parts(2001, 2001)); assert_eq!(take_trace(), vec![msg_complete(1000), msg_complete(1001)]); assert!(queue_is_empty()); }); @@ -554,8 +603,8 @@ mod tests { new_test_ext().execute_with(|| { let enqueued = vec![msg(1000), msg(1001), msg(1002)]; enqueue(&enqueued); - let weight_used = handle_messages(&[], Weight::from_ref_time(2500)); - assert_eq!(weight_used, Weight::from_ref_time(2001)); + let weight_used = handle_messages(&[], Weight::from_parts(2500, 2500)); + assert_eq!(weight_used, Weight::from_parts(2001, 2001)); assert_eq!( take_trace(), vec![msg_complete(1000), msg_complete(1001), msg_limit_reached(1002),] @@ -567,7 +616,7 @@ mod tests { fn enqueue_works() { new_test_ext().execute_with(|| { let incoming = vec![msg(1000), msg(1001), msg(1002)]; - let weight_used = handle_messages(&incoming, Weight::from_ref_time(999)); + let weight_used = handle_messages(&incoming, Weight::from_parts(999, 999)); assert_eq!(weight_used, Weight::zero()); assert_eq!( PageIndex::::get(), @@ -576,15 +625,15 @@ mod tests { assert_eq!(Pages::::get(0).len(), 3); assert_eq!(take_trace(), vec![msg_limit_reached(1000)]); - let weight_used = handle_messages(&[], Weight::from_ref_time(2500)); - assert_eq!(weight_used, Weight::from_ref_time(2001)); + let weight_used = handle_messages(&[], Weight::from_parts(2500, 2500)); + assert_eq!(weight_used, Weight::from_parts(2001, 2001)); assert_eq!( take_trace(), vec![msg_complete(1000), msg_complete(1001), msg_limit_reached(1002),] ); - let weight_used = handle_messages(&[], Weight::from_ref_time(2500)); - assert_eq!(weight_used, Weight::from_ref_time(1002)); + let weight_used = handle_messages(&[], Weight::from_parts(2500, 2500)); + assert_eq!(weight_used, Weight::from_parts(1002, 1002)); assert_eq!(take_trace(), vec![msg_complete(1002),]); assert!(queue_is_empty()); }); @@ -594,14 +643,14 @@ mod tests { fn service_inline_then_enqueue_works() { new_test_ext().execute_with(|| { let incoming = vec![msg(1000), msg(1001), msg(1002)]; - let weight_used = handle_messages(&incoming, Weight::from_ref_time(1500)); - assert_eq!(weight_used, Weight::from_ref_time(1000)); + let weight_used = handle_messages(&incoming, Weight::from_parts(1500, 1500)); + assert_eq!(weight_used, Weight::from_parts(1000, 1000)); assert_eq!(pages_queued(), 1); assert_eq!(Pages::::get(0).len(), 2); assert_eq!(take_trace(), vec![msg_complete(1000), msg_limit_reached(1001),]); - let weight_used = handle_messages(&[], Weight::from_ref_time(2500)); - assert_eq!(weight_used, Weight::from_ref_time(2003)); + let weight_used = handle_messages(&[], Weight::from_parts(2500, 2500)); + assert_eq!(weight_used, Weight::from_parts(2003, 2003)); assert_eq!(take_trace(), vec![msg_complete(1001), msg_complete(1002),]); assert!(queue_is_empty()); }); @@ -613,8 +662,8 @@ mod tests { let enqueued = vec![msg(1000), msg(1001)]; let incoming = vec![msg(1002), msg(1003)]; enqueue(&enqueued); - let weight_used = handle_messages(&incoming, Weight::from_ref_time(5000)); - assert_eq!(weight_used, Weight::from_ref_time(4006)); + let weight_used = handle_messages(&incoming, Weight::from_parts(5000, 5000)); + assert_eq!(weight_used, Weight::from_parts(4006, 4006)); assert_eq!( take_trace(), vec![ @@ -634,19 +683,19 @@ mod tests { let enqueued = vec![msg(1000), msg(10001)]; let incoming = vec![msg(1002), msg(1003)]; enqueue(&enqueued); - let weight_used = handle_messages(&incoming, Weight::from_ref_time(5000)); - assert_eq!(weight_used, Weight::from_ref_time(1000)); + let weight_used = handle_messages(&incoming, Weight::from_parts(5000, 5000)); + assert_eq!(weight_used, Weight::from_parts(1000, 1000)); assert_eq!(take_trace(), vec![msg_complete(1000), msg_limit_reached(10001),]); assert_eq!(pages_queued(), 2); // 5000 is not enough to process the 10001 blocker, so nothing happens. - let weight_used = handle_messages(&[], Weight::from_ref_time(5000)); + let weight_used = handle_messages(&[], Weight::from_parts(5000, 5000)); assert_eq!(weight_used, Weight::zero()); assert_eq!(take_trace(), vec![msg_limit_reached(10001),]); // 20000 is now enough to process everything. - let weight_used = handle_messages(&[], Weight::from_ref_time(20000)); - assert_eq!(weight_used, Weight::from_ref_time(12006)); + let weight_used = handle_messages(&[], Weight::from_parts(20000, 20000)); + assert_eq!(weight_used, Weight::from_parts(12006, 12006)); assert_eq!( take_trace(), vec![msg_complete(10001), msg_complete(1002), msg_complete(1003),] @@ -661,8 +710,8 @@ mod tests { let enqueued = vec![msg(1000), msg(1001)]; let incoming = vec![msg(10002), msg(1003)]; enqueue(&enqueued); - let weight_used = handle_messages(&incoming, Weight::from_ref_time(5000)); - assert_eq!(weight_used, Weight::from_ref_time(2001)); + let weight_used = handle_messages(&incoming, Weight::from_parts(5000, 5000)); + assert_eq!(weight_used, Weight::from_parts(2001, 2001)); assert_eq!( take_trace(), vec![msg_complete(1000), msg_complete(1001), msg_limit_reached(10002),] @@ -670,8 +719,8 @@ mod tests { assert_eq!(pages_queued(), 1); // 20000 is now enough to process everything. - let weight_used = handle_messages(&[], Weight::from_ref_time(20000)); - assert_eq!(weight_used, Weight::from_ref_time(11005)); + let weight_used = handle_messages(&[], Weight::from_parts(20000, 20000)); + assert_eq!(weight_used, Weight::from_parts(11005, 11005)); assert_eq!(take_trace(), vec![msg_complete(10002), msg_complete(1003),]); assert!(queue_is_empty()); }); @@ -683,8 +732,8 @@ mod tests { let enqueued = vec![msg(1000), msg(1001)]; let incoming = vec![msg(1002), msg(10003)]; enqueue(&enqueued); - let weight_used = handle_messages(&incoming, Weight::from_ref_time(5000)); - assert_eq!(weight_used, Weight::from_ref_time(3003)); + let weight_used = handle_messages(&incoming, Weight::from_parts(5000, 5000)); + assert_eq!(weight_used, Weight::from_parts(3003, 3003)); assert_eq!( take_trace(), vec![ @@ -697,8 +746,8 @@ mod tests { assert_eq!(pages_queued(), 1); // 20000 is now enough to process everything. - let weight_used = handle_messages(&[], Weight::from_ref_time(20000)); - assert_eq!(weight_used, Weight::from_ref_time(10003)); + let weight_used = handle_messages(&[], Weight::from_parts(20000, 20000)); + assert_eq!(weight_used, Weight::from_parts(10003, 10003)); assert_eq!(take_trace(), vec![msg_complete(10003),]); assert!(queue_is_empty()); }); @@ -709,20 +758,20 @@ 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_ref_time(1500)); - assert_eq!(weight_used, Weight::from_ref_time(1000)); + let weight_used = handle_messages(&vec![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_ref_time(1500)); - assert_eq!(weight_used, Weight::from_ref_time(1001)); + let weight_used = handle_messages(&vec![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_ref_time(1500)); - assert_eq!(weight_used, Weight::from_ref_time(1002)); + let weight_used = handle_messages(&vec![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); assert_eq!(PageIndex::::get().begin_used, 2); @@ -733,11 +782,13 @@ mod tests { fn overweight_should_not_block_queue() { new_test_ext().execute_with(|| { // Set the overweight threshold to 9999. - Configuration::::put(ConfigData { max_individual: Weight::from_ref_time(9999) }); + Configuration::::put(ConfigData { + max_individual: Weight::from_parts(9999, 9999), + }); let incoming = vec![msg(1000), msg(10001), msg(1002)]; - let weight_used = handle_messages(&incoming, Weight::from_ref_time(2500)); - assert_eq!(weight_used, Weight::from_ref_time(2002)); + let weight_used = handle_messages(&incoming, Weight::from_parts(2500, 2500)); + assert_eq!(weight_used, Weight::from_parts(2002, 2002)); assert!(queue_is_empty()); assert_eq!( take_trace(), @@ -752,40 +803,64 @@ mod tests { fn overweights_should_be_manually_executable() { new_test_ext().execute_with(|| { // Set the overweight threshold to 9999. - Configuration::::put(ConfigData { max_individual: Weight::from_ref_time(9999) }); + Configuration::::put(ConfigData { + max_individual: Weight::from_parts(9999, 9999), + }); let incoming = vec![msg(10000)]; - let weight_used = handle_messages(&incoming, Weight::from_ref_time(2500)); + let weight_used = handle_messages(&incoming, Weight::from_parts(2500, 2500)); assert_eq!(weight_used, Weight::zero()); assert_eq!(take_trace(), vec![msg_limit_reached(10000)]); assert_eq!(overweights(), vec![0]); assert_noop!( - DmpQueue::service_overweight(RuntimeOrigin::signed(1), 0, 20000), + DmpQueue::service_overweight( + RuntimeOrigin::signed(1), + 0, + Weight::from_parts(20000, 20000) + ), BadOrigin ); assert_noop!( - DmpQueue::service_overweight(RuntimeOrigin::root(), 1, 20000), + DmpQueue::service_overweight( + RuntimeOrigin::root(), + 1, + Weight::from_parts(20000, 20000) + ), Error::::Unknown ); assert_noop!( - DmpQueue::service_overweight(RuntimeOrigin::root(), 0, 9999), + DmpQueue::service_overweight( + RuntimeOrigin::root(), + 0, + Weight::from_parts(9999, 9999) + ), Error::::OverLimit ); assert_eq!(take_trace(), vec![msg_limit_reached(10000)]); - let base_weight = super::Call::::service_overweight { index: 0, weight_limit: 0 } - .get_dispatch_info() - .weight; + let base_weight = + super::Call::::service_overweight { index: 0, weight_limit: Weight::zero() } + .get_dispatch_info() + .weight; use frame_support::dispatch::GetDispatchInfo; - let info = DmpQueue::service_overweight(RuntimeOrigin::root(), 0, 20000).unwrap(); + let info = DmpQueue::service_overweight( + RuntimeOrigin::root(), + 0, + Weight::from_parts(20000, 20000), + ) + .unwrap(); let actual_weight = info.actual_weight.unwrap(); - assert_eq!(actual_weight, base_weight + Weight::from_ref_time(10000)); + assert_eq!(actual_weight, base_weight + Weight::from_parts(10000, 10000)); assert_eq!(take_trace(), vec![msg_complete(10000)]); assert!(overweights().is_empty()); assert_noop!( - DmpQueue::service_overweight(RuntimeOrigin::root(), 0, 20000), + DmpQueue::service_overweight( + RuntimeOrigin::root(), + 0, + Weight::from_parts(20000, 20000) + ), Error::::Unknown ); }); @@ -798,8 +873,8 @@ mod tests { enqueue(&vec![msg(1002), msg(1003)]); enqueue(&vec![msg(1004), msg(1005)]); - let weight_used = DmpQueue::on_idle(1, Weight::from_ref_time(6000)); - assert_eq!(weight_used, Weight::from_ref_time(5010)); + let weight_used = DmpQueue::on_idle(1, Weight::from_parts(6000, 6000)); + assert_eq!(weight_used, Weight::from_parts(5010, 5010)); assert_eq!( take_trace(), vec![ diff --git a/pallets/dmp-queue/src/migration.rs b/pallets/dmp-queue/src/migration.rs index 27b839ed8dd..82c1e8b6eb1 100644 --- a/pallets/dmp-queue/src/migration.rs +++ b/pallets/dmp-queue/src/migration.rs @@ -22,7 +22,6 @@ use frame_support::{ traits::StorageVersion, weights::{constants::WEIGHT_REF_TIME_PER_MILLIS, Weight}, }; -use xcm::latest::Weight as XcmWeight; /// The current storage version. pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); @@ -33,8 +32,15 @@ pub fn migrate_to_latest() -> Weight { let mut weight = T::DbWeight::get().reads(1); if StorageVersion::get::>() == 0 { - weight += migrate_to_v1::(); + weight.saturating_accrue(migrate_to_v1::()); StorageVersion::new(1).put::>(); + weight.saturating_accrue(T::DbWeight::get().writes(1)); + } + + if StorageVersion::get::>() == 1 { + weight.saturating_accrue(migrate_to_v2::()); + StorageVersion::new(2).put::>(); + weight.saturating_accrue(T::DbWeight::get().writes(1)); } weight @@ -46,7 +52,7 @@ mod v0 { #[derive(Decode, Encode, Debug)] pub struct ConfigData { - pub max_individual: XcmWeight, + pub max_individual: u64, } impl Default for ConfigData { @@ -78,6 +84,16 @@ pub fn migrate_to_v1() -> Weight { T::DbWeight::get().reads_writes(1, 1) } +/// Migrates `Overweight` so that it initializes the storage map's counter. +/// +/// NOTE: Only use this function if you know what you're doing. Default to using +/// `migrate_to_latest`. +pub fn migrate_to_v2() -> Weight { + let overweight_messages = as Store>::Overweight::initialize_counter() as u64; + + T::DbWeight::get().reads_writes(overweight_messages, 1) +} + #[cfg(test)] mod tests { use super::*; diff --git a/pallets/parachain-system/Cargo.toml b/pallets/parachain-system/Cargo.toml index 7602de269f3..abd333470eb 100644 --- a/pallets/parachain-system/Cargo.toml +++ b/pallets/parachain-system/Cargo.toml @@ -28,6 +28,7 @@ sp-version = { git = "https://github.com/paritytech/substrate", default-features # Polkadot polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, features = [ "wasm-api" ], branch = "master" } +xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } # Cumulus cumulus-pallet-parachain-system-proc-macro = { path = "proc-macro", default-features = false } @@ -67,6 +68,7 @@ std = [ "sp-state-machine/std", "sp-std/std", "sp-trie/std", + "xcm/std", ] runtime-benchmarks = [ diff --git a/pallets/parachain-system/src/lib.rs b/pallets/parachain-system/src/lib.rs index e1838f9f200..456ae5bf578 100644 --- a/pallets/parachain-system/src/lib.rs +++ b/pallets/parachain-system/src/lib.rs @@ -53,6 +53,7 @@ use sp_runtime::{ }, }; use sp_std::{cmp, collections::btree_map::BTreeMap, prelude::*}; +use xcm::latest::XcmHash; mod migration; mod relay_state_snapshot; @@ -480,6 +481,8 @@ pub mod pallet { DownwardMessagesReceived { count: u32 }, /// Downward messages were processed using the given weight. DownwardMessagesProcessed { weight_used: Weight, dmq_head: relay_chain::Hash }, + /// An upward message was sent to the relay chain. + UpwardMessageSent { message_hash: Option }, } #[pallet::error] @@ -743,7 +746,7 @@ impl GetChannelInfo for Pallet { // None then it must be that this is an edge-case where a message is attempted to be // sent at the first block. It should be safe to assume that there are no channels // opened at all so early. At least, relying on this assumption seems to be a better - // tradeoff, compared to introducing an error variant that the clients should be + // trade-off, compared to introducing an error variant that the clients should be // prepared to handle. let index = match channels.binary_search_by_key(&id, |item| item.0) { Err(_) => return ChannelStatus::Closed, @@ -1004,7 +1007,7 @@ impl frame_system::SetCode for ParachainSetCode { } impl Pallet { - pub fn send_upward_message(message: UpwardMessage) -> Result { + pub fn send_upward_message(message: UpwardMessage) -> Result<(u32, XcmHash), MessageSendError> { // Check if the message fits into the relay-chain constraints. // // Note, that we are using `host_configuration` here which may be from the previous @@ -1034,13 +1037,18 @@ impl Pallet { // Thus fall through here. }, }; - >::append(message); - Ok(0) + >::append(message.clone()); + + // The relay ump does not use using_encoded + // We apply the same this to use the same hash + let hash = sp_io::hashing::blake2_256(&message); + Self::deposit_event(Event::UpwardMessageSent { message_hash: Some(hash) }); + Ok((0, hash)) } } impl UpwardMessageSender for Pallet { - fn send_upward_message(message: UpwardMessage) -> Result { + fn send_upward_message(message: UpwardMessage) -> Result<(u32, XcmHash), MessageSendError> { Self::send_upward_message(message) } } diff --git a/pallets/xcm/src/lib.rs b/pallets/xcm/src/lib.rs index 9d9c656e84b..1bcfcdcce73 100644 --- a/pallets/xcm/src/lib.rs +++ b/pallets/xcm/src/lib.rs @@ -67,13 +67,13 @@ pub mod pallet { pub enum Event { /// Downward message is invalid XCM. /// \[ id \] - InvalidFormat([u8; 8]), + InvalidFormat([u8; 32]), /// Downward message is unsupported version of XCM. /// \[ id \] - UnsupportedVersion([u8; 8]), + UnsupportedVersion([u8; 32]), /// Downward message executed with the given outcome. /// \[ id, outcome \] - ExecutedDownward([u8; 8], Outcome), + ExecutedDownward([u8; 32], Outcome), } /// Origin for the parachains module. @@ -113,7 +113,7 @@ impl DmpMessageHandler for UnlimitedDmpExecution { ) -> Weight { let mut used = Weight::zero(); for (_sent_at, data) in iter { - let id = sp_io::hashing::twox_64(&data[..]); + let id = sp_io::hashing::blake2_256(&data[..]); let msg = VersionedXcm::::decode_all_with_depth_limit( MAX_XCM_DECODE_DEPTH, &mut data.as_slice(), @@ -123,8 +123,8 @@ impl DmpMessageHandler for UnlimitedDmpExecution { Err(_) => Pallet::::deposit_event(Event::InvalidFormat(id)), Ok(Err(())) => Pallet::::deposit_event(Event::UnsupportedVersion(id)), Ok(Ok(x)) => { - let outcome = T::XcmExecutor::execute_xcm(Parent, x, limit.ref_time()); - used += Weight::from_ref_time(outcome.weight_used()); + let outcome = T::XcmExecutor::execute_xcm(Parent, x, id, limit); + used = used.saturating_add(outcome.weight_used()); Pallet::::deposit_event(Event::ExecutedDownward(id, outcome)); }, } @@ -146,7 +146,7 @@ impl DmpMessageHandler for LimitAndDropDmpExecution { ) -> Weight { let mut used = Weight::zero(); for (_sent_at, data) in iter { - let id = sp_io::hashing::twox_64(&data[..]); + let id = sp_io::hashing::blake2_256(&data[..]); let msg = VersionedXcm::::decode_all_with_depth_limit( MAX_XCM_DECODE_DEPTH, &mut data.as_slice(), @@ -157,8 +157,8 @@ impl DmpMessageHandler for LimitAndDropDmpExecution { Ok(Err(())) => Pallet::::deposit_event(Event::UnsupportedVersion(id)), Ok(Ok(x)) => { let weight_limit = limit.saturating_sub(used); - let outcome = T::XcmExecutor::execute_xcm(Parent, x, weight_limit.ref_time()); - used += Weight::from_ref_time(outcome.weight_used()); + let outcome = T::XcmExecutor::execute_xcm(Parent, x, id, weight_limit); + used = used.saturating_add(outcome.weight_used()); Pallet::::deposit_event(Event::ExecutedDownward(id, outcome)); }, } diff --git a/pallets/xcmp-queue/Cargo.toml b/pallets/xcmp-queue/Cargo.toml index 7e7e9a01b24..38c26ca29f5 100644 --- a/pallets/xcmp-queue/Cargo.toml +++ b/pallets/xcmp-queue/Cargo.toml @@ -13,10 +13,12 @@ scale-info = { version = "2.3.1", default-features = false, features = ["derive" # Substrate frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } # Polkadot +polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } @@ -30,7 +32,6 @@ frame-benchmarking = { default-features = false, optional = true, git = "https:/ # Substrate sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "master" } pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master" } # Polkadot @@ -48,6 +49,8 @@ std = [ "frame-support/std", "frame-system/std", "log/std", + "polkadot-runtime-common/std", + "sp-io/std", "sp-runtime/std", "sp-std/std", "xcm-executor/std", diff --git a/pallets/xcmp-queue/src/benchmarking.rs b/pallets/xcmp-queue/src/benchmarking.rs index 5d34d499dbe..5ac78bee763 100644 --- a/pallets/xcmp-queue/src/benchmarking.rs +++ b/pallets/xcmp-queue/src/benchmarking.rs @@ -22,7 +22,7 @@ use frame_system::RawOrigin; benchmarks! { set_config_with_u32 {}: update_resume_threshold(RawOrigin::Root, 100) - set_config_with_weight {}: update_weight_restrict_decay(RawOrigin::Root, 3_000_000) + set_config_with_weight {}: update_weight_restrict_decay(RawOrigin::Root, Weight::from_ref_time(3_000_000)) } impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::Test); diff --git a/pallets/xcmp-queue/src/lib.rs b/pallets/xcmp-queue/src/lib.rs index bb062470c07..e31041b190e 100644 --- a/pallets/xcmp-queue/src/lib.rs +++ b/pallets/xcmp-queue/src/lib.rs @@ -44,20 +44,18 @@ use cumulus_primitives_core::{ ParaId, XcmpMessageFormat, XcmpMessageHandler, XcmpMessageSource, }; use frame_support::{ - traits::EnsureOrigin, + traits::{EnsureOrigin, Get}, weights::{constants::WEIGHT_REF_TIME_PER_MILLIS, Weight}, }; +use polkadot_runtime_common::xcm_sender::ConstantPrice; use rand_chacha::{ rand_core::{RngCore, SeedableRng}, ChaChaRng, }; use scale_info::TypeInfo; -use sp_runtime::{traits::Hash, RuntimeDebug}; +use sp_runtime::RuntimeDebug; use sp_std::{convert::TryFrom, prelude::*}; -use xcm::{ - latest::{prelude::*, Weight as XcmWeight}, - VersionedXcm, WrapVersion, MAX_XCM_DECODE_DEPTH, -}; +use xcm::{latest::prelude::*, VersionedXcm, WrapVersion, MAX_XCM_DECODE_DEPTH}; use xcm_executor::traits::ConvertOrigin; pub use pallet::*; @@ -68,6 +66,12 @@ pub type OverweightIndex = u64; const LOG_TARGET: &str = "xcmp_queue"; const DEFAULT_POV_SIZE: u64 = 64 * 1024; // 64 KB +// Maximum amount of messages to process per block. This is a temporary measure until we properly +// account for proof size weights. +const MAX_MESSAGES_PER_BLOCK: u8 = 10; +// Maximum amount of messages that can exist in the overweight queue at any given time. +const MAX_OVERWEIGHT_MESSAGES: u32 = 1000; + #[frame_support::pallet] pub mod pallet { use super::*; @@ -103,6 +107,9 @@ pub mod pallet { /// superuser origin. type ControllerOriginConverter: ConvertOrigin; + /// The price for delivering an XCM to a sibling parachain destination. + type PriceForSiblingDelivery: PriceForSiblingDelivery; + /// The weight information of this pallet. type WeightInfo: WeightInfo; } @@ -135,11 +142,11 @@ pub mod pallet { /// Events: /// - `OverweightServiced`: On success. #[pallet::call_index(0)] - #[pallet::weight((Weight::from_ref_time(weight_limit.saturating_add(1_000_000)), DispatchClass::Operational,))] + #[pallet::weight((weight_limit.saturating_add(Weight::from_ref_time(1_000_000)), DispatchClass::Operational))] pub fn service_overweight( origin: OriginFor, index: OverweightIndex, - weight_limit: XcmWeight, + weight_limit: Weight, ) -> DispatchResultWithPostInfo { T::ExecuteOverweightOrigin::ensure_origin(origin)?; @@ -150,9 +157,8 @@ pub mod pallet { &mut data.as_slice(), ) .map_err(|_| Error::::BadXcm)?; - let used = - Self::handle_xcm_message(sender, sent_at, xcm, Weight::from_ref_time(weight_limit)) - .map_err(|_| Error::::WeightOverLimit)?; + let used = Self::handle_xcm_message(sender, sent_at, xcm, weight_limit) + .map_err(|_| Error::::WeightOverLimit)?; Overweight::::remove(index); Self::deposit_event(Event::OverweightServiced { index, used }); Ok(Some(used.saturating_add(Weight::from_ref_time(1_000_000))).into()) @@ -234,9 +240,9 @@ pub mod pallet { /// - `new`: Desired value for `QueueConfigData.threshold_weight` #[pallet::call_index(6)] #[pallet::weight((T::WeightInfo::set_config_with_weight(), DispatchClass::Operational,))] - pub fn update_threshold_weight(origin: OriginFor, new: XcmWeight) -> DispatchResult { + pub fn update_threshold_weight(origin: OriginFor, new: Weight) -> DispatchResult { ensure_root(origin)?; - QueueConfig::::mutate(|data| data.threshold_weight = Weight::from_ref_time(new)); + QueueConfig::::mutate(|data| data.threshold_weight = new); Ok(()) } @@ -248,14 +254,9 @@ pub mod pallet { /// - `new`: Desired value for `QueueConfigData.weight_restrict_decay`. #[pallet::call_index(7)] #[pallet::weight((T::WeightInfo::set_config_with_weight(), DispatchClass::Operational,))] - pub fn update_weight_restrict_decay( - origin: OriginFor, - new: XcmWeight, - ) -> DispatchResult { + pub fn update_weight_restrict_decay(origin: OriginFor, new: Weight) -> DispatchResult { ensure_root(origin)?; - QueueConfig::::mutate(|data| { - data.weight_restrict_decay = Weight::from_ref_time(new) - }); + QueueConfig::::mutate(|data| data.weight_restrict_decay = new); Ok(()) } @@ -269,12 +270,10 @@ pub mod pallet { #[pallet::weight((T::WeightInfo::set_config_with_weight(), DispatchClass::Operational,))] pub fn update_xcmp_max_individual_weight( origin: OriginFor, - new: XcmWeight, + new: Weight, ) -> DispatchResult { ensure_root(origin)?; - QueueConfig::::mutate(|data| { - data.xcmp_max_individual_weight = Weight::from_ref_time(new) - }); + QueueConfig::::mutate(|data| data.xcmp_max_individual_weight = new); Ok(()) } @@ -284,17 +283,15 @@ pub mod pallet { #[pallet::generate_deposit(pub(super) fn deposit_event)] pub enum Event { /// Some XCM was executed ok. - Success { message_hash: Option, weight: Weight }, + Success { message_hash: Option, weight: Weight }, /// Some XCM failed. - Fail { message_hash: Option, error: XcmError, weight: Weight }, + Fail { message_hash: Option, error: XcmError, weight: Weight }, /// Bad XCM version used. - BadVersion { message_hash: Option }, + BadVersion { message_hash: Option }, /// Bad XCM format used. - BadFormat { message_hash: Option }, - /// An upward message was sent to the relay chain. - UpwardMessageSent { message_hash: Option }, + BadFormat { message_hash: Option }, /// An HRMP message was sent to a sibling parachain. - XcmpMessageSent { message_hash: Option }, + XcmpMessageSent { message_hash: Option }, /// An XCM exceeded the individual message weight budget. OverweightEnqueued { sender: ParaId, @@ -368,7 +365,7 @@ pub mod pallet { /// `service_overweight`. #[pallet::storage] pub(super) type Overweight = - StorageMap<_, Twox64Concat, OverweightIndex, (ParaId, RelayBlockNumber, Vec)>; + CountedStorageMap<_, Twox64Concat, OverweightIndex, (ParaId, RelayBlockNumber, Vec)>; /// The number of overweight messages ever recorded in `Overweight`. Also doubles as the next /// available free overweight index. @@ -623,34 +620,23 @@ impl Pallet { xcm: VersionedXcm, max_weight: Weight, ) -> Result { - let hash = Encode::using_encoded(&xcm, T::Hashing::hash); + let hash = xcm.using_encoded(sp_io::hashing::blake2_256); log::debug!("Processing XCMP-XCM: {:?}", &hash); let (result, event) = match Xcm::::try_from(xcm) { Ok(xcm) => { - let location = (1, Parachain(sender.into())); + let location = (Parent, Parachain(sender.into())); - match T::XcmExecutor::execute_xcm(location, xcm, max_weight.ref_time()) { + match T::XcmExecutor::execute_xcm(location, xcm, hash, max_weight) { Outcome::Error(e) => ( Err(e), Event::Fail { message_hash: Some(hash), error: e, weight: Weight::zero() }, ), - Outcome::Complete(w) => ( - Ok(Weight::from_ref_time(w)), - Event::Success { - message_hash: Some(hash), - weight: Weight::from_ref_time(w), - }, - ), + Outcome::Complete(w) => + (Ok(w), Event::Success { message_hash: Some(hash), weight: w }), // As far as the caller is concerned, this was dispatched without error, so // we just report the weight used. - Outcome::Incomplete(w, e) => ( - Ok(Weight::from_ref_time(w)), - Event::Fail { - message_hash: Some(hash), - error: e, - weight: Weight::from_ref_time(w), - }, - ), + Outcome::Incomplete(w, e) => + (Ok(w), Event::Fail { message_hash: Some(hash), error: e, weight: w }), } }, Err(()) => @@ -663,6 +649,7 @@ impl Pallet { fn process_xcmp_message( sender: ParaId, (sent_at, format): (RelayBlockNumber, XcmpMessageFormat), + messages_processed: &mut u8, max_weight: Weight, max_individual_weight: Weight, ) -> (Weight, bool) { @@ -672,35 +659,45 @@ impl Pallet { let mut weight_used = Weight::zero(); match format { XcmpMessageFormat::ConcatenatedVersionedXcm => { - while !remaining_fragments.is_empty() { + while !remaining_fragments.is_empty() && + *messages_processed < MAX_MESSAGES_PER_BLOCK + { last_remaining_fragments = remaining_fragments; if let Ok(xcm) = VersionedXcm::::decode_with_depth_limit( MAX_XCM_DECODE_DEPTH, &mut remaining_fragments, ) { let weight = max_weight - weight_used; + *messages_processed += 1; match Self::handle_xcm_message(sender, sent_at, xcm, weight) { Ok(used) => weight_used = weight_used.saturating_add(used), Err(XcmError::WeightLimitReached(required)) - if required > max_individual_weight.ref_time() => + if required.any_gt(max_individual_weight) => { - // overweight - add to overweight queue and continue with message - // execution consuming the message. - let msg_len = last_remaining_fragments - .len() - .saturating_sub(remaining_fragments.len()); - let overweight_xcm = last_remaining_fragments[..msg_len].to_vec(); - let index = Self::stash_overweight(sender, sent_at, overweight_xcm); - let e = Event::OverweightEnqueued { - sender, - sent_at, - index, - required: Weight::from_ref_time(required), - }; - Self::deposit_event(e); + let is_under_limit = + Overweight::::count() < MAX_OVERWEIGHT_MESSAGES; + weight_used.saturating_accrue(T::DbWeight::get().reads(1)); + if is_under_limit { + // overweight - add to overweight queue and continue with message + // execution consuming the message. + let msg_len = last_remaining_fragments + .len() + .saturating_sub(remaining_fragments.len()); + let overweight_xcm = + last_remaining_fragments[..msg_len].to_vec(); + let index = + Self::stash_overweight(sender, sent_at, overweight_xcm); + let e = Event::OverweightEnqueued { + sender, + sent_at, + index, + required, + }; + Self::deposit_event(e); + } }, Err(XcmError::WeightLimitReached(required)) - if required <= max_weight.ref_time() => + if required.all_lte(max_weight) => { // That message didn't get processed this time because of being // too heavy. We leave it around for next time and bail. @@ -727,6 +724,7 @@ impl Pallet { if let Ok(blob) = >::decode(&mut remaining_fragments) { let weight = max_weight - weight_used; + *messages_processed += 1; match Self::handle_blob_message(sender, sent_at, blob, weight) { Ok(used) => weight_used = weight_used.saturating_add(used), Err(true) => { @@ -804,6 +802,7 @@ impl Pallet { /// further. fn service_xcmp_queue(max_weight: Weight) -> Weight { let suspended = QueueSuspended::::get(); + let mut messages_processed = 0; let mut status = >::get(); // <- sorted. if status.is_empty() { @@ -832,12 +831,13 @@ impl Pallet { let mut shuffle_index = 0; while shuffle_index < shuffled.len() && - max_weight.saturating_sub(weight_used).all_gte(threshold_weight) + max_weight.saturating_sub(weight_used).all_gte(threshold_weight) && + messages_processed < MAX_MESSAGES_PER_BLOCK { let index = shuffled[shuffle_index]; let sender = status[index].sender; let sender_origin = T::ControllerOriginConverter::convert_origin( - (1, Parachain(sender.into())), + (Parent, Parachain(sender.into())), OriginKind::Superuser, ); let is_controller = sender_origin @@ -872,6 +872,7 @@ impl Pallet { let (weight_processed, is_empty) = Self::process_xcmp_message( sender, status[index].message_metadata[0], + &mut messages_processed, weight_remaining, xcmp_max_individual_weight, ); @@ -1133,28 +1134,60 @@ impl XcmpMessageSource for Pallet { } } +pub trait PriceForSiblingDelivery { + fn price_for_sibling_delivery(id: ParaId, message: &Xcm<()>) -> MultiAssets; +} + +impl PriceForSiblingDelivery for () { + fn price_for_sibling_delivery(_: ParaId, _: &Xcm<()>) -> MultiAssets { + MultiAssets::new() + } +} + +impl> PriceForSiblingDelivery for ConstantPrice { + fn price_for_sibling_delivery(_: ParaId, _: &Xcm<()>) -> MultiAssets { + T::get() + } +} + /// Xcm sender for sending to a sibling parachain. impl SendXcm for Pallet { - fn send_xcm(dest: impl Into, msg: Xcm<()>) -> Result<(), SendError> { - let dest = dest.into(); + type Ticket = (ParaId, VersionedXcm<()>); + + fn validate( + dest: &mut Option, + msg: &mut Option>, + ) -> SendResult<(ParaId, VersionedXcm<()>)> { + let d = dest.take().ok_or(SendError::MissingArgument)?; - match &dest { + match &d { // An HRMP message for a sibling parachain. MultiLocation { parents: 1, interior: X1(Parachain(id)) } => { - let versioned_xcm = T::VersionWrapper::wrap_version(&dest, msg) + let xcm = msg.take().ok_or(SendError::MissingArgument)?; + let id = ParaId::from(*id); + let price = T::PriceForSiblingDelivery::price_for_sibling_delivery(id, &xcm); + let versioned_xcm = T::VersionWrapper::wrap_version(&d, xcm) .map_err(|()| SendError::DestinationUnsupported)?; - let hash = T::Hashing::hash_of(&versioned_xcm); - Self::send_fragment( - (*id).into(), - XcmpMessageFormat::ConcatenatedVersionedXcm, - versioned_xcm, - ) - .map_err(|e| SendError::Transport(<&'static str>::from(e)))?; + Ok(((id, versioned_xcm), price)) + }, + _ => { + // Anything else is unhandled. This includes a message that is not meant for us. + // We need to make sure that dest/msg is not consumed here. + *dest = Some(d); + Err(SendError::NotApplicable) + }, + } + } + + fn deliver((id, xcm): (ParaId, VersionedXcm<()>)) -> Result { + let hash = xcm.using_encoded(sp_io::hashing::blake2_256); + + match Self::send_fragment(id, XcmpMessageFormat::ConcatenatedVersionedXcm, xcm) { + Ok(_) => { Self::deposit_event(Event::XcmpMessageSent { message_hash: Some(hash) }); - Ok(()) + Ok(hash) }, - // Anything else is unhandled. This includes a message this is meant for us. - _ => Err(SendError::CannotReachDestination(dest, msg)), + Err(e) => Err(SendError::Transport(<&'static str>::from(e))), } } } diff --git a/pallets/xcmp-queue/src/migration.rs b/pallets/xcmp-queue/src/migration.rs index 5eb808162f6..51a2c3104e9 100644 --- a/pallets/xcmp-queue/src/migration.rs +++ b/pallets/xcmp-queue/src/migration.rs @@ -22,7 +22,6 @@ use frame_support::{ traits::StorageVersion, weights::{constants::WEIGHT_REF_TIME_PER_MILLIS, Weight}, }; -use xcm::latest::Weight as XcmWeight; /// The current storage version. pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(2); @@ -33,8 +32,15 @@ pub fn migrate_to_latest() -> Weight { let mut weight = T::DbWeight::get().reads(1); if StorageVersion::get::>() == 1 { - weight += migrate_to_v2::(); + weight.saturating_accrue(migrate_to_v2::()); StorageVersion::new(2).put::>(); + weight.saturating_accrue(T::DbWeight::get().writes(1)); + } + + if StorageVersion::get::>() == 2 { + weight.saturating_accrue(migrate_to_v3::()); + StorageVersion::new(3).put::>(); + weight.saturating_accrue(T::DbWeight::get().writes(1)); } weight @@ -49,9 +55,9 @@ mod v1 { pub suspend_threshold: u32, pub drop_threshold: u32, pub resume_threshold: u32, - pub threshold_weight: XcmWeight, - pub weight_restrict_decay: XcmWeight, - pub xcmp_max_individual_weight: XcmWeight, + pub threshold_weight: u64, + pub weight_restrict_decay: u64, + pub xcmp_max_individual_weight: u64, } impl Default for QueueConfigData { @@ -98,6 +104,12 @@ pub fn migrate_to_v2() -> Weight { T::DbWeight::get().reads_writes(1, 1) } +pub fn migrate_to_v3() -> Weight { + let overweight_messages = as Store>::Overweight::initialize_counter() as u64; + + T::DbWeight::get().reads_writes(overweight_messages, 1) +} + #[cfg(test)] mod tests { use super::*; diff --git a/pallets/xcmp-queue/src/mock.rs b/pallets/xcmp-queue/src/mock.rs index c07ae0a29cb..a7bad5dc057 100644 --- a/pallets/xcmp-queue/src/mock.rs +++ b/pallets/xcmp-queue/src/mock.rs @@ -18,7 +18,10 @@ use crate as xcmp_queue; use core::marker::PhantomData; use cumulus_pallet_parachain_system::AnyRelayNumber; use cumulus_primitives_core::{IsSystem, ParaId}; -use frame_support::{parameter_types, traits::OriginTrait}; +use frame_support::{ + parameter_types, + traits::{Everything, Nothing, OriginTrait}, +}; use frame_system::EnsureRoot; use sp_core::H256; use sp_runtime::{ @@ -26,9 +29,7 @@ use sp_runtime::{ traits::{BlakeTwo256, IdentityLookup}, }; use xcm::prelude::*; -use xcm_builder::{ - CurrencyAdapter, FixedWeightBounds, IsConcrete, LocationInverter, NativeAsset, ParentIsPreset, -}; +use xcm_builder::{CurrencyAdapter, FixedWeightBounds, IsConcrete, NativeAsset, ParentIsPreset}; use xcm_executor::traits::ConvertOrigin; type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; @@ -58,7 +59,7 @@ parameter_types! { type AccountId = u64; impl frame_system::Config for Test { - type BaseCallFilter = frame_support::traits::Everything; + type BaseCallFilter = Everything; type BlockWeights = (); type BlockLength = (); type DbWeight = (); @@ -115,9 +116,10 @@ impl cumulus_pallet_parachain_system::Config for Test { parameter_types! { pub const RelayChain: MultiLocation = MultiLocation::parent(); - pub Ancestry: MultiLocation = X1(Parachain(1u32.into())).into(); - pub UnitWeightCost: u64 = 1_000_000; + pub UniversalLocation: InteriorMultiLocation = X1(Parachain(1u32.into())).into(); + pub UnitWeightCost: Weight = Weight::from_parts(1_000_000, 1024); pub const MaxInstructions: u32 = 100; + pub const MaxAssetsIntoHolding: u32 = 64; } /// Means for transacting assets on this chain. @@ -145,7 +147,7 @@ impl xcm_executor::Config for XcmConfig { type OriginConverter = (); type IsReserve = NativeAsset; type IsTeleporter = NativeAsset; - type LocationInverter = LocationInverter; + type UniversalLocation = UniversalLocation; type Barrier = (); type Weigher = FixedWeightBounds; type Trader = (); @@ -153,6 +155,15 @@ impl xcm_executor::Config for XcmConfig { type AssetTrap = (); type AssetClaims = (); type SubscriptionService = (); + type PalletInstancesInfo = AllPalletsWithSystem; + type MaxAssetsIntoHolding = MaxAssetsIntoHolding; + type AssetLocker = (); + type AssetExchanger = (); + type FeeManager = (); + type MessageExporter = (); + type UniversalAliases = Nothing; + type CallDispatcher = RuntimeCall; + type SafeCallFilter = Everything; } pub type XcmRouter = ( @@ -193,6 +204,7 @@ impl Config for Test { type ControllerOrigin = EnsureRoot; type ControllerOriginConverter = SystemParachainAsSuperuser; type WeightInfo = (); + type PriceForSiblingDelivery = (); } pub fn new_test_ext() -> sp_io::TestExternalities { diff --git a/pallets/xcmp-queue/src/tests.rs b/pallets/xcmp-queue/src/tests.rs index 17da2356a45..48cc4208b58 100644 --- a/pallets/xcmp-queue/src/tests.rs +++ b/pallets/xcmp-queue/src/tests.rs @@ -46,6 +46,7 @@ fn bad_message_is_handled() { XcmpQueue::process_xcmp_message( 1000.into(), (1, format), + &mut 0, Weight::from_ref_time(10_000_000_000), Weight::from_ref_time(10_000_000_000), ); @@ -69,6 +70,7 @@ fn handle_blob_message() { XcmpQueue::process_xcmp_message( 1000.into(), (1, format), + &mut 0, Weight::from_ref_time(10_000_000_000), Weight::from_ref_time(10_000_000_000), ); @@ -86,6 +88,7 @@ fn handle_invalid_data() { XcmpQueue::process_xcmp_message( 1000.into(), (1, format), + &mut 0, Weight::from_ref_time(10_000_000_000), Weight::from_ref_time(10_000_000_000), ); @@ -96,7 +99,7 @@ fn handle_invalid_data() { fn service_overweight_unknown() { new_test_ext().execute_with(|| { assert_noop!( - XcmpQueue::service_overweight(RuntimeOrigin::root(), 0, 1000), + XcmpQueue::service_overweight(RuntimeOrigin::root(), 0, Weight::from_parts(1000, 1000)), Error::::BadOverweightIndex, ); }); @@ -109,7 +112,7 @@ fn service_overweight_bad_xcm_format() { Overweight::::insert(0, (ParaId::from(1000), 0, bad_xcm)); assert_noop!( - XcmpQueue::service_overweight(RuntimeOrigin::root(), 0, 1000), + XcmpQueue::service_overweight(RuntimeOrigin::root(), 0, Weight::from_parts(1000, 1000)), Error::::BadXcm ); }); @@ -187,9 +190,15 @@ fn update_threshold_weight_works() { new_test_ext().execute_with(|| { let data: QueueConfigData = >::get(); assert_eq!(data.threshold_weight, Weight::from_ref_time(100_000)); - assert_ok!(XcmpQueue::update_threshold_weight(RuntimeOrigin::root(), 10_000)); + assert_ok!(XcmpQueue::update_threshold_weight( + RuntimeOrigin::root(), + Weight::from_ref_time(10_000) + )); assert_noop!( - XcmpQueue::update_threshold_weight(RuntimeOrigin::signed(5), 10_000_000), + XcmpQueue::update_threshold_weight( + RuntimeOrigin::signed(5), + Weight::from_ref_time(10_000_000), + ), BadOrigin ); let data: QueueConfigData = >::get(); @@ -203,9 +212,15 @@ fn update_weight_restrict_decay_works() { new_test_ext().execute_with(|| { let data: QueueConfigData = >::get(); assert_eq!(data.weight_restrict_decay, Weight::from_ref_time(2)); - assert_ok!(XcmpQueue::update_weight_restrict_decay(RuntimeOrigin::root(), 5)); + assert_ok!(XcmpQueue::update_weight_restrict_decay( + RuntimeOrigin::root(), + Weight::from_ref_time(5) + )); assert_noop!( - XcmpQueue::update_weight_restrict_decay(RuntimeOrigin::signed(6), 4), + XcmpQueue::update_weight_restrict_decay( + RuntimeOrigin::signed(6), + Weight::from_ref_time(4), + ), BadOrigin ); let data: QueueConfigData = >::get(); @@ -224,12 +239,12 @@ fn update_xcmp_max_individual_weight() { ); assert_ok!(XcmpQueue::update_xcmp_max_individual_weight( RuntimeOrigin::root(), - 30u64 * WEIGHT_REF_TIME_PER_MILLIS + Weight::from_ref_time(30u64 * WEIGHT_REF_TIME_PER_MILLIS) )); assert_noop!( XcmpQueue::update_xcmp_max_individual_weight( RuntimeOrigin::signed(3), - 10u64 * WEIGHT_REF_TIME_PER_MILLIS + Weight::from_ref_time(10u64 * WEIGHT_REF_TIME_PER_MILLIS) ), BadOrigin ); @@ -241,3 +256,88 @@ fn update_xcmp_max_individual_weight() { ); }); } + +/// Validates [`validate`] for required Some(destination) and Some(message) +struct OkFixedXcmHashWithAssertingRequiredInputsSender; +impl OkFixedXcmHashWithAssertingRequiredInputsSender { + const FIXED_XCM_HASH: [u8; 32] = [9; 32]; + + fn fixed_delivery_asset() -> MultiAssets { + MultiAssets::new() + } + + fn expected_delivery_result() -> Result<(XcmHash, MultiAssets), SendError> { + Ok((Self::FIXED_XCM_HASH, Self::fixed_delivery_asset())) + } +} +impl SendXcm for OkFixedXcmHashWithAssertingRequiredInputsSender { + type Ticket = (); + + fn validate( + destination: &mut Option, + message: &mut Option>, + ) -> SendResult { + assert!(destination.is_some()); + assert!(message.is_some()); + Ok(((), OkFixedXcmHashWithAssertingRequiredInputsSender::fixed_delivery_asset())) + } + + fn deliver(_: Self::Ticket) -> Result { + Ok(Self::FIXED_XCM_HASH) + } +} + +#[test] +fn xcmp_queue_does_not_consume_dest_or_msg_on_not_applicable() { + // dummy message + let message = Xcm(vec![Trap(5)]); + + // XcmpQueue - check dest is really not applicable + let dest = (Parent, Parent, Parent); + let mut dest_wrapper = Some(dest.clone().into()); + let mut msg_wrapper = Some(message.clone()); + assert_eq!( + Err(SendError::NotApplicable), + ::validate(&mut dest_wrapper, &mut msg_wrapper) + ); + + // check wrapper were not consumed + assert_eq!(Some(dest.clone().into()), dest_wrapper.take()); + assert_eq!(Some(message.clone()), msg_wrapper.take()); + + // another try with router chain with asserting sender + assert_eq!( + OkFixedXcmHashWithAssertingRequiredInputsSender::expected_delivery_result(), + send_xcm::<(XcmpQueue, OkFixedXcmHashWithAssertingRequiredInputsSender)>( + dest.into(), + message + ) + ); +} + +#[test] +fn xcmp_queue_consumes_dest_and_msg_on_ok_validate() { + // dummy message + let message = Xcm(vec![Trap(5)]); + + // XcmpQueue - check dest/msg is valid + let dest = (Parent, X1(Parachain(5555))); + let mut dest_wrapper = Some(dest.clone().into()); + let mut msg_wrapper = Some(message.clone()); + assert!(::validate(&mut dest_wrapper, &mut msg_wrapper).is_ok()); + + // check wrapper were consumed + assert_eq!(None, dest_wrapper.take()); + assert_eq!(None, msg_wrapper.take()); + + new_test_ext().execute_with(|| { + // another try with router chain with asserting sender + assert_eq!( + Err(SendError::Transport("NoChannel")), + send_xcm::<(XcmpQueue, OkFixedXcmHashWithAssertingRequiredInputsSender)>( + dest.into(), + message + ) + ); + }); +} diff --git a/parachain-template/runtime/src/lib.rs b/parachain-template/runtime/src/lib.rs index 2b15450811d..c59cc57a837 100644 --- a/parachain-template/runtime/src/lib.rs +++ b/parachain-template/runtime/src/lib.rs @@ -387,6 +387,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type ControllerOrigin = EnsureRoot; type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; type WeightInfo = (); + type PriceForSiblingDelivery = (); } impl cumulus_pallet_dmp_queue::Config for Runtime { diff --git a/parachain-template/runtime/src/xcm_config.rs b/parachain-template/runtime/src/xcm_config.rs index 73d45339b6e..fa056fc65d3 100644 --- a/parachain-template/runtime/src/xcm_config.rs +++ b/parachain-template/runtime/src/xcm_config.rs @@ -1,30 +1,31 @@ use super::{ - AccountId, Balances, ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, - RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue, + AccountId, AllPalletsWithSystem, Balances, ParachainInfo, ParachainSystem, PolkadotXcm, + Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue, }; use core::marker::PhantomData; use frame_support::{ log, match_types, parameter_types, - traits::{Everything, Nothing}, + traits::{ConstU32, Everything, Nothing}, + weights::Weight, }; use pallet_xcm::XcmPassthrough; use polkadot_parachain::primitives::Sibling; use polkadot_runtime_common::impls::ToAuthor; -use xcm::latest::{prelude::*, Weight as XCMWeight}; +use xcm::latest::prelude::*; use xcm_builder::{ - AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter, - EnsureXcmOrigin, FixedWeightBounds, IsConcrete, LocationInverter, NativeAsset, ParentIsPreset, + AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowTopLevelPaidExecutionFrom, + CurrencyAdapter, EnsureXcmOrigin, FixedWeightBounds, IsConcrete, NativeAsset, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, - UsingComponents, + UsingComponents, WithComputedOrigin, }; use xcm_executor::{traits::ShouldExecute, XcmExecutor}; parameter_types! { pub const RelayLocation: MultiLocation = MultiLocation::parent(); - pub const RelayNetwork: NetworkId = NetworkId::Any; + pub const RelayNetwork: Option = None; pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); - pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); + pub UniversalLocation: InteriorMultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); } /// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used @@ -76,8 +77,9 @@ pub type XcmOriginToTransactDispatchOrigin = ( parameter_types! { // One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate. - pub UnitWeightCost: u64 = 1_000_000_000; + pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 64 * 1024); pub const MaxInstructions: u32 = 100; + pub const MaxAssetsIntoHolding: u32 = 64; } match_types! { @@ -102,9 +104,9 @@ where { fn should_execute( origin: &MultiLocation, - message: &mut Xcm, - max_weight: XCMWeight, - weight_credit: &mut XCMWeight, + message: &mut [Instruction], + max_weight: Weight, + weight_credit: &mut Weight, ) -> Result<(), ()> { Deny::should_execute(origin, message, max_weight, weight_credit)?; Allow::should_execute(origin, message, max_weight, weight_credit) @@ -116,12 +118,11 @@ pub struct DenyReserveTransferToRelayChain; impl ShouldExecute for DenyReserveTransferToRelayChain { fn should_execute( origin: &MultiLocation, - - message: &mut Xcm, - _max_weight: XCMWeight, - _weight_credit: &mut XCMWeight, + message: &mut [Instruction], + _max_weight: Weight, + _weight_credit: &mut Weight, ) -> Result<(), ()> { - if message.0.iter().any(|inst| { + if message.iter().any(|inst| { matches!( inst, InitiateReserveWithdraw { @@ -140,7 +141,7 @@ impl ShouldExecute for DenyReserveTransferToRelayChain { // An unexpected reserve transfer has arrived from the Relay Chain. Generally, `IsReserve` // should not allow this, but we just log it here. if matches!(origin, MultiLocation { parents: 1, interior: Here }) && - message.0.iter().any(|inst| matches!(inst, ReserveAssetDeposited { .. })) + message.iter().any(|inst| matches!(inst, ReserveAssetDeposited { .. })) { log::warn!( target: "xcm::barriers", @@ -156,9 +157,15 @@ pub type Barrier = DenyThenTry< DenyReserveTransferToRelayChain, ( TakeWeightCredit, - AllowTopLevelPaidExecutionFrom, - AllowUnpaidExecutionFrom, - // ^^^ Parent and its exec plurality get free execution + WithComputedOrigin< + ( + AllowTopLevelPaidExecutionFrom, + AllowExplicitUnpaidExecutionFrom, + // ^^^ Parent and its exec plurality get free execution + ), + UniversalLocation, + ConstU32<8>, + >, ), >; @@ -171,7 +178,7 @@ impl xcm_executor::Config for XcmConfig { type OriginConverter = XcmOriginToTransactDispatchOrigin; type IsReserve = NativeAsset; type IsTeleporter = (); // Teleporting is disabled. - type LocationInverter = LocationInverter; + type UniversalLocation = UniversalLocation; type Barrier = Barrier; type Weigher = FixedWeightBounds; type Trader = @@ -180,6 +187,15 @@ impl xcm_executor::Config for XcmConfig { type AssetTrap = PolkadotXcm; type AssetClaims = PolkadotXcm; type SubscriptionService = PolkadotXcm; + type PalletInstancesInfo = AllPalletsWithSystem; + type MaxAssetsIntoHolding = MaxAssetsIntoHolding; + type AssetLocker = (); + type AssetExchanger = (); + type FeeManager = (); + type MessageExporter = (); + type UniversalAliases = Nothing; + type CallDispatcher = RuntimeCall; + type SafeCallFilter = Everything; } /// No local origins on this chain are allowed to dispatch XCM sends/executions. @@ -189,11 +205,16 @@ pub type LocalOriginToLocation = SignedToAccountId32, + cumulus_primitives_utility::ParentAsUmp, // ..and XCMP to communicate with the sibling chains. XcmpQueue, ); +#[cfg(feature = "runtime-benchmarks")] +parameter_types! { + pub ReachableDest: Option = Some(Parent.into()); +} + impl pallet_xcm::Config for Runtime { type RuntimeEvent = RuntimeEvent; type SendXcmOrigin = EnsureXcmOrigin; @@ -206,13 +227,21 @@ impl pallet_xcm::Config for Runtime { type XcmTeleportFilter = Everything; type XcmReserveTransferFilter = Nothing; type Weigher = FixedWeightBounds; - type LocationInverter = LocationInverter; + type UniversalLocation = UniversalLocation; type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; // ^ Override for AdvertisedXcmVersion default type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; + type Currency = Balances; + type CurrencyMatcher = (); + type TrustedLockers = (); + type SovereignAccountOf = LocationToAccountId; + type MaxLockers = ConstU32<8>; + type WeightInfo = pallet_xcm::TestWeightInfo; + #[cfg(feature = "runtime-benchmarks")] + type ReachableDest = ReachableDest; } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/parachains/common/Cargo.toml b/parachains/common/Cargo.toml index c59d0ec0a86..4b525c4525d 100644 --- a/parachains/common/Cargo.toml +++ b/parachains/common/Cargo.toml @@ -28,6 +28,7 @@ sp-std = { git = "https://github.com/paritytech/substrate", default-features = f # Polkadot polkadot-primitives = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } +xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } # Cumulus diff --git a/parachains/common/src/impls.rs b/parachains/common/src/impls.rs index 69a5a96537b..0057d150fd0 100644 --- a/parachains/common/src/impls.rs +++ b/parachains/common/src/impls.rs @@ -18,13 +18,12 @@ use frame_support::traits::{ fungibles::{self, Balanced, CreditOf}, - Contains, Currency, Get, Imbalance, OnUnbalanced, + Contains, ContainsPair, Currency, Get, Imbalance, OnUnbalanced, }; use pallet_asset_tx_payment::HandleCredit; use sp_runtime::traits::Zero; use sp_std::marker::PhantomData; use xcm::latest::{AssetId, Fungibility::Fungible, MultiAsset, MultiLocation}; -use xcm_executor::traits::FilterAssetLocation; /// Type alias to conveniently refer to the `Currency::NegativeImbalance` associated type. pub type NegativeImbalance = as Currency< @@ -97,8 +96,8 @@ where /// Asset filter that allows all assets from a certain location. pub struct AssetsFrom(PhantomData); -impl> FilterAssetLocation for AssetsFrom { - fn filter_asset_location(asset: &MultiAsset, origin: &MultiLocation) -> bool { +impl> ContainsPair for AssetsFrom { + fn contains(asset: &MultiAsset, origin: &MultiLocation) -> bool { let loc = T::get(); &loc == origin && matches!(asset, MultiAsset { id: AssetId::Concrete(asset_loc), fun: Fungible(_a) } @@ -267,12 +266,9 @@ mod tests { .clone() .pushed_with_interior(GeneralIndex(42)) .expect("multilocation will only have 2 junctions; qed"); - let asset = MultiAsset { id: Concrete(asset_location), fun: 1_000_000.into() }; + let asset = MultiAsset { id: Concrete(asset_location), fun: 1_000_000u128.into() }; assert!( - AssetsFrom::::filter_asset_location( - &asset, - &SomeSiblingParachain::get() - ), + AssetsFrom::::contains(&asset, &SomeSiblingParachain::get()), "AssetsFrom should allow assets from any of its interior locations" ); } diff --git a/parachains/common/src/xcm_config.rs b/parachains/common/src/xcm_config.rs index c0e5b50d17a..1ece2d2bd50 100644 --- a/parachains/common/src/xcm_config.rs +++ b/parachains/common/src/xcm_config.rs @@ -2,12 +2,12 @@ use crate::impls::AccountIdOf; use core::marker::PhantomData; use frame_support::{ log, - traits::{fungibles::Inspect, tokens::BalanceConversion}, + traits::{fungibles::Inspect, tokens::BalanceConversion, ContainsPair}, weights::{Weight, WeightToFee, WeightToFeePolynomial}, }; use sp_runtime::traits::Get; -use xcm::latest::{prelude::*, Weight as XCMWeight}; -use xcm_executor::traits::{FilterAssetLocation, ShouldExecute}; +use xcm::latest::prelude::*; +use xcm_executor::traits::ShouldExecute; //TODO: move DenyThenTry to polkadot's xcm module. /// Deny executing the XCM if it matches any of the Deny filter regardless of anything else. @@ -24,9 +24,9 @@ where { fn should_execute( origin: &MultiLocation, - message: &mut Xcm, - max_weight: XCMWeight, - weight_credit: &mut XCMWeight, + message: &mut [Instruction], + max_weight: Weight, + weight_credit: &mut Weight, ) -> Result<(), ()> { Deny::should_execute(origin, message, max_weight, weight_credit)?; Allow::should_execute(origin, message, max_weight, weight_credit) @@ -38,11 +38,11 @@ pub struct DenyReserveTransferToRelayChain; impl ShouldExecute for DenyReserveTransferToRelayChain { fn should_execute( origin: &MultiLocation, - message: &mut Xcm, - _max_weight: XCMWeight, - _weight_credit: &mut XCMWeight, + message: &mut [Instruction], + _max_weight: Weight, + _weight_credit: &mut Weight, ) -> Result<(), ()> { - if message.0.iter().any(|inst| { + if message.iter().any(|inst| { matches!( inst, InitiateReserveWithdraw { @@ -61,7 +61,7 @@ impl ShouldExecute for DenyReserveTransferToRelayChain { // An unexpected reserve transfer has arrived from the Relay Chain. Generally, `IsReserve` // should not allow this, but we just log it here. if matches!(origin, MultiLocation { parents: 1, interior: Here }) && - message.0.iter().any(|inst| matches!(inst, ReserveAssetDeposited { .. })) + message.iter().any(|inst| matches!(inst, ReserveAssetDeposited { .. })) { log::warn!( target: "xcm::barriers", @@ -111,8 +111,10 @@ where /// Accepts an asset if it is a native asset from a particular `MultiLocation`. pub struct ConcreteNativeAssetFrom(PhantomData); -impl> FilterAssetLocation for ConcreteNativeAssetFrom { - fn filter_asset_location(asset: &MultiAsset, origin: &MultiLocation) -> bool { +impl> ContainsPair + for ConcreteNativeAssetFrom +{ + fn contains(asset: &MultiAsset, origin: &MultiLocation) -> bool { log::trace!(target: "xcm::filter_asset_location", "ConcreteNativeAsset asset: {:?}, origin: {:?}, location: {:?}", asset, origin, Location::get()); diff --git a/parachains/pallets/ping/src/lib.rs b/parachains/pallets/ping/src/lib.rs index 099f45eeee7..2c9e5a40aff 100644 --- a/parachains/pallets/ping/src/lib.rs +++ b/parachains/pallets/ping/src/lib.rs @@ -78,9 +78,9 @@ pub mod pallet { #[pallet::event] #[pallet::generate_deposit(pub(super) fn deposit_event)] pub enum Event { - PingSent(ParaId, u32, Vec), + PingSent(ParaId, u32, Vec, XcmHash, MultiAssets), Pinged(ParaId, u32, Vec), - PongSent(ParaId, u32, Vec), + PongSent(ParaId, u32, Vec, XcmHash, MultiAssets), Ponged(ParaId, u32, Vec, T::BlockNumber), ErrorSendingPing(SendError, ParaId, u32, Vec), ErrorSendingPong(SendError, ParaId, u32, Vec), @@ -103,11 +103,11 @@ pub mod pallet { *seq += 1; *seq }); - match T::XcmSender::send_xcm( - (1, Junction::Parachain(para.into())), + match send_xcm::( + (Parent, Junction::Parachain(para.into())).into(), Xcm(vec![Transact { - origin_type: OriginKind::Native, - require_weight_at_most: 1_000, + origin_kind: OriginKind::Native, + require_weight_at_most: Weight::from_parts(1_000, 1_000), call: ::RuntimeCall::from(Call::::ping { seq, payload: payload.clone().to_vec(), @@ -116,9 +116,15 @@ pub mod pallet { .into(), }]), ) { - Ok(()) => { + Ok((hash, cost)) => { Pings::::insert(seq, n); - Self::deposit_event(Event::PingSent(para, seq, payload.to_vec())); + Self::deposit_event(Event::PingSent( + para, + seq, + payload.to_vec(), + hash, + cost, + )); }, Err(e) => { Self::deposit_event(Event::ErrorSendingPing( @@ -198,11 +204,11 @@ pub mod pallet { let para = ensure_sibling_para(::RuntimeOrigin::from(origin))?; Self::deposit_event(Event::Pinged(para, seq, payload.clone())); - match T::XcmSender::send_xcm( - (1, Junction::Parachain(para.into())), + match send_xcm::( + (Parent, Junction::Parachain(para.into())).into(), Xcm(vec![Transact { - origin_type: OriginKind::Native, - require_weight_at_most: 1_000, + origin_kind: OriginKind::Native, + require_weight_at_most: Weight::from_parts(1_000, 1_000), call: ::RuntimeCall::from(Call::::pong { seq, payload: payload.clone(), @@ -211,7 +217,8 @@ pub mod pallet { .into(), }]), ) { - Ok(()) => Self::deposit_event(Event::PongSent(para, seq, payload)), + Ok((hash, cost)) => + Self::deposit_event(Event::PongSent(para, seq, payload, hash, cost)), Err(e) => Self::deposit_event(Event::ErrorSendingPong(e, para, seq, payload)), } Ok(()) diff --git a/parachains/runtimes/assets/statemine/src/lib.rs b/parachains/runtimes/assets/statemine/src/lib.rs index 93a87c3396f..a7ac8aef9a0 100644 --- a/parachains/runtimes/assets/statemine/src/lib.rs +++ b/parachains/runtimes/assets/statemine/src/lib.rs @@ -471,6 +471,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { >; type ControllerOriginConverter = xcm_config::XcmOriginToTransactDispatchOrigin; type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo; + type PriceForSiblingDelivery = (); } impl cumulus_pallet_dmp_queue::Config for Runtime { @@ -684,6 +685,7 @@ mod benches { [pallet_collator_selection, CollatorSelection] [cumulus_pallet_xcmp_queue, XcmpQueue] // XCM + [pallet_xcm, PolkadotXcm] // NOTE: Make sure you point to the individual modules below. [pallet_xcm_benchmarks::fungible, XcmBalances] [pallet_xcm_benchmarks::generic, XcmGeneric] @@ -870,7 +872,7 @@ impl_runtime_apis! { impl cumulus_pallet_session_benchmarking::Config for Runtime {} use xcm::latest::prelude::*; - use xcm_config::KsmLocation; + use xcm_config::{KsmLocation, MaxAssetsIntoHolding}; use pallet_xcm_benchmarks::asset_instance_from; impl pallet_xcm_benchmarks::Config for Runtime { @@ -879,12 +881,12 @@ impl_runtime_apis! { fn valid_destination() -> Result { Ok(KsmLocation::get()) } - fn worst_case_holding() -> MultiAssets { + fn worst_case_holding(depositable_count: u32) -> MultiAssets { // A mix of fungible, non-fungible, and concrete assets. - const HOLDING_FUNGIBLES: u32 = 100; - const HOLDING_NON_FUNGIBLES: u32 = 100; + let holding_non_fungibles = MaxAssetsIntoHolding::get() / 2 - depositable_count; + let holding_fungibles = holding_non_fungibles.saturating_sub(1); let fungibles_amount: u128 = 100; - let mut assets = (0..HOLDING_FUNGIBLES) + let mut assets = (0..holding_fungibles) .map(|i| { MultiAsset { id: Concrete(GeneralIndex(i as u128).into()), @@ -893,17 +895,17 @@ impl_runtime_apis! { .into() }) .chain(core::iter::once(MultiAsset { id: Concrete(Here.into()), fun: Fungible(u128::MAX) })) - .chain((0..HOLDING_NON_FUNGIBLES).map(|i| MultiAsset { + .chain((0..holding_non_fungibles).map(|i| MultiAsset { id: Concrete(GeneralIndex(i as u128).into()), fun: NonFungible(asset_instance_from(i)), })) .collect::>(); - assets.push(MultiAsset{ - id: Concrete(KsmLocation::get()), - fun: Fungible(1_000_000 * UNITS), - }); - assets.into() + assets.push(MultiAsset { + id: Concrete(KsmLocation::get()), + fun: Fungible(1_000_000 * UNITS), + }); + assets.into() } } @@ -912,8 +914,7 @@ impl_runtime_apis! { KsmLocation::get(), MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(KsmLocation::get()) }, )); - pub const TrustedReserve: Option<(MultiLocation, MultiAsset)> = None; - pub const CheckedAccount: Option = None; + pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None; } @@ -922,7 +923,6 @@ impl_runtime_apis! { type CheckedAccount = CheckedAccount; type TrustedTeleporter = TrustedTeleporter; - type TrustedReserve = TrustedReserve; fn get_multi_asset() -> MultiAsset { MultiAsset { @@ -939,8 +939,16 @@ impl_runtime_apis! { (0u64, Response::Version(Default::default())) } - fn transact_origin() -> Result { - Ok(KsmLocation::get()) + fn worst_case_asset_exchange() -> Result<(MultiAssets, MultiAssets), BenchmarkError> { + Err(BenchmarkError::Skip) + } + + fn universal_alias() -> Result { + Err(BenchmarkError::Skip) + } + + fn transact_origin_and_runtime_call() -> Result<(MultiLocation, RuntimeCall), BenchmarkError> { + Ok((KsmLocation::get(), frame_system::Call::remark_with_event { remark: vec![] }.into())) } fn subscribe_origin() -> Result { @@ -953,6 +961,10 @@ impl_runtime_apis! { let ticket = MultiLocation { parents: 0, interior: Here }; Ok((origin, ticket, assets)) } + + fn unlockable_asset() -> Result<(MultiLocation, MultiLocation, MultiAsset), BenchmarkError> { + Err(BenchmarkError::Skip) + } } type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::; diff --git a/parachains/runtimes/assets/statemine/src/weights/mod.rs b/parachains/runtimes/assets/statemine/src/weights/mod.rs index 080584f2cfa..5dd6ffd662e 100644 --- a/parachains/runtimes/assets/statemine/src/weights/mod.rs +++ b/parachains/runtimes/assets/statemine/src/weights/mod.rs @@ -11,6 +11,7 @@ pub mod pallet_session; pub mod pallet_timestamp; pub mod pallet_uniques; pub mod pallet_utility; +pub mod pallet_xcm; pub mod paritydb_weights; pub mod rocksdb_weights; pub mod xcm; diff --git a/parachains/runtimes/assets/statemine/src/weights/pallet_xcm.rs b/parachains/runtimes/assets/statemine/src/weights/pallet_xcm.rs new file mode 100644 index 00000000000..1b862af5342 --- /dev/null +++ b/parachains/runtimes/assets/statemine/src/weights/pallet_xcm.rs @@ -0,0 +1,174 @@ +// Copyright 2021 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Cumulus is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Cumulus. If not, see . + +//! Autogenerated weights for `pallet_xcm` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-12-22, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024 + +// Executed Command: +// /home/benchbot/cargo_target_dir/production/polkadot-parachain +// benchmark +// pallet +// --steps=50 +// --repeat=20 +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json +// --pallet=pallet_xcm +// --chain=statemine-dev +// --header=./file_header.txt +// --output=./parachains/runtimes/assets/statemine/src/weights/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_xcm`. +pub struct WeightInfo(PhantomData); +impl pallet_xcm::WeightInfo for WeightInfo { + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + fn send() -> Weight { + // Minimum execution time: 26_577 nanoseconds. + Weight::from_ref_time(27_239_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: ParachainInfo ParachainId (r:1 w:0) + fn teleport_assets() -> Weight { + // Minimum execution time: 32_703 nanoseconds. + Weight::from_ref_time(33_200_000) + .saturating_add(T::DbWeight::get().reads(1)) + } + // Storage: ParachainInfo ParachainId (r:1 w:0) + fn reserve_transfer_assets() -> Weight { + // Minimum execution time: 25_142 nanoseconds. + Weight::from_ref_time(25_808_000) + .saturating_add(T::DbWeight::get().reads(1)) + } + // Storage: Benchmark Override (r:0 w:0) + fn execute() -> Weight { + // Minimum execution time: 18_446_744_073_709_551 nanoseconds. + Weight::from_ref_time(18_446_744_073_709_551_000) + } + // Storage: PolkadotXcm SupportedVersion (r:0 w:1) + fn force_xcm_version() -> Weight { + // Minimum execution time: 15_036 nanoseconds. + Weight::from_ref_time(15_456_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: PolkadotXcm SafeXcmVersion (r:0 w:1) + fn force_default_xcm_version() -> Weight { + // Minimum execution time: 4_404 nanoseconds. + Weight::from_ref_time(4_598_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: PolkadotXcm VersionNotifiers (r:1 w:1) + // Storage: PolkadotXcm QueryCounter (r:1 w:1) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + // Storage: PolkadotXcm Queries (r:0 w:1) + fn force_subscribe_version_notify() -> Weight { + // Minimum execution time: 30_942 nanoseconds. + Weight::from_ref_time(31_608_000) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(5)) + } + // Storage: PolkadotXcm VersionNotifiers (r:1 w:1) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + // Storage: PolkadotXcm Queries (r:0 w:1) + fn force_unsubscribe_version_notify() -> Weight { + // Minimum execution time: 32_327 nanoseconds. + Weight::from_ref_time(32_698_000) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: PolkadotXcm SupportedVersion (r:4 w:2) + fn migrate_supported_version() -> Weight { + // Minimum execution time: 13_522 nanoseconds. + Weight::from_ref_time(13_862_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PolkadotXcm VersionNotifiers (r:4 w:2) + fn migrate_version_notifiers() -> Weight { + // Minimum execution time: 13_621 nanoseconds. + Weight::from_ref_time(14_028_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PolkadotXcm VersionNotifyTargets (r:5 w:0) + fn already_notified_target() -> Weight { + // Minimum execution time: 15_511 nanoseconds. + Weight::from_ref_time(15_825_000) + .saturating_add(T::DbWeight::get().reads(5)) + } + // Storage: PolkadotXcm VersionNotifyTargets (r:2 w:1) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + fn notify_current_targets() -> Weight { + // Minimum execution time: 27_062 nanoseconds. + Weight::from_ref_time(27_514_000) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: PolkadotXcm VersionNotifyTargets (r:3 w:0) + fn notify_target_migration_fail() -> Weight { + // Minimum execution time: 7_062 nanoseconds. + Weight::from_ref_time(7_325_000) + .saturating_add(T::DbWeight::get().reads(3)) + } + // Storage: PolkadotXcm VersionNotifyTargets (r:4 w:2) + fn migrate_version_notify_targets() -> Weight { + // Minimum execution time: 14_362 nanoseconds. + Weight::from_ref_time(14_724_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PolkadotXcm VersionNotifyTargets (r:4 w:2) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + fn migrate_and_notify_old_targets() -> Weight { + // Minimum execution time: 32_435 nanoseconds. + Weight::from_ref_time(33_042_000) + .saturating_add(T::DbWeight::get().reads(9)) + .saturating_add(T::DbWeight::get().writes(4)) + } +} diff --git a/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs b/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs index 7972667cf06..d38e1c62e51 100644 --- a/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs +++ b/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs @@ -21,168 +21,220 @@ use crate::Runtime; use frame_support::weights::Weight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; -use sp_std::{cmp, prelude::*}; -use xcm::{ - latest::{prelude::*, Weight as XCMWeight}, - DoubleEncoded, -}; +use sp_std::prelude::*; +use xcm::{latest::prelude::*, DoubleEncoded}; trait WeighMultiAssets { - fn weigh_multi_assets(&self, weight: Weight) -> XCMWeight; + fn weigh_multi_assets(&self, weight: Weight) -> Weight; } const MAX_ASSETS: u32 = 100; impl WeighMultiAssets for MultiAssetFilter { - fn weigh_multi_assets(&self, weight: Weight) -> XCMWeight { - let weight = match self { + fn weigh_multi_assets(&self, weight: Weight) -> Weight { + match self { Self::Definite(assets) => weight.saturating_mul(assets.inner().into_iter().count() as u64), Self::Wild(_) => weight.saturating_mul(MAX_ASSETS as u64), - }; - weight.ref_time() + } } } impl WeighMultiAssets for MultiAssets { - fn weigh_multi_assets(&self, weight: Weight) -> XCMWeight { - weight.saturating_mul(self.inner().into_iter().count() as u64).ref_time() + fn weigh_multi_assets(&self, weight: Weight) -> Weight { + weight.saturating_mul(self.inner().into_iter().count() as u64) } } pub struct StatemineXcmWeight(core::marker::PhantomData); impl XcmWeightInfo for StatemineXcmWeight { - fn withdraw_asset(assets: &MultiAssets) -> XCMWeight { + fn withdraw_asset(assets: &MultiAssets) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::withdraw_asset()) } // Currently there is no trusted reserve - fn reserve_asset_deposited(_assets: &MultiAssets) -> XCMWeight { - u64::MAX + fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight { + // TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974 + Weight::from_ref_time(1_000_000_000 as u64) } - fn receive_teleported_asset(assets: &MultiAssets) -> XCMWeight { + fn receive_teleported_asset(assets: &MultiAssets) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::receive_teleported_asset()) } - fn query_response(_query_id: &u64, _response: &Response, _max_weight: &u64) -> XCMWeight { - XcmGeneric::::query_response().ref_time() + fn query_response( + _query_id: &u64, + _response: &Response, + _max_weight: &Weight, + _querier: &Option, + ) -> Weight { + XcmGeneric::::query_response() } - fn transfer_asset(assets: &MultiAssets, _dest: &MultiLocation) -> XCMWeight { + fn transfer_asset(assets: &MultiAssets, _dest: &MultiLocation) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::transfer_asset()) } fn transfer_reserve_asset( assets: &MultiAssets, _dest: &MultiLocation, _xcm: &Xcm<()>, - ) -> XCMWeight { + ) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::transfer_reserve_asset()) } fn transact( _origin_type: &OriginKind, - _require_weight_at_most: &u64, + _require_weight_at_most: &Weight, _call: &DoubleEncoded, - ) -> XCMWeight { - XcmGeneric::::transact().ref_time() + ) -> Weight { + XcmGeneric::::transact() } fn hrmp_new_channel_open_request( _sender: &u32, _max_message_size: &u32, _max_capacity: &u32, - ) -> XCMWeight { + ) -> Weight { // XCM Executor does not currently support HRMP channel operations - Weight::MAX.ref_time() + Weight::MAX } - fn hrmp_channel_accepted(_recipient: &u32) -> XCMWeight { + fn hrmp_channel_accepted(_recipient: &u32) -> Weight { // XCM Executor does not currently support HRMP channel operations - Weight::MAX.ref_time() + Weight::MAX } - fn hrmp_channel_closing(_initiator: &u32, _sender: &u32, _recipient: &u32) -> XCMWeight { + fn hrmp_channel_closing(_initiator: &u32, _sender: &u32, _recipient: &u32) -> Weight { // XCM Executor does not currently support HRMP channel operations - Weight::MAX.ref_time() + Weight::MAX } - fn clear_origin() -> XCMWeight { - XcmGeneric::::clear_origin().ref_time() + fn clear_origin() -> Weight { + XcmGeneric::::clear_origin() } - fn descend_origin(_who: &InteriorMultiLocation) -> XCMWeight { - XcmGeneric::::descend_origin().ref_time() + fn descend_origin(_who: &InteriorMultiLocation) -> Weight { + XcmGeneric::::descend_origin() } - fn report_error( - _query_id: &QueryId, - _dest: &MultiLocation, - _max_response_weight: &u64, - ) -> XCMWeight { - XcmGeneric::::report_error().ref_time() + fn report_error(_query_response_info: &QueryResponseInfo) -> Weight { + XcmGeneric::::report_error() } - fn deposit_asset( - assets: &MultiAssetFilter, - _max_assets: &u32, - _dest: &MultiLocation, - ) -> XCMWeight { + fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_ref_time(1_000_000_000 as u64).ref_time(); + let hardcoded_weight = Weight::from_ref_time(1_000_000_000 as u64); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::deposit_asset()); - cmp::min(hardcoded_weight, weight) + hardcoded_weight.min(weight) } fn deposit_reserve_asset( assets: &MultiAssetFilter, - _max_assets: &u32, _dest: &MultiLocation, _xcm: &Xcm<()>, - ) -> XCMWeight { + ) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::deposit_reserve_asset()) } - fn exchange_asset(_give: &MultiAssetFilter, _receive: &MultiAssets) -> XCMWeight { - Weight::MAX.ref_time() + fn exchange_asset(_give: &MultiAssetFilter, _receive: &MultiAssets, _maximal: &bool) -> Weight { + Weight::MAX } fn initiate_reserve_withdraw( assets: &MultiAssetFilter, _reserve: &MultiLocation, _xcm: &Xcm<()>, - ) -> XCMWeight { + ) -> Weight { assets.weigh_multi_assets(XcmGeneric::::initiate_reserve_withdraw()) } fn initiate_teleport( assets: &MultiAssetFilter, _dest: &MultiLocation, _xcm: &Xcm<()>, - ) -> XCMWeight { + ) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_ref_time(200_000_000 as u64).ref_time(); + let hardcoded_weight = Weight::from_ref_time(200_000_000 as u64); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::initiate_teleport()); - cmp::min(hardcoded_weight, weight) + hardcoded_weight.min(weight) } - fn query_holding( - _query_id: &u64, - _dest: &MultiLocation, - _assets: &MultiAssetFilter, - _max_response_weight: &u64, - ) -> XCMWeight { - XcmGeneric::::query_holding().ref_time() + fn report_holding(_response_info: &QueryResponseInfo, _assets: &MultiAssetFilter) -> Weight { + XcmGeneric::::report_holding() + } + fn buy_execution(_fees: &MultiAsset, _weight_limit: &WeightLimit) -> Weight { + XcmGeneric::::buy_execution() + } + fn refund_surplus() -> Weight { + XcmGeneric::::refund_surplus() + } + fn set_error_handler(_xcm: &Xcm) -> Weight { + XcmGeneric::::set_error_handler() + } + fn set_appendix(_xcm: &Xcm) -> Weight { + XcmGeneric::::set_appendix() + } + fn clear_error() -> Weight { + XcmGeneric::::clear_error() + } + fn claim_asset(_assets: &MultiAssets, _ticket: &MultiLocation) -> Weight { + XcmGeneric::::claim_asset() + } + fn trap(_code: &u64) -> Weight { + XcmGeneric::::trap() + } + fn subscribe_version(_query_id: &QueryId, _max_response_weight: &Weight) -> Weight { + XcmGeneric::::subscribe_version() + } + fn unsubscribe_version() -> Weight { + XcmGeneric::::unsubscribe_version() + } + fn burn_asset(assets: &MultiAssets) -> Weight { + assets.weigh_multi_assets(XcmGeneric::::burn_asset()) + } + fn expect_asset(assets: &MultiAssets) -> Weight { + assets.weigh_multi_assets(XcmGeneric::::expect_asset()) + } + fn expect_origin(_origin: &Option) -> Weight { + XcmGeneric::::expect_origin() + } + fn expect_error(_error: &Option<(u32, XcmError)>) -> Weight { + XcmGeneric::::expect_error() + } + fn query_pallet(_module_name: &Vec, _response_info: &QueryResponseInfo) -> Weight { + XcmGeneric::::query_pallet() + } + fn expect_pallet( + _index: &u32, + _name: &Vec, + _module_name: &Vec, + _crate_major: &u32, + _min_crate_minor: &u32, + ) -> Weight { + XcmGeneric::::expect_pallet() + } + fn report_transact_status(_response_info: &QueryResponseInfo) -> Weight { + XcmGeneric::::report_transact_status() + } + fn clear_transact_status() -> Weight { + XcmGeneric::::clear_transact_status() + } + fn universal_origin(_: &Junction) -> Weight { + Weight::MAX + } + fn export_message(_: &NetworkId, _: &Junctions, _: &Xcm<()>) -> Weight { + Weight::MAX } - fn buy_execution(_fees: &MultiAsset, _weight_limit: &WeightLimit) -> XCMWeight { - XcmGeneric::::buy_execution().ref_time() + fn lock_asset(_: &MultiAsset, _: &MultiLocation) -> Weight { + Weight::MAX } - fn refund_surplus() -> XCMWeight { - XcmGeneric::::refund_surplus().ref_time() + fn unlock_asset(_: &MultiAsset, _: &MultiLocation) -> Weight { + Weight::MAX } - fn set_error_handler(_xcm: &Xcm) -> XCMWeight { - XcmGeneric::::set_error_handler().ref_time() + fn note_unlockable(_: &MultiAsset, _: &MultiLocation) -> Weight { + Weight::MAX } - fn set_appendix(_xcm: &Xcm) -> XCMWeight { - XcmGeneric::::set_appendix().ref_time() + fn request_unlock(_: &MultiAsset, _: &MultiLocation) -> Weight { + Weight::MAX } - fn clear_error() -> XCMWeight { - XcmGeneric::::clear_error().ref_time() + fn set_fees_mode(_: &bool) -> Weight { + XcmGeneric::::set_fees_mode() } - fn claim_asset(_assets: &MultiAssets, _ticket: &MultiLocation) -> XCMWeight { - XcmGeneric::::claim_asset().ref_time() + fn set_topic(_topic: &[u8; 32]) -> Weight { + XcmGeneric::::set_topic() } - fn trap(_code: &u64) -> XCMWeight { - XcmGeneric::::trap().ref_time() + fn clear_topic() -> Weight { + XcmGeneric::::clear_topic() } - fn subscribe_version(_query_id: &QueryId, _max_response_weight: &u64) -> XCMWeight { - XcmGeneric::::subscribe_version().ref_time() + fn alias_origin(_: &MultiLocation) -> Weight { + // XCM Executor does not currently support alias origin operations + Weight::MAX } - fn unsubscribe_version() -> XCMWeight { - XcmGeneric::::unsubscribe_version().ref_time() + fn unpaid_execution(_: &WeightLimit, _: &Option) -> Weight { + XcmGeneric::::unpaid_execution() } } diff --git a/parachains/runtimes/assets/statemine/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs b/parachains/runtimes/assets/statemine/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs index 2b11d541d1f..52ae41f2d63 100644 --- a/parachains/runtimes/assets/statemine/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs +++ b/parachains/runtimes/assets/statemine/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs @@ -18,25 +18,26 @@ //! Autogenerated weights for `pallet_xcm_benchmarks::fungible` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-12-21, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! DATE: 2022-12-14, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024 // Executed Command: -// ./artifacts/polkadot-parachain +// /home/benchbot/cargo_target_dir/production/polkadot-parachain // benchmark // pallet -// --template=./templates/xcm-bench-template.hbs -// --chain=statemine-dev +// --steps=50 +// --repeat=20 +// --extrinsic=* // --execution=wasm // --wasm-execution=compiled +// --heap-pages=4096 +// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json // --pallet=pallet_xcm_benchmarks::fungible -// --extrinsic=* -// --steps=50 -// --repeat=20 -// --json +// --chain=statemine-dev // --header=./file_header.txt -// --output=./parachains/runtimes/assets/statemine/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs +// --template=./templates/xcm-bench-template.hbs +// --output=./parachains/runtimes/assets/statemine/src/weights/xcm/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -50,13 +51,13 @@ pub struct WeightInfo(PhantomData); impl WeightInfo { // Storage: System Account (r:1 w:1) pub(crate) fn withdraw_asset() -> Weight { - Weight::from_ref_time(32_154_000 as u64) + Weight::from_ref_time(31_498_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: System Account (r:2 w:2) pub(crate) fn transfer_asset() -> Weight { - Weight::from_ref_time(37_328_000 as u64) + Weight::from_ref_time(39_782_000 as u64) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -68,16 +69,16 @@ impl WeightInfo { // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) pub(crate) fn transfer_reserve_asset() -> Weight { - Weight::from_ref_time(53_253_000 as u64) + Weight::from_ref_time(55_814_000 as u64) .saturating_add(T::DbWeight::get().reads(8 as u64)) .saturating_add(T::DbWeight::get().writes(4 as u64)) } pub(crate) fn receive_teleported_asset() -> Weight { - Weight::from_ref_time(6_378_000 as u64) + Weight::from_ref_time(7_366_000 as u64) } // Storage: System Account (r:1 w:1) pub(crate) fn deposit_asset() -> Weight { - Weight::from_ref_time(33_783_000 as u64) + Weight::from_ref_time(59_346_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } @@ -89,7 +90,7 @@ impl WeightInfo { // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) pub(crate) fn deposit_reserve_asset() -> Weight { - Weight::from_ref_time(51_293_000 as u64) + Weight::from_ref_time(49_991_000 as u64) .saturating_add(T::DbWeight::get().reads(7 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -100,7 +101,7 @@ impl WeightInfo { // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) pub(crate) fn initiate_teleport() -> Weight { - Weight::from_ref_time(28_390_000 as u64) + Weight::from_ref_time(26_751_000 as u64) .saturating_add(T::DbWeight::get().reads(6 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } diff --git a/parachains/runtimes/assets/statemine/src/weights/xcm/pallet_xcm_benchmarks_generic.rs b/parachains/runtimes/assets/statemine/src/weights/xcm/pallet_xcm_benchmarks_generic.rs index 3e7d6b33dc2..96040ac7e85 100644 --- a/parachains/runtimes/assets/statemine/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +++ b/parachains/runtimes/assets/statemine/src/weights/xcm/pallet_xcm_benchmarks_generic.rs @@ -18,25 +18,26 @@ //! Autogenerated weights for `pallet_xcm_benchmarks::generic` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-12-21, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! DATE: 2022-12-14, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024 // Executed Command: -// ./artifacts/polkadot-parachain +// /home/benchbot/cargo_target_dir/production/polkadot-parachain // benchmark // pallet -// --template=./templates/xcm-bench-template.hbs -// --chain=statemine-dev +// --steps=50 +// --repeat=20 +// --extrinsic=* // --execution=wasm // --wasm-execution=compiled +// --heap-pages=4096 +// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json // --pallet=pallet_xcm_benchmarks::generic -// --extrinsic=* -// --steps=50 -// --repeat=20 -// --json +// --chain=statemine-dev // --header=./file_header.txt -// --output=./parachains/runtimes/assets/statemine/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +// --template=./templates/xcm-bench-template.hbs +// --output=./parachains/runtimes/assets/statemine/src/weights/xcm/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -54,58 +55,59 @@ impl WeightInfo { // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) - pub(crate) fn query_holding() -> Weight { - Weight::from_ref_time(892_211_000 as u64) + pub(crate) fn report_holding() -> Weight { + Weight::from_ref_time(337_149_000 as u64) .saturating_add(T::DbWeight::get().reads(6 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } pub(crate) fn buy_execution() -> Weight { - Weight::from_ref_time(8_728_000 as u64) + Weight::from_ref_time(7_033_000 as u64) } // Storage: PolkadotXcm Queries (r:1 w:0) pub(crate) fn query_response() -> Weight { - Weight::from_ref_time(16_766_000 as u64) + Weight::from_ref_time(17_915_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) } pub(crate) fn transact() -> Weight { - Weight::from_ref_time(19_546_000 as u64) + Weight::from_ref_time(20_973_000 as u64) } pub(crate) fn refund_surplus() -> Weight { - Weight::from_ref_time(8_907_000 as u64) + Weight::from_ref_time(7_210_000 as u64) } pub(crate) fn set_error_handler() -> Weight { - Weight::from_ref_time(5_393_000 as u64) + Weight::from_ref_time(5_940_000 as u64) } pub(crate) fn set_appendix() -> Weight { - Weight::from_ref_time(5_453_000 as u64) + Weight::from_ref_time(5_869_000 as u64) } pub(crate) fn clear_error() -> Weight { - Weight::from_ref_time(5_417_000 as u64) + Weight::from_ref_time(5_860_000 as u64) } pub(crate) fn descend_origin() -> Weight { - Weight::from_ref_time(6_700_000 as u64) + Weight::from_ref_time(6_556_000 as u64) } pub(crate) fn clear_origin() -> Weight { - Weight::from_ref_time(5_365_000 as u64) + Weight::from_ref_time(5_862_000 as u64) } + // Storage: ParachainInfo ParachainId (r:1 w:0) // Storage: PolkadotXcm SupportedVersion (r:1 w:0) // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) pub(crate) fn report_error() -> Weight { - Weight::from_ref_time(15_258_000 as u64) - .saturating_add(T::DbWeight::get().reads(5 as u64)) + Weight::from_ref_time(21_918_000 as u64) + .saturating_add(T::DbWeight::get().reads(6 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: PolkadotXcm AssetTraps (r:1 w:1) pub(crate) fn claim_asset() -> Weight { - Weight::from_ref_time(21_485_000 as u64) + Weight::from_ref_time(22_211_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } pub(crate) fn trap() -> Weight { - Weight::from_ref_time(5_334_000 as u64) + Weight::from_ref_time(5_844_000 as u64) } // Storage: PolkadotXcm VersionNotifyTargets (r:1 w:1) // Storage: PolkadotXcm SupportedVersion (r:1 w:0) @@ -114,13 +116,13 @@ impl WeightInfo { // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) pub(crate) fn subscribe_version() -> Weight { - Weight::from_ref_time(18_035_000 as u64) + Weight::from_ref_time(28_788_000 as u64) .saturating_add(T::DbWeight::get().reads(6 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: PolkadotXcm VersionNotifyTargets (r:0 w:1) pub(crate) fn unsubscribe_version() -> Weight { - Weight::from_ref_time(7_661_000 as u64) + Weight::from_ref_time(8_975_000 as u64) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: ParachainInfo ParachainId (r:1 w:0) @@ -130,8 +132,60 @@ impl WeightInfo { // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) pub(crate) fn initiate_reserve_withdraw() -> Weight { - Weight::from_ref_time(1_090_619_000 as u64) + Weight::from_ref_time(417_939_000 as u64) + .saturating_add(T::DbWeight::get().reads(6 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + pub(crate) fn burn_asset() -> Weight { + Weight::from_ref_time(137_412_000 as u64) + } + pub(crate) fn expect_asset() -> Weight { + Weight::from_ref_time(16_437_000 as u64) + } + pub(crate) fn expect_origin() -> Weight { + Weight::from_ref_time(5_890_000 as u64) + } + pub(crate) fn expect_error() -> Weight { + Weight::from_ref_time(5_859_000 as u64) + } + // Storage: ParachainInfo ParachainId (r:1 w:0) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + pub(crate) fn query_pallet() -> Weight { + Weight::from_ref_time(25_004_000 as u64) + .saturating_add(T::DbWeight::get().reads(6 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + pub(crate) fn expect_pallet() -> Weight { + Weight::from_ref_time(7_708_000 as u64) + } + // Storage: ParachainInfo ParachainId (r:1 w:0) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + pub(crate) fn report_transact_status() -> Weight { + Weight::from_ref_time(22_445_000 as u64) .saturating_add(T::DbWeight::get().reads(6 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } + pub(crate) fn clear_transact_status() -> Weight { + Weight::from_ref_time(5_822_000 as u64) + } + pub(crate) fn set_topic() -> Weight { + Weight::from_ref_time(5_763_000 as u64) + } + pub(crate) fn clear_topic() -> Weight { + Weight::from_ref_time(5_766_000 as u64) + } + pub(crate) fn set_fees_mode() -> Weight { + Weight::from_ref_time(5_907_000 as u64) + } + pub(crate) fn unpaid_execution() -> Weight { + Weight::from_ref_time(5_996_000 as u64) + } } diff --git a/parachains/runtimes/assets/statemine/src/xcm_config.rs b/parachains/runtimes/assets/statemine/src/xcm_config.rs index 98fe6381251..a86828e0fe9 100644 --- a/parachains/runtimes/assets/statemine/src/xcm_config.rs +++ b/parachains/runtimes/assets/statemine/src/xcm_config.rs @@ -14,12 +14,13 @@ // limitations under the License. use super::{ - AccountId, AssetId, Assets, Authorship, Balance, Balances, ParachainInfo, ParachainSystem, - PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue, + AccountId, AllPalletsWithSystem, AssetId, Assets, Authorship, Balance, Balances, ParachainInfo, + ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, + XcmpQueue, }; use frame_support::{ match_types, parameter_types, - traits::{Everything, Nothing, PalletInfoAccess}, + traits::{ConstU32, Contains, Everything, Nothing, PalletInfoAccess}, }; use pallet_xcm::XcmPassthrough; use parachains_common::{ @@ -32,22 +33,26 @@ use polkadot_parachain::primitives::Sibling; use sp_runtime::traits::ConvertInto; use xcm::latest::prelude::*; use xcm_builder::{ - AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, - AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, AsPrefixedGeneralIndex, - ConvertedConcreteAssetId, CurrencyAdapter, EnsureXcmOrigin, FungiblesAdapter, IsConcrete, - LocationInverter, NativeAsset, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, - SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, - SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, - WeightInfoBounds, + AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, + AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, AsPrefixedGeneralIndex, + ConvertedConcreteId, CurrencyAdapter, EnsureXcmOrigin, FungiblesAdapter, IsConcrete, LocalMint, + NativeAsset, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, + SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, + SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, WeightInfoBounds, + WithComputedOrigin, +}; +use xcm_executor::{ + traits::{JustTry, WithOriginFilter}, + XcmExecutor, }; -use xcm_executor::{traits::JustTry, XcmExecutor}; parameter_types! { pub const KsmLocation: MultiLocation = MultiLocation::parent(); - pub const RelayNetwork: NetworkId = NetworkId::Kusama; + pub const RelayNetwork: Option = Some(NetworkId::Kusama); pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); - pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); - pub const Local: MultiLocation = Here.into(); + pub UniversalLocation: InteriorMultiLocation = + X2(GlobalConsensus(RelayNetwork::get().unwrap()), Parachain(ParachainInfo::parachain_id().into())); + pub const Local: MultiLocation = Here.into_location(); pub AssetsPalletLocation: MultiLocation = PalletInstance(::index() as u8).into(); pub CheckingAccount: AccountId = PolkadotXcm::check_account(); @@ -84,7 +89,7 @@ pub type FungiblesTransactor = FungiblesAdapter< // Use this fungibles implementation: Assets, // Use this currency when it is a fungible asset matching the given location or name: - ConvertedConcreteAssetId< + ConvertedConcreteId< AssetId, Balance, AsPrefixedGeneralIndex, @@ -96,7 +101,7 @@ pub type FungiblesTransactor = FungiblesAdapter< AccountId, // We only want to allow teleports of known assets. We use non-zero issuance as an indication // that this asset is known. - parachains_common::impls::NonZeroIssuance, + LocalMint>, // The account to use for tracking teleports. CheckingAccount, >; @@ -129,13 +134,14 @@ pub type XcmOriginToTransactDispatchOrigin = ( parameter_types! { pub const MaxInstructions: u32 = 100; + pub const MaxAssetsIntoHolding: u32 = 64; pub XcmAssetFeesReceiver: Option = Authorship::author(); } match_types! { - pub type ParentOrParentsExecutivePlurality: impl Contains = { + pub type ParentOrParentsPlurality: impl Contains = { MultiLocation { parents: 1, interior: Here } | - MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Executive, .. }) } + MultiLocation { parents: 1, interior: X1(Plurality { .. }) } }; pub type ParentOrSiblings: impl Contains = { MultiLocation { parents: 1, interior: Here } | @@ -143,17 +149,122 @@ match_types! { }; } +/// A call filter for the XCM Transact instruction. This is a temporary measure until we properly +/// account for proof size weights. +/// +/// Calls that are allowed through this filter must: +/// 1. Have a fixed weight; +/// 2. Cannot lead to another call being made; +/// 3. Have a defined proof size weight, e.g. no unbounded vecs in call parameters. +pub struct SafeCallFilter; +impl Contains for SafeCallFilter { + fn contains(call: &RuntimeCall) -> bool { + #[cfg(feature = "runtime-benchmarks")] + { + if matches!(call, RuntimeCall::System(frame_system::Call::remark_with_event { .. })) { + return true + } + } + + match 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::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, + } + } +} + pub type Barrier = DenyThenTry< DenyReserveTransferToRelayChain, ( TakeWeightCredit, - AllowTopLevelPaidExecutionFrom, - // Parent and its exec plurality get free execution - AllowUnpaidExecutionFrom, // Expected responses are OK. AllowKnownQueryResponses, - // Subscriptions for version tracking are OK. - AllowSubscriptionsFrom, + // Allow XCMs with some computed origins to pass through. + WithComputedOrigin< + ( + // If the message is one that immediately attemps to pay for execution, then allow it. + AllowTopLevelPaidExecutionFrom, + // Parent and its plurality (i.e. governance bodies) gets free execution. + AllowExplicitUnpaidExecutionFrom, + // Subscriptions for version tracking are OK. + AllowSubscriptionsFrom, + ), + UniversalLocation, + ConstU32<8>, + >, ), >; @@ -174,7 +285,7 @@ impl xcm_executor::Config for XcmConfig { // For KSM, users must use teleport where allowed (e.g. with the Relay Chain). type IsReserve = (); type IsTeleporter = NativeAsset; // <- should be enough to allow teleportation of KSM - type LocationInverter = LocationInverter; + type UniversalLocation = UniversalLocation; type Barrier = Barrier; type Weigher = WeightInfoBounds< crate::weights::xcm::StatemineXcmWeight, @@ -186,7 +297,7 @@ impl xcm_executor::Config for XcmConfig { cumulus_primitives_utility::TakeFirstAssetTrader< AccountId, AssetFeeAsExistentialDepositMultiplierFeeCharger, - ConvertedConcreteAssetId< + ConvertedConcreteId< AssetId, Balance, AsPrefixedGeneralIndex, @@ -204,6 +315,15 @@ impl xcm_executor::Config for XcmConfig { type AssetTrap = PolkadotXcm; type AssetClaims = PolkadotXcm; type SubscriptionService = PolkadotXcm; + type PalletInstancesInfo = AllPalletsWithSystem; + type MaxAssetsIntoHolding = MaxAssetsIntoHolding; + type AssetLocker = (); + type AssetExchanger = (); + type FeeManager = (); + type MessageExporter = (); + type UniversalAliases = Nothing; + type CallDispatcher = WithOriginFilter; + type SafeCallFilter = SafeCallFilter; } /// Converts a local signed origin into an XCM multilocation. @@ -214,11 +334,16 @@ pub type LocalOriginToLocation = SignedToAccountId32, + cumulus_primitives_utility::ParentAsUmp, // ..and XCMP to communicate with the sibling chains. XcmpQueue, ); +#[cfg(feature = "runtime-benchmarks")] +parameter_types! { + pub ReachableDest: Option = Some(Parent.into()); +} + impl pallet_xcm::Config for Runtime { type RuntimeEvent = RuntimeEvent; // We want to disallow users sending (arbitrary) XCMs from this chain. @@ -237,11 +362,19 @@ impl pallet_xcm::Config for Runtime { MaxInstructions, >; - type LocationInverter = LocationInverter; + 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 = LocationToAccountId; + type MaxLockers = ConstU32<8>; + type WeightInfo = crate::weights::pallet_xcm::WeightInfo; + #[cfg(feature = "runtime-benchmarks")] + type ReachableDest = ReachableDest; } 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 18caaaf3f7e..9614fd80062 100644 --- a/parachains/runtimes/assets/statemine/tests/tests.rs +++ b/parachains/runtimes/assets/statemine/tests/tests.rs @@ -62,13 +62,13 @@ fn test_asset_xcm_trader() { RuntimeHelper::::run_to_block(2, Some(AccountId::from(ALICE))); // We are going to buy 4e9 weight - let bought = 4_000_000_000u64; + let bought = Weight::from_ref_time(4_000_000_000u64); // Lets calculate amount needed let asset_amount_needed = AssetFeeAsExistentialDepositMultiplierFeeCharger::charge_weight_in_fungibles( local_asset_id, - Weight::from_ref_time(bought), + bought, ) .expect("failed to compute"); @@ -138,7 +138,7 @@ fn test_asset_xcm_trader_with_refund() { RuntimeHelper::::run_to_block(2, Some(AccountId::from(ALICE))); // We are going to buy 4e9 weight - let bought = 4_000_000_000u64; + let bought = Weight::from_ref_time(4_000_000_000u64); let asset_multilocation = MultiLocation::new( 0, @@ -152,7 +152,7 @@ fn test_asset_xcm_trader_with_refund() { ); // lets calculate amount needed - let amount_bought = WeightToFee::weight_to_fee(&Weight::from_ref_time(bought)); + let amount_bought = WeightToFee::weight_to_fee(&bought); let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into(); @@ -166,8 +166,7 @@ fn test_asset_xcm_trader_with_refund() { let weight_used = bought / 2; // Make sure refurnd works. - let amount_refunded = - WeightToFee::weight_to_fee(&Weight::from_ref_time(bought - weight_used)); + let amount_refunded = WeightToFee::weight_to_fee(&(bought - weight_used)); assert_eq!( trader.refund_weight(bought - weight_used), @@ -178,7 +177,7 @@ fn test_asset_xcm_trader_with_refund() { drop(trader); // We only should have paid for half of the bought weight - let fees_paid = WeightToFee::weight_to_fee(&Weight::from_ref_time(weight_used)); + let fees_paid = WeightToFee::weight_to_fee(&weight_used); assert_eq!( Assets::balance(1, AccountId::from(ALICE)), @@ -217,7 +216,7 @@ fn test_asset_xcm_trader_refund_not_possible_since_amount_less_than_ed() { RuntimeHelper::::run_to_block(2, Some(AccountId::from(ALICE))); // We are going to buy small amount - let bought = 500_000_000u64; + let bought = Weight::from_ref_time(500_000_000u64); let asset_multilocation = MultiLocation::new( 0, @@ -230,7 +229,7 @@ fn test_asset_xcm_trader_refund_not_possible_since_amount_less_than_ed() { ), ); - let amount_bought = WeightToFee::weight_to_fee(&Weight::from_ref_time(bought)); + let amount_bought = WeightToFee::weight_to_fee(&bought); assert!( amount_bought < ExistentialDeposit::get(), @@ -277,7 +276,7 @@ fn test_that_buying_ed_refund_does_not_refund() { RuntimeHelper::::run_to_block(2, Some(AccountId::from(ALICE))); // We are gonna buy ED - let bought: u64 = ExistentialDeposit::get().try_into().unwrap(); + let bought = Weight::from_ref_time(ExistentialDeposit::get().try_into().unwrap()); let asset_multilocation = MultiLocation::new( 0, @@ -290,7 +289,7 @@ fn test_that_buying_ed_refund_does_not_refund() { ), ); - let amount_bought = WeightToFee::weight_to_fee(&Weight::from_ref_time(bought)); + let amount_bought = WeightToFee::weight_to_fee(&bought); assert!( amount_bought < ExistentialDeposit::get(), @@ -358,10 +357,10 @@ fn test_asset_xcm_trader_not_possible_for_non_sufficient_assets() { RuntimeHelper::::run_to_block(2, Some(AccountId::from(ALICE))); // We are going to buy 4e9 weight - let bought = 4_000_000_000u64; + let bought = Weight::from_ref_time(4_000_000_000u64); // lets calculate amount needed - let asset_amount_needed = WeightToFee::weight_to_fee(&Weight::from_ref_time(bought)); + let asset_amount_needed = WeightToFee::weight_to_fee(&bought); let asset_multilocation = MultiLocation::new( 0, diff --git a/parachains/runtimes/assets/statemint/src/lib.rs b/parachains/runtimes/assets/statemint/src/lib.rs index 2e8d8ea7749..4af9a723489 100644 --- a/parachains/runtimes/assets/statemint/src/lib.rs +++ b/parachains/runtimes/assets/statemint/src/lib.rs @@ -468,6 +468,7 @@ impl parachain_info::Config for Runtime {} impl cumulus_pallet_aura_ext::Config for Runtime {} impl cumulus_pallet_xcmp_queue::Config for Runtime { + type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo; type RuntimeEvent = RuntimeEvent; type XcmExecutor = XcmExecutor; type ChannelInfo = ParachainSystem; @@ -478,7 +479,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { EnsureXcm>, >; type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; - type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo; + type PriceForSiblingDelivery = (); } impl cumulus_pallet_dmp_queue::Config for Runtime { @@ -682,6 +683,7 @@ mod benches { [pallet_collator_selection, CollatorSelection] [cumulus_pallet_xcmp_queue, XcmpQueue] // XCM + [pallet_xcm, PolkadotXcm] // NOTE: Make sure you point to the individual modules below. [pallet_xcm_benchmarks::fungible, XcmBalances] [pallet_xcm_benchmarks::generic, XcmGeneric] @@ -868,7 +870,7 @@ impl_runtime_apis! { impl cumulus_pallet_session_benchmarking::Config for Runtime {} use xcm::latest::prelude::*; - use xcm_config::DotLocation; + use xcm_config::{DotLocation, MaxAssetsIntoHolding}; use pallet_xcm_benchmarks::asset_instance_from; impl pallet_xcm_benchmarks::Config for Runtime { @@ -877,12 +879,12 @@ impl_runtime_apis! { fn valid_destination() -> Result { Ok(DotLocation::get()) } - fn worst_case_holding() -> MultiAssets { + fn worst_case_holding(depositable_count: u32) -> MultiAssets { // A mix of fungible, non-fungible, and concrete assets. - const HOLDING_FUNGIBLES: u32 = 100; - const HOLDING_NON_FUNGIBLES: u32 = 100; + let holding_non_fungibles = MaxAssetsIntoHolding::get() / 2 - depositable_count; + let holding_fungibles = holding_non_fungibles - 1; let fungibles_amount: u128 = 100; - let mut assets = (0..HOLDING_FUNGIBLES) + let mut assets = (0..holding_fungibles) .map(|i| { MultiAsset { id: Concrete(GeneralIndex(i as u128).into()), @@ -891,17 +893,17 @@ impl_runtime_apis! { .into() }) .chain(core::iter::once(MultiAsset { id: Concrete(Here.into()), fun: Fungible(u128::MAX) })) - .chain((0..HOLDING_NON_FUNGIBLES).map(|i| MultiAsset { + .chain((0..holding_non_fungibles).map(|i| MultiAsset { id: Concrete(GeneralIndex(i as u128).into()), fun: NonFungible(asset_instance_from(i)), })) .collect::>(); - assets.push(MultiAsset{ - id: Concrete(DotLocation::get()), - fun: Fungible(1_000_000 * UNITS), - }); - assets.into() + assets.push(MultiAsset { + id: Concrete(DotLocation::get()), + fun: Fungible(1_000_000 * UNITS), + }); + assets.into() } } @@ -910,8 +912,7 @@ impl_runtime_apis! { DotLocation::get(), MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(DotLocation::get()) }, )); - pub const TrustedReserve: Option<(MultiLocation, MultiAsset)> = None; - pub const CheckedAccount: Option = None; + pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None; } impl pallet_xcm_benchmarks::fungible::Config for Runtime { @@ -919,7 +920,6 @@ impl_runtime_apis! { type CheckedAccount = CheckedAccount; type TrustedTeleporter = TrustedTeleporter; - type TrustedReserve = TrustedReserve; fn get_multi_asset() -> MultiAsset { MultiAsset { @@ -936,8 +936,16 @@ impl_runtime_apis! { (0u64, Response::Version(Default::default())) } - fn transact_origin() -> Result { - Ok(DotLocation::get()) + fn worst_case_asset_exchange() -> Result<(MultiAssets, MultiAssets), BenchmarkError> { + Err(BenchmarkError::Skip) + } + + fn universal_alias() -> Result { + Err(BenchmarkError::Skip) + } + + fn transact_origin_and_runtime_call() -> Result<(MultiLocation, RuntimeCall), BenchmarkError> { + Ok((DotLocation::get(), frame_system::Call::remark_with_event { remark: vec![] }.into())) } fn subscribe_origin() -> Result { @@ -950,6 +958,10 @@ impl_runtime_apis! { let ticket = MultiLocation { parents: 0, interior: Here }; Ok((origin, ticket, assets)) } + + fn unlockable_asset() -> Result<(MultiLocation, MultiLocation, MultiAsset), BenchmarkError> { + Err(BenchmarkError::Skip) + } } type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::; diff --git a/parachains/runtimes/assets/statemint/src/weights/mod.rs b/parachains/runtimes/assets/statemint/src/weights/mod.rs index 080584f2cfa..5dd6ffd662e 100644 --- a/parachains/runtimes/assets/statemint/src/weights/mod.rs +++ b/parachains/runtimes/assets/statemint/src/weights/mod.rs @@ -11,6 +11,7 @@ pub mod pallet_session; pub mod pallet_timestamp; pub mod pallet_uniques; pub mod pallet_utility; +pub mod pallet_xcm; pub mod paritydb_weights; pub mod rocksdb_weights; pub mod xcm; diff --git a/parachains/runtimes/assets/statemint/src/weights/pallet_xcm.rs b/parachains/runtimes/assets/statemint/src/weights/pallet_xcm.rs new file mode 100644 index 00000000000..69729e7f385 --- /dev/null +++ b/parachains/runtimes/assets/statemint/src/weights/pallet_xcm.rs @@ -0,0 +1,174 @@ +// Copyright 2021 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Cumulus is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Cumulus. If not, see . + +//! Autogenerated weights for `pallet_xcm` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-12-22, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 1024 + +// Executed Command: +// /home/benchbot/cargo_target_dir/production/polkadot-parachain +// benchmark +// pallet +// --steps=50 +// --repeat=20 +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json +// --pallet=pallet_xcm +// --chain=statemint-dev +// --header=./file_header.txt +// --output=./parachains/runtimes/assets/statemint/src/weights/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_xcm`. +pub struct WeightInfo(PhantomData); +impl pallet_xcm::WeightInfo for WeightInfo { + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + fn send() -> Weight { + // Minimum execution time: 27_694 nanoseconds. + Weight::from_ref_time(28_545_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: ParachainInfo ParachainId (r:1 w:0) + fn teleport_assets() -> Weight { + // Minimum execution time: 33_053 nanoseconds. + Weight::from_ref_time(33_789_000) + .saturating_add(T::DbWeight::get().reads(1)) + } + // Storage: ParachainInfo ParachainId (r:1 w:0) + fn reserve_transfer_assets() -> Weight { + // Minimum execution time: 24_781 nanoseconds. + Weight::from_ref_time(25_259_000) + .saturating_add(T::DbWeight::get().reads(1)) + } + // Storage: Benchmark Override (r:0 w:0) + fn execute() -> Weight { + // Minimum execution time: 18_446_744_073_709_551 nanoseconds. + Weight::from_ref_time(18_446_744_073_709_551_000) + } + // Storage: PolkadotXcm SupportedVersion (r:0 w:1) + fn force_xcm_version() -> Weight { + // Minimum execution time: 15_439 nanoseconds. + Weight::from_ref_time(15_750_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: PolkadotXcm SafeXcmVersion (r:0 w:1) + fn force_default_xcm_version() -> Weight { + // Minimum execution time: 4_576 nanoseconds. + Weight::from_ref_time(4_758_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: PolkadotXcm VersionNotifiers (r:1 w:1) + // Storage: PolkadotXcm QueryCounter (r:1 w:1) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + // Storage: PolkadotXcm Queries (r:0 w:1) + fn force_subscribe_version_notify() -> Weight { + // Minimum execution time: 31_540 nanoseconds. + Weight::from_ref_time(32_380_000) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(5)) + } + // Storage: PolkadotXcm VersionNotifiers (r:1 w:1) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + // Storage: PolkadotXcm Queries (r:0 w:1) + fn force_unsubscribe_version_notify() -> Weight { + // Minimum execution time: 32_627 nanoseconds. + Weight::from_ref_time(32_934_000) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: PolkadotXcm SupportedVersion (r:4 w:2) + fn migrate_supported_version() -> Weight { + // Minimum execution time: 13_968 nanoseconds. + Weight::from_ref_time(14_356_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PolkadotXcm VersionNotifiers (r:4 w:2) + fn migrate_version_notifiers() -> Weight { + // Minimum execution time: 14_263 nanoseconds. + Weight::from_ref_time(14_540_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PolkadotXcm VersionNotifyTargets (r:5 w:0) + fn already_notified_target() -> Weight { + // Minimum execution time: 15_825 nanoseconds. + Weight::from_ref_time(16_101_000) + .saturating_add(T::DbWeight::get().reads(5)) + } + // Storage: PolkadotXcm VersionNotifyTargets (r:2 w:1) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + fn notify_current_targets() -> Weight { + // Minimum execution time: 27_436 nanoseconds. + Weight::from_ref_time(28_083_000) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: PolkadotXcm VersionNotifyTargets (r:3 w:0) + fn notify_target_migration_fail() -> Weight { + // Minimum execution time: 7_187 nanoseconds. + Weight::from_ref_time(7_399_000) + .saturating_add(T::DbWeight::get().reads(3)) + } + // Storage: PolkadotXcm VersionNotifyTargets (r:4 w:2) + fn migrate_version_notify_targets() -> Weight { + // Minimum execution time: 14_904 nanoseconds. + Weight::from_ref_time(15_191_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PolkadotXcm VersionNotifyTargets (r:4 w:2) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + fn migrate_and_notify_old_targets() -> Weight { + // Minimum execution time: 33_269 nanoseconds. + Weight::from_ref_time(34_064_000) + .saturating_add(T::DbWeight::get().reads(9)) + .saturating_add(T::DbWeight::get().writes(4)) + } +} diff --git a/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs b/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs index 1a0ffcdb229..ed48d433170 100644 --- a/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs +++ b/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs @@ -21,168 +21,220 @@ use crate::Runtime; use frame_support::weights::Weight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; -use sp_std::{cmp, prelude::*}; -use xcm::{ - latest::{prelude::*, Weight as XCMWeight}, - DoubleEncoded, -}; +use sp_std::prelude::*; +use xcm::{latest::prelude::*, DoubleEncoded}; trait WeighMultiAssets { - fn weigh_multi_assets(&self, weight: Weight) -> XCMWeight; + fn weigh_multi_assets(&self, weight: Weight) -> Weight; } const MAX_ASSETS: u32 = 100; impl WeighMultiAssets for MultiAssetFilter { - fn weigh_multi_assets(&self, weight: Weight) -> XCMWeight { - let weight = match self { + fn weigh_multi_assets(&self, weight: Weight) -> Weight { + match self { Self::Definite(assets) => weight.saturating_mul(assets.inner().into_iter().count() as u64), Self::Wild(_) => weight.saturating_mul(MAX_ASSETS as u64), - }; - weight.ref_time() + } } } impl WeighMultiAssets for MultiAssets { - fn weigh_multi_assets(&self, weight: Weight) -> XCMWeight { - weight.saturating_mul(self.inner().into_iter().count() as u64).ref_time() + fn weigh_multi_assets(&self, weight: Weight) -> Weight { + weight.saturating_mul(self.inner().into_iter().count() as u64) } } pub struct StatemintXcmWeight(core::marker::PhantomData); impl XcmWeightInfo for StatemintXcmWeight { - fn withdraw_asset(assets: &MultiAssets) -> XCMWeight { + fn withdraw_asset(assets: &MultiAssets) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::withdraw_asset()) } // Currently there is no trusted reserve - fn reserve_asset_deposited(_assets: &MultiAssets) -> XCMWeight { - u64::MAX + fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight { + // TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974 + Weight::from_ref_time(1_000_000_000 as u64) } - fn receive_teleported_asset(assets: &MultiAssets) -> XCMWeight { + fn receive_teleported_asset(assets: &MultiAssets) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::receive_teleported_asset()) } - fn query_response(_query_id: &u64, _response: &Response, _max_weight: &u64) -> XCMWeight { - XcmGeneric::::query_response().ref_time() + fn query_response( + _query_id: &u64, + _response: &Response, + _max_weight: &Weight, + _querier: &Option, + ) -> Weight { + XcmGeneric::::query_response() } - fn transfer_asset(assets: &MultiAssets, _dest: &MultiLocation) -> XCMWeight { + fn transfer_asset(assets: &MultiAssets, _dest: &MultiLocation) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::transfer_asset()) } fn transfer_reserve_asset( assets: &MultiAssets, _dest: &MultiLocation, _xcm: &Xcm<()>, - ) -> XCMWeight { + ) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::transfer_reserve_asset()) } fn transact( _origin_type: &OriginKind, - _require_weight_at_most: &u64, + _require_weight_at_most: &Weight, _call: &DoubleEncoded, - ) -> XCMWeight { - XcmGeneric::::transact().ref_time() + ) -> Weight { + XcmGeneric::::transact() } fn hrmp_new_channel_open_request( _sender: &u32, _max_message_size: &u32, _max_capacity: &u32, - ) -> XCMWeight { + ) -> Weight { // XCM Executor does not currently support HRMP channel operations - Weight::MAX.ref_time() + Weight::MAX } - fn hrmp_channel_accepted(_recipient: &u32) -> XCMWeight { + fn hrmp_channel_accepted(_recipient: &u32) -> Weight { // XCM Executor does not currently support HRMP channel operations - Weight::MAX.ref_time() + Weight::MAX } - fn hrmp_channel_closing(_initiator: &u32, _sender: &u32, _recipient: &u32) -> XCMWeight { + fn hrmp_channel_closing(_initiator: &u32, _sender: &u32, _recipient: &u32) -> Weight { // XCM Executor does not currently support HRMP channel operations - Weight::MAX.ref_time() + Weight::MAX } - fn clear_origin() -> XCMWeight { - XcmGeneric::::clear_origin().ref_time() + fn clear_origin() -> Weight { + XcmGeneric::::clear_origin() } - fn descend_origin(_who: &InteriorMultiLocation) -> XCMWeight { - XcmGeneric::::descend_origin().ref_time() + fn descend_origin(_who: &InteriorMultiLocation) -> Weight { + XcmGeneric::::descend_origin() } - fn report_error( - _query_id: &QueryId, - _dest: &MultiLocation, - _max_response_weight: &u64, - ) -> XCMWeight { - XcmGeneric::::report_error().ref_time() + fn report_error(_query_response_info: &QueryResponseInfo) -> Weight { + XcmGeneric::::report_error() } - fn deposit_asset( - assets: &MultiAssetFilter, - _max_assets: &u32, - _dest: &MultiLocation, - ) -> XCMWeight { + fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_ref_time(1_000_000_000 as u64).ref_time(); + let hardcoded_weight = Weight::from_ref_time(1_000_000_000 as u64); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::deposit_asset()); - cmp::min(hardcoded_weight, weight) + hardcoded_weight.min(weight) } fn deposit_reserve_asset( assets: &MultiAssetFilter, - _max_assets: &u32, _dest: &MultiLocation, _xcm: &Xcm<()>, - ) -> XCMWeight { + ) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::deposit_reserve_asset()) } - fn exchange_asset(_give: &MultiAssetFilter, _receive: &MultiAssets) -> XCMWeight { - Weight::MAX.ref_time() + fn exchange_asset(_give: &MultiAssetFilter, _receive: &MultiAssets, _maximal: &bool) -> Weight { + Weight::MAX } fn initiate_reserve_withdraw( assets: &MultiAssetFilter, _reserve: &MultiLocation, _xcm: &Xcm<()>, - ) -> XCMWeight { + ) -> Weight { assets.weigh_multi_assets(XcmGeneric::::initiate_reserve_withdraw()) } fn initiate_teleport( assets: &MultiAssetFilter, _dest: &MultiLocation, _xcm: &Xcm<()>, - ) -> XCMWeight { + ) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_ref_time(200_000_000 as u64).ref_time(); + let hardcoded_weight = Weight::from_ref_time(200_000_000 as u64); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::initiate_teleport()); - cmp::min(hardcoded_weight, weight) + hardcoded_weight.min(weight) } - fn query_holding( - _query_id: &u64, - _dest: &MultiLocation, - _assets: &MultiAssetFilter, - _max_response_weight: &u64, - ) -> XCMWeight { - XcmGeneric::::query_holding().ref_time() + fn report_holding(_response_info: &QueryResponseInfo, _assets: &MultiAssetFilter) -> Weight { + XcmGeneric::::report_holding() + } + fn buy_execution(_fees: &MultiAsset, _weight_limit: &WeightLimit) -> Weight { + XcmGeneric::::buy_execution() + } + fn refund_surplus() -> Weight { + XcmGeneric::::refund_surplus() + } + fn set_error_handler(_xcm: &Xcm) -> Weight { + XcmGeneric::::set_error_handler() + } + fn set_appendix(_xcm: &Xcm) -> Weight { + XcmGeneric::::set_appendix() + } + fn clear_error() -> Weight { + XcmGeneric::::clear_error() + } + fn claim_asset(_assets: &MultiAssets, _ticket: &MultiLocation) -> Weight { + XcmGeneric::::claim_asset() + } + fn trap(_code: &u64) -> Weight { + XcmGeneric::::trap() + } + fn subscribe_version(_query_id: &QueryId, _max_response_weight: &Weight) -> Weight { + XcmGeneric::::subscribe_version() + } + fn unsubscribe_version() -> Weight { + XcmGeneric::::unsubscribe_version() + } + fn burn_asset(assets: &MultiAssets) -> Weight { + assets.weigh_multi_assets(XcmGeneric::::burn_asset()) + } + fn expect_asset(assets: &MultiAssets) -> Weight { + assets.weigh_multi_assets(XcmGeneric::::expect_asset()) + } + fn expect_origin(_origin: &Option) -> Weight { + XcmGeneric::::expect_origin() + } + fn expect_error(_error: &Option<(u32, XcmError)>) -> Weight { + XcmGeneric::::expect_error() + } + fn query_pallet(_module_name: &Vec, _response_info: &QueryResponseInfo) -> Weight { + XcmGeneric::::query_pallet() + } + fn expect_pallet( + _index: &u32, + _name: &Vec, + _module_name: &Vec, + _crate_major: &u32, + _min_crate_minor: &u32, + ) -> Weight { + XcmGeneric::::expect_pallet() + } + fn report_transact_status(_response_info: &QueryResponseInfo) -> Weight { + XcmGeneric::::report_transact_status() + } + fn clear_transact_status() -> Weight { + XcmGeneric::::clear_transact_status() + } + fn universal_origin(_: &Junction) -> Weight { + Weight::MAX + } + fn export_message(_: &NetworkId, _: &Junctions, _: &Xcm<()>) -> Weight { + Weight::MAX } - fn buy_execution(_fees: &MultiAsset, _weight_limit: &WeightLimit) -> XCMWeight { - XcmGeneric::::buy_execution().ref_time() + fn lock_asset(_: &MultiAsset, _: &MultiLocation) -> Weight { + Weight::MAX } - fn refund_surplus() -> XCMWeight { - XcmGeneric::::refund_surplus().ref_time() + fn unlock_asset(_: &MultiAsset, _: &MultiLocation) -> Weight { + Weight::MAX } - fn set_error_handler(_xcm: &Xcm) -> XCMWeight { - XcmGeneric::::set_error_handler().ref_time() + fn note_unlockable(_: &MultiAsset, _: &MultiLocation) -> Weight { + Weight::MAX } - fn set_appendix(_xcm: &Xcm) -> XCMWeight { - XcmGeneric::::set_appendix().ref_time() + fn request_unlock(_: &MultiAsset, _: &MultiLocation) -> Weight { + Weight::MAX } - fn clear_error() -> XCMWeight { - XcmGeneric::::clear_error().ref_time() + fn set_fees_mode(_: &bool) -> Weight { + XcmGeneric::::set_fees_mode() } - fn claim_asset(_assets: &MultiAssets, _ticket: &MultiLocation) -> XCMWeight { - XcmGeneric::::claim_asset().ref_time() + fn set_topic(_topic: &[u8; 32]) -> Weight { + XcmGeneric::::set_topic() } - fn trap(_code: &u64) -> XCMWeight { - XcmGeneric::::trap().ref_time() + fn clear_topic() -> Weight { + XcmGeneric::::clear_topic() } - fn subscribe_version(_query_id: &QueryId, _max_response_weight: &u64) -> XCMWeight { - XcmGeneric::::subscribe_version().ref_time() + fn alias_origin(_: &MultiLocation) -> Weight { + // XCM Executor does not currently support alias origin operations + Weight::MAX } - fn unsubscribe_version() -> XCMWeight { - XcmGeneric::::unsubscribe_version().ref_time() + fn unpaid_execution(_: &WeightLimit, _: &Option) -> Weight { + XcmGeneric::::unpaid_execution() } } diff --git a/parachains/runtimes/assets/statemint/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs b/parachains/runtimes/assets/statemint/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs index 338aafb1d30..286623a5ab7 100644 --- a/parachains/runtimes/assets/statemint/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs +++ b/parachains/runtimes/assets/statemint/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs @@ -18,25 +18,26 @@ //! Autogenerated weights for `pallet_xcm_benchmarks::fungible` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-12-21, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! DATE: 2022-12-14, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 1024 // Executed Command: -// ./artifacts/polkadot-parachain +// /home/benchbot/cargo_target_dir/production/polkadot-parachain // benchmark // pallet -// --template=./templates/xcm-bench-template.hbs -// --chain=statemint-dev +// --steps=50 +// --repeat=20 +// --extrinsic=* // --execution=wasm // --wasm-execution=compiled +// --heap-pages=4096 +// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json // --pallet=pallet_xcm_benchmarks::fungible -// --extrinsic=* -// --steps=50 -// --repeat=20 -// --json +// --chain=statemint-dev // --header=./file_header.txt -// --output=./parachains/runtimes/assets/statemint/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs +// --template=./templates/xcm-bench-template.hbs +// --output=./parachains/runtimes/assets/statemint/src/weights/xcm/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -50,13 +51,13 @@ pub struct WeightInfo(PhantomData); impl WeightInfo { // Storage: System Account (r:1 w:1) pub(crate) fn withdraw_asset() -> Weight { - Weight::from_ref_time(31_628_000 as u64) + Weight::from_ref_time(30_093_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: System Account (r:2 w:2) pub(crate) fn transfer_asset() -> Weight { - Weight::from_ref_time(36_286_000 as u64) + Weight::from_ref_time(38_287_000 as u64) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -68,16 +69,16 @@ impl WeightInfo { // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) pub(crate) fn transfer_reserve_asset() -> Weight { - Weight::from_ref_time(51_189_000 as u64) + Weight::from_ref_time(55_153_000 as u64) .saturating_add(T::DbWeight::get().reads(8 as u64)) .saturating_add(T::DbWeight::get().writes(4 as u64)) } pub(crate) fn receive_teleported_asset() -> Weight { - Weight::from_ref_time(6_157_000 as u64) + Weight::from_ref_time(7_127_000 as u64) } // Storage: System Account (r:1 w:1) pub(crate) fn deposit_asset() -> Weight { - Weight::from_ref_time(32_614_000 as u64) + Weight::from_ref_time(31_534_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } @@ -89,7 +90,7 @@ impl WeightInfo { // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) pub(crate) fn deposit_reserve_asset() -> Weight { - Weight::from_ref_time(49_945_000 as u64) + Weight::from_ref_time(50_137_000 as u64) .saturating_add(T::DbWeight::get().reads(7 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -100,7 +101,7 @@ impl WeightInfo { // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) pub(crate) fn initiate_teleport() -> Weight { - Weight::from_ref_time(26_905_000 as u64) + Weight::from_ref_time(26_702_000 as u64) .saturating_add(T::DbWeight::get().reads(6 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } diff --git a/parachains/runtimes/assets/statemint/src/weights/xcm/pallet_xcm_benchmarks_generic.rs b/parachains/runtimes/assets/statemint/src/weights/xcm/pallet_xcm_benchmarks_generic.rs index 91d5d5cd102..27c05868787 100644 --- a/parachains/runtimes/assets/statemint/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +++ b/parachains/runtimes/assets/statemint/src/weights/xcm/pallet_xcm_benchmarks_generic.rs @@ -18,25 +18,26 @@ //! Autogenerated weights for `pallet_xcm_benchmarks::generic` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-12-21, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! DATE: 2022-12-14, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 1024 // Executed Command: -// ./artifacts/polkadot-parachain +// /home/benchbot/cargo_target_dir/production/polkadot-parachain // benchmark // pallet -// --template=./templates/xcm-bench-template.hbs -// --chain=statemint-dev +// --steps=50 +// --repeat=20 +// --extrinsic=* // --execution=wasm // --wasm-execution=compiled +// --heap-pages=4096 +// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json // --pallet=pallet_xcm_benchmarks::generic -// --extrinsic=* -// --steps=50 -// --repeat=20 -// --json +// --chain=statemint-dev // --header=./file_header.txt -// --output=./parachains/runtimes/assets/statemint/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +// --template=./templates/xcm-bench-template.hbs +// --output=./parachains/runtimes/assets/statemint/src/weights/xcm/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -54,58 +55,59 @@ impl WeightInfo { // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) - pub(crate) fn query_holding() -> Weight { - Weight::from_ref_time(684_287_000 as u64) + pub(crate) fn report_holding() -> Weight { + Weight::from_ref_time(331_611_000 as u64) .saturating_add(T::DbWeight::get().reads(6 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } pub(crate) fn buy_execution() -> Weight { - Weight::from_ref_time(8_580_000 as u64) + Weight::from_ref_time(6_432_000 as u64) } // Storage: PolkadotXcm Queries (r:1 w:0) pub(crate) fn query_response() -> Weight { - Weight::from_ref_time(16_082_000 as u64) + Weight::from_ref_time(17_465_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) } pub(crate) fn transact() -> Weight { - Weight::from_ref_time(19_394_000 as u64) + Weight::from_ref_time(21_163_000 as u64) } pub(crate) fn refund_surplus() -> Weight { - Weight::from_ref_time(8_833_000 as u64) + Weight::from_ref_time(7_024_000 as u64) } pub(crate) fn set_error_handler() -> Weight { - Weight::from_ref_time(5_128_000 as u64) + Weight::from_ref_time(5_758_000 as u64) } pub(crate) fn set_appendix() -> Weight { - Weight::from_ref_time(5_081_000 as u64) + Weight::from_ref_time(5_832_000 as u64) } pub(crate) fn clear_error() -> Weight { - Weight::from_ref_time(5_196_000 as u64) + Weight::from_ref_time(5_763_000 as u64) } pub(crate) fn descend_origin() -> Weight { - Weight::from_ref_time(6_199_000 as u64) + Weight::from_ref_time(6_560_000 as u64) } pub(crate) fn clear_origin() -> Weight { - Weight::from_ref_time(5_078_000 as u64) + Weight::from_ref_time(5_765_000 as u64) } + // Storage: ParachainInfo ParachainId (r:1 w:0) // Storage: PolkadotXcm SupportedVersion (r:1 w:0) // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) pub(crate) fn report_error() -> Weight { - Weight::from_ref_time(14_742_000 as u64) - .saturating_add(T::DbWeight::get().reads(5 as u64)) + Weight::from_ref_time(21_465_000 as u64) + .saturating_add(T::DbWeight::get().reads(6 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: PolkadotXcm AssetTraps (r:1 w:1) pub(crate) fn claim_asset() -> Weight { - Weight::from_ref_time(20_490_000 as u64) + Weight::from_ref_time(21_284_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } pub(crate) fn trap() -> Weight { - Weight::from_ref_time(5_024_000 as u64) + Weight::from_ref_time(5_723_000 as u64) } // Storage: PolkadotXcm VersionNotifyTargets (r:1 w:1) // Storage: PolkadotXcm SupportedVersion (r:1 w:0) @@ -114,13 +116,13 @@ impl WeightInfo { // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) pub(crate) fn subscribe_version() -> Weight { - Weight::from_ref_time(17_473_000 as u64) + Weight::from_ref_time(27_907_000 as u64) .saturating_add(T::DbWeight::get().reads(6 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: PolkadotXcm VersionNotifyTargets (r:0 w:1) pub(crate) fn unsubscribe_version() -> Weight { - Weight::from_ref_time(7_230_000 as u64) + Weight::from_ref_time(7_971_000 as u64) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: ParachainInfo ParachainId (r:1 w:0) @@ -130,8 +132,60 @@ impl WeightInfo { // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) pub(crate) fn initiate_reserve_withdraw() -> Weight { - Weight::from_ref_time(897_033_000 as u64) + Weight::from_ref_time(384_329_000 as u64) + .saturating_add(T::DbWeight::get().reads(6 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + pub(crate) fn burn_asset() -> Weight { + Weight::from_ref_time(127_341_000 as u64) + } + pub(crate) fn expect_asset() -> Weight { + Weight::from_ref_time(15_151_000 as u64) + } + pub(crate) fn expect_origin() -> Weight { + Weight::from_ref_time(5_828_000 as u64) + } + pub(crate) fn expect_error() -> Weight { + Weight::from_ref_time(5_758_000 as u64) + } + // Storage: ParachainInfo ParachainId (r:1 w:0) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + pub(crate) fn query_pallet() -> Weight { + Weight::from_ref_time(23_974_000 as u64) + .saturating_add(T::DbWeight::get().reads(6 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + pub(crate) fn expect_pallet() -> Weight { + Weight::from_ref_time(7_579_000 as u64) + } + // Storage: ParachainInfo ParachainId (r:1 w:0) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + pub(crate) fn report_transact_status() -> Weight { + Weight::from_ref_time(21_711_000 as u64) .saturating_add(T::DbWeight::get().reads(6 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } + pub(crate) fn clear_transact_status() -> Weight { + Weight::from_ref_time(5_798_000 as u64) + } + pub(crate) fn set_topic() -> Weight { + Weight::from_ref_time(5_876_000 as u64) + } + pub(crate) fn clear_topic() -> Weight { + Weight::from_ref_time(5_690_000 as u64) + } + pub(crate) fn set_fees_mode() -> Weight { + Weight::from_ref_time(5_668_000 as u64) + } + pub(crate) fn unpaid_execution() -> Weight { + Weight::from_ref_time(6_005_000 as u64) + } } diff --git a/parachains/runtimes/assets/statemint/src/xcm_config.rs b/parachains/runtimes/assets/statemint/src/xcm_config.rs index 0095e4fd1e3..8b76134da31 100644 --- a/parachains/runtimes/assets/statemint/src/xcm_config.rs +++ b/parachains/runtimes/assets/statemint/src/xcm_config.rs @@ -14,12 +14,13 @@ // limitations under the License. use super::{ - AccountId, AssetId, Assets, Authorship, Balance, Balances, ParachainInfo, ParachainSystem, - PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue, + AccountId, AllPalletsWithSystem, AssetId, Assets, Authorship, Balance, Balances, ParachainInfo, + ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, + XcmpQueue, }; use frame_support::{ match_types, parameter_types, - traits::{Everything, Nothing, PalletInfoAccess}, + traits::{ConstU32, Contains, Everything, Nothing, PalletInfoAccess}, }; use pallet_xcm::XcmPassthrough; use parachains_common::{ @@ -32,22 +33,26 @@ use polkadot_parachain::primitives::Sibling; use sp_runtime::traits::ConvertInto; use xcm::latest::prelude::*; use xcm_builder::{ - AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, - AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, AsPrefixedGeneralIndex, - ConvertedConcreteAssetId, CurrencyAdapter, EnsureXcmOrigin, FungiblesAdapter, IsConcrete, - LocationInverter, NativeAsset, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, - SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, - SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, - WeightInfoBounds, + AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, + AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, AsPrefixedGeneralIndex, + ConvertedConcreteId, CurrencyAdapter, EnsureXcmOrigin, FungiblesAdapter, IsConcrete, LocalMint, + NativeAsset, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, + SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, + SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, WeightInfoBounds, + WithComputedOrigin, +}; +use xcm_executor::{ + traits::{JustTry, WithOriginFilter}, + XcmExecutor, }; -use xcm_executor::{traits::JustTry, XcmExecutor}; parameter_types! { pub const DotLocation: MultiLocation = MultiLocation::parent(); - pub const RelayNetwork: NetworkId = NetworkId::Polkadot; + pub const RelayNetwork: Option = Some(NetworkId::Polkadot); pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); - pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); - pub const Local: MultiLocation = Here.into(); + pub UniversalLocation: InteriorMultiLocation = + X2(GlobalConsensus(RelayNetwork::get().unwrap()), Parachain(ParachainInfo::parachain_id().into())); + pub const Local: MultiLocation = MultiLocation::here(); pub AssetsPalletLocation: MultiLocation = PalletInstance(::index() as u8).into(); pub CheckingAccount: AccountId = PolkadotXcm::check_account(); @@ -84,7 +89,7 @@ pub type FungiblesTransactor = FungiblesAdapter< // Use this fungibles implementation: Assets, // Use this currency when it is a fungible asset matching the given location or name: - ConvertedConcreteAssetId< + ConvertedConcreteId< AssetId, Balance, AsPrefixedGeneralIndex, @@ -96,7 +101,7 @@ pub type FungiblesTransactor = FungiblesAdapter< AccountId, // We only want to allow teleports of known assets. We use non-zero issuance as an indication // that this asset is known. - parachains_common::impls::NonZeroIssuance, + LocalMint>, // The account to use for tracking teleports. CheckingAccount, >; @@ -129,13 +134,14 @@ pub type XcmOriginToTransactDispatchOrigin = ( parameter_types! { pub const MaxInstructions: u32 = 100; + pub const MaxAssetsIntoHolding: u32 = 64; pub XcmAssetFeesReceiver: Option = Authorship::author(); } match_types! { - pub type ParentOrParentsExecutivePlurality: impl Contains = { + pub type ParentOrParentsPlurality: impl Contains = { MultiLocation { parents: 1, interior: Here } | - MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Executive, .. }) } + MultiLocation { parents: 1, interior: X1(Plurality { .. }) } }; pub type ParentOrSiblings: impl Contains = { MultiLocation { parents: 1, interior: Here } | @@ -143,17 +149,122 @@ match_types! { }; } +/// A call filter for the XCM Transact instruction. This is a temporary measure until we properly +/// account for proof size weights. +/// +/// Calls that are allowed through this filter must: +/// 1. Have a fixed weight; +/// 2. Cannot lead to another call being made; +/// 3. Have a defined proof size weight, e.g. no unbounded vecs in call parameters. +pub struct SafeCallFilter; +impl Contains for SafeCallFilter { + fn contains(call: &RuntimeCall) -> bool { + #[cfg(feature = "runtime-benchmarks")] + { + if matches!(call, RuntimeCall::System(frame_system::Call::remark_with_event { .. })) { + return true + } + } + + match 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::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, + } + } +} + pub type Barrier = DenyThenTry< DenyReserveTransferToRelayChain, ( TakeWeightCredit, - AllowTopLevelPaidExecutionFrom, - // Parent and its exec plurality get free execution - AllowUnpaidExecutionFrom, // Expected responses are OK. AllowKnownQueryResponses, - // Subscriptions for version tracking are OK. - AllowSubscriptionsFrom, + // Allow XCMs with some computed origins to pass through. + WithComputedOrigin< + ( + // If the message is one that immediately attemps to pay for execution, then allow it. + AllowTopLevelPaidExecutionFrom, + // Parent and its plurality (i.e. governance bodies) gets free execution. + AllowExplicitUnpaidExecutionFrom, + // Subscriptions for version tracking are OK. + AllowSubscriptionsFrom, + ), + UniversalLocation, + ConstU32<8>, + >, ), >; @@ -174,7 +285,7 @@ impl xcm_executor::Config for XcmConfig { // For DOT, users must use teleport where allowed (e.g. with the Relay Chain). type IsReserve = (); type IsTeleporter = NativeAsset; // <- should be enough to allow teleportation of DOT - type LocationInverter = LocationInverter; + type UniversalLocation = UniversalLocation; type Barrier = Barrier; type Weigher = WeightInfoBounds< crate::weights::xcm::StatemintXcmWeight, @@ -186,7 +297,7 @@ impl xcm_executor::Config for XcmConfig { cumulus_primitives_utility::TakeFirstAssetTrader< AccountId, AssetFeeAsExistentialDepositMultiplierFeeCharger, - ConvertedConcreteAssetId< + ConvertedConcreteId< AssetId, Balance, AsPrefixedGeneralIndex, @@ -204,6 +315,15 @@ impl xcm_executor::Config for XcmConfig { type AssetTrap = PolkadotXcm; type AssetClaims = PolkadotXcm; type SubscriptionService = PolkadotXcm; + type PalletInstancesInfo = AllPalletsWithSystem; + type MaxAssetsIntoHolding = MaxAssetsIntoHolding; + type AssetLocker = (); + type AssetExchanger = (); + type FeeManager = (); + type MessageExporter = (); + type UniversalAliases = Nothing; + type CallDispatcher = WithOriginFilter; + type SafeCallFilter = SafeCallFilter; } /// Converts a local signed origin into an XCM multilocation. @@ -214,11 +334,16 @@ pub type LocalOriginToLocation = SignedToAccountId32, + cumulus_primitives_utility::ParentAsUmp, // ..and XCMP to communicate with the sibling chains. XcmpQueue, ); +#[cfg(feature = "runtime-benchmarks")] +parameter_types! { + pub ReachableDest: Option = Some(Parent.into()); +} + impl pallet_xcm::Config for Runtime { type RuntimeEvent = RuntimeEvent; // We want to disallow users sending (arbitrary) XCMs from this chain. @@ -236,11 +361,19 @@ impl pallet_xcm::Config for Runtime { RuntimeCall, MaxInstructions, >; - type LocationInverter = LocationInverter; + 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 = LocationToAccountId; + type MaxLockers = ConstU32<8>; + type WeightInfo = crate::weights::pallet_xcm::WeightInfo; + #[cfg(feature = "runtime-benchmarks")] + type ReachableDest = ReachableDest; } 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 50c0f904eb1..b52383f3d3e 100644 --- a/parachains/runtimes/assets/statemint/tests/tests.rs +++ b/parachains/runtimes/assets/statemint/tests/tests.rs @@ -65,13 +65,13 @@ fn test_asset_xcm_trader() { // Because of the ED being higher in statemine // and not to complicate things, we use a little // bit more of weight - let bought = 400_000_000_000u64; + let bought = Weight::from_ref_time(400_000_000_000u64); // Lets calculate amount needed let asset_amount_needed = AssetFeeAsExistentialDepositMultiplierFeeCharger::charge_weight_in_fungibles( local_asset_id, - Weight::from_ref_time(bought), + bought, ) .expect("failed to compute"); @@ -144,7 +144,7 @@ fn test_asset_xcm_trader_with_refund() { // Because of the ED being higher in statemine // and not to complicate things, we use a little // bit more of weight - let bought = 400_000_000_000u64; + let bought = Weight::from_ref_time(400_000_000_000u64); let asset_multilocation = MultiLocation::new( 0, @@ -158,7 +158,7 @@ fn test_asset_xcm_trader_with_refund() { ); // lets calculate amount needed - let amount_bought = WeightToFee::weight_to_fee(&Weight::from_ref_time(bought)); + let amount_bought = WeightToFee::weight_to_fee(&bought); let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into(); @@ -172,8 +172,7 @@ fn test_asset_xcm_trader_with_refund() { let weight_used = bought / 2; // Make sure refurnd works. - let amount_refunded = - WeightToFee::weight_to_fee(&Weight::from_ref_time(bought - weight_used)); + let amount_refunded = WeightToFee::weight_to_fee(&(bought - weight_used)); assert_eq!( trader.refund_weight(bought - weight_used), @@ -184,7 +183,7 @@ fn test_asset_xcm_trader_with_refund() { drop(trader); // We only should have paid for half of the bought weight - let fees_paid = WeightToFee::weight_to_fee(&Weight::from_ref_time(weight_used)); + let fees_paid = WeightToFee::weight_to_fee(&weight_used); assert_eq!( Assets::balance(1, AccountId::from(ALICE)), @@ -226,7 +225,7 @@ fn test_asset_xcm_trader_refund_not_possible_since_amount_less_than_ed() { // Because of the ED being higher in statemine // and not to complicate things, we use a little // bit more of weight - let bought = 50_000_000_000u64; + let bought = Weight::from_ref_time(50_000_000_000u64); let asset_multilocation = MultiLocation::new( 0, @@ -239,7 +238,7 @@ fn test_asset_xcm_trader_refund_not_possible_since_amount_less_than_ed() { ), ); - let amount_bought = WeightToFee::weight_to_fee(&Weight::from_ref_time(bought)); + let amount_bought = WeightToFee::weight_to_fee(&bought); assert!( amount_bought < ExistentialDeposit::get(), @@ -286,7 +285,7 @@ fn test_that_buying_ed_refund_does_not_refund() { RuntimeHelper::::run_to_block(2, Some(AccountId::from(ALICE))); // We are gonna buy ED - let bought: u64 = ExistentialDeposit::get().try_into().unwrap(); + let bought = Weight::from_ref_time(ExistentialDeposit::get().try_into().unwrap()); let asset_multilocation = MultiLocation::new( 0, @@ -299,7 +298,7 @@ fn test_that_buying_ed_refund_does_not_refund() { ), ); - let amount_bought = WeightToFee::weight_to_fee(&Weight::from_ref_time(bought)); + let amount_bought = WeightToFee::weight_to_fee(&bought); assert!( amount_bought < ExistentialDeposit::get(), @@ -370,10 +369,10 @@ fn test_asset_xcm_trader_not_possible_for_non_sufficient_assets() { // Because of the ED being higher in statemine // and not to complicate things, we use a little // bit more of weight - let bought = 400_000_000_000u64; + let bought = Weight::from_ref_time(400_000_000_000u64); // lets calculate amount needed - let asset_amount_needed = WeightToFee::weight_to_fee(&Weight::from_ref_time(bought)); + let asset_amount_needed = WeightToFee::weight_to_fee(&bought); let asset_multilocation = MultiLocation::new( 0, diff --git a/parachains/runtimes/assets/westmint/src/lib.rs b/parachains/runtimes/assets/westmint/src/lib.rs index 2d2ff8a0bf4..56dbfd3de8e 100644 --- a/parachains/runtimes/assets/westmint/src/lib.rs +++ b/parachains/runtimes/assets/westmint/src/lib.rs @@ -460,6 +460,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type ControllerOrigin = EnsureRoot; type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo; + type PriceForSiblingDelivery = (); } impl cumulus_pallet_dmp_queue::Config for Runtime { @@ -694,6 +695,7 @@ mod benches { [pallet_collator_selection, CollatorSelection] [cumulus_pallet_xcmp_queue, XcmpQueue] // XCM + [pallet_xcm, PolkadotXcm] // NOTE: Make sure you point to the individual modules below. [pallet_xcm_benchmarks::fungible, XcmBalances] [pallet_xcm_benchmarks::generic, XcmGeneric] @@ -879,7 +881,7 @@ impl_runtime_apis! { impl cumulus_pallet_session_benchmarking::Config for Runtime {} use xcm::latest::prelude::*; - use xcm_config::WestendLocation; + use xcm_config::{MaxAssetsIntoHolding, WestendLocation}; use pallet_xcm_benchmarks::asset_instance_from; impl pallet_xcm_benchmarks::Config for Runtime { @@ -888,12 +890,12 @@ impl_runtime_apis! { fn valid_destination() -> Result { Ok(WestendLocation::get()) } - fn worst_case_holding() -> MultiAssets { + fn worst_case_holding(depositable_count: u32) -> MultiAssets { // A mix of fungible, non-fungible, and concrete assets. - const HOLDING_FUNGIBLES: u32 = 100; - const HOLDING_NON_FUNGIBLES: u32 = 100; + let holding_non_fungibles = MaxAssetsIntoHolding::get() / 2 - depositable_count; + let holding_fungibles = holding_non_fungibles - 1; let fungibles_amount: u128 = 100; - let mut assets = (0..HOLDING_FUNGIBLES) + let mut assets = (0..holding_fungibles) .map(|i| { MultiAsset { id: Concrete(GeneralIndex(i as u128).into()), @@ -902,17 +904,17 @@ impl_runtime_apis! { .into() }) .chain(core::iter::once(MultiAsset { id: Concrete(Here.into()), fun: Fungible(u128::MAX) })) - .chain((0..HOLDING_NON_FUNGIBLES).map(|i| MultiAsset { + .chain((0..holding_non_fungibles).map(|i| MultiAsset { id: Concrete(GeneralIndex(i as u128).into()), fun: NonFungible(asset_instance_from(i)), })) .collect::>(); - assets.push(MultiAsset{ - id: Concrete(WestendLocation::get()), - fun: Fungible(1_000_000 * UNITS), - }); - assets.into() + assets.push(MultiAsset { + id: Concrete(WestendLocation::get()), + fun: Fungible(1_000_000 * UNITS), + }); + assets.into() } } @@ -921,8 +923,7 @@ impl_runtime_apis! { WestendLocation::get(), MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(WestendLocation::get()) }, )); - pub const TrustedReserve: Option<(MultiLocation, MultiAsset)> = None; - pub const CheckedAccount: Option = None; + pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None; } @@ -931,7 +932,6 @@ impl_runtime_apis! { type CheckedAccount = CheckedAccount; type TrustedTeleporter = TrustedTeleporter; - type TrustedReserve = TrustedReserve; fn get_multi_asset() -> MultiAsset { MultiAsset { @@ -948,8 +948,16 @@ impl_runtime_apis! { (0u64, Response::Version(Default::default())) } - fn transact_origin() -> Result { - Ok(WestendLocation::get()) + fn worst_case_asset_exchange() -> Result<(MultiAssets, MultiAssets), BenchmarkError> { + Err(BenchmarkError::Skip) + } + + fn universal_alias() -> Result { + Err(BenchmarkError::Skip) + } + + fn transact_origin_and_runtime_call() -> Result<(MultiLocation, RuntimeCall), BenchmarkError> { + Ok((WestendLocation::get(), frame_system::Call::remark_with_event { remark: vec![] }.into())) } fn subscribe_origin() -> Result { @@ -962,6 +970,10 @@ impl_runtime_apis! { let ticket = MultiLocation { parents: 0, interior: Here }; Ok((origin, ticket, assets)) } + + fn unlockable_asset() -> Result<(MultiLocation, MultiLocation, MultiAsset), BenchmarkError> { + Err(BenchmarkError::Skip) + } } type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::; diff --git a/parachains/runtimes/assets/westmint/src/weights/mod.rs b/parachains/runtimes/assets/westmint/src/weights/mod.rs index 6bccc7bbd6d..92af360ced1 100644 --- a/parachains/runtimes/assets/westmint/src/weights/mod.rs +++ b/parachains/runtimes/assets/westmint/src/weights/mod.rs @@ -12,6 +12,7 @@ pub mod pallet_session; pub mod pallet_timestamp; pub mod pallet_uniques; pub mod pallet_utility; +pub mod pallet_xcm; pub mod paritydb_weights; pub mod rocksdb_weights; pub mod xcm; diff --git a/parachains/runtimes/assets/westmint/src/weights/pallet_xcm.rs b/parachains/runtimes/assets/westmint/src/weights/pallet_xcm.rs new file mode 100644 index 00000000000..457e551e52d --- /dev/null +++ b/parachains/runtimes/assets/westmint/src/weights/pallet_xcm.rs @@ -0,0 +1,173 @@ +// Copyright 2021 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Cumulus is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Cumulus. If not, see . + +//! Autogenerated weights for `pallet_xcm` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-12-22, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westmint-dev"), DB CACHE: 1024 + +// Executed Command: +// /home/benchbot/cargo_target_dir/production/polkadot-parachain +// benchmark +// pallet +// --steps=50 +// --repeat=20 +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json +// --pallet=pallet_xcm +// --chain=westmint-dev +// --header=./file_header.txt +// --output=./parachains/runtimes/assets/westmint/src/weights/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_xcm`. +pub struct WeightInfo(PhantomData); +impl pallet_xcm::WeightInfo for WeightInfo { + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + fn send() -> Weight { + // Minimum execution time: 27_623 nanoseconds. + Weight::from_ref_time(28_375_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: ParachainInfo ParachainId (r:1 w:0) + fn teleport_assets() -> Weight { + // Minimum execution time: 33_363 nanoseconds. + Weight::from_ref_time(33_942_000) + .saturating_add(T::DbWeight::get().reads(1)) + } + // Storage: ParachainInfo ParachainId (r:1 w:0) + fn reserve_transfer_assets() -> Weight { + // Minimum execution time: 25_113 nanoseconds. + Weight::from_ref_time(25_549_000) + .saturating_add(T::DbWeight::get().reads(1)) + } + fn execute() -> Weight { + // Minimum execution time: 15_464 nanoseconds. + Weight::from_ref_time(15_772_000) + } + // Storage: PolkadotXcm SupportedVersion (r:0 w:1) + fn force_xcm_version() -> Weight { + // Minimum execution time: 15_375 nanoseconds. + Weight::from_ref_time(15_631_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: PolkadotXcm SafeXcmVersion (r:0 w:1) + fn force_default_xcm_version() -> Weight { + // Minimum execution time: 4_575 nanoseconds. + Weight::from_ref_time(4_708_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: PolkadotXcm VersionNotifiers (r:1 w:1) + // Storage: PolkadotXcm QueryCounter (r:1 w:1) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + // Storage: PolkadotXcm Queries (r:0 w:1) + fn force_subscribe_version_notify() -> Weight { + // Minimum execution time: 31_521 nanoseconds. + Weight::from_ref_time(32_350_000) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(5)) + } + // Storage: PolkadotXcm VersionNotifiers (r:1 w:1) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + // Storage: PolkadotXcm Queries (r:0 w:1) + fn force_unsubscribe_version_notify() -> Weight { + // Minimum execution time: 32_589 nanoseconds. + Weight::from_ref_time(33_282_000) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: PolkadotXcm SupportedVersion (r:4 w:2) + fn migrate_supported_version() -> Weight { + // Minimum execution time: 13_642 nanoseconds. + Weight::from_ref_time(13_969_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PolkadotXcm VersionNotifiers (r:4 w:2) + fn migrate_version_notifiers() -> Weight { + // Minimum execution time: 13_569 nanoseconds. + Weight::from_ref_time(14_168_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PolkadotXcm VersionNotifyTargets (r:5 w:0) + fn already_notified_target() -> Weight { + // Minimum execution time: 15_406 nanoseconds. + Weight::from_ref_time(15_731_000) + .saturating_add(T::DbWeight::get().reads(5)) + } + // Storage: PolkadotXcm VersionNotifyTargets (r:2 w:1) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + fn notify_current_targets() -> Weight { + // Minimum execution time: 27_357 nanoseconds. + Weight::from_ref_time(27_804_000) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: PolkadotXcm VersionNotifyTargets (r:3 w:0) + fn notify_target_migration_fail() -> Weight { + // Minimum execution time: 6_940 nanoseconds. + Weight::from_ref_time(7_147_000) + .saturating_add(T::DbWeight::get().reads(3)) + } + // Storage: PolkadotXcm VersionNotifyTargets (r:4 w:2) + fn migrate_version_notify_targets() -> Weight { + // Minimum execution time: 14_204 nanoseconds. + Weight::from_ref_time(14_529_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PolkadotXcm VersionNotifyTargets (r:4 w:2) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + fn migrate_and_notify_old_targets() -> Weight { + // Minimum execution time: 32_809 nanoseconds. + Weight::from_ref_time(33_346_000) + .saturating_add(T::DbWeight::get().reads(9)) + .saturating_add(T::DbWeight::get().writes(4)) + } +} diff --git a/parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs b/parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs index 5f6bf034fdc..ee63ee3f2ad 100644 --- a/parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs +++ b/parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs @@ -21,168 +21,220 @@ use crate::Runtime; use frame_support::weights::Weight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; -use sp_std::{cmp, prelude::*}; -use xcm::{ - latest::{prelude::*, Weight as XCMWeight}, - DoubleEncoded, -}; +use sp_std::prelude::*; +use xcm::{latest::prelude::*, DoubleEncoded}; trait WeighMultiAssets { - fn weigh_multi_assets(&self, weight: Weight) -> XCMWeight; + fn weigh_multi_assets(&self, weight: Weight) -> Weight; } const MAX_ASSETS: u32 = 100; impl WeighMultiAssets for MultiAssetFilter { - fn weigh_multi_assets(&self, weight: Weight) -> XCMWeight { - let weight = match self { + fn weigh_multi_assets(&self, weight: Weight) -> Weight { + match self { Self::Definite(assets) => weight.saturating_mul(assets.inner().into_iter().count() as u64), Self::Wild(_) => weight.saturating_mul(MAX_ASSETS as u64), - }; - weight.ref_time() + } } } impl WeighMultiAssets for MultiAssets { - fn weigh_multi_assets(&self, weight: Weight) -> XCMWeight { - weight.saturating_mul(self.inner().into_iter().count() as u64).ref_time() + fn weigh_multi_assets(&self, weight: Weight) -> Weight { + weight.saturating_mul(self.inner().into_iter().count() as u64) } } pub struct WestmintXcmWeight(core::marker::PhantomData); impl XcmWeightInfo for WestmintXcmWeight { - fn withdraw_asset(assets: &MultiAssets) -> XCMWeight { + fn withdraw_asset(assets: &MultiAssets) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::withdraw_asset()) } // Currently there is no trusted reserve - fn reserve_asset_deposited(_assets: &MultiAssets) -> XCMWeight { - u64::MAX + fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight { + // TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974 + Weight::from_ref_time(1_000_000_000 as u64) } - fn receive_teleported_asset(assets: &MultiAssets) -> XCMWeight { + fn receive_teleported_asset(assets: &MultiAssets) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::receive_teleported_asset()) } - fn query_response(_query_id: &u64, _response: &Response, _max_weight: &u64) -> XCMWeight { - XcmGeneric::::query_response().ref_time() + fn query_response( + _query_id: &u64, + _response: &Response, + _max_weight: &Weight, + _querier: &Option, + ) -> Weight { + XcmGeneric::::query_response() } - fn transfer_asset(assets: &MultiAssets, _dest: &MultiLocation) -> XCMWeight { + fn transfer_asset(assets: &MultiAssets, _dest: &MultiLocation) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::transfer_asset()) } fn transfer_reserve_asset( assets: &MultiAssets, _dest: &MultiLocation, _xcm: &Xcm<()>, - ) -> XCMWeight { + ) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::transfer_reserve_asset()) } fn transact( _origin_type: &OriginKind, - _require_weight_at_most: &u64, + _require_weight_at_most: &Weight, _call: &DoubleEncoded, - ) -> XCMWeight { - XcmGeneric::::transact().ref_time() + ) -> Weight { + XcmGeneric::::transact() } fn hrmp_new_channel_open_request( _sender: &u32, _max_message_size: &u32, _max_capacity: &u32, - ) -> XCMWeight { + ) -> Weight { // XCM Executor does not currently support HRMP channel operations - Weight::MAX.ref_time() + Weight::MAX } - fn hrmp_channel_accepted(_recipient: &u32) -> XCMWeight { + fn hrmp_channel_accepted(_recipient: &u32) -> Weight { // XCM Executor does not currently support HRMP channel operations - Weight::MAX.ref_time() + Weight::MAX } - fn hrmp_channel_closing(_initiator: &u32, _sender: &u32, _recipient: &u32) -> XCMWeight { + fn hrmp_channel_closing(_initiator: &u32, _sender: &u32, _recipient: &u32) -> Weight { // XCM Executor does not currently support HRMP channel operations - Weight::MAX.ref_time() + Weight::MAX } - fn clear_origin() -> XCMWeight { - XcmGeneric::::clear_origin().ref_time() + fn clear_origin() -> Weight { + XcmGeneric::::clear_origin() } - fn descend_origin(_who: &InteriorMultiLocation) -> XCMWeight { - XcmGeneric::::descend_origin().ref_time() + fn descend_origin(_who: &InteriorMultiLocation) -> Weight { + XcmGeneric::::descend_origin() } - fn report_error( - _query_id: &QueryId, - _dest: &MultiLocation, - _max_response_weight: &u64, - ) -> XCMWeight { - XcmGeneric::::report_error().ref_time() + fn report_error(_query_response_info: &QueryResponseInfo) -> Weight { + XcmGeneric::::report_error() } - fn deposit_asset( - assets: &MultiAssetFilter, - _max_assets: &u32, - _dest: &MultiLocation, - ) -> XCMWeight { + fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_ref_time(1_000_000_000 as u64).ref_time(); + let hardcoded_weight = Weight::from_ref_time(1_000_000_000 as u64); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::deposit_asset()); - cmp::min(hardcoded_weight, weight) + hardcoded_weight.min(weight) } fn deposit_reserve_asset( assets: &MultiAssetFilter, - _max_assets: &u32, _dest: &MultiLocation, _xcm: &Xcm<()>, - ) -> XCMWeight { + ) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::deposit_reserve_asset()) } - fn exchange_asset(_give: &MultiAssetFilter, _receive: &MultiAssets) -> XCMWeight { - Weight::MAX.ref_time() + fn exchange_asset(_give: &MultiAssetFilter, _receive: &MultiAssets, _maximal: &bool) -> Weight { + Weight::MAX } fn initiate_reserve_withdraw( assets: &MultiAssetFilter, _reserve: &MultiLocation, _xcm: &Xcm<()>, - ) -> XCMWeight { + ) -> Weight { assets.weigh_multi_assets(XcmGeneric::::initiate_reserve_withdraw()) } fn initiate_teleport( assets: &MultiAssetFilter, _dest: &MultiLocation, _xcm: &Xcm<()>, - ) -> XCMWeight { + ) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_ref_time(200_000_000 as u64).ref_time(); + let hardcoded_weight = Weight::from_ref_time(200_000_000 as u64); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::initiate_teleport()); - cmp::min(hardcoded_weight, weight) + hardcoded_weight.min(weight) } - fn query_holding( - _query_id: &u64, - _dest: &MultiLocation, - _assets: &MultiAssetFilter, - _max_response_weight: &u64, - ) -> XCMWeight { - XcmGeneric::::query_holding().ref_time() + fn report_holding(_response_info: &QueryResponseInfo, _assets: &MultiAssetFilter) -> Weight { + XcmGeneric::::report_holding() + } + fn buy_execution(_fees: &MultiAsset, _weight_limit: &WeightLimit) -> Weight { + XcmGeneric::::buy_execution() + } + fn refund_surplus() -> Weight { + XcmGeneric::::refund_surplus() + } + fn set_error_handler(_xcm: &Xcm) -> Weight { + XcmGeneric::::set_error_handler() + } + fn set_appendix(_xcm: &Xcm) -> Weight { + XcmGeneric::::set_appendix() + } + fn clear_error() -> Weight { + XcmGeneric::::clear_error() + } + fn claim_asset(_assets: &MultiAssets, _ticket: &MultiLocation) -> Weight { + XcmGeneric::::claim_asset() + } + fn trap(_code: &u64) -> Weight { + XcmGeneric::::trap() + } + fn subscribe_version(_query_id: &QueryId, _max_response_weight: &Weight) -> Weight { + XcmGeneric::::subscribe_version() + } + fn unsubscribe_version() -> Weight { + XcmGeneric::::unsubscribe_version() + } + fn burn_asset(assets: &MultiAssets) -> Weight { + assets.weigh_multi_assets(XcmGeneric::::burn_asset()) + } + fn expect_asset(assets: &MultiAssets) -> Weight { + assets.weigh_multi_assets(XcmGeneric::::expect_asset()) + } + fn expect_origin(_origin: &Option) -> Weight { + XcmGeneric::::expect_origin() + } + fn expect_error(_error: &Option<(u32, XcmError)>) -> Weight { + XcmGeneric::::expect_error() + } + fn query_pallet(_module_name: &Vec, _response_info: &QueryResponseInfo) -> Weight { + XcmGeneric::::query_pallet() + } + fn expect_pallet( + _index: &u32, + _name: &Vec, + _module_name: &Vec, + _crate_major: &u32, + _min_crate_minor: &u32, + ) -> Weight { + XcmGeneric::::expect_pallet() + } + fn report_transact_status(_response_info: &QueryResponseInfo) -> Weight { + XcmGeneric::::report_transact_status() + } + fn clear_transact_status() -> Weight { + XcmGeneric::::clear_transact_status() + } + fn universal_origin(_: &Junction) -> Weight { + Weight::MAX + } + fn export_message(_: &NetworkId, _: &Junctions, _: &Xcm<()>) -> Weight { + Weight::MAX } - fn buy_execution(_fees: &MultiAsset, _weight_limit: &WeightLimit) -> XCMWeight { - XcmGeneric::::buy_execution().ref_time() + fn lock_asset(_: &MultiAsset, _: &MultiLocation) -> Weight { + Weight::MAX } - fn refund_surplus() -> XCMWeight { - XcmGeneric::::refund_surplus().ref_time() + fn unlock_asset(_: &MultiAsset, _: &MultiLocation) -> Weight { + Weight::MAX } - fn set_error_handler(_xcm: &Xcm) -> XCMWeight { - XcmGeneric::::set_error_handler().ref_time() + fn note_unlockable(_: &MultiAsset, _: &MultiLocation) -> Weight { + Weight::MAX } - fn set_appendix(_xcm: &Xcm) -> XCMWeight { - XcmGeneric::::set_appendix().ref_time() + fn request_unlock(_: &MultiAsset, _: &MultiLocation) -> Weight { + Weight::MAX } - fn clear_error() -> XCMWeight { - XcmGeneric::::clear_error().ref_time() + fn set_fees_mode(_: &bool) -> Weight { + XcmGeneric::::set_fees_mode() } - fn claim_asset(_assets: &MultiAssets, _ticket: &MultiLocation) -> XCMWeight { - XcmGeneric::::claim_asset().ref_time() + fn set_topic(_topic: &[u8; 32]) -> Weight { + XcmGeneric::::set_topic() } - fn trap(_code: &u64) -> XCMWeight { - XcmGeneric::::trap().ref_time() + fn clear_topic() -> Weight { + XcmGeneric::::clear_topic() } - fn subscribe_version(_query_id: &QueryId, _max_response_weight: &u64) -> XCMWeight { - XcmGeneric::::subscribe_version().ref_time() + fn alias_origin(_: &MultiLocation) -> Weight { + // XCM Executor does not currently support alias origin operations + Weight::MAX } - fn unsubscribe_version() -> XCMWeight { - XcmGeneric::::unsubscribe_version().ref_time() + fn unpaid_execution(_: &WeightLimit, _: &Option) -> Weight { + XcmGeneric::::unpaid_execution() } } diff --git a/parachains/runtimes/assets/westmint/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs b/parachains/runtimes/assets/westmint/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs index fcd1b0b5f41..bcf175e7c5e 100644 --- a/parachains/runtimes/assets/westmint/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs +++ b/parachains/runtimes/assets/westmint/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs @@ -18,25 +18,26 @@ //! Autogenerated weights for `pallet_xcm_benchmarks::fungible` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-12-21, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! DATE: 2022-12-14, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westmint-dev"), DB CACHE: 1024 // Executed Command: -// ./artifacts/polkadot-parachain +// /home/benchbot/cargo_target_dir/production/polkadot-parachain // benchmark // pallet -// --template=./templates/xcm-bench-template.hbs -// --chain=westmint-dev +// --steps=50 +// --repeat=20 +// --extrinsic=* // --execution=wasm // --wasm-execution=compiled +// --heap-pages=4096 +// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json // --pallet=pallet_xcm_benchmarks::fungible -// --extrinsic=* -// --steps=50 -// --repeat=20 -// --json +// --chain=westmint-dev // --header=./file_header.txt -// --output=./parachains/runtimes/assets/westmint/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs +// --template=./templates/xcm-bench-template.hbs +// --output=./parachains/runtimes/assets/westmint/src/weights/xcm/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -50,13 +51,13 @@ pub struct WeightInfo(PhantomData); impl WeightInfo { // Storage: System Account (r:1 w:1) pub(crate) fn withdraw_asset() -> Weight { - Weight::from_ref_time(32_238_000 as u64) + Weight::from_ref_time(30_986_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: System Account (r:2 w:2) pub(crate) fn transfer_asset() -> Weight { - Weight::from_ref_time(37_145_000 as u64) + Weight::from_ref_time(39_149_000 as u64) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -68,16 +69,16 @@ impl WeightInfo { // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) pub(crate) fn transfer_reserve_asset() -> Weight { - Weight::from_ref_time(52_803_000 as u64) + Weight::from_ref_time(56_235_000 as u64) .saturating_add(T::DbWeight::get().reads(8 as u64)) .saturating_add(T::DbWeight::get().writes(4 as u64)) } pub(crate) fn receive_teleported_asset() -> Weight { - Weight::from_ref_time(6_248_000 as u64) + Weight::from_ref_time(7_616_000 as u64) } // Storage: System Account (r:1 w:1) pub(crate) fn deposit_asset() -> Weight { - Weight::from_ref_time(33_168_000 as u64) + Weight::from_ref_time(34_864_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } @@ -89,7 +90,7 @@ impl WeightInfo { // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) pub(crate) fn deposit_reserve_asset() -> Weight { - Weight::from_ref_time(53_662_000 as u64) + Weight::from_ref_time(55_915_000 as u64) .saturating_add(T::DbWeight::get().reads(7 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -100,7 +101,7 @@ impl WeightInfo { // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) pub(crate) fn initiate_teleport() -> Weight { - Weight::from_ref_time(29_189_000 as u64) + Weight::from_ref_time(30_050_000 as u64) .saturating_add(T::DbWeight::get().reads(6 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } diff --git a/parachains/runtimes/assets/westmint/src/weights/xcm/pallet_xcm_benchmarks_generic.rs b/parachains/runtimes/assets/westmint/src/weights/xcm/pallet_xcm_benchmarks_generic.rs index ff3da44e032..0e88b1349e2 100644 --- a/parachains/runtimes/assets/westmint/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +++ b/parachains/runtimes/assets/westmint/src/weights/xcm/pallet_xcm_benchmarks_generic.rs @@ -18,25 +18,26 @@ //! Autogenerated weights for `pallet_xcm_benchmarks::generic` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-12-21, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `bm4`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! DATE: 2022-12-14, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westmint-dev"), DB CACHE: 1024 // Executed Command: -// ./artifacts/polkadot-parachain +// /home/benchbot/cargo_target_dir/production/polkadot-parachain // benchmark // pallet -// --template=./templates/xcm-bench-template.hbs -// --chain=westmint-dev +// --steps=50 +// --repeat=20 +// --extrinsic=* // --execution=wasm // --wasm-execution=compiled +// --heap-pages=4096 +// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json // --pallet=pallet_xcm_benchmarks::generic -// --extrinsic=* -// --steps=50 -// --repeat=20 -// --json +// --chain=westmint-dev // --header=./file_header.txt -// --output=./parachains/runtimes/assets/westmint/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +// --template=./templates/xcm-bench-template.hbs +// --output=./parachains/runtimes/assets/westmint/src/weights/xcm/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -54,58 +55,59 @@ impl WeightInfo { // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) - pub(crate) fn query_holding() -> Weight { - Weight::from_ref_time(710_352_000 as u64) + pub(crate) fn report_holding() -> Weight { + Weight::from_ref_time(337_762_000 as u64) .saturating_add(T::DbWeight::get().reads(6 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } pub(crate) fn buy_execution() -> Weight { - Weight::from_ref_time(8_924_000 as u64) + Weight::from_ref_time(6_682_000 as u64) } // Storage: PolkadotXcm Queries (r:1 w:0) pub(crate) fn query_response() -> Weight { - Weight::from_ref_time(17_278_000 as u64) + Weight::from_ref_time(17_801_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) } pub(crate) fn transact() -> Weight { - Weight::from_ref_time(20_214_000 as u64) + Weight::from_ref_time(21_889_000 as u64) } pub(crate) fn refund_surplus() -> Weight { - Weight::from_ref_time(9_218_000 as u64) + Weight::from_ref_time(7_081_000 as u64) } pub(crate) fn set_error_handler() -> Weight { - Weight::from_ref_time(5_175_000 as u64) + Weight::from_ref_time(6_050_000 as u64) } pub(crate) fn set_appendix() -> Weight { - Weight::from_ref_time(5_145_000 as u64) + Weight::from_ref_time(5_982_000 as u64) } pub(crate) fn clear_error() -> Weight { - Weight::from_ref_time(5_298_000 as u64) + Weight::from_ref_time(5_948_000 as u64) } pub(crate) fn descend_origin() -> Weight { - Weight::from_ref_time(6_134_000 as u64) + Weight::from_ref_time(7_022_000 as u64) } pub(crate) fn clear_origin() -> Weight { - Weight::from_ref_time(5_277_000 as u64) + Weight::from_ref_time(6_019_000 as u64) } + // Storage: ParachainInfo ParachainId (r:1 w:0) // Storage: PolkadotXcm SupportedVersion (r:1 w:0) // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) pub(crate) fn report_error() -> Weight { - Weight::from_ref_time(15_270_000 as u64) - .saturating_add(T::DbWeight::get().reads(5 as u64)) + Weight::from_ref_time(21_836_000 as u64) + .saturating_add(T::DbWeight::get().reads(6 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: PolkadotXcm AssetTraps (r:1 w:1) pub(crate) fn claim_asset() -> Weight { - Weight::from_ref_time(21_147_000 as u64) + Weight::from_ref_time(21_512_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } pub(crate) fn trap() -> Weight { - Weight::from_ref_time(5_429_000 as u64) + Weight::from_ref_time(5_971_000 as u64) } // Storage: PolkadotXcm VersionNotifyTargets (r:1 w:1) // Storage: PolkadotXcm SupportedVersion (r:1 w:0) @@ -114,13 +116,13 @@ impl WeightInfo { // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) pub(crate) fn subscribe_version() -> Weight { - Weight::from_ref_time(18_098_000 as u64) + Weight::from_ref_time(27_912_000 as u64) .saturating_add(T::DbWeight::get().reads(6 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: PolkadotXcm VersionNotifyTargets (r:0 w:1) pub(crate) fn unsubscribe_version() -> Weight { - Weight::from_ref_time(7_527_000 as u64) + Weight::from_ref_time(7_870_000 as u64) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: ParachainInfo ParachainId (r:1 w:0) @@ -130,8 +132,60 @@ impl WeightInfo { // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) pub(crate) fn initiate_reserve_withdraw() -> Weight { - Weight::from_ref_time(927_560_000 as u64) + Weight::from_ref_time(390_638_000 as u64) + .saturating_add(T::DbWeight::get().reads(6 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + pub(crate) fn burn_asset() -> Weight { + Weight::from_ref_time(128_254_000 as u64) + } + pub(crate) fn expect_asset() -> Weight { + Weight::from_ref_time(15_386_000 as u64) + } + pub(crate) fn expect_origin() -> Weight { + Weight::from_ref_time(6_071_000 as u64) + } + pub(crate) fn expect_error() -> Weight { + Weight::from_ref_time(6_044_000 as u64) + } + // Storage: ParachainInfo ParachainId (r:1 w:0) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + pub(crate) fn query_pallet() -> Weight { + Weight::from_ref_time(24_744_000 as u64) + .saturating_add(T::DbWeight::get().reads(6 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + pub(crate) fn expect_pallet() -> Weight { + Weight::from_ref_time(7_558_000 as u64) + } + // Storage: ParachainInfo ParachainId (r:1 w:0) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + pub(crate) fn report_transact_status() -> Weight { + Weight::from_ref_time(22_068_000 as u64) .saturating_add(T::DbWeight::get().reads(6 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } + pub(crate) fn clear_transact_status() -> Weight { + Weight::from_ref_time(5_945_000 as u64) + } + pub(crate) fn set_topic() -> Weight { + Weight::from_ref_time(5_863_000 as u64) + } + pub(crate) fn clear_topic() -> Weight { + Weight::from_ref_time(5_807_000 as u64) + } + pub(crate) fn set_fees_mode() -> Weight { + Weight::from_ref_time(5_825_000 as u64) + } + pub(crate) fn unpaid_execution() -> Weight { + Weight::from_ref_time(5_920_000 as u64) + } } diff --git a/parachains/runtimes/assets/westmint/src/xcm_config.rs b/parachains/runtimes/assets/westmint/src/xcm_config.rs index 9d23dd55e59..81578bc4da7 100644 --- a/parachains/runtimes/assets/westmint/src/xcm_config.rs +++ b/parachains/runtimes/assets/westmint/src/xcm_config.rs @@ -14,12 +14,13 @@ // limitations under the License. use super::{ - AccountId, AssetId, Assets, Authorship, Balance, Balances, ParachainInfo, ParachainSystem, - PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue, + AccountId, AllPalletsWithSystem, AssetId, Assets, Authorship, Balance, Balances, ParachainInfo, + ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, + XcmpQueue, }; use frame_support::{ match_types, parameter_types, - traits::{Everything, PalletInfoAccess}, + traits::{ConstU32, Contains, Everything, Nothing, PalletInfoAccess}, }; use pallet_xcm::XcmPassthrough; use parachains_common::{ @@ -32,23 +33,26 @@ use polkadot_parachain::primitives::Sibling; use sp_runtime::traits::ConvertInto; use xcm::latest::prelude::*; use xcm_builder::{ - AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, - AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, AsPrefixedGeneralIndex, - ConvertedConcreteAssetId, CurrencyAdapter, EnsureXcmOrigin, FungiblesAdapter, IsConcrete, - LocationInverter, NativeAsset, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, - SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, - SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, - WeightInfoBounds, + AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, + AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, AsPrefixedGeneralIndex, + ConvertedConcreteId, CurrencyAdapter, EnsureXcmOrigin, FungiblesAdapter, IsConcrete, LocalMint, + NativeAsset, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, + SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, + SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, WeightInfoBounds, + WithComputedOrigin, +}; +use xcm_executor::{ + traits::{JustTry, WithOriginFilter}, + XcmExecutor, }; -use xcm_executor::{traits::JustTry, XcmExecutor}; parameter_types! { pub const WestendLocation: MultiLocation = MultiLocation::parent(); - pub RelayNetwork: NetworkId = - NetworkId::Named(b"Westend".to_vec().try_into().expect("less than length limit; qed")); + pub RelayNetwork: Option = Some(NetworkId::Westend); pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); - pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); - pub const Local: MultiLocation = Here.into(); + pub UniversalLocation: InteriorMultiLocation = + X2(GlobalConsensus(RelayNetwork::get().unwrap()), Parachain(ParachainInfo::parachain_id().into())); + pub const Local: MultiLocation = Here.into_location(); pub AssetsPalletLocation: MultiLocation = PalletInstance(::index() as u8).into(); pub CheckingAccount: AccountId = PolkadotXcm::check_account(); @@ -85,7 +89,7 @@ pub type FungiblesTransactor = FungiblesAdapter< // Use this fungibles implementation: Assets, // Use this currency when it is a fungible asset matching the given location or name: - ConvertedConcreteAssetId< + ConvertedConcreteId< AssetId, Balance, AsPrefixedGeneralIndex, @@ -97,7 +101,7 @@ pub type FungiblesTransactor = FungiblesAdapter< AccountId, // We only want to allow teleports of known assets. We use non-zero issuance as an indication // that this asset is known. - parachains_common::impls::NonZeroIssuance, + LocalMint>, // The account to use for tracking teleports. CheckingAccount, >; @@ -130,6 +134,7 @@ pub type XcmOriginToTransactDispatchOrigin = ( parameter_types! { pub const MaxInstructions: u32 = 100; + pub const MaxAssetsIntoHolding: u32 = 64; pub XcmAssetFeesReceiver: Option = Authorship::author(); } @@ -139,18 +144,122 @@ match_types! { MultiLocation { parents: 1, interior: X1(Plurality { .. }) } }; } +/// A call filter for the XCM Transact instruction. This is a temporary measure until we properly +/// account for proof size weights. +/// +/// Calls that are allowed through this filter must: +/// 1. Have a fixed weight; +/// 2. Cannot lead to another call being made; +/// 3. Have a defined proof size weight, e.g. no unbounded vecs in call parameters. +pub struct SafeCallFilter; +impl Contains for SafeCallFilter { + fn contains(call: &RuntimeCall) -> bool { + #[cfg(feature = "runtime-benchmarks")] + { + if matches!(call, RuntimeCall::System(frame_system::Call::remark_with_event { .. })) { + return true + } + } + + match 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::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, + } + } +} pub type Barrier = DenyThenTry< DenyReserveTransferToRelayChain, ( TakeWeightCredit, - AllowTopLevelPaidExecutionFrom, - // Parent and its plurality get free execution - AllowUnpaidExecutionFrom, // Expected responses are OK. AllowKnownQueryResponses, - // Subscriptions for version tracking are OK. - AllowSubscriptionsFrom, + // Allow XCMs with some computed origins to pass through. + WithComputedOrigin< + ( + // If the message is one that immediately attemps to pay for execution, then allow it. + AllowTopLevelPaidExecutionFrom, + // Parent or its plurality (i.e. governance bodies) gets free execution. + AllowExplicitUnpaidExecutionFrom, + // Subscriptions for version tracking are OK. + AllowSubscriptionsFrom, + ), + UniversalLocation, + ConstU32<8>, + >, ), >; @@ -171,7 +280,7 @@ impl xcm_executor::Config for XcmConfig { // For WND, users must use teleport where allowed (e.g. with the Relay Chain). type IsReserve = (); type IsTeleporter = NativeAsset; // <- should be enough to allow teleportation of WND - type LocationInverter = LocationInverter; + type UniversalLocation = UniversalLocation; type Barrier = Barrier; type Weigher = WeightInfoBounds< crate::weights::xcm::WestmintXcmWeight, @@ -183,7 +292,7 @@ impl xcm_executor::Config for XcmConfig { cumulus_primitives_utility::TakeFirstAssetTrader< AccountId, AssetFeeAsExistentialDepositMultiplierFeeCharger, - ConvertedConcreteAssetId< + ConvertedConcreteId< AssetId, Balance, AsPrefixedGeneralIndex, @@ -201,6 +310,15 @@ impl xcm_executor::Config for XcmConfig { type AssetTrap = PolkadotXcm; type AssetClaims = PolkadotXcm; type SubscriptionService = PolkadotXcm; + type PalletInstancesInfo = AllPalletsWithSystem; + type MaxAssetsIntoHolding = MaxAssetsIntoHolding; + type AssetLocker = (); + type AssetExchanger = (); + type FeeManager = (); + type MessageExporter = (); + type UniversalAliases = Nothing; + type CallDispatcher = WithOriginFilter; + type SafeCallFilter = SafeCallFilter; } /// Local origins on this chain are allowed to dispatch XCM sends/executions. @@ -210,11 +328,16 @@ pub type LocalOriginToLocation = SignedToAccountId32, + cumulus_primitives_utility::ParentAsUmp, // ..and XCMP to communicate with the sibling chains. XcmpQueue, ); +#[cfg(feature = "runtime-benchmarks")] +parameter_types! { + pub ReachableDest: Option = Some(Parent.into()); +} + impl pallet_xcm::Config for Runtime { type RuntimeEvent = RuntimeEvent; type SendXcmOrigin = EnsureXcmOrigin; @@ -229,11 +352,19 @@ impl pallet_xcm::Config for Runtime { RuntimeCall, MaxInstructions, >; - type LocationInverter = LocationInverter; + 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 = LocationToAccountId; + type MaxLockers = ConstU32<8>; + type WeightInfo = crate::weights::pallet_xcm::WeightInfo; + #[cfg(feature = "runtime-benchmarks")] + type ReachableDest = ReachableDest; } 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 a7b846d49ec..68c6cf670d5 100644 --- a/parachains/runtimes/assets/westmint/tests/tests.rs +++ b/parachains/runtimes/assets/westmint/tests/tests.rs @@ -62,13 +62,13 @@ fn test_asset_xcm_trader() { RuntimeHelper::::run_to_block(2, Some(AccountId::from(ALICE))); // We are going to buy 4e9 weight - let bought = 4_000_000_000u64; + let bought = Weight::from_ref_time(4_000_000_000u64); // Lets calculate amount needed let asset_amount_needed = AssetFeeAsExistentialDepositMultiplierFeeCharger::charge_weight_in_fungibles( local_asset_id, - Weight::from_ref_time(bought), + bought, ) .expect("failed to compute"); @@ -138,7 +138,7 @@ fn test_asset_xcm_trader_with_refund() { RuntimeHelper::::run_to_block(2, Some(AccountId::from(ALICE))); // We are going to buy 4e9 weight - let bought = 4_000_000_000u64; + let bought = Weight::from_ref_time(4_000_000_000u64); let asset_multilocation = MultiLocation::new( 0, X2( @@ -151,7 +151,7 @@ fn test_asset_xcm_trader_with_refund() { ); // lets calculate amount needed - let amount_bought = WeightToFee::weight_to_fee(&Weight::from_ref_time(bought)); + let amount_bought = WeightToFee::weight_to_fee(&bought); let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into(); @@ -165,8 +165,7 @@ fn test_asset_xcm_trader_with_refund() { let weight_used = bought / 2; // Make sure refurnd works. - let amount_refunded = - WeightToFee::weight_to_fee(&Weight::from_ref_time(bought - weight_used)); + let amount_refunded = WeightToFee::weight_to_fee(&(bought - weight_used)); assert_eq!( trader.refund_weight(bought - weight_used), @@ -177,7 +176,7 @@ fn test_asset_xcm_trader_with_refund() { drop(trader); // We only should have paid for half of the bought weight - let fees_paid = WeightToFee::weight_to_fee(&Weight::from_ref_time(weight_used)); + let fees_paid = WeightToFee::weight_to_fee(&weight_used); assert_eq!( Assets::balance(1, AccountId::from(ALICE)), @@ -216,7 +215,7 @@ fn test_asset_xcm_trader_refund_not_possible_since_amount_less_than_ed() { RuntimeHelper::::run_to_block(2, Some(AccountId::from(ALICE))); // We are going to buy 5e9 weight - let bought = 500_000_000u64; + let bought = Weight::from_ref_time(500_000_000u64); let asset_multilocation = MultiLocation::new( 0, @@ -229,7 +228,7 @@ fn test_asset_xcm_trader_refund_not_possible_since_amount_less_than_ed() { ), ); - let amount_bought = WeightToFee::weight_to_fee(&Weight::from_ref_time(bought)); + let amount_bought = WeightToFee::weight_to_fee(&bought); assert!( amount_bought < ExistentialDeposit::get(), @@ -275,7 +274,7 @@ fn test_that_buying_ed_refund_does_not_refund() { // Set Alice as block author, who will receive fees RuntimeHelper::::run_to_block(2, Some(AccountId::from(ALICE))); - let bought = 500_000_000u64; + let bought = Weight::from_ref_time(500_000_000u64); let asset_multilocation = MultiLocation::new( 0, @@ -288,7 +287,7 @@ fn test_that_buying_ed_refund_does_not_refund() { ), ); - let amount_bought = WeightToFee::weight_to_fee(&Weight::from_ref_time(bought)); + let amount_bought = WeightToFee::weight_to_fee(&bought); assert!( amount_bought < ExistentialDeposit::get(), @@ -356,10 +355,10 @@ fn test_asset_xcm_trader_not_possible_for_non_sufficient_assets() { RuntimeHelper::::run_to_block(2, Some(AccountId::from(ALICE))); // We are going to buy 4e9 weight - let bought = 4_000_000_000u64; + let bought = Weight::from_ref_time(4_000_000_000u64); // lets calculate amount needed - let asset_amount_needed = WeightToFee::weight_to_fee(&Weight::from_ref_time(bought)); + let asset_amount_needed = WeightToFee::weight_to_fee(&bought); let asset_multilocation = MultiLocation::new( 0, 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 492cad5da9f..8ed397c613d 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs @@ -305,6 +305,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type ControllerOrigin = RootOrExecutiveSimpleMajority; type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo; + type PriceForSiblingDelivery = (); } impl cumulus_pallet_dmp_queue::Config for Runtime { @@ -440,6 +441,7 @@ mod benches { [pallet_collator_selection, CollatorSelection] [cumulus_pallet_xcmp_queue, XcmpQueue] // XCM + [pallet_xcm, PolkadotXcm] // NOTE: Make sure you point to the individual modules below. [pallet_xcm_benchmarks::fungible, XcmBalances] [pallet_xcm_benchmarks::generic, XcmGeneric] @@ -616,7 +618,7 @@ impl_runtime_apis! { fn valid_destination() -> Result { Ok(KsmRelayLocation::get()) } - fn worst_case_holding() -> MultiAssets { + fn worst_case_holding(_depositable_count: u32) -> MultiAssets { // just concrete assets according to relay chain. let assets: Vec = vec![ MultiAsset { @@ -633,8 +635,7 @@ impl_runtime_apis! { KsmRelayLocation::get(), MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(KsmRelayLocation::get()) }, )); - pub const TrustedReserve: Option<(MultiLocation, MultiAsset)> = None; - pub const CheckedAccount: Option = None; + pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None; } impl pallet_xcm_benchmarks::fungible::Config for Runtime { @@ -642,7 +643,6 @@ impl_runtime_apis! { type CheckedAccount = CheckedAccount; type TrustedTeleporter = TrustedTeleporter; - type TrustedReserve = TrustedReserve; fn get_multi_asset() -> MultiAsset { MultiAsset { @@ -659,8 +659,16 @@ impl_runtime_apis! { (0u64, Response::Version(Default::default())) } - fn transact_origin() -> Result { - Ok(KsmRelayLocation::get()) + fn worst_case_asset_exchange() -> Result<(MultiAssets, MultiAssets), BenchmarkError> { + Err(BenchmarkError::Skip) + } + + fn universal_alias() -> Result { + Err(BenchmarkError::Skip) + } + + fn transact_origin_and_runtime_call() -> Result<(MultiLocation, RuntimeCall), BenchmarkError> { + Ok((KsmRelayLocation::get(), frame_system::Call::remark_with_event { remark: vec![] }.into())) } fn subscribe_origin() -> Result { @@ -673,6 +681,10 @@ impl_runtime_apis! { let ticket = MultiLocation { parents: 0, interior: Here }; Ok((origin, ticket, assets)) } + + fn unlockable_asset() -> Result<(MultiLocation, MultiLocation, MultiAsset), BenchmarkError> { + Err(BenchmarkError::Skip) + } } type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::; diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/mod.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/mod.rs index 869c03be687..d5722374def 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/mod.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/mod.rs @@ -27,6 +27,7 @@ pub mod pallet_multisig; pub mod pallet_session; pub mod pallet_timestamp; pub mod pallet_utility; +pub mod pallet_xcm; pub mod paritydb_weights; pub mod rocksdb_weights; pub mod xcm; diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_xcm.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_xcm.rs new file mode 100644 index 00000000000..672b3f75421 --- /dev/null +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_xcm.rs @@ -0,0 +1,173 @@ +// Copyright 2021 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Cumulus is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Cumulus. If not, see . + +//! Autogenerated weights for `pallet_xcm` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-12-22, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-kusama-dev"), DB CACHE: 1024 + +// Executed Command: +// /home/benchbot/cargo_target_dir/production/polkadot-parachain +// benchmark +// pallet +// --steps=50 +// --repeat=20 +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json +// --pallet=pallet_xcm +// --chain=bridge-hub-kusama-dev +// --header=./file_header.txt +// --output=./parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_xcm`. +pub struct WeightInfo(PhantomData); +impl pallet_xcm::WeightInfo for WeightInfo { + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + fn send() -> Weight { + // Minimum execution time: 26_824 nanoseconds. + Weight::from_ref_time(27_272_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: ParachainInfo ParachainId (r:1 w:0) + fn teleport_assets() -> Weight { + // Minimum execution time: 32_322 nanoseconds. + Weight::from_ref_time(32_760_000) + .saturating_add(T::DbWeight::get().reads(1)) + } + // Storage: Benchmark Override (r:0 w:0) + fn reserve_transfer_assets() -> Weight { + // Minimum execution time: 18_446_744_073_709_551 nanoseconds. + Weight::from_ref_time(18_446_744_073_709_551_000) + } + // Storage: Benchmark Override (r:0 w:0) + fn execute() -> Weight { + // Minimum execution time: 18_446_744_073_709_551 nanoseconds. + Weight::from_ref_time(18_446_744_073_709_551_000) + } + // Storage: PolkadotXcm SupportedVersion (r:0 w:1) + fn force_xcm_version() -> Weight { + // Minimum execution time: 14_919 nanoseconds. + Weight::from_ref_time(15_388_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: PolkadotXcm SafeXcmVersion (r:0 w:1) + fn force_default_xcm_version() -> Weight { + // Minimum execution time: 4_754 nanoseconds. + Weight::from_ref_time(4_857_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: PolkadotXcm VersionNotifiers (r:1 w:1) + // Storage: PolkadotXcm QueryCounter (r:1 w:1) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + // Storage: PolkadotXcm Queries (r:0 w:1) + fn force_subscribe_version_notify() -> Weight { + // Minimum execution time: 31_107 nanoseconds. + Weight::from_ref_time(31_928_000) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(5)) + } + // Storage: PolkadotXcm VersionNotifiers (r:1 w:1) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + // Storage: PolkadotXcm Queries (r:0 w:1) + fn force_unsubscribe_version_notify() -> Weight { + // Minimum execution time: 31_745 nanoseconds. + Weight::from_ref_time(32_243_000) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: PolkadotXcm SupportedVersion (r:4 w:2) + fn migrate_supported_version() -> Weight { + // Minimum execution time: 13_855 nanoseconds. + Weight::from_ref_time(14_060_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PolkadotXcm VersionNotifiers (r:4 w:2) + fn migrate_version_notifiers() -> Weight { + // Minimum execution time: 13_693 nanoseconds. + Weight::from_ref_time(13_984_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PolkadotXcm VersionNotifyTargets (r:5 w:0) + fn already_notified_target() -> Weight { + // Minimum execution time: 15_148 nanoseconds. + Weight::from_ref_time(15_399_000) + .saturating_add(T::DbWeight::get().reads(5)) + } + // Storage: PolkadotXcm VersionNotifyTargets (r:2 w:1) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + fn notify_current_targets() -> Weight { + // Minimum execution time: 26_582 nanoseconds. + Weight::from_ref_time(27_284_000) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: PolkadotXcm VersionNotifyTargets (r:3 w:0) + fn notify_target_migration_fail() -> Weight { + // Minimum execution time: 6_961 nanoseconds. + Weight::from_ref_time(7_139_000) + .saturating_add(T::DbWeight::get().reads(3)) + } + // Storage: PolkadotXcm VersionNotifyTargets (r:4 w:2) + fn migrate_version_notify_targets() -> Weight { + // Minimum execution time: 14_094 nanoseconds. + Weight::from_ref_time(14_474_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PolkadotXcm VersionNotifyTargets (r:4 w:2) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + fn migrate_and_notify_old_targets() -> Weight { + // Minimum execution time: 31_931 nanoseconds. + Weight::from_ref_time(32_628_000) + .saturating_add(T::DbWeight::get().reads(9)) + .saturating_add(T::DbWeight::get().writes(4)) + } +} 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 5051255d827..82b29187960 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 @@ -21,168 +21,220 @@ use crate::Runtime; use frame_support::weights::Weight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; -use sp_std::{cmp, prelude::*}; -use xcm::{ - latest::{prelude::*, Weight as XCMWeight}, - DoubleEncoded, -}; +use sp_std::prelude::*; +use xcm::{latest::prelude::*, DoubleEncoded}; trait WeighMultiAssets { - fn weigh_multi_assets(&self, weight: Weight) -> XCMWeight; + fn weigh_multi_assets(&self, weight: Weight) -> Weight; } const MAX_ASSETS: u32 = 100; impl WeighMultiAssets for MultiAssetFilter { - fn weigh_multi_assets(&self, weight: Weight) -> XCMWeight { - let weight = match self { + fn weigh_multi_assets(&self, weight: Weight) -> Weight { + match self { Self::Definite(assets) => weight.saturating_mul(assets.inner().into_iter().count() as u64), Self::Wild(_) => weight.saturating_mul(MAX_ASSETS as u64), - }; - weight.ref_time() + } } } impl WeighMultiAssets for MultiAssets { - fn weigh_multi_assets(&self, weight: Weight) -> XCMWeight { - weight.saturating_mul(self.inner().into_iter().count() as u64).ref_time() + fn weigh_multi_assets(&self, weight: Weight) -> Weight { + weight.saturating_mul(self.inner().into_iter().count() as u64) } } pub struct BridgeHubKusamaXcmWeight(core::marker::PhantomData); impl XcmWeightInfo for BridgeHubKusamaXcmWeight { - fn withdraw_asset(assets: &MultiAssets) -> XCMWeight { + fn withdraw_asset(assets: &MultiAssets) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::withdraw_asset()) } // Currently there is no trusted reserve - fn reserve_asset_deposited(_assets: &MultiAssets) -> XCMWeight { - u64::MAX + fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight { + // TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974 + Weight::from_ref_time(1_000_000_000 as u64) } - fn receive_teleported_asset(assets: &MultiAssets) -> XCMWeight { + fn receive_teleported_asset(assets: &MultiAssets) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::receive_teleported_asset()) } - fn query_response(_query_id: &u64, _response: &Response, _max_weight: &u64) -> XCMWeight { - XcmGeneric::::query_response().ref_time() + fn query_response( + _query_id: &u64, + _response: &Response, + _max_weight: &Weight, + _querier: &Option, + ) -> Weight { + XcmGeneric::::query_response() } - fn transfer_asset(assets: &MultiAssets, _dest: &MultiLocation) -> XCMWeight { + fn transfer_asset(assets: &MultiAssets, _dest: &MultiLocation) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::transfer_asset()) } fn transfer_reserve_asset( assets: &MultiAssets, _dest: &MultiLocation, _xcm: &Xcm<()>, - ) -> XCMWeight { + ) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::transfer_reserve_asset()) } fn transact( _origin_type: &OriginKind, - _require_weight_at_most: &u64, + _require_weight_at_most: &Weight, _call: &DoubleEncoded, - ) -> XCMWeight { - XcmGeneric::::transact().ref_time() + ) -> Weight { + XcmGeneric::::transact() } fn hrmp_new_channel_open_request( _sender: &u32, _max_message_size: &u32, _max_capacity: &u32, - ) -> XCMWeight { + ) -> Weight { // XCM Executor does not currently support HRMP channel operations - Weight::MAX.ref_time() + Weight::MAX } - fn hrmp_channel_accepted(_recipient: &u32) -> XCMWeight { + fn hrmp_channel_accepted(_recipient: &u32) -> Weight { // XCM Executor does not currently support HRMP channel operations - Weight::MAX.ref_time() + Weight::MAX } - fn hrmp_channel_closing(_initiator: &u32, _sender: &u32, _recipient: &u32) -> XCMWeight { + fn hrmp_channel_closing(_initiator: &u32, _sender: &u32, _recipient: &u32) -> Weight { // XCM Executor does not currently support HRMP channel operations - Weight::MAX.ref_time() + Weight::MAX } - fn clear_origin() -> XCMWeight { - XcmGeneric::::clear_origin().ref_time() + fn clear_origin() -> Weight { + XcmGeneric::::clear_origin() } - fn descend_origin(_who: &InteriorMultiLocation) -> XCMWeight { - XcmGeneric::::descend_origin().ref_time() + fn descend_origin(_who: &InteriorMultiLocation) -> Weight { + XcmGeneric::::descend_origin() } - fn report_error( - _query_id: &QueryId, - _dest: &MultiLocation, - _max_response_weight: &u64, - ) -> XCMWeight { - XcmGeneric::::report_error().ref_time() + fn report_error(_query_response_info: &QueryResponseInfo) -> Weight { + XcmGeneric::::report_error() } - fn deposit_asset( - assets: &MultiAssetFilter, - _max_assets: &u32, - _dest: &MultiLocation, - ) -> XCMWeight { + fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_ref_time(1_000_000_000 as u64).ref_time(); + let hardcoded_weight = Weight::from_ref_time(1_000_000_000 as u64); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::deposit_asset()); - cmp::min(hardcoded_weight, weight) + hardcoded_weight.min(weight) } fn deposit_reserve_asset( assets: &MultiAssetFilter, - _max_assets: &u32, _dest: &MultiLocation, _xcm: &Xcm<()>, - ) -> XCMWeight { + ) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::deposit_reserve_asset()) } - fn exchange_asset(_give: &MultiAssetFilter, _receive: &MultiAssets) -> XCMWeight { - Weight::MAX.ref_time() + fn exchange_asset(_give: &MultiAssetFilter, _receive: &MultiAssets, _maximal: &bool) -> Weight { + Weight::MAX } fn initiate_reserve_withdraw( assets: &MultiAssetFilter, _reserve: &MultiLocation, _xcm: &Xcm<()>, - ) -> XCMWeight { + ) -> Weight { assets.weigh_multi_assets(XcmGeneric::::initiate_reserve_withdraw()) } fn initiate_teleport( assets: &MultiAssetFilter, _dest: &MultiLocation, _xcm: &Xcm<()>, - ) -> XCMWeight { + ) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_ref_time(200_000_000 as u64).ref_time(); + let hardcoded_weight = Weight::from_ref_time(200_000_000 as u64); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::initiate_teleport()); - cmp::min(hardcoded_weight, weight) + hardcoded_weight.min(weight) } - fn query_holding( - _query_id: &u64, - _dest: &MultiLocation, - _assets: &MultiAssetFilter, - _max_response_weight: &u64, - ) -> XCMWeight { - XcmGeneric::::query_holding().ref_time() + fn report_holding(_response_info: &QueryResponseInfo, _assets: &MultiAssetFilter) -> Weight { + XcmGeneric::::report_holding() + } + fn buy_execution(_fees: &MultiAsset, _weight_limit: &WeightLimit) -> Weight { + XcmGeneric::::buy_execution() + } + fn refund_surplus() -> Weight { + XcmGeneric::::refund_surplus() + } + fn set_error_handler(_xcm: &Xcm) -> Weight { + XcmGeneric::::set_error_handler() + } + fn set_appendix(_xcm: &Xcm) -> Weight { + XcmGeneric::::set_appendix() + } + fn clear_error() -> Weight { + XcmGeneric::::clear_error() + } + fn claim_asset(_assets: &MultiAssets, _ticket: &MultiLocation) -> Weight { + XcmGeneric::::claim_asset() + } + fn trap(_code: &u64) -> Weight { + XcmGeneric::::trap() + } + fn subscribe_version(_query_id: &QueryId, _max_response_weight: &Weight) -> Weight { + XcmGeneric::::subscribe_version() + } + fn unsubscribe_version() -> Weight { + XcmGeneric::::unsubscribe_version() + } + fn burn_asset(assets: &MultiAssets) -> Weight { + assets.weigh_multi_assets(XcmGeneric::::burn_asset()) + } + fn expect_asset(assets: &MultiAssets) -> Weight { + assets.weigh_multi_assets(XcmGeneric::::expect_asset()) + } + fn expect_origin(_origin: &Option) -> Weight { + XcmGeneric::::expect_origin() + } + fn expect_error(_error: &Option<(u32, XcmError)>) -> Weight { + XcmGeneric::::expect_error() + } + fn query_pallet(_module_name: &Vec, _response_info: &QueryResponseInfo) -> Weight { + XcmGeneric::::query_pallet() + } + fn expect_pallet( + _index: &u32, + _name: &Vec, + _module_name: &Vec, + _crate_major: &u32, + _min_crate_minor: &u32, + ) -> Weight { + XcmGeneric::::expect_pallet() + } + fn report_transact_status(_response_info: &QueryResponseInfo) -> Weight { + XcmGeneric::::report_transact_status() + } + fn clear_transact_status() -> Weight { + XcmGeneric::::clear_transact_status() + } + fn universal_origin(_: &Junction) -> Weight { + Weight::MAX + } + fn export_message(_: &NetworkId, _: &Junctions, _: &Xcm<()>) -> Weight { + Weight::MAX } - fn buy_execution(_fees: &MultiAsset, _weight_limit: &WeightLimit) -> XCMWeight { - XcmGeneric::::buy_execution().ref_time() + fn lock_asset(_: &MultiAsset, _: &MultiLocation) -> Weight { + Weight::MAX } - fn refund_surplus() -> XCMWeight { - XcmGeneric::::refund_surplus().ref_time() + fn unlock_asset(_: &MultiAsset, _: &MultiLocation) -> Weight { + Weight::MAX } - fn set_error_handler(_xcm: &Xcm) -> XCMWeight { - XcmGeneric::::set_error_handler().ref_time() + fn note_unlockable(_: &MultiAsset, _: &MultiLocation) -> Weight { + Weight::MAX } - fn set_appendix(_xcm: &Xcm) -> XCMWeight { - XcmGeneric::::set_appendix().ref_time() + fn request_unlock(_: &MultiAsset, _: &MultiLocation) -> Weight { + Weight::MAX } - fn clear_error() -> XCMWeight { - XcmGeneric::::clear_error().ref_time() + fn set_fees_mode(_: &bool) -> Weight { + XcmGeneric::::set_fees_mode() } - fn claim_asset(_assets: &MultiAssets, _ticket: &MultiLocation) -> XCMWeight { - XcmGeneric::::claim_asset().ref_time() + fn set_topic(_topic: &[u8; 32]) -> Weight { + XcmGeneric::::set_topic() } - fn trap(_code: &u64) -> XCMWeight { - XcmGeneric::::trap().ref_time() + fn clear_topic() -> Weight { + XcmGeneric::::clear_topic() } - fn subscribe_version(_query_id: &QueryId, _max_response_weight: &u64) -> XCMWeight { - XcmGeneric::::subscribe_version().ref_time() + fn alias_origin(_: &MultiLocation) -> Weight { + // XCM Executor does not currently support alias origin operations + Weight::MAX } - fn unsubscribe_version() -> XCMWeight { - XcmGeneric::::unsubscribe_version().ref_time() + fn unpaid_execution(_: &WeightLimit, _: &Option) -> Weight { + XcmGeneric::::unpaid_execution() } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs index d85ace695e6..6e262a7af4b 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs @@ -18,8 +18,8 @@ //! Autogenerated weights for `pallet_xcm_benchmarks::fungible` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-12-21, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! DATE: 2022-12-22, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-kusama-dev"), DB CACHE: 1024 // Executed Command: @@ -50,13 +50,13 @@ pub struct WeightInfo(PhantomData); impl WeightInfo { // Storage: System Account (r:1 w:1) pub(crate) fn withdraw_asset() -> Weight { - Weight::from_ref_time(26_021_000 as u64) + Weight::from_ref_time(27_070_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: System Account (r:2 w:2) pub(crate) fn transfer_asset() -> Weight { - Weight::from_ref_time(35_776_000 as u64) + Weight::from_ref_time(38_614_000 as u64) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -68,16 +68,16 @@ impl WeightInfo { // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) pub(crate) fn transfer_reserve_asset() -> Weight { - Weight::from_ref_time(52_799_000 as u64) + Weight::from_ref_time(55_875_000 as u64) .saturating_add(T::DbWeight::get().reads(8 as u64)) .saturating_add(T::DbWeight::get().writes(4 as u64)) } pub(crate) fn receive_teleported_asset() -> Weight { - Weight::from_ref_time(5_784_000 as u64) + Weight::from_ref_time(7_121_000 as u64) } // Storage: System Account (r:1 w:1) pub(crate) fn deposit_asset() -> Weight { - Weight::from_ref_time(28_148_000 as u64) + Weight::from_ref_time(30_450_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } @@ -89,7 +89,7 @@ impl WeightInfo { // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) pub(crate) fn deposit_reserve_asset() -> Weight { - Weight::from_ref_time(45_600_000 as u64) + Weight::from_ref_time(49_122_000 as u64) .saturating_add(T::DbWeight::get().reads(7 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -100,7 +100,7 @@ impl WeightInfo { // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) pub(crate) fn initiate_teleport() -> Weight { - Weight::from_ref_time(23_402_000 as u64) + Weight::from_ref_time(25_016_000 as u64) .saturating_add(T::DbWeight::get().reads(6 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/pallet_xcm_benchmarks_generic.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/pallet_xcm_benchmarks_generic.rs index cece5061304..526bdad2def 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/pallet_xcm_benchmarks_generic.rs @@ -18,8 +18,8 @@ //! Autogenerated weights for `pallet_xcm_benchmarks::generic` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-12-21, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! DATE: 2022-12-22, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-kusama-dev"), DB CACHE: 1024 // Executed Command: @@ -54,58 +54,59 @@ impl WeightInfo { // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) - pub(crate) fn query_holding() -> Weight { - Weight::from_ref_time(21_401_000 as u64) + pub(crate) fn report_holding() -> Weight { + Weight::from_ref_time(28_638_000 as u64) .saturating_add(T::DbWeight::get().reads(6 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } pub(crate) fn buy_execution() -> Weight { - Weight::from_ref_time(5_320_000 as u64) + Weight::from_ref_time(5_869_000 as u64) } // Storage: PolkadotXcm Queries (r:1 w:0) pub(crate) fn query_response() -> Weight { - Weight::from_ref_time(16_749_000 as u64) + Weight::from_ref_time(18_018_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) } pub(crate) fn transact() -> Weight { - Weight::from_ref_time(19_670_000 as u64) + Weight::from_ref_time(21_240_000 as u64) } pub(crate) fn refund_surplus() -> Weight { - Weight::from_ref_time(5_373_000 as u64) + Weight::from_ref_time(6_118_000 as u64) } pub(crate) fn set_error_handler() -> Weight { - Weight::from_ref_time(5_100_000 as u64) + Weight::from_ref_time(5_855_000 as u64) } pub(crate) fn set_appendix() -> Weight { - Weight::from_ref_time(5_288_000 as u64) + Weight::from_ref_time(5_901_000 as u64) } pub(crate) fn clear_error() -> Weight { - Weight::from_ref_time(5_315_000 as u64) + Weight::from_ref_time(5_762_000 as u64) } pub(crate) fn descend_origin() -> Weight { - Weight::from_ref_time(6_432_000 as u64) + Weight::from_ref_time(6_717_000 as u64) } pub(crate) fn clear_origin() -> Weight { - Weight::from_ref_time(5_254_000 as u64) + Weight::from_ref_time(5_924_000 as u64) } + // Storage: ParachainInfo ParachainId (r:1 w:0) // Storage: PolkadotXcm SupportedVersion (r:1 w:0) // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) pub(crate) fn report_error() -> Weight { - Weight::from_ref_time(15_047_000 as u64) - .saturating_add(T::DbWeight::get().reads(5 as u64)) + Weight::from_ref_time(22_264_000 as u64) + .saturating_add(T::DbWeight::get().reads(6 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: PolkadotXcm AssetTraps (r:1 w:1) pub(crate) fn claim_asset() -> Weight { - Weight::from_ref_time(21_288_000 as u64) + Weight::from_ref_time(21_620_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } pub(crate) fn trap() -> Weight { - Weight::from_ref_time(5_120_000 as u64) + Weight::from_ref_time(5_795_000 as u64) } // Storage: PolkadotXcm VersionNotifyTargets (r:1 w:1) // Storage: PolkadotXcm SupportedVersion (r:1 w:0) @@ -114,13 +115,13 @@ impl WeightInfo { // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) pub(crate) fn subscribe_version() -> Weight { - Weight::from_ref_time(17_992_000 as u64) + Weight::from_ref_time(29_039_000 as u64) .saturating_add(T::DbWeight::get().reads(6 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: PolkadotXcm VersionNotifyTargets (r:0 w:1) pub(crate) fn unsubscribe_version() -> Weight { - Weight::from_ref_time(7_321_000 as u64) + Weight::from_ref_time(8_794_000 as u64) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: ParachainInfo ParachainId (r:1 w:0) @@ -130,8 +131,60 @@ impl WeightInfo { // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) pub(crate) fn initiate_reserve_withdraw() -> Weight { - Weight::from_ref_time(22_846_000 as u64) + Weight::from_ref_time(26_793_000 as u64) + .saturating_add(T::DbWeight::get().reads(6 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + pub(crate) fn burn_asset() -> Weight { + Weight::from_ref_time(7_912_000 as u64) + } + pub(crate) fn expect_asset() -> Weight { + Weight::from_ref_time(6_981_000 as u64) + } + pub(crate) fn expect_origin() -> Weight { + Weight::from_ref_time(6_880_000 as u64) + } + pub(crate) fn expect_error() -> Weight { + Weight::from_ref_time(6_802_000 as u64) + } + // Storage: ParachainInfo ParachainId (r:1 w:0) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + pub(crate) fn query_pallet() -> Weight { + Weight::from_ref_time(31_039_000 as u64) .saturating_add(T::DbWeight::get().reads(6 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } + pub(crate) fn expect_pallet() -> Weight { + Weight::from_ref_time(9_291_000 as u64) + } + // Storage: ParachainInfo ParachainId (r:1 w:0) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + pub(crate) fn report_transact_status() -> Weight { + Weight::from_ref_time(28_012_000 as u64) + .saturating_add(T::DbWeight::get().reads(6 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + pub(crate) fn clear_transact_status() -> Weight { + Weight::from_ref_time(7_491_000 as u64) + } + pub(crate) fn set_topic() -> Weight { + Weight::from_ref_time(7_373_000 as u64) + } + pub(crate) fn clear_topic() -> Weight { + Weight::from_ref_time(7_490_000 as u64) + } + pub(crate) fn set_fees_mode() -> Weight { + Weight::from_ref_time(11_585_000 as u64) + } + pub(crate) fn unpaid_execution() -> Weight { + Weight::from_ref_time(7_582_000 as u64) + } } 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 ba15eed589b..c2e95c6ed4e 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 @@ -15,12 +15,12 @@ // along with Cumulus. If not, see . use super::{ - AccountId, Balances, ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, - RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue, + AccountId, AllPalletsWithSystem, Balances, ParachainInfo, ParachainSystem, PolkadotXcm, + Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue, }; use frame_support::{ match_types, parameter_types, - traits::{Everything, Nothing}, + traits::{ConstU32, Contains, Everything, Nothing}, }; use pallet_xcm::XcmPassthrough; use parachains_common::xcm_config::{ @@ -30,21 +30,23 @@ use polkadot_parachain::primitives::Sibling; use polkadot_runtime_common::impls::ToAuthor; use xcm::latest::prelude::*; use xcm_builder::{ - AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, - AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin, - IsConcrete, LocationInverter, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, - SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, - SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, - WeightInfoBounds, + AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, + AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin, + IsConcrete, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, + SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, + SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, WeightInfoBounds, + WithComputedOrigin, }; -use xcm_executor::XcmExecutor; +use xcm_executor::{traits::WithOriginFilter, XcmExecutor}; parameter_types! { pub const KsmRelayLocation: MultiLocation = MultiLocation::parent(); - pub const RelayNetwork: NetworkId = NetworkId::Kusama; + pub const RelayNetwork: Option = Some(NetworkId::Kusama); pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); - pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); + pub UniversalLocation: InteriorMultiLocation = + X2(GlobalConsensus(RelayNetwork::get().unwrap()), Parachain(ParachainInfo::parachain_id().into())); pub const MaxInstructions: u32 = 100; + pub const MaxAssetsIntoHolding: u32 = 64; } /// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used @@ -108,20 +110,67 @@ match_types! { MultiLocation { parents: 1, interior: X1(_) } }; } +/// A call filter for the XCM Transact instruction. This is a temporary measure until we properly +/// account for proof size weights. +/// +/// Calls that are allowed through this filter must: +/// 1. Have a fixed weight; +/// 2. Cannot lead to another call being made; +/// 3. Have a defined proof size weight, e.g. no unbounded vecs in call parameters. +pub struct SafeCallFilter; +impl Contains for SafeCallFilter { + fn contains(call: &RuntimeCall) -> bool { + #[cfg(feature = "runtime-benchmarks")] + { + if matches!(call, RuntimeCall::System(frame_system::Call::remark_with_event { .. })) { + return true + } + } + + match 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::XcmpQueue(..) | + RuntimeCall::DmpQueue(..) | + RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) => true, + _ => false, + } + } +} pub type Barrier = DenyThenTry< DenyReserveTransferToRelayChain, ( // Allow local users to buy weight credit. TakeWeightCredit, - // Parent and its exec plurality get free execution. - AllowUnpaidExecutionFrom, // Expected responses are OK. AllowKnownQueryResponses, - // Subscriptions for version tracking are OK. - AllowSubscriptionsFrom, - // Allow anything to pay for execution. - AllowTopLevelPaidExecutionFrom, + WithComputedOrigin< + ( + // Allow anything to pay for execution. + AllowTopLevelPaidExecutionFrom, + // Parent and its exec plurality get free execution. + AllowExplicitUnpaidExecutionFrom, + // Subscriptions for version tracking are OK. + AllowSubscriptionsFrom, + ), + UniversalLocation, + ConstU32<8>, + >, ), >; @@ -136,7 +185,7 @@ impl xcm_executor::Config for XcmConfig { type IsReserve = (); /// Only allow teleportation of KSM. type IsTeleporter = ConcreteNativeAssetFrom; - type LocationInverter = LocationInverter; + type UniversalLocation = UniversalLocation; type Barrier = Barrier; type Weigher = WeightInfoBounds< crate::weights::xcm::BridgeHubKusamaXcmWeight, @@ -149,6 +198,15 @@ impl xcm_executor::Config for XcmConfig { type AssetTrap = PolkadotXcm; type AssetClaims = PolkadotXcm; type SubscriptionService = PolkadotXcm; + type PalletInstancesInfo = AllPalletsWithSystem; + type MaxAssetsIntoHolding = MaxAssetsIntoHolding; + type AssetLocker = (); + type AssetExchanger = (); + type FeeManager = (); + type MessageExporter = (); + type UniversalAliases = Nothing; + type CallDispatcher = WithOriginFilter; + type SafeCallFilter = SafeCallFilter; } /// Converts a local signed origin into an XCM multilocation. @@ -159,11 +217,16 @@ pub type LocalOriginToLocation = SignedToAccountId32, + cumulus_primitives_utility::ParentAsUmp, // ..and XCMP to communicate with the sibling chains. XcmpQueue, ); +#[cfg(feature = "runtime-benchmarks")] +parameter_types! { + pub ReachableDest: Option = Some(Parent.into()); +} + impl pallet_xcm::Config for Runtime { type RuntimeEvent = RuntimeEvent; // We want to disallow users sending (arbitrary) XCMs from this chain. @@ -181,11 +244,19 @@ impl pallet_xcm::Config for Runtime { RuntimeCall, MaxInstructions, >; - type LocationInverter = LocationInverter; + 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 = LocationToAccountId; + type MaxLockers = ConstU32<8>; + type WeightInfo = crate::weights::pallet_xcm::WeightInfo; + #[cfg(feature = "runtime-benchmarks")] + type ReachableDest = ReachableDest; } impl cumulus_pallet_xcm::Config for Runtime { 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 d296a7a6a57..56860b07ce4 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -335,6 +335,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type ControllerOrigin = EnsureRoot; type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo; + type PriceForSiblingDelivery = (); } impl cumulus_pallet_dmp_queue::Config for Runtime { @@ -468,6 +469,7 @@ mod benches { [pallet_collator_selection, CollatorSelection] [cumulus_pallet_xcmp_queue, XcmpQueue] // XCM + [pallet_xcm, PolkadotXcm] // NOTE: Make sure you point to the individual modules below. [pallet_xcm_benchmarks::fungible, XcmBalances] [pallet_xcm_benchmarks::generic, XcmGeneric] @@ -644,7 +646,7 @@ impl_runtime_apis! { fn valid_destination() -> Result { Ok(RelayLocation::get()) } - fn worst_case_holding() -> MultiAssets { + fn worst_case_holding(_depositable_count: u32) -> MultiAssets { // just concrete assets according to relay chain. let assets: Vec = vec![ MultiAsset { @@ -661,8 +663,7 @@ impl_runtime_apis! { RelayLocation::get(), MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(RelayLocation::get()) }, )); - pub const TrustedReserve: Option<(MultiLocation, MultiAsset)> = None; - pub const CheckedAccount: Option = None; + pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None; } impl pallet_xcm_benchmarks::fungible::Config for Runtime { @@ -670,7 +671,6 @@ impl_runtime_apis! { type CheckedAccount = CheckedAccount; type TrustedTeleporter = TrustedTeleporter; - type TrustedReserve = TrustedReserve; fn get_multi_asset() -> MultiAsset { MultiAsset { @@ -687,8 +687,16 @@ impl_runtime_apis! { (0u64, Response::Version(Default::default())) } - fn transact_origin() -> Result { - Ok(RelayLocation::get()) + fn worst_case_asset_exchange() -> Result<(MultiAssets, MultiAssets), BenchmarkError> { + Err(BenchmarkError::Skip) + } + + fn universal_alias() -> Result { + Err(BenchmarkError::Skip) + } + + fn transact_origin_and_runtime_call() -> Result<(MultiLocation, RuntimeCall), BenchmarkError> { + Ok((RelayLocation::get(), frame_system::Call::remark_with_event { remark: vec![] }.into())) } fn subscribe_origin() -> Result { @@ -701,6 +709,10 @@ impl_runtime_apis! { let ticket = MultiLocation { parents: 0, interior: Here }; Ok((origin, ticket, assets)) } + + fn unlockable_asset() -> Result<(MultiLocation, MultiLocation, MultiAsset), BenchmarkError> { + Err(BenchmarkError::Skip) + } } type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::; diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/mod.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/mod.rs index 869c03be687..d5722374def 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/mod.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/mod.rs @@ -27,6 +27,7 @@ pub mod pallet_multisig; pub mod pallet_session; pub mod pallet_timestamp; pub mod pallet_utility; +pub mod pallet_xcm; pub mod paritydb_weights; pub mod rocksdb_weights; pub mod xcm; diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_xcm.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_xcm.rs new file mode 100644 index 00000000000..7d0e4a3546c --- /dev/null +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_xcm.rs @@ -0,0 +1,173 @@ +// Copyright 2021 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Cumulus is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Cumulus. If not, see . + +//! Autogenerated weights for `pallet_xcm` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-12-22, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// /home/benchbot/cargo_target_dir/production/polkadot-parachain +// benchmark +// pallet +// --steps=50 +// --repeat=20 +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json +// --pallet=pallet_xcm +// --chain=bridge-hub-rococo-dev +// --header=./file_header.txt +// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_xcm`. +pub struct WeightInfo(PhantomData); +impl pallet_xcm::WeightInfo for WeightInfo { + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + fn send() -> Weight { + // Minimum execution time: 27_797 nanoseconds. + Weight::from_ref_time(28_356_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: ParachainInfo ParachainId (r:1 w:0) + fn teleport_assets() -> Weight { + // Minimum execution time: 32_656 nanoseconds. + Weight::from_ref_time(33_011_000) + .saturating_add(T::DbWeight::get().reads(1)) + } + // Storage: Benchmark Override (r:0 w:0) + fn reserve_transfer_assets() -> Weight { + // Minimum execution time: 18_446_744_073_709_551 nanoseconds. + Weight::from_ref_time(18_446_744_073_709_551_000) + } + // Storage: Benchmark Override (r:0 w:0) + fn execute() -> Weight { + // Minimum execution time: 18_446_744_073_709_551 nanoseconds. + Weight::from_ref_time(18_446_744_073_709_551_000) + } + // Storage: PolkadotXcm SupportedVersion (r:0 w:1) + fn force_xcm_version() -> Weight { + // Minimum execution time: 15_101 nanoseconds. + Weight::from_ref_time(15_535_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: PolkadotXcm SafeXcmVersion (r:0 w:1) + fn force_default_xcm_version() -> Weight { + // Minimum execution time: 4_700 nanoseconds. + Weight::from_ref_time(4_896_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: PolkadotXcm VersionNotifiers (r:1 w:1) + // Storage: PolkadotXcm QueryCounter (r:1 w:1) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + // Storage: PolkadotXcm Queries (r:0 w:1) + fn force_subscribe_version_notify() -> Weight { + // Minimum execution time: 31_532 nanoseconds. + Weight::from_ref_time(32_180_000) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(5)) + } + // Storage: PolkadotXcm VersionNotifiers (r:1 w:1) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + // Storage: PolkadotXcm Queries (r:0 w:1) + fn force_unsubscribe_version_notify() -> Weight { + // Minimum execution time: 32_515 nanoseconds. + Weight::from_ref_time(33_097_000) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: PolkadotXcm SupportedVersion (r:4 w:2) + fn migrate_supported_version() -> Weight { + // Minimum execution time: 13_811 nanoseconds. + Weight::from_ref_time(14_149_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PolkadotXcm VersionNotifiers (r:4 w:2) + fn migrate_version_notifiers() -> Weight { + // Minimum execution time: 13_708 nanoseconds. + Weight::from_ref_time(14_067_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PolkadotXcm VersionNotifyTargets (r:5 w:0) + fn already_notified_target() -> Weight { + // Minimum execution time: 15_277 nanoseconds. + Weight::from_ref_time(15_626_000) + .saturating_add(T::DbWeight::get().reads(5)) + } + // Storage: PolkadotXcm VersionNotifyTargets (r:2 w:1) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + fn notify_current_targets() -> Weight { + // Minimum execution time: 29_263 nanoseconds. + Weight::from_ref_time(29_831_000) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: PolkadotXcm VersionNotifyTargets (r:3 w:0) + fn notify_target_migration_fail() -> Weight { + // Minimum execution time: 7_787 nanoseconds. + Weight::from_ref_time(7_858_000) + .saturating_add(T::DbWeight::get().reads(3)) + } + // Storage: PolkadotXcm VersionNotifyTargets (r:4 w:2) + fn migrate_version_notify_targets() -> Weight { + // Minimum execution time: 15_252 nanoseconds. + Weight::from_ref_time(15_558_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PolkadotXcm VersionNotifyTargets (r:4 w:2) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + fn migrate_and_notify_old_targets() -> Weight { + // Minimum execution time: 35_105 nanoseconds. + Weight::from_ref_time(35_719_000) + .saturating_add(T::DbWeight::get().reads(9)) + .saturating_add(T::DbWeight::get().writes(4)) + } +} 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 4d0d2c6ca9e..0b911aec2d5 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 @@ -21,168 +21,220 @@ use crate::Runtime; use frame_support::weights::Weight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; -use sp_std::{cmp, prelude::*}; -use xcm::{ - latest::{prelude::*, Weight as XCMWeight}, - DoubleEncoded, -}; +use sp_std::prelude::*; +use xcm::{latest::prelude::*, DoubleEncoded}; trait WeighMultiAssets { - fn weigh_multi_assets(&self, weight: Weight) -> XCMWeight; + fn weigh_multi_assets(&self, weight: Weight) -> Weight; } const MAX_ASSETS: u32 = 100; impl WeighMultiAssets for MultiAssetFilter { - fn weigh_multi_assets(&self, weight: Weight) -> XCMWeight { - let weight = match self { + fn weigh_multi_assets(&self, weight: Weight) -> Weight { + match self { Self::Definite(assets) => weight.saturating_mul(assets.inner().into_iter().count() as u64), Self::Wild(_) => weight.saturating_mul(MAX_ASSETS as u64), - }; - weight.ref_time() + } } } impl WeighMultiAssets for MultiAssets { - fn weigh_multi_assets(&self, weight: Weight) -> XCMWeight { - weight.saturating_mul(self.inner().into_iter().count() as u64).ref_time() + fn weigh_multi_assets(&self, weight: Weight) -> Weight { + weight.saturating_mul(self.inner().into_iter().count() as u64) } } pub struct BridgeHubRococoXcmWeight(core::marker::PhantomData); impl XcmWeightInfo for BridgeHubRococoXcmWeight { - fn withdraw_asset(assets: &MultiAssets) -> XCMWeight { + fn withdraw_asset(assets: &MultiAssets) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::withdraw_asset()) } // Currently there is no trusted reserve - fn reserve_asset_deposited(_assets: &MultiAssets) -> XCMWeight { - u64::MAX + fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight { + // TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974 + Weight::from_ref_time(1_000_000_000 as u64) } - fn receive_teleported_asset(assets: &MultiAssets) -> XCMWeight { + fn receive_teleported_asset(assets: &MultiAssets) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::receive_teleported_asset()) } - fn query_response(_query_id: &u64, _response: &Response, _max_weight: &u64) -> XCMWeight { - XcmGeneric::::query_response().ref_time() + fn query_response( + _query_id: &u64, + _response: &Response, + _max_weight: &Weight, + _querier: &Option, + ) -> Weight { + XcmGeneric::::query_response() } - fn transfer_asset(assets: &MultiAssets, _dest: &MultiLocation) -> XCMWeight { + fn transfer_asset(assets: &MultiAssets, _dest: &MultiLocation) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::transfer_asset()) } fn transfer_reserve_asset( assets: &MultiAssets, _dest: &MultiLocation, _xcm: &Xcm<()>, - ) -> XCMWeight { + ) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::transfer_reserve_asset()) } fn transact( _origin_type: &OriginKind, - _require_weight_at_most: &u64, + _require_weight_at_most: &Weight, _call: &DoubleEncoded, - ) -> XCMWeight { - XcmGeneric::::transact().ref_time() + ) -> Weight { + XcmGeneric::::transact() } fn hrmp_new_channel_open_request( _sender: &u32, _max_message_size: &u32, _max_capacity: &u32, - ) -> XCMWeight { + ) -> Weight { // XCM Executor does not currently support HRMP channel operations - Weight::MAX.ref_time() + Weight::MAX } - fn hrmp_channel_accepted(_recipient: &u32) -> XCMWeight { + fn hrmp_channel_accepted(_recipient: &u32) -> Weight { // XCM Executor does not currently support HRMP channel operations - Weight::MAX.ref_time() + Weight::MAX } - fn hrmp_channel_closing(_initiator: &u32, _sender: &u32, _recipient: &u32) -> XCMWeight { + fn hrmp_channel_closing(_initiator: &u32, _sender: &u32, _recipient: &u32) -> Weight { // XCM Executor does not currently support HRMP channel operations - Weight::MAX.ref_time() + Weight::MAX } - fn clear_origin() -> XCMWeight { - XcmGeneric::::clear_origin().ref_time() + fn clear_origin() -> Weight { + XcmGeneric::::clear_origin() } - fn descend_origin(_who: &InteriorMultiLocation) -> XCMWeight { - XcmGeneric::::descend_origin().ref_time() + fn descend_origin(_who: &InteriorMultiLocation) -> Weight { + XcmGeneric::::descend_origin() } - fn report_error( - _query_id: &QueryId, - _dest: &MultiLocation, - _max_response_weight: &u64, - ) -> XCMWeight { - XcmGeneric::::report_error().ref_time() + fn report_error(_query_response_info: &QueryResponseInfo) -> Weight { + XcmGeneric::::report_error() } - fn deposit_asset( - assets: &MultiAssetFilter, - _max_assets: &u32, - _dest: &MultiLocation, - ) -> XCMWeight { + fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_ref_time(1_000_000_000 as u64).ref_time(); + let hardcoded_weight = Weight::from_ref_time(1_000_000_000 as u64); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::deposit_asset()); - cmp::min(hardcoded_weight, weight) + hardcoded_weight.min(weight) } fn deposit_reserve_asset( assets: &MultiAssetFilter, - _max_assets: &u32, _dest: &MultiLocation, _xcm: &Xcm<()>, - ) -> XCMWeight { + ) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::deposit_reserve_asset()) } - fn exchange_asset(_give: &MultiAssetFilter, _receive: &MultiAssets) -> XCMWeight { - Weight::MAX.ref_time() + fn exchange_asset(_give: &MultiAssetFilter, _receive: &MultiAssets, _maximal: &bool) -> Weight { + Weight::MAX } fn initiate_reserve_withdraw( assets: &MultiAssetFilter, _reserve: &MultiLocation, _xcm: &Xcm<()>, - ) -> XCMWeight { + ) -> Weight { assets.weigh_multi_assets(XcmGeneric::::initiate_reserve_withdraw()) } fn initiate_teleport( assets: &MultiAssetFilter, _dest: &MultiLocation, _xcm: &Xcm<()>, - ) -> XCMWeight { + ) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_ref_time(200_000_000 as u64).ref_time(); + let hardcoded_weight = Weight::from_ref_time(200_000_000 as u64); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::initiate_teleport()); - cmp::min(hardcoded_weight, weight) + hardcoded_weight.min(weight) } - fn query_holding( - _query_id: &u64, - _dest: &MultiLocation, - _assets: &MultiAssetFilter, - _max_response_weight: &u64, - ) -> XCMWeight { - XcmGeneric::::query_holding().ref_time() + fn report_holding(_response_info: &QueryResponseInfo, _assets: &MultiAssetFilter) -> Weight { + XcmGeneric::::report_holding() + } + fn buy_execution(_fees: &MultiAsset, _weight_limit: &WeightLimit) -> Weight { + XcmGeneric::::buy_execution() + } + fn refund_surplus() -> Weight { + XcmGeneric::::refund_surplus() + } + fn set_error_handler(_xcm: &Xcm) -> Weight { + XcmGeneric::::set_error_handler() + } + fn set_appendix(_xcm: &Xcm) -> Weight { + XcmGeneric::::set_appendix() + } + fn clear_error() -> Weight { + XcmGeneric::::clear_error() + } + fn claim_asset(_assets: &MultiAssets, _ticket: &MultiLocation) -> Weight { + XcmGeneric::::claim_asset() + } + fn trap(_code: &u64) -> Weight { + XcmGeneric::::trap() + } + fn subscribe_version(_query_id: &QueryId, _max_response_weight: &Weight) -> Weight { + XcmGeneric::::subscribe_version() + } + fn unsubscribe_version() -> Weight { + XcmGeneric::::unsubscribe_version() + } + fn burn_asset(assets: &MultiAssets) -> Weight { + assets.weigh_multi_assets(XcmGeneric::::burn_asset()) + } + fn expect_asset(assets: &MultiAssets) -> Weight { + assets.weigh_multi_assets(XcmGeneric::::expect_asset()) + } + fn expect_origin(_origin: &Option) -> Weight { + XcmGeneric::::expect_origin() + } + fn expect_error(_error: &Option<(u32, XcmError)>) -> Weight { + XcmGeneric::::expect_error() + } + fn query_pallet(_module_name: &Vec, _response_info: &QueryResponseInfo) -> Weight { + XcmGeneric::::query_pallet() + } + fn expect_pallet( + _index: &u32, + _name: &Vec, + _module_name: &Vec, + _crate_major: &u32, + _min_crate_minor: &u32, + ) -> Weight { + XcmGeneric::::expect_pallet() + } + fn report_transact_status(_response_info: &QueryResponseInfo) -> Weight { + XcmGeneric::::report_transact_status() + } + fn clear_transact_status() -> Weight { + XcmGeneric::::clear_transact_status() + } + fn universal_origin(_: &Junction) -> Weight { + Weight::MAX + } + fn export_message(_: &NetworkId, _: &Junctions, _: &Xcm<()>) -> Weight { + Weight::MAX } - fn buy_execution(_fees: &MultiAsset, _weight_limit: &WeightLimit) -> XCMWeight { - XcmGeneric::::buy_execution().ref_time() + fn lock_asset(_: &MultiAsset, _: &MultiLocation) -> Weight { + Weight::MAX } - fn refund_surplus() -> XCMWeight { - XcmGeneric::::refund_surplus().ref_time() + fn unlock_asset(_: &MultiAsset, _: &MultiLocation) -> Weight { + Weight::MAX } - fn set_error_handler(_xcm: &Xcm) -> XCMWeight { - XcmGeneric::::set_error_handler().ref_time() + fn note_unlockable(_: &MultiAsset, _: &MultiLocation) -> Weight { + Weight::MAX } - fn set_appendix(_xcm: &Xcm) -> XCMWeight { - XcmGeneric::::set_appendix().ref_time() + fn request_unlock(_: &MultiAsset, _: &MultiLocation) -> Weight { + Weight::MAX } - fn clear_error() -> XCMWeight { - XcmGeneric::::clear_error().ref_time() + fn set_fees_mode(_: &bool) -> Weight { + XcmGeneric::::set_fees_mode() } - fn claim_asset(_assets: &MultiAssets, _ticket: &MultiLocation) -> XCMWeight { - XcmGeneric::::claim_asset().ref_time() + fn set_topic(_topic: &[u8; 32]) -> Weight { + XcmGeneric::::set_topic() } - fn trap(_code: &u64) -> XCMWeight { - XcmGeneric::::trap().ref_time() + fn clear_topic() -> Weight { + XcmGeneric::::clear_topic() } - fn subscribe_version(_query_id: &QueryId, _max_response_weight: &u64) -> XCMWeight { - XcmGeneric::::subscribe_version().ref_time() + fn alias_origin(_: &MultiLocation) -> Weight { + // XCM Executor does not currently support alias origin operations + Weight::MAX } - fn unsubscribe_version() -> XCMWeight { - XcmGeneric::::unsubscribe_version().ref_time() + fn unpaid_execution(_: &WeightLimit, _: &Option) -> Weight { + XcmGeneric::::unpaid_execution() } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs index 75b9db0ff85..4b60676e23c 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs @@ -18,8 +18,8 @@ //! Autogenerated weights for `pallet_xcm_benchmarks::fungible` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-12-21, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! DATE: 2022-12-22, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-rococo-dev"), DB CACHE: 1024 // Executed Command: @@ -50,13 +50,13 @@ pub struct WeightInfo(PhantomData); impl WeightInfo { // Storage: System Account (r:1 w:1) pub(crate) fn withdraw_asset() -> Weight { - Weight::from_ref_time(27_085_000 as u64) + Weight::from_ref_time(27_244_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: System Account (r:2 w:2) pub(crate) fn transfer_asset() -> Weight { - Weight::from_ref_time(37_130_000 as u64) + Weight::from_ref_time(38_254_000 as u64) .saturating_add(T::DbWeight::get().reads(2 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } @@ -68,16 +68,16 @@ impl WeightInfo { // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) pub(crate) fn transfer_reserve_asset() -> Weight { - Weight::from_ref_time(54_004_000 as u64) + Weight::from_ref_time(55_608_000 as u64) .saturating_add(T::DbWeight::get().reads(8 as u64)) .saturating_add(T::DbWeight::get().writes(4 as u64)) } pub(crate) fn receive_teleported_asset() -> Weight { - Weight::from_ref_time(6_208_000 as u64) + Weight::from_ref_time(7_053_000 as u64) } // Storage: System Account (r:1 w:1) pub(crate) fn deposit_asset() -> Weight { - Weight::from_ref_time(29_191_000 as u64) + Weight::from_ref_time(29_030_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } @@ -89,7 +89,7 @@ impl WeightInfo { // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) pub(crate) fn deposit_reserve_asset() -> Weight { - Weight::from_ref_time(48_966_000 as u64) + Weight::from_ref_time(48_233_000 as u64) .saturating_add(T::DbWeight::get().reads(7 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } @@ -100,7 +100,7 @@ impl WeightInfo { // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) pub(crate) fn initiate_teleport() -> Weight { - Weight::from_ref_time(23_337_000 as u64) + Weight::from_ref_time(24_691_000 as u64) .saturating_add(T::DbWeight::get().reads(6 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } 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 08c5d03941c..259b483882a 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 @@ -18,8 +18,8 @@ //! Autogenerated weights for `pallet_xcm_benchmarks::generic` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-12-21, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! DATE: 2022-12-22, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-rococo-dev"), DB CACHE: 1024 // Executed Command: @@ -54,58 +54,59 @@ impl WeightInfo { // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) - pub(crate) fn query_holding() -> Weight { - Weight::from_ref_time(23_077_000 as u64) + pub(crate) fn report_holding() -> Weight { + Weight::from_ref_time(27_691_000 as u64) .saturating_add(T::DbWeight::get().reads(6 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } pub(crate) fn buy_execution() -> Weight { - Weight::from_ref_time(5_595_000 as u64) + Weight::from_ref_time(5_927_000 as u64) } // Storage: PolkadotXcm Queries (r:1 w:0) pub(crate) fn query_response() -> Weight { - Weight::from_ref_time(16_593_000 as u64) + Weight::from_ref_time(17_594_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) } pub(crate) fn transact() -> Weight { - Weight::from_ref_time(19_522_000 as u64) + Weight::from_ref_time(20_743_000 as u64) } pub(crate) fn refund_surplus() -> Weight { - Weight::from_ref_time(5_612_000 as u64) + Weight::from_ref_time(5_960_000 as u64) } pub(crate) fn set_error_handler() -> Weight { - Weight::from_ref_time(5_455_000 as u64) + Weight::from_ref_time(5_857_000 as u64) } pub(crate) fn set_appendix() -> Weight { - Weight::from_ref_time(5_404_000 as u64) + Weight::from_ref_time(5_819_000 as u64) } pub(crate) fn clear_error() -> Weight { - Weight::from_ref_time(5_402_000 as u64) + Weight::from_ref_time(5_826_000 as u64) } pub(crate) fn descend_origin() -> Weight { - Weight::from_ref_time(6_725_000 as u64) + Weight::from_ref_time(6_641_000 as u64) } pub(crate) fn clear_origin() -> Weight { - Weight::from_ref_time(5_417_000 as u64) + Weight::from_ref_time(5_754_000 as u64) } + // Storage: ParachainInfo ParachainId (r:1 w:0) // Storage: PolkadotXcm SupportedVersion (r:1 w:0) // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) pub(crate) fn report_error() -> Weight { - Weight::from_ref_time(14_868_000 as u64) - .saturating_add(T::DbWeight::get().reads(5 as u64)) + Weight::from_ref_time(21_742_000 as u64) + .saturating_add(T::DbWeight::get().reads(6 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: PolkadotXcm AssetTraps (r:1 w:1) pub(crate) fn claim_asset() -> Weight { - Weight::from_ref_time(20_838_000 as u64) + Weight::from_ref_time(20_833_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } pub(crate) fn trap() -> Weight { - Weight::from_ref_time(5_354_000 as u64) + Weight::from_ref_time(5_773_000 as u64) } // Storage: PolkadotXcm VersionNotifyTargets (r:1 w:1) // Storage: PolkadotXcm SupportedVersion (r:1 w:0) @@ -114,13 +115,13 @@ impl WeightInfo { // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) pub(crate) fn subscribe_version() -> Weight { - Weight::from_ref_time(17_989_000 as u64) + Weight::from_ref_time(28_365_000 as u64) .saturating_add(T::DbWeight::get().reads(6 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: PolkadotXcm VersionNotifyTargets (r:0 w:1) pub(crate) fn unsubscribe_version() -> Weight { - Weight::from_ref_time(7_304_000 as u64) + Weight::from_ref_time(7_961_000 as u64) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: ParachainInfo ParachainId (r:1 w:0) @@ -130,8 +131,60 @@ impl WeightInfo { // Storage: ParachainSystem HostConfiguration (r:1 w:0) // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) pub(crate) fn initiate_reserve_withdraw() -> Weight { - Weight::from_ref_time(22_875_000 as u64) + Weight::from_ref_time(24_970_000 as u64) + .saturating_add(T::DbWeight::get().reads(6 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + pub(crate) fn burn_asset() -> Weight { + Weight::from_ref_time(7_400_000 as u64) + } + pub(crate) fn expect_asset() -> Weight { + Weight::from_ref_time(6_018_000 as u64) + } + pub(crate) fn expect_origin() -> Weight { + Weight::from_ref_time(5_862_000 as u64) + } + pub(crate) fn expect_error() -> Weight { + Weight::from_ref_time(5_857_000 as u64) + } + // Storage: ParachainInfo ParachainId (r:1 w:0) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + pub(crate) fn query_pallet() -> Weight { + Weight::from_ref_time(24_420_000 as u64) .saturating_add(T::DbWeight::get().reads(6 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } + pub(crate) fn expect_pallet() -> Weight { + Weight::from_ref_time(7_212_000 as u64) + } + // Storage: ParachainInfo ParachainId (r:1 w:0) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + pub(crate) fn report_transact_status() -> Weight { + Weight::from_ref_time(22_227_000 as u64) + .saturating_add(T::DbWeight::get().reads(6 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } + pub(crate) fn clear_transact_status() -> Weight { + Weight::from_ref_time(5_890_000 as u64) + } + pub(crate) fn set_topic() -> Weight { + Weight::from_ref_time(5_684_000 as u64) + } + pub(crate) fn clear_topic() -> Weight { + Weight::from_ref_time(5_763_000 as u64) + } + pub(crate) fn set_fees_mode() -> Weight { + Weight::from_ref_time(5_812_000 as u64) + } + pub(crate) fn unpaid_execution() -> Weight { + Weight::from_ref_time(6_043_000 as u64) + } } 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 9064389f6f9..5e2511d6eb5 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 @@ -15,12 +15,12 @@ // along with Cumulus. If not, see . use super::{ - AccountId, Balances, ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, - RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue, + AccountId, AllPalletsWithSystem, Balances, ParachainInfo, ParachainSystem, PolkadotXcm, + Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue, }; use frame_support::{ match_types, parameter_types, - traits::{Everything, Nothing}, + traits::{ConstU32, Contains, Everything, Nothing}, }; use pallet_xcm::XcmPassthrough; use parachains_common::xcm_config::{ @@ -30,21 +30,23 @@ use polkadot_parachain::primitives::Sibling; use polkadot_runtime_common::impls::ToAuthor; use xcm::latest::prelude::*; use xcm_builder::{ - AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, - AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin, - IsConcrete, LocationInverter, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, - SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, - SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, - WeightInfoBounds, + AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, + AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin, + IsConcrete, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, + SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, + SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, WeightInfoBounds, + WithComputedOrigin, }; -use xcm_executor::XcmExecutor; +use xcm_executor::{traits::WithOriginFilter, XcmExecutor}; parameter_types! { pub const RelayLocation: MultiLocation = MultiLocation::parent(); - pub const RelayNetwork: NetworkId = NetworkId::Any; + pub const RelayNetwork: Option = Some(NetworkId::Rococo); pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); - pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); + pub UniversalLocation: InteriorMultiLocation = + X2(GlobalConsensus(RelayNetwork::get().unwrap()), Parachain(ParachainInfo::parachain_id().into())); pub const MaxInstructions: u32 = 100; + pub const MaxAssetsIntoHolding: u32 = 64; } /// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used @@ -108,19 +110,67 @@ match_types! { }; } +/// A call filter for the XCM Transact instruction. This is a temporary measure until we properly +/// account for proof size weights. +/// +/// Calls that are allowed through this filter must: +/// 1. Have a fixed weight; +/// 2. Cannot lead to another call being made; +/// 3. Have a defined proof size weight, e.g. no unbounded vecs in call parameters. +pub struct SafeCallFilter; +impl Contains for SafeCallFilter { + fn contains(call: &RuntimeCall) -> bool { + #[cfg(feature = "runtime-benchmarks")] + { + if matches!(call, RuntimeCall::System(frame_system::Call::remark_with_event { .. })) { + return true + } + } + + match 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::XcmpQueue(..) | + RuntimeCall::DmpQueue(..) | + RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) => true, + _ => false, + } + } +} + pub type Barrier = DenyThenTry< DenyReserveTransferToRelayChain, ( // Allow local users to buy weight credit. TakeWeightCredit, - // Parent and its exec plurality get free execution. - AllowUnpaidExecutionFrom, // Expected responses are OK. AllowKnownQueryResponses, - // Subscriptions for version tracking are OK. - AllowSubscriptionsFrom, - // Allow anything to pay for execution. - AllowTopLevelPaidExecutionFrom, + WithComputedOrigin< + ( + // Allow anything to pay for execution. + AllowTopLevelPaidExecutionFrom, + // Parent and its exec plurality get free execution. + AllowExplicitUnpaidExecutionFrom, + // Subscriptions for version tracking are OK. + AllowSubscriptionsFrom, + ), + UniversalLocation, + ConstU32<8>, + >, ), >; @@ -135,7 +185,7 @@ impl xcm_executor::Config for XcmConfig { type IsReserve = (); /// Only allow teleportation of NativeToken of relay chain. type IsTeleporter = ConcreteNativeAssetFrom; - type LocationInverter = LocationInverter; + type UniversalLocation = UniversalLocation; type Barrier = Barrier; type Weigher = WeightInfoBounds< crate::weights::xcm::BridgeHubRococoXcmWeight, @@ -148,6 +198,15 @@ impl xcm_executor::Config for XcmConfig { type AssetTrap = PolkadotXcm; type AssetClaims = PolkadotXcm; type SubscriptionService = PolkadotXcm; + type PalletInstancesInfo = AllPalletsWithSystem; + type MaxAssetsIntoHolding = MaxAssetsIntoHolding; + type AssetLocker = (); + type AssetExchanger = (); + type FeeManager = (); + type MessageExporter = (); + type UniversalAliases = Nothing; + type CallDispatcher = WithOriginFilter; + type SafeCallFilter = SafeCallFilter; } /// Converts a local signed origin into an XCM multilocation. @@ -158,11 +217,16 @@ pub type LocalOriginToLocation = SignedToAccountId32, + cumulus_primitives_utility::ParentAsUmp, // ..and XCMP to communicate with the sibling chains. XcmpQueue, ); +#[cfg(feature = "runtime-benchmarks")] +parameter_types! { + pub ReachableDest: Option = Some(Parent.into()); +} + impl pallet_xcm::Config for Runtime { type RuntimeEvent = RuntimeEvent; // We want to disallow users sending (arbitrary) XCMs from this chain. @@ -180,11 +244,19 @@ impl pallet_xcm::Config for Runtime { RuntimeCall, MaxInstructions, >; - type LocationInverter = LocationInverter; + 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 = LocationToAccountId; + type MaxLockers = ConstU32<8>; + type WeightInfo = crate::weights::pallet_xcm::WeightInfo; + #[cfg(feature = "runtime-benchmarks")] + type ReachableDest = ReachableDest; } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/impls.rs b/parachains/runtimes/collectives/collectives-polkadot/src/impls.rs index 9373f1ef8f5..d8c7d4247ac 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/impls.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/impls.rs @@ -21,7 +21,7 @@ use frame_support::{ }; use pallet_alliance::{ProposalIndex, ProposalProvider}; use sp_std::{marker::PhantomData, prelude::*}; -use xcm::latest::{Fungibility, Junction, NetworkId, Parent}; +use xcm::latest::{Fungibility, Junction, Parent}; type AccountIdOf = ::AccountId; @@ -65,8 +65,8 @@ where ::RuntimeOrigin::signed(temp_account.into()), Box::new(Parent.into()), Box::new( - Junction::AccountId32 { network: NetworkId::Any, id: treasury_acc.into() } - .into() + Junction::AccountId32 { network: None, id: treasury_acc.into() } + .into_location() .into(), ), Box::new((Parent, imbalance).into()), diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs b/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs index 731ec3715dc..588087977db 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs @@ -371,6 +371,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type ControllerOrigin = RootOrExecutiveSimpleMajority; type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo; + type PriceForSiblingDelivery = (); } impl cumulus_pallet_dmp_queue::Config for Runtime { @@ -586,6 +587,7 @@ mod benches { [cumulus_pallet_xcmp_queue, XcmpQueue] [pallet_alliance, Alliance] [pallet_collective, AllianceMotion] + [pallet_xcm, PolkadotXcm] ); } diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/weights/mod.rs b/parachains/runtimes/collectives/collectives-polkadot/src/weights/mod.rs index bf736022ca7..76fbc081bc5 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/weights/mod.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/weights/mod.rs @@ -11,6 +11,7 @@ pub mod pallet_proxy; pub mod pallet_session; pub mod pallet_timestamp; pub mod pallet_utility; +pub mod pallet_xcm; pub mod paritydb_weights; pub mod rocksdb_weights; diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_xcm.rs b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_xcm.rs new file mode 100644 index 00000000000..ec9974dd295 --- /dev/null +++ b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_xcm.rs @@ -0,0 +1,173 @@ +// Copyright 2021 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Cumulus is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Cumulus. If not, see . + +//! Autogenerated weights for `pallet_xcm` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-12-22, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("collectives-polkadot-dev"), DB CACHE: 1024 + +// Executed Command: +// /home/benchbot/cargo_target_dir/production/polkadot-parachain +// benchmark +// pallet +// --steps=50 +// --repeat=20 +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json +// --pallet=pallet_xcm +// --chain=collectives-polkadot-dev +// --header=./file_header.txt +// --output=./parachains/runtimes/collectives/collectives-polkadot/src/weights/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_xcm`. +pub struct WeightInfo(PhantomData); +impl pallet_xcm::WeightInfo for WeightInfo { + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + fn send() -> Weight { + // Minimum execution time: 27_016 nanoseconds. + Weight::from_ref_time(27_587_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: ParachainInfo ParachainId (r:1 w:0) + fn teleport_assets() -> Weight { + // Minimum execution time: 33_807 nanoseconds. + Weight::from_ref_time(34_960_000) + .saturating_add(T::DbWeight::get().reads(1)) + } + // Storage: Benchmark Override (r:0 w:0) + fn reserve_transfer_assets() -> Weight { + // Minimum execution time: 18_446_744_073_709_551 nanoseconds. + Weight::from_ref_time(18_446_744_073_709_551_000) + } + // Storage: Benchmark Override (r:0 w:0) + fn execute() -> Weight { + // Minimum execution time: 18_446_744_073_709_551 nanoseconds. + Weight::from_ref_time(18_446_744_073_709_551_000) + } + // Storage: PolkadotXcm SupportedVersion (r:0 w:1) + fn force_xcm_version() -> Weight { + // Minimum execution time: 15_322 nanoseconds. + Weight::from_ref_time(15_782_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: PolkadotXcm SafeXcmVersion (r:0 w:1) + fn force_default_xcm_version() -> Weight { + // Minimum execution time: 4_390 nanoseconds. + Weight::from_ref_time(4_564_000) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: PolkadotXcm VersionNotifiers (r:1 w:1) + // Storage: PolkadotXcm QueryCounter (r:1 w:1) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + // Storage: PolkadotXcm Queries (r:0 w:1) + fn force_subscribe_version_notify() -> Weight { + // Minimum execution time: 31_238 nanoseconds. + Weight::from_ref_time(32_021_000) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(5)) + } + // Storage: PolkadotXcm VersionNotifiers (r:1 w:1) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + // Storage: PolkadotXcm Queries (r:0 w:1) + fn force_unsubscribe_version_notify() -> Weight { + // Minimum execution time: 32_459 nanoseconds. + Weight::from_ref_time(32_802_000) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(4)) + } + // Storage: PolkadotXcm SupportedVersion (r:4 w:2) + fn migrate_supported_version() -> Weight { + // Minimum execution time: 13_433 nanoseconds. + Weight::from_ref_time(13_890_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PolkadotXcm VersionNotifiers (r:4 w:2) + fn migrate_version_notifiers() -> Weight { + // Minimum execution time: 13_798 nanoseconds. + Weight::from_ref_time(14_104_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PolkadotXcm VersionNotifyTargets (r:5 w:0) + fn already_notified_target() -> Weight { + // Minimum execution time: 15_012 nanoseconds. + Weight::from_ref_time(15_360_000) + .saturating_add(T::DbWeight::get().reads(5)) + } + // Storage: PolkadotXcm VersionNotifyTargets (r:2 w:1) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + fn notify_current_targets() -> Weight { + // Minimum execution time: 26_911 nanoseconds. + Weight::from_ref_time(27_686_000) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: PolkadotXcm VersionNotifyTargets (r:3 w:0) + fn notify_target_migration_fail() -> Weight { + // Minimum execution time: 7_067 nanoseconds. + Weight::from_ref_time(7_207_000) + .saturating_add(T::DbWeight::get().reads(3)) + } + // Storage: PolkadotXcm VersionNotifyTargets (r:4 w:2) + fn migrate_version_notify_targets() -> Weight { + // Minimum execution time: 13_882 nanoseconds. + Weight::from_ref_time(14_067_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + // Storage: PolkadotXcm VersionNotifyTargets (r:4 w:2) + // Storage: PolkadotXcm SupportedVersion (r:1 w:0) + // Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + // Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + // Storage: ParachainSystem HostConfiguration (r:1 w:0) + // Storage: ParachainSystem PendingUpwardMessages (r:1 w:1) + fn migrate_and_notify_old_targets() -> Weight { + // Minimum execution time: 32_227 nanoseconds. + Weight::from_ref_time(33_068_000) + .saturating_add(T::DbWeight::get().reads(9)) + .saturating_add(T::DbWeight::get().writes(4)) + } +} diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/xcm_config.rs b/parachains/runtimes/collectives/collectives-polkadot/src/xcm_config.rs index 1192306daa4..a97c7677570 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/xcm_config.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/xcm_config.rs @@ -14,12 +14,13 @@ // limitations under the License. use super::{ - AccountId, Balances, ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, - RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue, + AccountId, AllPalletsWithSystem, Balances, ParachainInfo, ParachainSystem, PolkadotXcm, + Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue, }; use frame_support::{ match_types, parameter_types, - traits::{Everything, Nothing}, + traits::{ConstU32, Contains, Everything, Nothing}, + weights::Weight, }; use pallet_xcm::XcmPassthrough; use parachains_common::{ @@ -29,21 +30,22 @@ use parachains_common::{ use polkadot_parachain::primitives::Sibling; use xcm::latest::prelude::*; use xcm_builder::{ - AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, - AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin, - FixedWeightBounds, IsConcrete, LocationInverter, ParentAsSuperuser, ParentIsPreset, - RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, - SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, - UsingComponents, + AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, + AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin, + FixedWeightBounds, IsConcrete, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, + SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, + SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, + WithComputedOrigin, }; -use xcm_executor::XcmExecutor; +use xcm_executor::{traits::WithOriginFilter, XcmExecutor}; parameter_types! { pub const DotLocation: MultiLocation = MultiLocation::parent(); - pub const RelayNetwork: NetworkId = NetworkId::Polkadot; + pub const RelayNetwork: Option = Some(NetworkId::Polkadot); pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); - pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); - pub const Local: MultiLocation = Here.into(); + pub UniversalLocation: InteriorMultiLocation = + X2(GlobalConsensus(RelayNetwork::get().unwrap()), Parachain(ParachainInfo::parachain_id().into())); + pub const Local: MultiLocation = Here.into_location(); pub CheckingAccount: AccountId = PolkadotXcm::check_account(); } @@ -99,14 +101,15 @@ pub type XcmOriginToTransactDispatchOrigin = ( parameter_types! { // One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate. - pub UnitWeightCost: u64 = 1_000_000_000; + pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 64 * 1024); pub const MaxInstructions: u32 = 100; + pub const MaxAssetsIntoHolding: u32 = 64; } match_types! { - pub type ParentOrParentsExecutivePlurality: impl Contains = { + pub type ParentOrParentsPlurality: impl Contains = { MultiLocation { parents: 1, interior: Here } | - MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Executive, .. }) } + MultiLocation { parents: 1, interior: X1(Plurality { .. }) } }; pub type ParentOrSiblings: impl Contains = { MultiLocation { parents: 1, interior: Here } | @@ -114,19 +117,90 @@ match_types! { }; } +/// A call filter for the XCM Transact instruction. This is a temporary measure until we properly +/// account for proof size weights. +/// +/// Calls that are allowed through this filter must: +/// 1. Have a fixed weight; +/// 2. Cannot lead to another call being made; +/// 3. Have a defined proof size weight, e.g. no unbounded vecs in call parameters. +pub struct SafeCallFilter; +impl Contains for SafeCallFilter { + fn contains(call: &RuntimeCall) -> bool { + #[cfg(feature = "runtime-benchmarks")] + { + if matches!(call, RuntimeCall::System(frame_system::Call::remark_with_event { .. })) { + return true + } + } + + match 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::XcmpQueue(..) | + RuntimeCall::DmpQueue(..) | + RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) | + RuntimeCall::Alliance( + pallet_alliance::Call::vote { .. } | + pallet_alliance::Call::close_old_weight { .. } | + 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::close_old_weight { .. } | + pallet_collective::Call::disapprove_proposal { .. } | + pallet_collective::Call::close { .. }, + ) => true, + _ => false, + } + } +} + pub type Barrier = DenyThenTry< DenyReserveTransferToRelayChain, ( // Allow local users to buy weight credit. TakeWeightCredit, - // Parent and its exec plurality get free execution. - AllowUnpaidExecutionFrom, // Expected responses are OK. AllowKnownQueryResponses, - // Subscriptions for version tracking are OK. - AllowSubscriptionsFrom, - // Allow anything to pay for execution. - AllowTopLevelPaidExecutionFrom, + // Allow XCMs with some computed origins to pass through. + WithComputedOrigin< + ( + // If the message is one that immediately attemps to pay for execution, then allow it. + AllowTopLevelPaidExecutionFrom, + // Parent and its plurality (i.e. governance bodies) gets free execution. + AllowExplicitUnpaidExecutionFrom, + // Subscriptions for version tracking are OK. + AllowSubscriptionsFrom, + ), + UniversalLocation, + ConstU32<8>, + >, ), >; @@ -141,7 +215,7 @@ impl xcm_executor::Config for XcmConfig { type IsReserve = (); /// Only allow teleportation of DOT. type IsTeleporter = ConcreteNativeAssetFrom; - type LocationInverter = LocationInverter; + type UniversalLocation = UniversalLocation; type Barrier = Barrier; type Weigher = FixedWeightBounds; type Trader = @@ -150,6 +224,15 @@ impl xcm_executor::Config for XcmConfig { type AssetTrap = PolkadotXcm; type AssetClaims = PolkadotXcm; type SubscriptionService = PolkadotXcm; + type PalletInstancesInfo = AllPalletsWithSystem; + type MaxAssetsIntoHolding = MaxAssetsIntoHolding; + type AssetLocker = (); + type AssetExchanger = (); + type FeeManager = (); + type MessageExporter = (); + type UniversalAliases = Nothing; + type CallDispatcher = WithOriginFilter; + type SafeCallFilter = SafeCallFilter; } /// Converts a local signed origin into an XCM multilocation. @@ -160,11 +243,16 @@ pub type LocalOriginToLocation = SignedToAccountId32, + cumulus_primitives_utility::ParentAsUmp, // ..and XCMP to communicate with the sibling chains. XcmpQueue, ); +#[cfg(feature = "runtime-benchmarks")] +parameter_types! { + pub ReachableDest: Option = Some(Parent.into()); +} + impl pallet_xcm::Config for Runtime { type RuntimeEvent = RuntimeEvent; // We want to disallow users sending (arbitrary) XCMs from this chain. @@ -178,11 +266,19 @@ impl pallet_xcm::Config for Runtime { type XcmTeleportFilter = Everything; type XcmReserveTransferFilter = Nothing; // This parachain is not meant as a reserve location. type Weigher = FixedWeightBounds; - type LocationInverter = LocationInverter; + 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 = LocationToAccountId; + type MaxLockers = ConstU32<8>; + type WeightInfo = crate::weights::pallet_xcm::WeightInfo; + #[cfg(feature = "runtime-benchmarks")] + type ReachableDest = ReachableDest; } 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 831677b4796..1fe75d76770 100644 --- a/parachains/runtimes/contracts/contracts-rococo/src/lib.rs +++ b/parachains/runtimes/contracts/contracts-rococo/src/lib.rs @@ -382,6 +382,7 @@ mod benches { [pallet_timestamp, Timestamp] [pallet_collator_selection, CollatorSelection] [pallet_contracts, Contracts] + [pallet_xcm, PolkadotXcm] ); } diff --git a/parachains/runtimes/contracts/contracts-rococo/src/xcm_config.rs b/parachains/runtimes/contracts/contracts-rococo/src/xcm_config.rs index 14619efb021..c71a60107e3 100644 --- a/parachains/runtimes/contracts/contracts-rococo/src/xcm_config.rs +++ b/parachains/runtimes/contracts/contracts-rococo/src/xcm_config.rs @@ -14,12 +14,13 @@ // limitations under the License. use super::{ - AccountId, Balances, ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, - RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue, + AccountId, AllPalletsWithSystem, Balances, ParachainInfo, ParachainSystem, PolkadotXcm, + Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue, }; use frame_support::{ match_types, parameter_types, - traits::{EitherOfDiverse, Everything, Nothing}, + traits::{ConstU32, EitherOfDiverse, Everything, Nothing}, + weights::Weight, }; use frame_system::EnsureRoot; use pallet_xcm::{EnsureXcm, IsMajorityOfBody, XcmPassthrough}; @@ -27,22 +28,20 @@ use parachains_common::xcm_config::{DenyReserveTransferToRelayChain, DenyThenTry use polkadot_parachain::primitives::Sibling; use xcm::latest::prelude::*; use xcm_builder::{ - AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, - AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin, - FixedWeightBounds, IsConcrete, LocationInverter, NativeAsset, ParentAsSuperuser, - ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, + AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, + AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin, + FixedWeightBounds, IsConcrete, NativeAsset, ParentAsSuperuser, ParentIsPreset, + RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, - UsingComponents, + UsingComponents, WithComputedOrigin, }; use xcm_executor::XcmExecutor; parameter_types! { pub const RelayLocation: MultiLocation = MultiLocation::parent(); - pub const RelayNetwork: NetworkId = NetworkId::Any; + pub const RelayNetwork: Option = None; pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); - pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); - pub const Local: MultiLocation = Here.into(); - pub CheckingAccount: AccountId = PolkadotXcm::check_account(); + pub UniversalLocation: InteriorMultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); pub const ExecutiveBody: BodyId = BodyId::Executive; } @@ -104,14 +103,14 @@ pub type XcmOriginToTransactDispatchOrigin = ( parameter_types! { // One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate. - pub UnitWeightCost: u64 = 1_000_000_000; + pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 64 * 1024); pub const MaxInstructions: u32 = 100; } match_types! { - pub type ParentOrParentsExecutivePlurality: impl Contains = { + pub type ParentOrParentsPlurality: impl Contains = { MultiLocation { parents: 1, interior: Here } | - MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Executive, .. }) } + MultiLocation { parents: 1, interior: X1(Plurality { .. }) } }; pub type ParentOrSiblings: impl Contains = { MultiLocation { parents: 1, interior: Here } | @@ -123,13 +122,21 @@ pub type Barrier = DenyThenTry< DenyReserveTransferToRelayChain, ( TakeWeightCredit, - AllowTopLevelPaidExecutionFrom, - // Parent and its exec plurality get free execution - AllowUnpaidExecutionFrom, // Expected responses are OK. AllowKnownQueryResponses, - // Subscriptions for version tracking are OK. - AllowSubscriptionsFrom, + // Allow XCMs with some computed origins to pass through. + WithComputedOrigin< + ( + // If the message is one that immediately attemps to pay for execution, then allow it. + AllowTopLevelPaidExecutionFrom, + // Parent and its plurality (i.e. governance bodies) gets free execution. + AllowExplicitUnpaidExecutionFrom, + // Subscriptions for version tracking are OK. + AllowSubscriptionsFrom, + ), + UniversalLocation, + ConstU32<8>, + >, ), >; @@ -141,7 +148,7 @@ impl xcm_executor::Config for XcmConfig { type OriginConverter = XcmOriginToTransactDispatchOrigin; type IsReserve = NativeAsset; type IsTeleporter = NativeAsset; - type LocationInverter = LocationInverter; + type UniversalLocation = UniversalLocation; type Barrier = Barrier; type Weigher = FixedWeightBounds; type Trader = UsingComponents; @@ -149,6 +156,15 @@ impl xcm_executor::Config for XcmConfig { type AssetTrap = PolkadotXcm; type AssetClaims = PolkadotXcm; type SubscriptionService = PolkadotXcm; + type PalletInstancesInfo = AllPalletsWithSystem; + type MaxAssetsIntoHolding = ConstU32<8>; + type AssetLocker = (); + type AssetExchanger = (); + type FeeManager = (); + type MessageExporter = (); + type UniversalAliases = Nothing; + type CallDispatcher = RuntimeCall; + type SafeCallFilter = Everything; } /// Converts a local signed origin into an XCM multilocation. @@ -159,11 +175,16 @@ pub type LocalOriginToLocation = SignedToAccountId32, + cumulus_primitives_utility::ParentAsUmp, // ..and XCMP to communicate with the sibling chains. XcmpQueue, ); +#[cfg(feature = "runtime-benchmarks")] +parameter_types! { + pub ReachableDest: Option = Some(Parent.into()); +} + impl pallet_xcm::Config for Runtime { type RuntimeEvent = RuntimeEvent; // We want to disallow users sending (arbitrary) XCMs from this chain. @@ -177,11 +198,20 @@ impl pallet_xcm::Config for Runtime { type XcmTeleportFilter = Everything; type XcmReserveTransferFilter = Everything; type Weigher = FixedWeightBounds; - type LocationInverter = LocationInverter; + 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 = LocationToAccountId; + type MaxLockers = ConstU32<8>; + // FIXME: Replace with benchmarked weight info + type WeightInfo = pallet_xcm::TestWeightInfo; + #[cfg(feature = "runtime-benchmarks")] + type ReachableDest = ReachableDest; } impl cumulus_pallet_xcm::Config for Runtime { @@ -201,6 +231,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { >; type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; type WeightInfo = cumulus_pallet_xcmp_queue::weights::SubstrateWeight; + type PriceForSiblingDelivery = (); } impl cumulus_pallet_dmp_queue::Config for Runtime { diff --git a/parachains/runtimes/starters/shell/src/xcm_config.rs b/parachains/runtimes/starters/shell/src/xcm_config.rs index 2c51387a15c..8a7b3f21339 100644 --- a/parachains/runtimes/starters/shell/src/xcm_config.rs +++ b/parachains/runtimes/starters/shell/src/xcm_config.rs @@ -13,18 +13,25 @@ // See the License for the specific language governing permissions and // limitations under the License. -use super::{AccountId, ParachainInfo, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin}; -use frame_support::{match_types, parameter_types}; +use super::{ + AccountId, AllPalletsWithSystem, ParachainInfo, Runtime, RuntimeCall, RuntimeEvent, + RuntimeOrigin, +}; +use frame_support::{ + match_types, parameter_types, + traits::{Everything, Nothing}, + weights::Weight, +}; use xcm::latest::prelude::*; use xcm_builder::{ - AllowUnpaidExecutionFrom, FixedWeightBounds, LocationInverter, ParentAsSuperuser, - ParentIsPreset, SovereignSignedViaLocation, + AllowExplicitUnpaidExecutionFrom, FixedWeightBounds, ParentAsSuperuser, ParentIsPreset, + SovereignSignedViaLocation, }; parameter_types! { pub const RococoLocation: MultiLocation = MultiLocation::parent(); - pub const RococoNetwork: NetworkId = NetworkId::Polkadot; - pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); + pub const RococoNetwork: Option = Some(NetworkId::Rococo); + pub UniversalLocation: InteriorMultiLocation = X1(Parachain(ParachainInfo::parachain_id().into())); } /// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance, @@ -46,8 +53,9 @@ match_types! { parameter_types! { // One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate. - pub UnitWeightCost: u64 = 1_000_000_000; + pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 64 * 1024); pub const MaxInstructions: u32 = 100; + pub const MaxAssetsIntoHolding: u32 = 64; } pub struct XcmConfig; @@ -58,14 +66,23 @@ impl xcm_executor::Config for XcmConfig { type OriginConverter = XcmOriginToTransactDispatchOrigin; type IsReserve = (); // balances not supported type IsTeleporter = (); // balances not supported - type LocationInverter = LocationInverter; - type Barrier = AllowUnpaidExecutionFrom; + type UniversalLocation = UniversalLocation; + type Barrier = AllowExplicitUnpaidExecutionFrom; type Weigher = FixedWeightBounds; // balances not supported type Trader = (); // balances not supported type ResponseHandler = (); // Don't handle responses for now. type AssetTrap = (); // don't trap for now type AssetClaims = (); // don't claim for now type SubscriptionService = (); // don't handle subscriptions for now + type PalletInstancesInfo = AllPalletsWithSystem; + type MaxAssetsIntoHolding = MaxAssetsIntoHolding; + type AssetLocker = (); + type AssetExchanger = (); + type FeeManager = (); + type MessageExporter = (); + type UniversalAliases = Nothing; + type CallDispatcher = RuntimeCall; + type SafeCallFilter = Everything; } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/parachains/runtimes/testing/penpal/src/lib.rs b/parachains/runtimes/testing/penpal/src/lib.rs index e4716b80b20..4f2a80b036c 100644 --- a/parachains/runtimes/testing/penpal/src/lib.rs +++ b/parachains/runtimes/testing/penpal/src/lib.rs @@ -440,6 +440,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type ControllerOrigin = EnsureRoot; type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; type WeightInfo = (); + type PriceForSiblingDelivery = (); } impl cumulus_pallet_dmp_queue::Config for Runtime { diff --git a/parachains/runtimes/testing/penpal/src/xcm_config.rs b/parachains/runtimes/testing/penpal/src/xcm_config.rs index 0492dbee4d7..a7822879656 100644 --- a/parachains/runtimes/testing/penpal/src/xcm_config.rs +++ b/parachains/runtimes/testing/penpal/src/xcm_config.rs @@ -22,17 +22,18 @@ //! with statemine as the reserve. At present no derivative tokens are minted on receipt of a //! ReserveAssetTransferDeposited message but that will but the intension will be to support this soon. use super::{ - AccountId, AssetId as AssetIdPalletAssets, Assets, Balance, Balances, ParachainInfo, - ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, - XcmpQueue, + AccountId, AllPalletsWithSystem, AssetId as AssetIdPalletAssets, Assets, Balance, Balances, + ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, + WeightToFee, XcmpQueue, }; use core::marker::PhantomData; use frame_support::{ match_types, parameter_types, traits::{ fungibles::{self, Balanced, CreditOf}, - Contains, Everything, Get, Nothing, + ConstU32, Contains, ContainsPair, Everything, Get, Nothing, }, + weights::Weight, }; use pallet_asset_tx_payment::HandleCredit; use pallet_xcm::XcmPassthrough; @@ -42,24 +43,21 @@ use polkadot_runtime_common::impls::ToAuthor; use sp_runtime::traits::Zero; use xcm::latest::prelude::*; use xcm_builder::{ - AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, - AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, AsPrefixedGeneralIndex, - ConvertedConcreteAssetId, CurrencyAdapter, EnsureXcmOrigin, FixedWeightBounds, - FungiblesAdapter, IsConcrete, LocationInverter, NativeAsset, ParentIsPreset, - RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, - SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, - UsingComponents, -}; -use xcm_executor::{ - traits::{FilterAssetLocation, JustTry}, - XcmExecutor, + AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, + AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, AsPrefixedGeneralIndex, + ConvertedConcreteId, CurrencyAdapter, EnsureXcmOrigin, FixedWeightBounds, FungiblesAdapter, + IsConcrete, LocalMint, NativeAsset, ParentIsPreset, RelayChainAsNative, + SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, + SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, + WithComputedOrigin, }; +use xcm_executor::{traits::JustTry, XcmExecutor}; parameter_types! { pub const RelayLocation: MultiLocation = MultiLocation::parent(); - pub const RelayNetwork: NetworkId = NetworkId::Any; + pub const RelayNetwork: Option = None; pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); - pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); + pub UniversalLocation: InteriorMultiLocation = X1(Parachain(ParachainInfo::parachain_id().into())); } /// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used @@ -93,7 +91,7 @@ pub type FungiblesTransactor = FungiblesAdapter< // Use this fungibles implementation: Assets, // Use this currency when it is a fungible asset matching the given location or name: - ConvertedConcreteAssetId< + ConvertedConcreteId< AssetIdPalletAssets, Balance, AsPrefixedGeneralIndex, @@ -105,7 +103,7 @@ pub type FungiblesTransactor = FungiblesAdapter< AccountId, // We only want to allow teleports of known assets. We use non-zero issuance as an indication // that this asset is known. - NonZeroIssuance, + LocalMint>, // The account to use for tracking teleports. CheckingAccount, >; @@ -136,8 +134,9 @@ pub type XcmOriginToTransactDispatchOrigin = ( parameter_types! { // One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate. - pub UnitWeightCost: u64 = 1_000_000_000; + pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 64 * 1024); pub const MaxInstructions: u32 = 100; + pub const MaxAssetsIntoHolding: u32 = 64; } match_types! { @@ -154,15 +153,24 @@ pub type Barrier = DenyThenTry< DenyReserveTransferToRelayChain, ( TakeWeightCredit, - AllowTopLevelPaidExecutionFrom, - // Parent and its exec plurality get free execution - AllowUnpaidExecutionFrom, - // Assets Common Good parachain gets free execution - AllowUnpaidExecutionFrom, // Expected responses are OK. AllowKnownQueryResponses, - // Subscriptions for version tracking are OK. - AllowSubscriptionsFrom, + // Allow XCMs with some computed origins to pass through. + WithComputedOrigin< + ( + // If the message is one that immediately attemps to pay for execution, then allow it. + AllowTopLevelPaidExecutionFrom, + // Common Good Assets parachain, parent and its exec plurality get free execution + AllowExplicitUnpaidExecutionFrom<( + CommonGoodAssetsParachain, + ParentOrParentsExecutivePlurality, + )>, + // Subscriptions for version tracking are OK. + AllowSubscriptionsFrom, + ), + UniversalLocation, + ConstU32<8>, + >, ), >; @@ -171,8 +179,8 @@ pub type AccountIdOf = ::AccountId; /// Asset filter that allows all assets from a certain location. pub struct AssetsFrom(PhantomData); -impl> FilterAssetLocation for AssetsFrom { - fn filter_asset_location(asset: &MultiAsset, origin: &MultiLocation) -> bool { +impl> ContainsPair for AssetsFrom { + fn contains(asset: &MultiAsset, origin: &MultiLocation) -> bool { let loc = T::get(); &loc == origin && matches!(asset, MultiAsset { id: AssetId::Concrete(asset_loc), fun: Fungible(_a) } @@ -234,8 +242,8 @@ impl Reserve for MultiAsset { /// A `FilterAssetLocation` implementation. Filters multi native assets whose /// reserve is same with `origin`. pub struct MultiNativeAsset; -impl FilterAssetLocation for MultiNativeAsset { - fn filter_asset_location(asset: &MultiAsset, origin: &MultiLocation) -> bool { +impl ContainsPair for MultiNativeAsset { + fn contains(asset: &MultiAsset, origin: &MultiLocation) -> bool { if let Some(ref reserve) = asset.reserve() { if reserve == origin { return true @@ -265,7 +273,7 @@ impl xcm_executor::Config for XcmConfig { type OriginConverter = XcmOriginToTransactDispatchOrigin; type IsReserve = MultiNativeAsset; // TODO: maybe needed to be replaced by Reserves type IsTeleporter = NativeAsset; - type LocationInverter = LocationInverter; + type UniversalLocation = UniversalLocation; type Barrier = Barrier; type Weigher = FixedWeightBounds; type Trader = @@ -274,6 +282,15 @@ impl xcm_executor::Config for XcmConfig { type AssetTrap = PolkadotXcm; type AssetClaims = PolkadotXcm; type SubscriptionService = PolkadotXcm; + type PalletInstancesInfo = AllPalletsWithSystem; + type MaxAssetsIntoHolding = MaxAssetsIntoHolding; + type AssetLocker = (); + type AssetExchanger = (); + type FeeManager = (); + type MessageExporter = (); + type UniversalAliases = Nothing; + type CallDispatcher = RuntimeCall; + type SafeCallFilter = Everything; } /// No local origins on this chain are allowed to dispatch XCM sends/executions. @@ -283,11 +300,16 @@ pub type LocalOriginToLocation = SignedToAccountId32, + cumulus_primitives_utility::ParentAsUmp, // ..and XCMP to communicate with the sibling chains. XcmpQueue, ); +#[cfg(feature = "runtime-benchmarks")] +parameter_types! { + pub ReachableDest: Option = Some(Parent.into()); +} + impl pallet_xcm::Config for Runtime { type RuntimeEvent = RuntimeEvent; type SendXcmOrigin = EnsureXcmOrigin; @@ -300,13 +322,21 @@ impl pallet_xcm::Config for Runtime { type XcmTeleportFilter = Everything; type XcmReserveTransferFilter = Everything; type Weigher = FixedWeightBounds; - type LocationInverter = LocationInverter; + type UniversalLocation = UniversalLocation; type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; // ^ Override for AdvertisedXcmVersion default type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; + type Currency = Balances; + type CurrencyMatcher = (); + type TrustedLockers = (); + type SovereignAccountOf = LocationToAccountId; + type MaxLockers = ConstU32<8>; + type WeightInfo = pallet_xcm::TestWeightInfo; + #[cfg(feature = "runtime-benchmarks")] + type ReachableDest = ReachableDest; } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/parachains/runtimes/testing/rococo-parachain/Cargo.toml b/parachains/runtimes/testing/rococo-parachain/Cargo.toml index ad231cb7747..f425a4972d4 100644 --- a/parachains/runtimes/testing/rococo-parachain/Cargo.toml +++ b/parachains/runtimes/testing/rococo-parachain/Cargo.toml @@ -103,4 +103,5 @@ std = [ runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", "pallet-assets/runtime-benchmarks", + "pallet-xcm/runtime-benchmarks", ] diff --git a/parachains/runtimes/testing/rococo-parachain/src/lib.rs b/parachains/runtimes/testing/rococo-parachain/src/lib.rs index af9b9a0e1c7..e0bed8f6cb6 100644 --- a/parachains/runtimes/testing/rococo-parachain/src/lib.rs +++ b/parachains/runtimes/testing/rococo-parachain/src/lib.rs @@ -43,7 +43,7 @@ pub use frame_support::{ match_types, parameter_types, traits::{ AsEnsureOriginWithArg, ConstU32, ConstU64, ConstU8, EitherOfDiverse, Everything, IsInVec, - Randomness, + Nothing, Randomness, }, weights::{ constants::{ @@ -69,8 +69,8 @@ use parachains_common::{ AccountId, AssetId, Signature, }; use xcm_builder::{ - AllowKnownQueryResponses, AllowSubscriptionsFrom, AsPrefixedGeneralIndex, - ConvertedConcreteAssetId, FungiblesAdapter, + AllowKnownQueryResponses, AllowSubscriptionsFrom, AsPrefixedGeneralIndex, ConvertedConcreteId, + FungiblesAdapter, LocalMint, }; use xcm_executor::traits::JustTry; @@ -79,13 +79,13 @@ use pallet_xcm::{EnsureXcm, IsMajorityOfBody, XcmPassthrough}; use polkadot_parachain::primitives::Sibling; use xcm::latest::prelude::*; use xcm_builder::{ - AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter, - EnsureXcmOrigin, FixedWeightBounds, IsConcrete, LocationInverter, NativeAsset, + AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowTopLevelPaidExecutionFrom, + CurrencyAdapter, EnsureXcmOrigin, FixedWeightBounds, IsConcrete, NativeAsset, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, }; -use xcm_executor::{Config, XcmExecutor}; +use xcm_executor::XcmExecutor; pub type SessionHandlers = (); @@ -276,9 +276,9 @@ impl cumulus_pallet_aura_ext::Config for Runtime {} parameter_types! { pub const RocLocation: MultiLocation = MultiLocation::parent(); - pub const RococoNetwork: NetworkId = NetworkId::Polkadot; + pub const RococoNetwork: Option = Some(NetworkId::Rococo); pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); - pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); + pub UniversalLocation: InteriorMultiLocation = X1(Parachain(ParachainInfo::parachain_id().into())); pub CheckingAccount: AccountId = PolkadotXcm::check_account(); } @@ -313,7 +313,7 @@ pub type FungiblesTransactor = FungiblesAdapter< // Use this fungibles implementation: Assets, // Use this currency when it is a fungible asset matching the given location or name: - ConvertedConcreteAssetId< + ConvertedConcreteId< AssetId, u64, AsPrefixedGeneralIndex, @@ -325,7 +325,7 @@ pub type FungiblesTransactor = FungiblesAdapter< AccountId, // We only want to allow teleports of known assets. We use non-zero issuance as an indication // that this asset is known. - NonZeroIssuance, + LocalMint>, // The account to use for tracking teleports. CheckingAccount, >; @@ -358,7 +358,7 @@ pub type XcmOriginToTransactDispatchOrigin = ( parameter_types! { // One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate. - pub UnitWeightCost: u64 = 1_000_000_000; + pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 64 * 1024); // One ROC buys 1 second of weight. pub const WeightPrice: (MultiLocation, u128) = (MultiLocation::parent(), ROC); pub const MaxInstructions: u32 = 100; @@ -377,9 +377,9 @@ match_types! { pub type Barrier = ( TakeWeightCredit, AllowTopLevelPaidExecutionFrom, - AllowUnpaidExecutionFrom, + AllowExplicitUnpaidExecutionFrom, // ^^^ Parent & its unit plurality gets free execution - AllowUnpaidExecutionFrom, + AllowExplicitUnpaidExecutionFrom, // Expected responses are OK. AllowKnownQueryResponses, // Subscriptions for version tracking are OK. @@ -387,6 +387,7 @@ pub type Barrier = ( ); parameter_types! { + pub MaxAssetsIntoHolding: u32 = 64; pub StatemintLocation: MultiLocation = MultiLocation::new(1, X1(Parachain(1000))); // ALWAYS ensure that the index in PalletInstance stays up-to-date with // Statemint's Assets pallet index @@ -397,7 +398,7 @@ parameter_types! { pub type Reserves = (NativeAsset, AssetsFrom); pub struct XcmConfig; -impl Config for XcmConfig { +impl xcm_executor::Config for XcmConfig { type RuntimeCall = RuntimeCall; type XcmSender = XcmRouter; // How to withdraw and deposit an asset. @@ -405,7 +406,7 @@ impl Config for XcmConfig { type OriginConverter = XcmOriginToTransactDispatchOrigin; type IsReserve = Reserves; type IsTeleporter = NativeAsset; // <- should be enough to allow teleportation of ROC - type LocationInverter = LocationInverter; + type UniversalLocation = UniversalLocation; type Barrier = Barrier; type Weigher = FixedWeightBounds; type Trader = UsingComponents, RocLocation, AccountId, Balances, ()>; @@ -413,6 +414,15 @@ impl Config for XcmConfig { type AssetTrap = PolkadotXcm; type AssetClaims = PolkadotXcm; type SubscriptionService = PolkadotXcm; + type PalletInstancesInfo = AllPalletsWithSystem; + type MaxAssetsIntoHolding = MaxAssetsIntoHolding; + type AssetLocker = (); + type AssetExchanger = (); + type FeeManager = (); + type MessageExporter = (); + type UniversalAliases = Nothing; + type CallDispatcher = RuntimeCall; + type SafeCallFilter = Everything; } /// Local origins on this chain are allowed to dispatch XCM sends/executions. @@ -422,11 +432,16 @@ pub type LocalOriginToLocation = SignedToAccountId32, + cumulus_primitives_utility::ParentAsUmp, // ..and XCMP to communicate with the sibling chains. XcmpQueue, ); +#[cfg(feature = "runtime-benchmarks")] +parameter_types! { + pub ReachableDest: Option = Some(Parent.into()); +} + impl pallet_xcm::Config for Runtime { type RuntimeEvent = RuntimeEvent; type SendXcmOrigin = EnsureXcmOrigin; @@ -435,13 +450,21 @@ impl pallet_xcm::Config for Runtime { type XcmExecuteFilter = Everything; type XcmExecutor = XcmExecutor; type XcmTeleportFilter = Everything; - type XcmReserveTransferFilter = frame_support::traits::Nothing; + type XcmReserveTransferFilter = Nothing; type Weigher = FixedWeightBounds; - type LocationInverter = LocationInverter; + 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 = LocationToAccountId; + type MaxLockers = ConstU32<8>; + type WeightInfo = pallet_xcm::TestWeightInfo; + #[cfg(feature = "runtime-benchmarks")] + type ReachableDest = ReachableDest; } impl cumulus_pallet_xcm::Config for Runtime { @@ -458,6 +481,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type ControllerOrigin = EnsureRoot; type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; type WeightInfo = cumulus_pallet_xcmp_queue::weights::SubstrateWeight; + type PriceForSiblingDelivery = (); } impl cumulus_pallet_dmp_queue::Config for Runtime { diff --git a/primitives/core/Cargo.toml b/primitives/core/Cargo.toml index 9a67cac16c5..bc00a655563 100644 --- a/primitives/core/Cargo.toml +++ b/primitives/core/Cargo.toml @@ -17,6 +17,7 @@ sp-trie = { git = "https://github.com/paritytech/substrate", default-features = polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } polkadot-primitives = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } +xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } [features] default = [ "std" ] diff --git a/primitives/core/src/lib.rs b/primitives/core/src/lib.rs index c0c14c021d1..d94224927dc 100644 --- a/primitives/core/src/lib.rs +++ b/primitives/core/src/lib.rs @@ -32,6 +32,8 @@ pub use polkadot_primitives::{ AbridgedHostConfiguration, AbridgedHrmpChannel, PersistedValidationData, }; +pub use xcm::latest::prelude::*; + /// A module that re-exports relevant relay chain definitions. pub mod relay_chain { pub use polkadot_core_primitives::*; @@ -94,10 +96,11 @@ pub trait GetChannelInfo { pub trait UpwardMessageSender { /// Send the given UMP message; return the expected number of blocks before the message will /// be dispatched or an error if the message cannot be sent. - fn send_upward_message(msg: UpwardMessage) -> Result; + /// return the hash of the message sent + fn send_upward_message(msg: UpwardMessage) -> Result<(u32, XcmHash), MessageSendError>; } impl UpwardMessageSender for () { - fn send_upward_message(_msg: UpwardMessage) -> Result { + fn send_upward_message(_msg: UpwardMessage) -> Result<(u32, XcmHash), MessageSendError> { Err(MessageSendError::NoChannel) } } diff --git a/primitives/utility/Cargo.toml b/primitives/utility/Cargo.toml index 6278025e1db..58d5ee23c8e 100644 --- a/primitives/utility/Cargo.toml +++ b/primitives/utility/Cargo.toml @@ -10,10 +10,12 @@ log = { version = "0.4.17", default-features = false } # Substrate frame-support = { 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-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } # Polkadot +polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } @@ -29,6 +31,8 @@ std = [ "frame-support/std", "sp-runtime/std", "sp-std/std", + "sp-io/std", + "polkadot-runtime-common/std", "cumulus-primitives-core/std", "xcm/std", "xcm-builder/std", diff --git a/primitives/utility/src/lib.rs b/primitives/utility/src/lib.rs index a84000c815b..c9747b67db6 100644 --- a/primitives/utility/src/lib.rs +++ b/primitives/utility/src/lib.rs @@ -20,20 +20,37 @@ #![cfg_attr(not(feature = "std"), no_std)] use codec::Encode; -use cumulus_primitives_core::UpwardMessageSender; +use cumulus_primitives_core::{MessageSendError, UpwardMessageSender}; use frame_support::{ - traits::tokens::{fungibles, fungibles::Inspect}, + traits::{ + tokens::{fungibles, fungibles::Inspect}, + Get, + }, weights::Weight, }; +use polkadot_runtime_common::xcm_sender::ConstantPrice; use sp_runtime::{traits::Saturating, SaturatedConversion}; - -use sp_std::marker::PhantomData; -use xcm::{ - latest::{prelude::*, Weight as XCMWeight}, - WrapVersion, -}; +use sp_std::{marker::PhantomData, prelude::*}; +use xcm::{latest::prelude::*, WrapVersion}; use xcm_builder::TakeRevenue; use xcm_executor::traits::{MatchesFungibles, TransactAsset, WeightTrader}; + +pub trait PriceForParentDelivery { + fn price_for_parent_delivery(message: &Xcm<()>) -> MultiAssets; +} + +impl PriceForParentDelivery for () { + fn price_for_parent_delivery(_: &Xcm<()>) -> MultiAssets { + MultiAssets::new() + } +} + +impl> PriceForParentDelivery for ConstantPrice { + fn price_for_parent_delivery(_: &Xcm<()>) -> MultiAssets { + T::get() + } +} + /// Xcm router which recognises the `Parent` destination and handles it by sending the message into /// the given UMP `UpwardMessageSender` implementation. Thus this essentially adapts an /// `UpwardMessageSender` trait impl into a `SendXcm` trait impl. @@ -41,25 +58,46 @@ use xcm_executor::traits::{MatchesFungibles, TransactAsset, WeightTrader}; /// NOTE: This is a pretty dumb "just send it" router; we will probably want to introduce queuing /// to UMP eventually and when we do, the pallet which implements the queuing will be responsible /// for the `SendXcm` implementation. -pub struct ParentAsUmp(PhantomData<(T, W)>); -impl SendXcm for ParentAsUmp { - fn send_xcm(dest: impl Into, msg: Xcm<()>) -> Result<(), SendError> { - let dest = dest.into(); +pub struct ParentAsUmp(PhantomData<(T, W, P)>); +impl SendXcm for ParentAsUmp +where + T: UpwardMessageSender, + W: WrapVersion, + P: PriceForParentDelivery, +{ + type Ticket = Vec; + + fn validate( + dest: &mut Option, + msg: &mut Option>, + ) -> SendResult> { + let d = dest.take().ok_or(SendError::MissingArgument)?; - if dest.contains_parents_only(1) { + if d.contains_parents_only(1) { // An upward message for the relay chain. + let xcm = msg.take().ok_or(SendError::MissingArgument)?; + let price = P::price_for_parent_delivery(&xcm); let versioned_xcm = - W::wrap_version(&dest, msg).map_err(|()| SendError::DestinationUnsupported)?; + W::wrap_version(&d, xcm).map_err(|()| SendError::DestinationUnsupported)?; let data = versioned_xcm.encode(); - T::send_upward_message(data).map_err(|e| SendError::Transport(e.into()))?; - - Ok(()) + Ok((data, price)) } else { - // Anything else is unhandled. This includes a message this is meant for us. - Err(SendError::CannotReachDestination(dest, msg)) + // Anything else is unhandled. This includes a message that is not meant for us. + // We need to make sure that dest/msg is not consumed here. + *dest = Some(d); + Err(SendError::NotApplicable) } } + + fn deliver(data: Vec) -> Result { + let (_, hash) = T::send_upward_message(data).map_err(|e| match e { + MessageSendError::TooBig => SendError::ExceedsMaxMessageSize, + e => SendError::Transport(e.into()), + })?; + + Ok(hash) + } } /// Contains information to handle refund/payment for xcm-execution @@ -108,7 +146,7 @@ impl< // If everything goes well, we charge. fn buy_weight( &mut self, - weight: XCMWeight, + weight: Weight, payment: xcm_executor::Assets, ) -> Result { log::trace!(target: "xcm::weight", "TakeFirstAssetTrader::buy_weight weight: {:?}, payment: {:?}", weight, payment); @@ -118,8 +156,6 @@ impl< return Err(XcmError::NotWithdrawable) } - let weight = Weight::from_ref_time(weight); - // We take the very first multiasset from payment // (assets are sorted by fungibility/amount after this conversion) let multiassets: MultiAssets = payment.clone().into(); @@ -161,15 +197,13 @@ impl< Ok(unused) } - fn refund_weight(&mut self, weight: XCMWeight) -> Option { + fn refund_weight(&mut self, weight: Weight) -> Option { log::trace!(target: "xcm::weight", "TakeFirstAssetTrader::refund_weight weight: {:?}", weight); if let Some(AssetTraderRefunder { mut weight_outstanding, outstanding_concrete_asset: MultiAsset { id, fun }, }) = self.0.clone() { - let weight = Weight::from_ref_time(weight).min(weight_outstanding); - // 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()?; @@ -255,7 +289,10 @@ impl< if let Some(receiver) = ReceiverAccount::get() { let ok = FungiblesMutateAdapter::deposit_asset( &revenue, - &(X1(AccountId32 { network: Any, id: receiver.into() }).into()), + &(X1(AccountId32 { network: None, id: receiver.into() }).into()), + // We aren't able to track the XCM that initiated the fee deposit, so we create a + // fake message hash here + &XcmContext::with_message_hash([0; 32]), ) .is_ok(); @@ -273,3 +310,104 @@ pub trait ChargeWeightInFungibles Result<>::Balance, XcmError>; } + +#[cfg(test)] +mod tests { + use super::*; + use cumulus_primitives_core::UpwardMessage; + + /// Validates [`validate`] for required Some(destination) and Some(message) + struct OkFixedXcmHashWithAssertingRequiredInputsSender; + impl OkFixedXcmHashWithAssertingRequiredInputsSender { + const FIXED_XCM_HASH: [u8; 32] = [9; 32]; + + fn fixed_delivery_asset() -> MultiAssets { + MultiAssets::new() + } + + fn expected_delivery_result() -> Result<(XcmHash, MultiAssets), SendError> { + Ok((Self::FIXED_XCM_HASH, Self::fixed_delivery_asset())) + } + } + impl SendXcm for OkFixedXcmHashWithAssertingRequiredInputsSender { + type Ticket = (); + + fn validate( + destination: &mut Option, + message: &mut Option>, + ) -> SendResult { + assert!(destination.is_some()); + assert!(message.is_some()); + Ok(((), OkFixedXcmHashWithAssertingRequiredInputsSender::fixed_delivery_asset())) + } + + fn deliver(_: Self::Ticket) -> Result { + Ok(Self::FIXED_XCM_HASH) + } + } + + /// Impl [`UpwardMessageSender`] that return `Other` error + struct OtherErrorUpwardMessageSender; + impl UpwardMessageSender for OtherErrorUpwardMessageSender { + fn send_upward_message(_: UpwardMessage) -> Result<(u32, XcmHash), MessageSendError> { + Err(MessageSendError::Other) + } + } + + #[test] + fn parent_as_ump_does_not_consume_dest_or_msg_on_not_applicable() { + // dummy message + let message = Xcm(vec![Trap(5)]); + + // ParentAsUmp - check dest is really not applicable + let dest = (Parent, Parent, Parent); + let mut dest_wrapper = Some(dest.clone().into()); + let mut msg_wrapper = Some(message.clone()); + assert_eq!( + Err(SendError::NotApplicable), + as SendXcm>::validate(&mut dest_wrapper, &mut msg_wrapper) + ); + + // check wrapper were not consumed + assert_eq!(Some(dest.clone().into()), dest_wrapper.take()); + assert_eq!(Some(message.clone()), msg_wrapper.take()); + + // another try with router chain with asserting sender + assert_eq!( + OkFixedXcmHashWithAssertingRequiredInputsSender::expected_delivery_result(), + send_xcm::<(ParentAsUmp<(), (), ()>, OkFixedXcmHashWithAssertingRequiredInputsSender)>( + dest.into(), + message + ) + ); + } + + #[test] + fn parent_as_ump_consumes_dest_and_msg_on_ok_validate() { + // dummy message + let message = Xcm(vec![Trap(5)]); + + // ParentAsUmp - check dest/msg is valid + let dest = (Parent, Here); + let mut dest_wrapper = Some(dest.clone().into()); + let mut msg_wrapper = Some(message.clone()); + assert!( as SendXcm>::validate( + &mut dest_wrapper, + &mut msg_wrapper + ) + .is_ok()); + + // check wrapper were consumed + assert_eq!(None, dest_wrapper.take()); + assert_eq!(None, msg_wrapper.take()); + + // another try with router chain with asserting sender + assert_eq!( + Err(SendError::Transport("Other")), + send_xcm::<( + ParentAsUmp, + OkFixedXcmHashWithAssertingRequiredInputsSender + )>(dest.into(), message) + ); + } +} diff --git a/test/service/Cargo.toml b/test/service/Cargo.toml index 58712afce54..f746118c778 100644 --- a/test/service/Cargo.toml +++ b/test/service/Cargo.toml @@ -82,6 +82,9 @@ polkadot-test-service = { git = "https://github.com/paritytech/polkadot", branch sc-cli = { git = "https://github.com/paritytech/substrate", branch = "master" } substrate-test-utils = { git = "https://github.com/paritytech/substrate", branch = "master" } +[features] +runtime-benchmarks = ["polkadot-test-service/runtime-benchmarks"] + [[bench]] name = "transaction_throughput" harness = false